• 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ón18f5a22b3e7afc176d2ee7728b80e351060a9822 (tree)
Tiempo2013-09-01 22:26:08
Autorhylom <hylom@hylo...>
Commiterhylom

Log Message

update jarkup.json: enable textlink in table

Cambiar Resumen

Diferencia incremental

--- a/jarkup.json
+++ b/jarkup.json
@@ -42,6 +42,23 @@
4242 "regexp": "\\*b\\[(.*?)]",
4343 "replace": "<strong>\\1</strong>"
4444 }
45+ },
46+ "inline": {
47+ "textLink": {
48+ "priority": 100,
49+ "regexp": "\\*\\[(https?:/[^ ]*?)\\s+(.*?)]",
50+ "replace": "<a href=\"\\1\">\\2</a>"
51+ },
52+ "rawLink": {
53+ "priority": 101,
54+ "regexp": "\\*\\[(https?:/[^ ]*?)]",
55+ "replace": "<a href=\"\\1\">\\1</a>"
56+ },
57+ "refference": {
58+ "priority": 102,
59+ "regexp": "\\*(図|表|リスト|実行例)([0-9A-Za-z、]+)",
60+ "replace": "<strong>\\1\\2</strong>"
61+ }
4562 }
4663 },
4764 "modes": {
@@ -72,6 +89,7 @@
7289 "transitions": [
7390 "figure",
7491 "code",
92+ "langCode",
7593 "table",
7694 "unOrderdList",
7795 "note",
@@ -98,7 +116,7 @@
98116 }
99117 },
100118 "table": {
101- "includeRule": ["fontDecoration", "toEntity"],
119+ "includeRule": ["inline", "fontDecoration", "toEntity" ],
102120 "rules": {
103121 "tableRow": {
104122 "priority": 102,
@@ -157,6 +175,19 @@
157175 "replace": ""
158176 }
159177 },
178+ "langCode": {
179+ "includeRule": ["fontDecoration", "toEntity"],
180+ "begin": "^☆\\+---\\((.*)\\)\\s*$",
181+ "end": "^☆\\+---\\s*$",
182+ "onStart": {
183+ "insert": "<pre>",
184+ "replace": ""
185+ },
186+ "onFinished": {
187+ "insert": "</pre>",
188+ "replace": ""
189+ }
190+ },
160191 "codeList": {
161192 "includeRule": ["fontDecoration", "toEntity"],
162193 "begin": "^☆リスト.*$",
@@ -219,6 +250,7 @@
219250 "transitions": [
220251 "figure",
221252 "code",
253+ "langCode",
222254 "table",
223255 "unOrderdList",
224256 "comment",
--- a/textparser.py
+++ b/textparser.py
@@ -237,13 +237,17 @@ class Parser(object):
237237 rex = re.compile('\$([0-9]+)')
238238 m = rex.search(text)
239239 if m and match:
240- sub_func = lambda x:match.group(int(x.group(1)))
241- text = rex.sub(sub_func, text)
240+ def match_func(x):
241+ ret = match.group(int(x.group(1)))
242+ if ret == None:
243+ ret = x
244+ return ret
245+ text = rex.sub(match_func, text)
242246
243247 # expand vars
244248 rex = re.compile('\${?([A-Za-z0-9_]+)}?')
245249 m = rex.search(text)
246- sub_func = lambda x:self.store.load(x.group(1), '')
250+ sub_func = lambda x:self.store.load(x.group(1), x.string)
247251 text = rex.sub(sub_func, text)
248252 return text
249253