瀏覽代碼

imporved hyphenation to build.py

Bachir Soussi Chiadmi 7 年之前
父節點
當前提交
7d5c19f9fd
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      bin/build.py

+ 2 - 2
bin/build.py

@@ -245,11 +245,11 @@ def hyphenate(node):
    # add none breaking spaces
    nbspzr_before = ['»', '\!', '\?', ':', ';']
    for char in nbspzr_before:
-      nodestr = re.sub(r'(\w)\s('+char+')', r'\1 \2', nodestr)
+      nodestr = re.sub(r'(\w|>)\s('+char+')', r'\1 \2', nodestr)
 
    nbspzr_after = ['«']
    for char in nbspzr_after:
-      nodestr = re.sub(r'('+char+')\s(\w)', r'\1 \2', nodestr)
+      nodestr = re.sub(r'('+char+')\s(\w|<)', r'\1&nbsp;\2', nodestr)
 
    # print(nodestr)
    # replace node by hyphenated one