From: mshio Date: Sun, 16 Feb 2020 08:51:57 +0000 (+0900) Subject: update html X-Git-Tag: v.20200415~4 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7e551c698deead4dbc5f9393ff2c18fbbb03ca92;p=sawarabi-fonts%2Fsawarabi-fonts.git update html add SIL Open Font License --- diff --git a/html/bin/gen.py b/html/bin/gen.py index c175e0a2..1be62b16 100644 --- a/html/bin/gen.py +++ b/html/bin/gen.py @@ -101,9 +101,24 @@ def parse_args(): ps.add_argument("source") ps.add_argument("-o", dest="out_path", default="out.html") ps.add_argument("-t", dest="template_path", default="template.html") + ps.add_argument("-r", dest="for_rootdir", default=False) return ps.parse_args() +def rewrite_resource_path(template): + def to_be_rewritten(path: str) -> bool: + return not re.match(r"^(https?:)?//.*", path) + + for l in template.xpath("//link[@rel='stylesheet']"): + path = l.attrib.get("href") + if to_be_rewritten(path): + l.attrib["href"] = f"../{path}" + + for s in template.xpath("//script|//img"): + path = s.attrib.get("src") + if to_be_rewritten(path): + s.attrib["src"] = f"../{path}" + if __name__ == "__main__": args = parse_args() @@ -113,7 +128,7 @@ if __name__ == "__main__": temp = html.parse(args.template_path) temp.getroot().attrib['lang'] = doc.property['lang'] - temp.xpath('//title')[0].text = doc.property['title'] + temp.xpath('/html/head/title')[0].text = doc.property['title'] img = temp.xpath('//div[contains(@class, "logo")]/img')[0] img.attrib['alt'] = doc.property['title'] langname = temp.xpath('//div[contains(@id, "current-lang")]/span')[0] @@ -126,5 +141,8 @@ if __name__ == "__main__": for a in temp.xpath('//a'): a.attrib['target'] = '_blank' + if not args.for_rootdir: + rewrite_resource_path(temp) + with open(args.out_path, 'w') as f: f.write(html.tostring(temp, encoding='utf-8').decode()) diff --git a/html/coffee/doc-header.coffee b/html/coffee/doc-header.coffee index b9cda809..6f117bd2 100644 --- a/html/coffee/doc-header.coffee +++ b/html/coffee/doc-header.coffee @@ -290,7 +290,7 @@ $ -> 'mincho' ] - $container = $('#docs-header .buttons-container .inner-container') + $container = $('header .buttons-container .inner-container') buttons = [] for name, n in drawPage.mapping b = document.createElement('div') diff --git a/html/coffee/lang.coffee b/html/coffee/lang.coffee index af27e7fd..35762b6b 100644 --- a/html/coffee/lang.coffee +++ b/html/coffee/lang.coffee @@ -52,13 +52,9 @@ class LangMenu return onclickItem: (event)-> - console.log(@) - return if $(@).attr("id") == "current-lang" key = $(@).attr("data-key") + '/' - key = '' if key is 'ja/' root = '../' - root = './' if $("div#current-lang").attr("data-key") is "ja" window.location = root + key return diff --git a/html/css/style.css b/html/css/style.css index 6965e4e4..3961efd4 100644 --- a/html/css/style.css +++ b/html/css/style.css @@ -25,7 +25,7 @@ nav .container div#navbar div#lang div.container { } nav .container div#navbar div#lang div.item { padding: 26px 1em 0 1em; - width: 85px; + width: 90px; height: 40px; cursor: pointer; background-color: #fff; diff --git a/html/en.txt b/html/en.txt index e92c65e7..e2a40255 100644 --- a/html/en.txt +++ b/html/en.txt @@ -22,21 +22,23 @@ daily use, such as standard kanji, for being under developing now. % license ## License -The license of Sawarabi Fonts is Creative Commons Attribution 3.0. You can see -the content of this license on the following site: +Sawarabi Gothic and Mincho are dual-licensed under either the terms of +the Creative Commons Attribution 3.0 or under the terms of the SIL Open +Font License 1.1. - [Creative Commons Attribution 3.0](https://creativecommons.org/licenses/by/3.0/) +- [SIL Open Font License 1.1](https://scripts.sil.org/OFL) % samples ## Samples Sawarabi Gothic (ver.20161015). -Sample (Gothic)
+Sample (Gothic)
-Sawarabi Mincho (ver.20140815). +Sawarabi Mincho (ver.20200215). -Sample (Mincho)
+Sample (Mincho)
% download ## Download diff --git a/html/img/sample-mincho-20200215.png b/html/img/sample-mincho-20200215.png new file mode 100644 index 00000000..ec07ee59 Binary files /dev/null and b/html/img/sample-mincho-20200215.png differ diff --git a/html/ja.txt b/html/ja.txt index e01fe962..4d0a5920 100644 --- a/html/ja.txt +++ b/html/ja.txt @@ -17,21 +17,21 @@ % license ## ライセンス - さわらびフォントのライセンスは、Creative Commons Attribution 3.0 です。 -このライセンスの内容は、以下のリンクからご覧いただけます。 + さわらびフォントは、Creative Commons Attribution 3.0 と SIL Open Font License 1.1 のデュアルライセンスで配布されています。ライセンスの内容は、以下のリンクからご覧いただけます。 - [Creative Commons Attribution 3.0](https://creativecommons.org/licenses/by/3.0/deed.ja) +- [SIL Open Font License 1.1](https://scripts.sil.org/OFL) % samples ## 書体見本  さわらびゴシック(ver.20161015)の書体見本です。 -書体見本(ゴシック)
+書体見本(ゴシック)
- さわらび明朝(ver.20140815)の書体見本です。 + さわらび明朝(ver.20200215)の書体見本です。 -書体見本(明朝)
+書体見本(明朝)
% download ## ダウンロード diff --git a/html/js/doc-header.js b/html/js/doc-header.js index a780cf6a..8c4565ef 100644 --- a/html/js/doc-header.js +++ b/html/js/doc-header.js @@ -1,8 +1,8 @@ -// Generated by CoffeeScript 1.4.0 +// Generated by CoffeeScript 1.12.7 (function() { var AbstractRectangle, Canvas, GradientRectangle, GraphBar, KanjiInfo, Label, Line, Screen, makeGraphPage, merge, screenPosition, - __hasProp = {}.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; Canvas = { el: "canvas#header-canvas", @@ -19,7 +19,6 @@ }; Screen = (function() { - function Screen(attr) { if (attr == null) { attr = {}; @@ -42,13 +41,13 @@ }; Screen.prototype.draw = function(obj) { - var x, _i, _len, _ref; + var i, len, ref, x; if (obj) { obj.draw(); } else { - _ref = this.objects; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - x = _ref[_i]; + ref = this.objects; + for (i = 0, len = ref.length; i < len; i++) { + x = ref[i]; x.draw(); } } @@ -56,40 +55,41 @@ }; Screen.prototype.animate = function() { - var _this = this; this.locking = true; - return setTimeout(function() { - var animating, x, _i, _len, _ref; - animating = false; - _ref = _this.objects; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - x = _ref[_i]; - if (!((x.isAnimating != null) && x.isAnimating())) { - continue; + return setTimeout((function(_this) { + return function() { + var animating, i, len, ref, x; + animating = false; + ref = _this.objects; + for (i = 0, len = ref.length; i < len; i++) { + x = ref[i]; + if (!((x.isAnimating != null) && x.isAnimating())) { + continue; + } + x.draw(); + animating = true; } - x.draw(); - animating = true; - } - if (animating) { - return _this.animate(); - } else { - return _this.afterAnimation(); - } - }, 25); + if (animating) { + return _this.animate(); + } else { + return _this.afterAnimation(); + } + }; + })(this), 25); }; Screen.prototype.afterAnimation = function() { - var x, _i, _len, _ref, _results; + var i, len, ref, results, x; this.locking = false; - _ref = this.objects; - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - x = _ref[_i]; + ref = this.objects; + results = []; + for (i = 0, len = ref.length; i < len; i++) { + x = ref[i]; if (x.afterAnimation != null) { - _results.push(x.afterAnimation(this)); + results.push(x.afterAnimation(this)); } } - return _results; + return results; }; return Screen; @@ -97,24 +97,22 @@ })(); Label = (function() { - function Label(text, attr) { - var _ref, _ref1, _ref2, _ref3; if (attr == null) { attr = {}; } this.text = text; merge(this, attr); - if ((_ref = this.font) == null) { + if (this.font == null) { this.font = '10px sans'; } - if ((_ref1 = this.color) == null) { + if (this.color == null) { this.color = 'white'; } - if ((_ref2 = this.x) == null) { + if (this.x == null) { this.x = 0; } - if ((_ref3 = this.y) == null) { + if (this.y == null) { this.y = 0; } } @@ -143,7 +141,6 @@ })(); Line = (function() { - function Line(attr) { if (attr == null) { attr = {}; @@ -178,23 +175,21 @@ })(); AbstractRectangle = (function() { - function AbstractRectangle(attr) { - var _ref, _ref1, _ref2, _ref3; if (attr == null) { attr = {}; } merge(this, attr); - if ((_ref = this.x0) == null) { + if (this.x0 == null) { this.x0 = 0; } - if ((_ref1 = this.y0) == null) { + if (this.y0 == null) { this.y0 = 0; } - if ((_ref2 = this.x1) == null) { + if (this.x1 == null) { this.x1 = 0; } - if ((_ref3 = this.y1) == null) { + if (this.y1 == null) { this.y1 = 0; } } @@ -216,26 +211,24 @@ })(); - GradientRectangle = (function(_super) { - - __extends(GradientRectangle, _super); + GradientRectangle = (function(superClass) { + extend(GradientRectangle, superClass); function GradientRectangle(attr) { - var _ref, _ref1; if (attr == null) { attr = {}; } GradientRectangle.__super__.constructor.call(this, attr); - if ((_ref = this.colors) == null) { + if (this.colors == null) { this.colors = ['#fff', '#fff']; } - if ((_ref1 = this.direction) == null) { + if (this.direction == null) { this.direction = 'horizontal'; } } GradientRectangle.prototype.draw = function(offsetX, offsetY) { - var c, d, g, p, v, _i, _len, _ref; + var c, d, g, i, len, p, ref, v; if (offsetX == null) { offsetX = 0; } @@ -251,9 +244,9 @@ g = c.createLinearGradient(p.x0, p.y0, p.x1, p.y0); } d = 0.0; - _ref = this.colors; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - v = _ref[_i]; + ref = this.colors; + for (i = 0, len = ref.length; i < len; i++) { + v = ref[i]; g.addColorStop(d, v); d += 1 / (this.colors.length - 1); } @@ -267,23 +260,21 @@ })(AbstractRectangle); GraphBar = (function() { - function GraphBar(attr) { - var _ref, _ref1, _ref2, _ref3; if (attr == null) { attr = {}; } merge(this, attr); - if ((_ref = this.x) == null) { + if (this.x == null) { this.x = 0; } - if ((_ref1 = this.y) == null) { + if (this.y == null) { this.y = 0; } - if ((_ref2 = this.width) == null) { + if (this.width == null) { this.width = 1; } - if ((_ref3 = this.height) == null) { + if (this.height == null) { this.height = 24; } this.performance = attr.performance || 0; @@ -331,7 +322,7 @@ if (parseInt(val) * 1.0 === Number(val)) { val = parseInt(val); } - label = new Label("" + val + "%", { + label = new Label(val + "%", { font: '12px sans' }); width = 1.0 * this.width / this.max * this.performance; @@ -349,27 +340,27 @@ })(); merge = function(dist, src) { - var k, v, _results; - _results = []; + var k, results, v; + results = []; for (k in src) { v = src[k]; if (src.hasOwnProperty(k)) { - _results.push(dist[k] = v); + results.push(dist[k] = v); } } - return _results; + return results; }; screenPosition = function(obj, offsetX, offsetY) { - var m, offset, pos, _i, _len, _ref; + var i, len, m, offset, pos, ref; pos = {}; offset = { x: offsetX, y: offsetY }; - _ref = screenPosition.fields; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - m = _ref[_i]; + ref = screenPosition.fields; + for (i = 0, len = ref.length; i < len; i++) { + m = ref[i]; if (obj.hasOwnProperty(m)) { pos[m] = obj[m] + offset[m[0]]; } @@ -433,7 +424,7 @@ return screen.add(bottomLine); })(); (function() { - var d, graphArea, x, _, _i, _len, _ref, _results; + var _, d, graphArea, i, len, ref, results, x; graphArea = new GradientRectangle({ x0: 146, y0: 75, @@ -443,31 +434,31 @@ }); screen.add(graphArea); d = [650 - 146] / 4; - _ref = new Array(5); - _results = []; - for (x = _i = 0, _len = _ref.length; _i < _len; x = ++_i) { - _ = _ref[x]; - _results.push(screen.add(new Line({ + ref = new Array(5); + results = []; + for (x = i = 0, len = ref.length; i < len; x = ++i) { + _ = ref[x]; + results.push(screen.add(new Line({ x: 146 + d * (x + 1), y0: 75, y1: 268, color: "rgb(178, 255, 178)" }))); } - return _results; + return results; })(); (function() { - var field, fields, n, _i, _len, _results; + var field, fields, i, len, n, results; fields = ['kyoikuKanji', 'level1st', 'level2nd', 'level3rd', 'level4th']; - _results = []; - for (n = _i = 0, _len = fields.length; _i < _len; n = ++_i) { + results = []; + for (n = i = 0, len = fields.length; i < len; n = ++i) { field = fields[n]; screen.add(new Label(window.dictionary[field], { x: 30, y: 103 + (37 * n), font: '14px sans' })); - _results.push(screen.add(new GraphBar({ + results.push(screen.add(new GraphBar({ x: 146, y: 87 + (37 * n), width: 504, @@ -475,7 +466,7 @@ performance: KanjiInfo[pageName][field] }))); } - return _results; + return results; })(); screen.add(new Line({ x: 146, @@ -493,18 +484,18 @@ return; } screenScale = (function() { - var m, scale, _i, _len, _ref; + var i, len, m, ref, scale; scale = {}; - _ref = ['width', 'height']; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - m = _ref[_i]; + ref = ['width', 'height']; + for (i = 0, len = ref.length; i < len; i++) { + m = ref[i]; scale[m] = parseInt(Canvas.$el.css(m)); } return scale; })(); screen = new Screen(screenScale); return KanjiInfo.update(function() { - var $container, b, buttons, drawPage, n, name, _i, _len, _ref; + var $container, b, buttons, drawPage, i, len, n, name, ref; drawPage = function(pageIndex) { var pageName; pageName = drawPage.mapping[pageIndex]; @@ -513,11 +504,11 @@ } }; drawPage.mapping = ['gothic', 'mincho']; - $container = $('#docs-header .buttons-container .inner-container'); + $container = $('header .buttons-container .inner-container'); buttons = []; - _ref = drawPage.mapping; - for (n = _i = 0, _len = _ref.length; _i < _len; n = ++_i) { - name = _ref[n]; + ref = drawPage.mapping; + for (n = i = 0, len = ref.length; i < len; n = ++i) { + name = ref[n]; b = document.createElement('div'); $(b).addClass('button').text(n + 1).click(function() { var index; diff --git a/html/js/lang.js b/html/js/lang.js index 1b6294c6..6fdb2ca3 100644 --- a/html/js/lang.js +++ b/html/js/lang.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.4.0 +// Generated by CoffeeScript 1.12.7 (function() { var CurrentLangLabel, LangMenu, LangMenuItem, availableLanguages, main; @@ -17,18 +17,18 @@ }; CurrentLangLabel = (function() { - function CurrentLangLabel(menu) { - var _this = this; this.el = "#current-lang"; this.$el = $(this.el); this.menu = menu; - this.$el.click(function(event) { - event.stopPropagation(); - return $(_this.menu.$el).css({ - "z-index": 99 - }).toggle(); - }); + this.$el.click((function(_this) { + return function(event) { + event.stopPropagation(); + return $(_this.menu.$el).css({ + "z-index": 99 + }).toggle(); + }; + })(this)); } CurrentLangLabel.prototype.text = function() { @@ -40,7 +40,6 @@ })(); LangMenuItem = (function() { - function LangMenuItem(langSymbol, langText) { this.$el = $(document.createElement("div")); this.$el.attr({ @@ -56,15 +55,13 @@ })(); LangMenu = (function() { - function LangMenu() { this.el = "#lang-menu-container"; this.$el = $(this.el); } LangMenu.prototype.buildItems = function(currentLangText) { - var k, v, - _this = this; + var k, v; for (k in availableLanguages) { v = availableLanguages[k]; if (v === currentLangText) { @@ -74,25 +71,20 @@ } } $('.item', this.$el).click(this.onclickItem); - $('body').click(function() { - return _this.$el.hide(); - }); + $('body').click((function(_this) { + return function() { + return _this.$el.hide(); + }; + })(this)); }; LangMenu.prototype.onclickItem = function(event) { var key, root; - console.log(this); if ($(this).attr("id") === "current-lang") { return; } key = $(this).attr("data-key") + '/'; - if (key === 'ja/') { - key = ''; - } root = '../'; - if ($("div#current-lang").attr("data-key") === "ja") { - root = './'; - } window.location = root + key; }; diff --git a/html/requirements.txt b/html/requirements.txt new file mode 100644 index 00000000..e02aeec4 --- /dev/null +++ b/html/requirements.txt @@ -0,0 +1,3 @@ +lxml==4.5.0 +Markdown==3.2.1 +pkg-resources==0.0.0