OSDN Git Service

update html
authormshio <mshio@users.osdn.me>
Sun, 16 Feb 2020 08:51:57 +0000 (17:51 +0900)
committermshio <mshio@users.osdn.me>
Sun, 16 Feb 2020 08:51:57 +0000 (17:51 +0900)
add SIL Open Font License

html/bin/gen.py
html/coffee/doc-header.coffee
html/coffee/lang.coffee
html/css/style.css
html/en.txt
html/img/sample-mincho-20200215.png [new file with mode: 0644]
html/ja.txt
html/js/doc-header.js
html/js/lang.js
html/requirements.txt [new file with mode: 0644]

index c175e0a..1be62b1 100644 (file)
@@ -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())
index b9cda80..6f117bd 100644 (file)
@@ -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')
index af27e7f..35762b6 100644 (file)
@@ -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
 
index 6965e4e..3961efd 100644 (file)
@@ -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;
index e92c65e..e2a4025 100644 (file)
@@ -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).
 
-<img src="/img/sample-gothic.png" alt="Sample (Gothic)" /><br />
+<img src="img/sample-gothic.png" alt="Sample (Gothic)" /><br />
 
-Sawarabi Mincho (ver.20140815).
+Sawarabi Mincho (ver.20200215).
 
-<img src="../img/sample-mincho.png" alt="Sample (Mincho)" /><br />
+<img src="img/sample-mincho-20200215.png" alt="Sample (Mincho)" /><br />
 
 % download
 ## Download
diff --git a/html/img/sample-mincho-20200215.png b/html/img/sample-mincho-20200215.png
new file mode 100644 (file)
index 0000000..ec07ee5
Binary files /dev/null and b/html/img/sample-mincho-20200215.png differ
index e01fe96..4d0a592 100644 (file)
 % 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)の書体見本です。
 
-<img src="/img/sample-gothic.png" alt="書体見本(ゴシック)" /><br />
+<img src="img/sample-gothic.png" alt="書体見本(ゴシック)" /><br />
 
- さわらび明朝(ver.20140815)の書体見本です。
+ さわらび明朝(ver.20200215)の書体見本です。
 
-<img src="/img/sample-mincho.png" alt="書体見本(明朝)" /><br />
+<img src="img/sample-mincho-20200215.png" alt="書体見本(明朝)" /><br />
 
 % download
 ## ダウンロード
index a780cf6..8c4565e 100644 (file)
@@ -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 = {};
     };
 
     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();
         }
       }
     };
 
     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;
   })();
 
   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;
       }
     }
   })();
 
   Line = (function() {
-
     function Line(attr) {
       if (attr == null) {
         attr = {};
   })();
 
   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;
       }
     }
 
   })();
 
-  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;
       }
         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);
       }
   })(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;
       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;
   })();
 
   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]];
       }
       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,
       });
       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,
           performance: KanjiInfo[pageName][field]
         })));
       }
-      return _results;
+      return results;
     })();
     screen.add(new Line({
       x: 146,
       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];
         }
       };
       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;
index 1b6294c..6fdb2ca 100644 (file)
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 1.4.0
+// Generated by CoffeeScript 1.12.7
 (function() {
   var CurrentLangLabel, LangMenu, LangMenuItem, availableLanguages, main;
 
   };
 
   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({
   })();
 
   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) {
         }
       }
       $('.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 (file)
index 0000000..e02aeec
--- /dev/null
@@ -0,0 +1,3 @@
+lxml==4.5.0
+Markdown==3.2.1
+pkg-resources==0.0.0