• R/O
  • HTTP
  • SSH
  • HTTPS

sawarabi-fonts: Commit


Commit MetaInfo

Revision7e551c698deead4dbc5f9393ff2c18fbbb03ca92 (tree)
Time2020-02-16 17:51:57
Authormshio <mshio@user...>
Commitermshio

Log Message

update html

add SIL Open Font License

Change Summary

Incremental Difference

--- a/html/bin/gen.py
+++ b/html/bin/gen.py
@@ -101,9 +101,24 @@ def parse_args():
101101 ps.add_argument("source")
102102 ps.add_argument("-o", dest="out_path", default="out.html")
103103 ps.add_argument("-t", dest="template_path", default="template.html")
104+ ps.add_argument("-r", dest="for_rootdir", default=False)
104105
105106 return ps.parse_args()
106107
108+def rewrite_resource_path(template):
109+ def to_be_rewritten(path: str) -> bool:
110+ return not re.match(r"^(https?:)?//.*", path)
111+
112+ for l in template.xpath("//link[@rel='stylesheet']"):
113+ path = l.attrib.get("href")
114+ if to_be_rewritten(path):
115+ l.attrib["href"] = f"../{path}"
116+
117+ for s in template.xpath("//script|//img"):
118+ path = s.attrib.get("src")
119+ if to_be_rewritten(path):
120+ s.attrib["src"] = f"../{path}"
121+
107122 if __name__ == "__main__":
108123 args = parse_args()
109124
@@ -113,7 +128,7 @@ if __name__ == "__main__":
113128
114129 temp = html.parse(args.template_path)
115130 temp.getroot().attrib['lang'] = doc.property['lang']
116- temp.xpath('//title')[0].text = doc.property['title']
131+ temp.xpath('/html/head/title')[0].text = doc.property['title']
117132 img = temp.xpath('//div[contains(@class, "logo")]/img')[0]
118133 img.attrib['alt'] = doc.property['title']
119134 langname = temp.xpath('//div[contains(@id, "current-lang")]/span')[0]
@@ -126,5 +141,8 @@ if __name__ == "__main__":
126141
127142 for a in temp.xpath('//a'): a.attrib['target'] = '_blank'
128143
144+ if not args.for_rootdir:
145+ rewrite_resource_path(temp)
146+
129147 with open(args.out_path, 'w') as f:
130148 f.write(html.tostring(temp, encoding='utf-8').decode())
--- a/html/coffee/doc-header.coffee
+++ b/html/coffee/doc-header.coffee
@@ -290,7 +290,7 @@ $ ->
290290 'mincho'
291291 ]
292292
293- $container = $('#docs-header .buttons-container .inner-container')
293+ $container = $('header .buttons-container .inner-container')
294294 buttons = []
295295 for name, n in drawPage.mapping
296296 b = document.createElement('div')
--- a/html/coffee/lang.coffee
+++ b/html/coffee/lang.coffee
@@ -52,13 +52,9 @@ class LangMenu
5252 return
5353
5454 onclickItem: (event)->
55- console.log(@)
56-
5755 return if $(@).attr("id") == "current-lang"
5856 key = $(@).attr("data-key") + '/'
59- key = '' if key is 'ja/'
6057 root = '../'
61- root = './' if $("div#current-lang").attr("data-key") is "ja"
6258 window.location = root + key
6359 return
6460
--- a/html/css/style.css
+++ b/html/css/style.css
@@ -25,7 +25,7 @@ nav .container div#navbar div#lang div.container {
2525 }
2626 nav .container div#navbar div#lang div.item {
2727 padding: 26px 1em 0 1em;
28- width: 85px;
28+ width: 90px;
2929 height: 40px;
3030 cursor: pointer;
3131 background-color: #fff;
--- a/html/en.txt
+++ b/html/en.txt
@@ -22,21 +22,23 @@ daily use, such as standard kanji, for being under developing now.
2222 % license
2323 ## License
2424
25-The license of Sawarabi Fonts is Creative Commons Attribution 3.0. You can see
26-the content of this license on the following site:
25+Sawarabi Gothic and Mincho are dual-licensed under either the terms of
26+the Creative Commons Attribution 3.0 or under the terms of the SIL Open
27+Font License 1.1.
2728
2829 - [Creative Commons Attribution 3.0](https://creativecommons.org/licenses/by/3.0/)
30+- [SIL Open Font License 1.1](https://scripts.sil.org/OFL)
2931
3032 % samples
3133 ## Samples
3234
3335 Sawarabi Gothic (ver.20161015).
3436
35-<img src="/img/sample-gothic.png" alt="Sample (Gothic)" /><br />
37+<img src="img/sample-gothic.png" alt="Sample (Gothic)" /><br />
3638
37-Sawarabi Mincho (ver.20140815).
39+Sawarabi Mincho (ver.20200215).
3840
39-<img src="../img/sample-mincho.png" alt="Sample (Mincho)" /><br />
41+<img src="img/sample-mincho-20200215.png" alt="Sample (Mincho)" /><br />
4042
4143 % download
4244 ## Download
Binary files /dev/null and b/html/img/sample-mincho-20200215.png differ
--- a/html/ja.txt
+++ b/html/ja.txt
@@ -17,21 +17,21 @@
1717 % license
1818 ## ライセンス
1919
20- さわらびフォントのライセンスは、Creative Commons Attribution 3.0 です。
21-このライセンスの内容は、以下のリンクからご覧いただけます。
20+ さわらびフォントは、Creative Commons Attribution 3.0 と SIL Open Font License 1.1 のデュアルライセンスで配布されています。ライセンスの内容は、以下のリンクからご覧いただけます。
2221
2322 - [Creative Commons Attribution 3.0](https://creativecommons.org/licenses/by/3.0/deed.ja)
23+- [SIL Open Font License 1.1](https://scripts.sil.org/OFL)
2424
2525 % samples
2626 ## 書体見本
2727
2828  さわらびゴシック(ver.20161015)の書体見本です。
2929
30-<img src="/img/sample-gothic.png" alt="書体見本(ゴシック)" /><br />
30+<img src="img/sample-gothic.png" alt="書体見本(ゴシック)" /><br />
3131
32- さわらび明朝(ver.20140815)の書体見本です。
32+ さわらび明朝(ver.20200215)の書体見本です。
3333
34-<img src="/img/sample-mincho.png" alt="書体見本(明朝)" /><br />
34+<img src="img/sample-mincho-20200215.png" alt="書体見本(明朝)" /><br />
3535
3636 % download
3737 ## ダウンロード
--- a/html/js/doc-header.js
+++ b/html/js/doc-header.js
@@ -1,8 +1,8 @@
1-// Generated by CoffeeScript 1.4.0
1+// Generated by CoffeeScript 1.12.7
22 (function() {
33 var AbstractRectangle, Canvas, GradientRectangle, GraphBar, KanjiInfo, Label, Line, Screen, makeGraphPage, merge, screenPosition,
4- __hasProp = {}.hasOwnProperty,
5- __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; };
4+ 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; },
5+ hasProp = {}.hasOwnProperty;
66
77 Canvas = {
88 el: "canvas#header-canvas",
@@ -19,7 +19,6 @@
1919 };
2020
2121 Screen = (function() {
22-
2322 function Screen(attr) {
2423 if (attr == null) {
2524 attr = {};
@@ -42,13 +41,13 @@
4241 };
4342
4443 Screen.prototype.draw = function(obj) {
45- var x, _i, _len, _ref;
44+ var i, len, ref, x;
4645 if (obj) {
4746 obj.draw();
4847 } else {
49- _ref = this.objects;
50- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
51- x = _ref[_i];
48+ ref = this.objects;
49+ for (i = 0, len = ref.length; i < len; i++) {
50+ x = ref[i];
5251 x.draw();
5352 }
5453 }
@@ -56,40 +55,41 @@
5655 };
5756
5857 Screen.prototype.animate = function() {
59- var _this = this;
6058 this.locking = true;
61- return setTimeout(function() {
62- var animating, x, _i, _len, _ref;
63- animating = false;
64- _ref = _this.objects;
65- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
66- x = _ref[_i];
67- if (!((x.isAnimating != null) && x.isAnimating())) {
68- continue;
59+ return setTimeout((function(_this) {
60+ return function() {
61+ var animating, i, len, ref, x;
62+ animating = false;
63+ ref = _this.objects;
64+ for (i = 0, len = ref.length; i < len; i++) {
65+ x = ref[i];
66+ if (!((x.isAnimating != null) && x.isAnimating())) {
67+ continue;
68+ }
69+ x.draw();
70+ animating = true;
6971 }
70- x.draw();
71- animating = true;
72- }
73- if (animating) {
74- return _this.animate();
75- } else {
76- return _this.afterAnimation();
77- }
78- }, 25);
72+ if (animating) {
73+ return _this.animate();
74+ } else {
75+ return _this.afterAnimation();
76+ }
77+ };
78+ })(this), 25);
7979 };
8080
8181 Screen.prototype.afterAnimation = function() {
82- var x, _i, _len, _ref, _results;
82+ var i, len, ref, results, x;
8383 this.locking = false;
84- _ref = this.objects;
85- _results = [];
86- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
87- x = _ref[_i];
84+ ref = this.objects;
85+ results = [];
86+ for (i = 0, len = ref.length; i < len; i++) {
87+ x = ref[i];
8888 if (x.afterAnimation != null) {
89- _results.push(x.afterAnimation(this));
89+ results.push(x.afterAnimation(this));
9090 }
9191 }
92- return _results;
92+ return results;
9393 };
9494
9595 return Screen;
@@ -97,24 +97,22 @@
9797 })();
9898
9999 Label = (function() {
100-
101100 function Label(text, attr) {
102- var _ref, _ref1, _ref2, _ref3;
103101 if (attr == null) {
104102 attr = {};
105103 }
106104 this.text = text;
107105 merge(this, attr);
108- if ((_ref = this.font) == null) {
106+ if (this.font == null) {
109107 this.font = '10px sans';
110108 }
111- if ((_ref1 = this.color) == null) {
109+ if (this.color == null) {
112110 this.color = 'white';
113111 }
114- if ((_ref2 = this.x) == null) {
112+ if (this.x == null) {
115113 this.x = 0;
116114 }
117- if ((_ref3 = this.y) == null) {
115+ if (this.y == null) {
118116 this.y = 0;
119117 }
120118 }
@@ -143,7 +141,6 @@
143141 })();
144142
145143 Line = (function() {
146-
147144 function Line(attr) {
148145 if (attr == null) {
149146 attr = {};
@@ -178,23 +175,21 @@
178175 })();
179176
180177 AbstractRectangle = (function() {
181-
182178 function AbstractRectangle(attr) {
183- var _ref, _ref1, _ref2, _ref3;
184179 if (attr == null) {
185180 attr = {};
186181 }
187182 merge(this, attr);
188- if ((_ref = this.x0) == null) {
183+ if (this.x0 == null) {
189184 this.x0 = 0;
190185 }
191- if ((_ref1 = this.y0) == null) {
186+ if (this.y0 == null) {
192187 this.y0 = 0;
193188 }
194- if ((_ref2 = this.x1) == null) {
189+ if (this.x1 == null) {
195190 this.x1 = 0;
196191 }
197- if ((_ref3 = this.y1) == null) {
192+ if (this.y1 == null) {
198193 this.y1 = 0;
199194 }
200195 }
@@ -216,26 +211,24 @@
216211
217212 })();
218213
219- GradientRectangle = (function(_super) {
220-
221- __extends(GradientRectangle, _super);
214+ GradientRectangle = (function(superClass) {
215+ extend(GradientRectangle, superClass);
222216
223217 function GradientRectangle(attr) {
224- var _ref, _ref1;
225218 if (attr == null) {
226219 attr = {};
227220 }
228221 GradientRectangle.__super__.constructor.call(this, attr);
229- if ((_ref = this.colors) == null) {
222+ if (this.colors == null) {
230223 this.colors = ['#fff', '#fff'];
231224 }
232- if ((_ref1 = this.direction) == null) {
225+ if (this.direction == null) {
233226 this.direction = 'horizontal';
234227 }
235228 }
236229
237230 GradientRectangle.prototype.draw = function(offsetX, offsetY) {
238- var c, d, g, p, v, _i, _len, _ref;
231+ var c, d, g, i, len, p, ref, v;
239232 if (offsetX == null) {
240233 offsetX = 0;
241234 }
@@ -251,9 +244,9 @@
251244 g = c.createLinearGradient(p.x0, p.y0, p.x1, p.y0);
252245 }
253246 d = 0.0;
254- _ref = this.colors;
255- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
256- v = _ref[_i];
247+ ref = this.colors;
248+ for (i = 0, len = ref.length; i < len; i++) {
249+ v = ref[i];
257250 g.addColorStop(d, v);
258251 d += 1 / (this.colors.length - 1);
259252 }
@@ -267,23 +260,21 @@
267260 })(AbstractRectangle);
268261
269262 GraphBar = (function() {
270-
271263 function GraphBar(attr) {
272- var _ref, _ref1, _ref2, _ref3;
273264 if (attr == null) {
274265 attr = {};
275266 }
276267 merge(this, attr);
277- if ((_ref = this.x) == null) {
268+ if (this.x == null) {
278269 this.x = 0;
279270 }
280- if ((_ref1 = this.y) == null) {
271+ if (this.y == null) {
281272 this.y = 0;
282273 }
283- if ((_ref2 = this.width) == null) {
274+ if (this.width == null) {
284275 this.width = 1;
285276 }
286- if ((_ref3 = this.height) == null) {
277+ if (this.height == null) {
287278 this.height = 24;
288279 }
289280 this.performance = attr.performance || 0;
@@ -331,7 +322,7 @@
331322 if (parseInt(val) * 1.0 === Number(val)) {
332323 val = parseInt(val);
333324 }
334- label = new Label("" + val + "%", {
325+ label = new Label(val + "%", {
335326 font: '12px sans'
336327 });
337328 width = 1.0 * this.width / this.max * this.performance;
@@ -349,27 +340,27 @@
349340 })();
350341
351342 merge = function(dist, src) {
352- var k, v, _results;
353- _results = [];
343+ var k, results, v;
344+ results = [];
354345 for (k in src) {
355346 v = src[k];
356347 if (src.hasOwnProperty(k)) {
357- _results.push(dist[k] = v);
348+ results.push(dist[k] = v);
358349 }
359350 }
360- return _results;
351+ return results;
361352 };
362353
363354 screenPosition = function(obj, offsetX, offsetY) {
364- var m, offset, pos, _i, _len, _ref;
355+ var i, len, m, offset, pos, ref;
365356 pos = {};
366357 offset = {
367358 x: offsetX,
368359 y: offsetY
369360 };
370- _ref = screenPosition.fields;
371- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
372- m = _ref[_i];
361+ ref = screenPosition.fields;
362+ for (i = 0, len = ref.length; i < len; i++) {
363+ m = ref[i];
373364 if (obj.hasOwnProperty(m)) {
374365 pos[m] = obj[m] + offset[m[0]];
375366 }
@@ -433,7 +424,7 @@
433424 return screen.add(bottomLine);
434425 })();
435426 (function() {
436- var d, graphArea, x, _, _i, _len, _ref, _results;
427+ var _, d, graphArea, i, len, ref, results, x;
437428 graphArea = new GradientRectangle({
438429 x0: 146,
439430 y0: 75,
@@ -443,31 +434,31 @@
443434 });
444435 screen.add(graphArea);
445436 d = [650 - 146] / 4;
446- _ref = new Array(5);
447- _results = [];
448- for (x = _i = 0, _len = _ref.length; _i < _len; x = ++_i) {
449- _ = _ref[x];
450- _results.push(screen.add(new Line({
437+ ref = new Array(5);
438+ results = [];
439+ for (x = i = 0, len = ref.length; i < len; x = ++i) {
440+ _ = ref[x];
441+ results.push(screen.add(new Line({
451442 x: 146 + d * (x + 1),
452443 y0: 75,
453444 y1: 268,
454445 color: "rgb(178, 255, 178)"
455446 })));
456447 }
457- return _results;
448+ return results;
458449 })();
459450 (function() {
460- var field, fields, n, _i, _len, _results;
451+ var field, fields, i, len, n, results;
461452 fields = ['kyoikuKanji', 'level1st', 'level2nd', 'level3rd', 'level4th'];
462- _results = [];
463- for (n = _i = 0, _len = fields.length; _i < _len; n = ++_i) {
453+ results = [];
454+ for (n = i = 0, len = fields.length; i < len; n = ++i) {
464455 field = fields[n];
465456 screen.add(new Label(window.dictionary[field], {
466457 x: 30,
467458 y: 103 + (37 * n),
468459 font: '14px sans'
469460 }));
470- _results.push(screen.add(new GraphBar({
461+ results.push(screen.add(new GraphBar({
471462 x: 146,
472463 y: 87 + (37 * n),
473464 width: 504,
@@ -475,7 +466,7 @@
475466 performance: KanjiInfo[pageName][field]
476467 })));
477468 }
478- return _results;
469+ return results;
479470 })();
480471 screen.add(new Line({
481472 x: 146,
@@ -493,18 +484,18 @@
493484 return;
494485 }
495486 screenScale = (function() {
496- var m, scale, _i, _len, _ref;
487+ var i, len, m, ref, scale;
497488 scale = {};
498- _ref = ['width', 'height'];
499- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
500- m = _ref[_i];
489+ ref = ['width', 'height'];
490+ for (i = 0, len = ref.length; i < len; i++) {
491+ m = ref[i];
501492 scale[m] = parseInt(Canvas.$el.css(m));
502493 }
503494 return scale;
504495 })();
505496 screen = new Screen(screenScale);
506497 return KanjiInfo.update(function() {
507- var $container, b, buttons, drawPage, n, name, _i, _len, _ref;
498+ var $container, b, buttons, drawPage, i, len, n, name, ref;
508499 drawPage = function(pageIndex) {
509500 var pageName;
510501 pageName = drawPage.mapping[pageIndex];
@@ -513,11 +504,11 @@
513504 }
514505 };
515506 drawPage.mapping = ['gothic', 'mincho'];
516- $container = $('#docs-header .buttons-container .inner-container');
507+ $container = $('header .buttons-container .inner-container');
517508 buttons = [];
518- _ref = drawPage.mapping;
519- for (n = _i = 0, _len = _ref.length; _i < _len; n = ++_i) {
520- name = _ref[n];
509+ ref = drawPage.mapping;
510+ for (n = i = 0, len = ref.length; i < len; n = ++i) {
511+ name = ref[n];
521512 b = document.createElement('div');
522513 $(b).addClass('button').text(n + 1).click(function() {
523514 var index;
--- a/html/js/lang.js
+++ b/html/js/lang.js
@@ -1,4 +1,4 @@
1-// Generated by CoffeeScript 1.4.0
1+// Generated by CoffeeScript 1.12.7
22 (function() {
33 var CurrentLangLabel, LangMenu, LangMenuItem, availableLanguages, main;
44
@@ -17,18 +17,18 @@
1717 };
1818
1919 CurrentLangLabel = (function() {
20-
2120 function CurrentLangLabel(menu) {
22- var _this = this;
2321 this.el = "#current-lang";
2422 this.$el = $(this.el);
2523 this.menu = menu;
26- this.$el.click(function(event) {
27- event.stopPropagation();
28- return $(_this.menu.$el).css({
29- "z-index": 99
30- }).toggle();
31- });
24+ this.$el.click((function(_this) {
25+ return function(event) {
26+ event.stopPropagation();
27+ return $(_this.menu.$el).css({
28+ "z-index": 99
29+ }).toggle();
30+ };
31+ })(this));
3232 }
3333
3434 CurrentLangLabel.prototype.text = function() {
@@ -40,7 +40,6 @@
4040 })();
4141
4242 LangMenuItem = (function() {
43-
4443 function LangMenuItem(langSymbol, langText) {
4544 this.$el = $(document.createElement("div"));
4645 this.$el.attr({
@@ -56,15 +55,13 @@
5655 })();
5756
5857 LangMenu = (function() {
59-
6058 function LangMenu() {
6159 this.el = "#lang-menu-container";
6260 this.$el = $(this.el);
6361 }
6462
6563 LangMenu.prototype.buildItems = function(currentLangText) {
66- var k, v,
67- _this = this;
64+ var k, v;
6865 for (k in availableLanguages) {
6966 v = availableLanguages[k];
7067 if (v === currentLangText) {
@@ -74,25 +71,20 @@
7471 }
7572 }
7673 $('.item', this.$el).click(this.onclickItem);
77- $('body').click(function() {
78- return _this.$el.hide();
79- });
74+ $('body').click((function(_this) {
75+ return function() {
76+ return _this.$el.hide();
77+ };
78+ })(this));
8079 };
8180
8281 LangMenu.prototype.onclickItem = function(event) {
8382 var key, root;
84- console.log(this);
8583 if ($(this).attr("id") === "current-lang") {
8684 return;
8785 }
8886 key = $(this).attr("data-key") + '/';
89- if (key === 'ja/') {
90- key = '';
91- }
9287 root = '../';
93- if ($("div#current-lang").attr("data-key") === "ja") {
94- root = './';
95- }
9688 window.location = root + key;
9789 };
9890
--- /dev/null
+++ b/html/requirements.txt
@@ -0,0 +1,3 @@
1+lxml==4.5.0
2+Markdown==3.2.1
3+pkg-resources==0.0.0
Show on old repository browser