• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

generic text markup tools


Commit MetaInfo

Revisióndc1eabe62fc8d19696dd74bc9a6ad0d576b550b0 (tree)
Tiempo2013-04-08 23:42:04
Autorhylom <hylom@hylo...>
Commiterhylom

Log Message

jarkup.json: add note mode

Cambiar Resumen

Diferencia incremental

--- a/jarkup.json
+++ b/jarkup.json
@@ -70,7 +70,8 @@
7070 "figure",
7171 "code",
7272 "table",
73- "unOrderdList"
73+ "unOrderdList",
74+ "note"
7475 ]
7576 },
7677 "unOrderdList": {
@@ -161,7 +162,7 @@
161162 },
162163 "caption": {
163164 "priority": 100,
164- "regexp": "^^☆図([0-9]+)\\s+(.*)$",
165+ "regexp": "^☆図([0-9]+)\\s+(.*)$",
165166 "continue": false,
166167 "store": [
167168 "ref",
@@ -178,17 +179,29 @@
178179 },
179180 "note": {
180181 "extends": "global",
181- "begin": "^☆note$",
182- "end": "^☆note-end$",
182+ "transitions": [
183+ "figure",
184+ "code",
185+ "table",
186+ "unOrderdList"
187+ ],
188+ "begin": "^☆note\\s+(.*)$",
189+ "end": "^☆note-end\\s*$",
183190 "onStart": {
184- "insert": "<div class=\"column note\">",
185- "replace": ""
191+ "insert": "<div class=\"note\">\n"
186192 },
187193 "onFinished": {
188- "insert": "</div>\n",
194+ "insert": "</div>",
189195 "replace": ""
196+ },
197+ "rules": {
198+ "title": {
199+ "priority": 100,
200+ "regexp": "^☆note\\s+(.*)$",
201+ "replace": "<h5>\\1</h5>"
202+ }
190203 }
191- },
204+ },
192205 "inline": {
193206 "includeRule": ["fontDecoration", "toEntity"],
194207 "rules": {
--- a/test/test.txt
+++ b/test/test.txt
@@ -40,6 +40,10 @@
4040 もしくは*b{こういう感じ}や*g{こんな風}にもできます
4141 ☆+---
4242
43+☆note 注釈/コラム
44+ 注釈/コラム内ではほかのマークアップがそのまま使えます。
45+☆note-end
46+
4347  下記、テストその2。
4448
4549 ☆+---
--- a/textparser.py
+++ b/textparser.py
@@ -25,6 +25,7 @@ class Mode(object):
2525 def test(self, attr_name, text):
2626 '''test attr_name matches text'''
2727 rex = self.attr(attr_name, False)
28+ #_debug_print(rex)
2829 if rex and re.search(rex, text):
2930 return True
3031 else:
@@ -228,6 +229,7 @@ class Parser(object):
228229 return ''
229230
230231 mode = self.current_mode()
232+ #_debug_print(mode.name)
231233 if mode.test("end", text):
232234 text = mode.on_exit(self, text)
233235 self.mode_stack.pop()