1 |
wakaba |
1.1 |
Module: |
2 |
|
|
@QName: Markup|SuikaWiki |
3 |
|
|
@enFN: |
4 |
|
|
SuikaWiki/0.9 and SuikaWiki/0.10 Document Markup Language DOM |
5 |
|
|
@enDesc: |
6 |
|
|
{TODO:: |
7 |
|
|
|
8 |
|
|
} |
9 |
|
|
|
10 |
wakaba |
1.2 |
<Caption::Supported element types> |
11 |
|
|
|
12 |
|
|
- SuikaWiki/0.9 Structure::: |
13 |
|
|
<XE::sw09|document>, <XE::xhtml2|head>, <XE::xhtml2|body>, |
14 |
|
|
<XE::sw09|parameter> (deprecated), <XE::sw09|value> (deprecated), |
15 |
|
|
<XE::sw09|replace> (deprecated), <XE::sw09|text> (deprecated) |
16 |
|
|
|
17 |
|
|
- SuikaWikiImage/0.9 Structure::: |
18 |
|
|
<XE::sw09|image> (deprecated) |
19 |
|
|
|
20 |
|
|
- SuikaWiki/0.9 Block-level::: |
21 |
|
|
<XE::xhtml2|section>, <XE::xhtml2|blockquote>, <XE::html3|bodytext>, |
22 |
|
|
<XE::sw09|insert>, <XE::sw09|delete>, |
23 |
|
|
<XE::xhtml2|ul>, <XE::xhtml2|ol>, <XE::xhtml2|dl>, |
24 |
|
|
<XE::xhtml2|li>, <XE::sw09|dr>, <XE::xhtml2|dt>, <XE::xhtml2|dd>, |
25 |
|
|
<XE::xhrml2|p>, <XE::xhtml2|pre> |
26 |
|
|
|
27 |
|
|
- SuikaWiki/0.10 Block-level::: |
28 |
|
|
<XE::sw010|ed>, <XE::sw010|comment-p> |
29 |
|
|
|
30 |
|
|
- SuikaWiki/0.9 Table::: |
31 |
|
|
<XE::xhtml2|table>, <XE::xhtml2|tbody>, |
32 |
|
|
<XE::xhtml2|tr>, <XE::xhtml2|td> |
33 |
|
|
|
34 |
|
|
- SuikaWiki/0.9 Hyperlink::: |
35 |
|
|
<XE::sw09|anchor-external>, <XE::sw09|anchor-internal>, |
36 |
|
|
<XE::sw09|anchor-end>, <XE::sw09|form> |
37 |
|
|
|
38 |
|
|
- SuikaWiki/0.9 Phrase::: |
39 |
|
|
<XE::xhtml2|dfn>, <XE::xhtml2|q>, <XE::xhtml2|sub>, <XE::xhtml2|sup>, |
40 |
|
|
<XE::xhtml2|abbr>, <XE::xhtml2|ruby>, <XE::sw09|rubyb>, |
41 |
|
|
<XE::xhtml2|rb>, <XE::xhtml2|rt>, <XE::xhtml2|var>, |
42 |
|
|
<XE::xhtml2|code>, <XE::xhtml2|kbd>, <XE::xhtml2|samp> (deprecated), |
43 |
|
|
<XE::xhtml2|del>, <XE::xhtml2|ins>, <XE::sw09|anchor>, |
44 |
|
|
<XE::xhtml2|em>, <XE::xhtml2|strong>, <XE::sw09|weak> |
45 |
|
|
|
46 |
|
|
- SuikaWiki/0.10 Phrase:: |
47 |
|
|
<XE::sw010|aa>, <XE::sw010|key>, <XE::xhtml2|span>, |
48 |
|
|
<XE::xhtml2|cite>, <XE::sw010|csection>, <XE::sw010|src>, |
49 |
|
|
<XE::sw010|qn>, <XE::sw010|qname>, <XE::sw010|nsuri> |
50 |
|
|
|
51 |
wakaba |
1.1 |
@Namespace: |
52 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/manakai/Markup/SuikaWiki/ |
53 |
|
|
|
54 |
|
|
@DISCore:author: DISCore|Wakaba |
55 |
|
|
@License: license|Perl+MPL |
56 |
|
|
@Date: |
57 |
wakaba |
1.8 |
$Date: 2006/12/30 08:27:50 $ |
58 |
wakaba |
1.1 |
|
59 |
|
|
@Require: |
60 |
|
|
@@Module: |
61 |
|
|
@@@QName: Markup|common |
62 |
|
|
@@Module: |
63 |
|
|
@@@QName: MDOM|TreeCore |
64 |
|
|
@@Module: |
65 |
|
|
@@@QName: Markup|Atom |
66 |
|
|
|
67 |
|
|
Namespace: |
68 |
|
|
@aa: |
69 |
|
|
http://pc5.2ch.net/test/read.cgi/hp/1096723178/aavocab# |
70 |
|
|
@c: |
71 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core# |
72 |
|
|
@cfg: |
73 |
|
|
http://suika.fam.cx/www/2006/dom-config/ |
74 |
|
|
@dis: |
75 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#dis-- |
76 |
|
|
@doc: |
77 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/7/tutorial# |
78 |
|
|
@d: |
79 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/dom/xdt# |
80 |
|
|
@DOMMain: |
81 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/dom/main# |
82 |
|
|
@dx: |
83 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException# |
84 |
|
|
@ecore: |
85 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/Core/ |
86 |
|
|
@f: |
87 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/dom/feature# |
88 |
|
|
@fe: |
89 |
|
|
http://suika.fam.cx/www/2006/feature/ |
90 |
|
|
@gls: |
91 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/dom/gls# |
92 |
|
|
@html: |
93 |
|
|
http://www.w3.org/1999/xhtml |
94 |
|
|
@idl: |
95 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/dis/IDL# |
96 |
|
|
@kwd: |
97 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/rfc2119/ |
98 |
|
|
@lang: |
99 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/18/lang# |
100 |
|
|
@license: |
101 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/18/license# |
102 |
|
|
@ManakaiDOM: |
103 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom# |
104 |
|
|
@mat: |
105 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/manakai/Markup/Atom/ |
106 |
|
|
@Markup: |
107 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/manakai/Markup# |
108 |
|
|
@mat: |
109 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/manakai/Markup/Atom/ |
110 |
|
|
@MDOM: |
111 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOM. |
112 |
|
|
@MDOMX: |
113 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception# |
114 |
|
|
@dlp: |
115 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/dis/Perl# |
116 |
|
|
@html3: |
117 |
|
|
urn:x-suika-fam-cx:markup:ietf:html:3:draft:00: |
118 |
|
|
@html5: |
119 |
|
|
http://www.w3.org/1999/xhtml |
120 |
|
|
@rel: |
121 |
|
|
http://www.iana.org/assignments/relation/ |
122 |
|
|
@s: |
123 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/dis/Markup# |
124 |
|
|
@sw09: |
125 |
|
|
urn:x-suika-fam-cx:markup:suikawiki:0:9: |
126 |
|
|
@sw010: |
127 |
|
|
urn:x-suika-fam-cx:markup:suikawiki:0:10: |
128 |
|
|
@tc: |
129 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/ |
130 |
|
|
@td: |
131 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/Document/ |
132 |
|
|
@te: |
133 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/Element/ |
134 |
|
|
@test: |
135 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/dis/Test# |
136 |
|
|
@tx: |
137 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/XML/ |
138 |
|
|
@urigen: |
139 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/manakai/URI/Generic/ |
140 |
|
|
@xhtml2: |
141 |
|
|
http://www.w3.org/2002/06/xhtml2/ |
142 |
|
|
@xml: |
143 |
|
|
http://www.w3.org/XML/1998/namespace |
144 |
|
|
@xmlns: |
145 |
|
|
http://www.w3.org/2000/xmlns/ |
146 |
|
|
|
147 |
|
|
ElementTypeBinding: |
148 |
|
|
@Name: CODE |
149 |
|
|
@ElementType: |
150 |
|
|
dis:ResourceDef |
151 |
|
|
@ShadowContent: |
152 |
|
|
@@DISCore:resourceType: dlp|BlockCode |
153 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
154 |
|
|
|
155 |
|
|
ElementTypeBinding: |
156 |
|
|
@Name: Method |
157 |
|
|
@ElementType: |
158 |
|
|
dis:ResourceDef |
159 |
|
|
@ShadowContent: |
160 |
|
|
@@DISCore:resourceType: DISLang|Method |
161 |
|
|
@@ForCheck: !=ManakaiDOM|ManakaiDOM |
162 |
|
|
|
163 |
|
|
ElementTypeBinding: |
164 |
|
|
@Name: Param |
165 |
|
|
@ElementType: |
166 |
|
|
dis:ResourceDef |
167 |
|
|
@ShadowContent: |
168 |
|
|
@@DISCore:resourceType: DISLang|MethodParameter |
169 |
|
|
|
170 |
|
|
ElementTypeBinding: |
171 |
|
|
@Name: Return |
172 |
|
|
@ElementType: |
173 |
|
|
dis:ResourceDef |
174 |
|
|
@ShadowContent: |
175 |
|
|
@@DISCore:resourceType: DISLang|MethodReturn |
176 |
|
|
|
177 |
|
|
ElementTypeBinding: |
178 |
|
|
@Name: Attr |
179 |
|
|
@ElementType: |
180 |
|
|
dis:ResourceDef |
181 |
|
|
@ShadowContent: |
182 |
|
|
@@DISCore:resourceType: DISLang|Attribute |
183 |
|
|
|
184 |
|
|
ElementTypeBinding: |
185 |
|
|
@Name: Get |
186 |
|
|
@ElementType: |
187 |
|
|
dis:ResourceDef |
188 |
|
|
@ShadowContent: |
189 |
|
|
@@DISCore:resourceType: DISLang|AttributeGet |
190 |
|
|
|
191 |
|
|
ElementTypeBinding: |
192 |
|
|
@Name: Set |
193 |
|
|
@ElementType: |
194 |
|
|
dis:ResourceDef |
195 |
|
|
@ShadowContent: |
196 |
|
|
@@DISCore:resourceType: DISLang|AttributeSet |
197 |
|
|
|
198 |
|
|
ElementTypeBinding: |
199 |
|
|
@Name: nullCase |
200 |
|
|
@ElementType: |
201 |
|
|
dis:ResourceDef |
202 |
|
|
@ShadowContent: |
203 |
|
|
@@DISCore:resourceType: ManakaiDOM|InCase |
204 |
|
|
@@Value: |
205 |
|
|
@@@is-null:1 |
206 |
|
|
|
207 |
|
|
ElementTypeBinding: |
208 |
|
|
@Name: PerlDef |
209 |
|
|
@ElementType: |
210 |
|
|
dis:Def |
211 |
|
|
@ShadowContent: |
212 |
|
|
@@ContentType: lang|Perl |
213 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
214 |
|
|
|
215 |
|
|
ElementTypeBinding: |
216 |
|
|
@Name: PerlCDef |
217 |
|
|
@ElementType: |
218 |
|
|
dis:Def |
219 |
|
|
@ShadowContent: |
220 |
|
|
@@ContentType: lang|Perl |
221 |
|
|
|
222 |
|
|
ElementTypeBinding: |
223 |
|
|
@Name: enImplNote |
224 |
|
|
@ElementType: |
225 |
|
|
dis:ImplNote |
226 |
|
|
@ShadowContent: |
227 |
|
|
@@lang:en |
228 |
|
|
|
229 |
|
|
ElementTypeBinding: |
230 |
|
|
@Name: enFN |
231 |
|
|
@ElementType: |
232 |
|
|
dis:FullName |
233 |
|
|
@ShadowContent: |
234 |
|
|
@@lang:en |
235 |
|
|
|
236 |
|
|
ElementTypeBinding: |
237 |
wakaba |
1.3 |
@Name: PTests |
238 |
|
|
@ElementType: |
239 |
|
|
dis:ResourceDef |
240 |
|
|
@ShadowContent: |
241 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
242 |
|
|
@@DISCore:resourceType: test|ParserTestSet |
243 |
|
|
|
244 |
|
|
ElementTypeBinding: |
245 |
|
|
@Name: PTest |
246 |
|
|
@ElementType: |
247 |
|
|
dis:ResourceDef |
248 |
|
|
@ShadowContent: |
249 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
250 |
|
|
@@DISCore:resourceType: test|ParserTest |
251 |
|
|
|
252 |
|
|
ElementTypeBinding: |
253 |
|
|
@Name: DEnt |
254 |
|
|
@ElementType: |
255 |
|
|
dis:ResourceDef |
256 |
|
|
@ShadowContent: |
257 |
|
|
@@DISCore:resourceType: test|RootEntity |
258 |
|
|
|
259 |
|
|
ElementTypeBinding: |
260 |
wakaba |
1.1 |
@Name: IFClsETDef |
261 |
|
|
@ElementType: |
262 |
|
|
dis:ResourceDef |
263 |
|
|
@ShadowContent: |
264 |
|
|
@@DISCore:resourceType: |
265 |
|
|
@@@@: dis|MultipleResource |
266 |
|
|
@@@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass !s|ForML |
267 |
|
|
@@resourceFor: ManakaiDOM|ForIF |
268 |
|
|
@@resourceFor: ManakaiDOM|ForClass |
269 |
|
|
@@resourceFor: s|ForML |
270 |
|
|
|
271 |
|
|
@@DISCore:resourceType: |
272 |
|
|
@@@@: DISLang|Interface |
273 |
|
|
@@@ForCheck: ManakaiDOM|ForIF |
274 |
|
|
|
275 |
|
|
@@DISCore:resourceType: |
276 |
|
|
@@@@: DISLang|Class |
277 |
|
|
@@@ForCheck: ManakaiDOM|ForClass |
278 |
wakaba |
1.6 |
|
279 |
wakaba |
1.1 |
@@Implement: |
280 |
wakaba |
1.7 |
@@@@: ||+||ManakaiDOM|ForIF |
281 |
wakaba |
1.1 |
@@@ContentType: DISCore|TFPQNames |
282 |
wakaba |
1.7 |
@@@ForCheck: ManakaiDOM|ForClass |
283 |
wakaba |
1.1 |
|
284 |
|
|
@@s:elementType: |
285 |
|
|
@@@@: ||+||s|ForML |
286 |
|
|
@@@ContentType: DISCore|TFPQNames |
287 |
|
|
@@@DISCore:stopISARecursive:1 |
288 |
|
|
|
289 |
|
|
@@DISCore:resourceType: |
290 |
|
|
@@@@: s|ElementType |
291 |
|
|
@@@ForCheck: s|ForML |
292 |
|
|
|
293 |
|
|
@@f:implements: AtomFeature10 |
294 |
|
|
|
295 |
|
|
ElementTypeBinding: |
296 |
|
|
@Name: IFClsDef |
297 |
|
|
@ElementType: |
298 |
|
|
dis:ResourceDef |
299 |
|
|
@ShadowContent: |
300 |
|
|
@@DISCore:resourceType: |
301 |
|
|
@@@@: dis|MultipleResource |
302 |
|
|
@@@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass !s|ForML |
303 |
|
|
@@resourceFor: ManakaiDOM|ForIF |
304 |
|
|
@@resourceFor: ManakaiDOM|ForClass |
305 |
|
|
|
306 |
|
|
@@DISCore:resourceType: |
307 |
|
|
@@@@: DISLang|Interface |
308 |
|
|
@@@ForCheck: ManakaiDOM|ForIF |
309 |
|
|
|
310 |
|
|
@@DISCore:resourceType: |
311 |
|
|
@@@@: DISLang|Class |
312 |
|
|
@@@ForCheck: ManakaiDOM|ForClass |
313 |
wakaba |
1.6 |
|
314 |
wakaba |
1.1 |
@@Implement: |
315 |
wakaba |
1.7 |
@@@@: ||+||ManakaiDOM|ForIF |
316 |
wakaba |
1.1 |
@@@ContentType: DISCore|TFPQNames |
317 |
wakaba |
1.7 |
@@@ForCheck: ManakaiDOM|ForClass |
318 |
wakaba |
1.1 |
|
319 |
|
|
@@f:implements: AtomFeature10 |
320 |
|
|
|
321 |
|
|
ElementTypeBinding: |
322 |
|
|
@Name: IFQName |
323 |
|
|
@ElementType: |
324 |
|
|
dis:QName |
325 |
|
|
@ShadowContent: |
326 |
|
|
@@ForCheck: ManakaiDOM|ForIF |
327 |
|
|
|
328 |
|
|
ElementTypeBinding: |
329 |
|
|
@Name: ClsQName |
330 |
|
|
@ElementType: |
331 |
|
|
dis:QName |
332 |
|
|
@ShadowContent: |
333 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
334 |
|
|
|
335 |
|
|
ElementTypeBinding: |
336 |
|
|
@Name: ETRQName |
337 |
|
|
@ElementType: |
338 |
|
|
dis:QName |
339 |
|
|
@ShadowContent: |
340 |
|
|
@@ForCheck: s|ForML |
341 |
|
|
|
342 |
|
|
ElementTypeBinding: |
343 |
|
|
@Name: ETQName |
344 |
|
|
@ElementType: |
345 |
|
|
dis:AppName |
346 |
|
|
@ShadowContent: |
347 |
|
|
@@ForCheck: s|ForML |
348 |
|
|
@@ContentType: DISCore|QName |
349 |
|
|
|
350 |
|
|
ElementTypeBinding: |
351 |
|
|
@Name: IFISA |
352 |
|
|
@ElementType: |
353 |
|
|
dis:ISA |
354 |
|
|
@ShadowContent: |
355 |
|
|
@@ForCheck: ManakaiDOM|ForIF |
356 |
|
|
|
357 |
|
|
ElementTypeBinding: |
358 |
|
|
@Name: ClsISA |
359 |
|
|
@ElementType: |
360 |
|
|
dis:ISA |
361 |
|
|
@ShadowContent: |
362 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
363 |
|
|
|
364 |
|
|
ElementTypeBinding: |
365 |
|
|
@Name: disDef |
366 |
|
|
@ElementType: |
367 |
|
|
dis:Def |
368 |
|
|
@ShadowContent: |
369 |
|
|
@@ContentType: |
370 |
|
|
lang:dis |
371 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
372 |
|
|
|
373 |
|
|
ElementTypeBinding: |
374 |
|
|
@Name: Code |
375 |
|
|
@ElementType: |
376 |
|
|
dis:ResourceDef |
377 |
|
|
@ShadowContent: |
378 |
|
|
@@DISCore:resourceType: dlp|InlineCode |
379 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
380 |
|
|
|
381 |
|
|
ElementTypeBinding: |
382 |
|
|
@Name: Test |
383 |
|
|
@ElementType: |
384 |
|
|
dis:ResourceDef |
385 |
|
|
@ShadowContent: |
386 |
|
|
@@DISCore:resourceType: test|StandaloneTest |
387 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
388 |
|
|
|
389 |
|
|
ElementTypeBinding: |
390 |
|
|
@Name: TestC |
391 |
|
|
@ElementType: |
392 |
|
|
dis:ResourceDef |
393 |
|
|
@ShadowContent: |
394 |
|
|
@@DISCore:resourceType: test|StandaloneTest |
395 |
|
|
|
396 |
|
|
ResourceDef: |
397 |
|
|
@QName: Document |
398 |
|
|
@AliasFor: td|Document |
399 |
|
|
|
400 |
|
|
ResourceDef: |
401 |
|
|
@QName: Element |
402 |
|
|
@AliasFor: te|Element |
403 |
|
|
|
404 |
|
|
ResourceDef: |
405 |
|
|
@QName: Attr |
406 |
|
|
@AliasFor: te|Attr |
407 |
|
|
|
408 |
|
|
ResourceDef: |
409 |
|
|
@QName: DOMString |
410 |
|
|
@AliasFor: DOMMain|DOMString |
411 |
|
|
|
412 |
|
|
ResourceDef: |
413 |
|
|
@QName: DOMURI |
414 |
|
|
@AliasFor: ManakaiDOM|ManakaiDOMURI |
415 |
|
|
|
416 |
|
|
ResourceDef: |
417 |
|
|
@QName: DOMTimeStamp |
418 |
|
|
@AliasFor: DOMMain|DOMTimeStamp |
419 |
|
|
|
420 |
|
|
ResourceDef: |
421 |
|
|
@QName: boolean |
422 |
wakaba |
1.8 |
@AliasFor: idl|boolean |
423 |
wakaba |
1.1 |
|
424 |
|
|
ResourceDef: |
425 |
|
|
@QName: Node |
426 |
|
|
@AliasFor: tc|Node |
427 |
|
|
|
428 |
|
|
ResourceDef: |
429 |
|
|
@QName: NodeList |
430 |
|
|
@AliasFor: tc|NodeList |
431 |
|
|
|
432 |
|
|
ResourceDef: |
433 |
|
|
@QName: StaticNodeList |
434 |
|
|
@AliasFor: tc|StaticNodeList |
435 |
|
|
|
436 |
|
|
ElementTypeBinding: |
437 |
|
|
@Name: enDesc |
438 |
|
|
@ElementType: |
439 |
|
|
dis:Description |
440 |
|
|
@ShadowContent: |
441 |
|
|
@@lang:en |
442 |
|
|
|
443 |
|
|
ElementTypeBinding: |
444 |
|
|
@Name: TrueCase |
445 |
|
|
@ElementType: |
446 |
|
|
dis:ResourceDef |
447 |
|
|
@ShadowContent: |
448 |
|
|
@@DISCore:resourceType: |
449 |
|
|
ManakaiDOM:InCase |
450 |
|
|
@@Value: |
451 |
|
|
@@@@: 1 |
452 |
|
|
@@@ContentType: DISCore|Boolean |
453 |
wakaba |
1.8 |
@@Type: idl|boolean |
454 |
wakaba |
1.1 |
|
455 |
|
|
ElementTypeBinding: |
456 |
|
|
@Name: FalseCase |
457 |
|
|
@ElementType: |
458 |
|
|
dis:ResourceDef |
459 |
|
|
@ShadowContent: |
460 |
|
|
@@DISCore:resourceType: |
461 |
|
|
ManakaiDOM:InCase |
462 |
|
|
@@Value: |
463 |
|
|
@@@@: 0 |
464 |
|
|
@@@ContentType: DISCore|Boolean |
465 |
wakaba |
1.8 |
@@Type: idl|boolean |
466 |
wakaba |
1.1 |
|
467 |
|
|
## -- Features |
468 |
|
|
|
469 |
|
|
ElementTypeBinding: |
470 |
|
|
@Name: FeatureDef |
471 |
|
|
@ElementType: |
472 |
|
|
dis:ResourceDef |
473 |
|
|
@ShadowContent: |
474 |
|
|
@@DISCore:resourceType: f|Feature |
475 |
|
|
|
476 |
|
|
ElementTypeBinding: |
477 |
|
|
@Name: FeatureVerDef |
478 |
|
|
@ElementType: |
479 |
|
|
dis:ResourceDef |
480 |
|
|
@ShadowContent: |
481 |
|
|
@@DISCore:resourceType: f|Feature |
482 |
|
|
|
483 |
|
|
ElementTypeBinding: |
484 |
|
|
@Name: featureQName |
485 |
|
|
@ElementType: |
486 |
|
|
f:name |
487 |
|
|
@ShadowContent: |
488 |
|
|
@@ContentType: DISCore|QName |
489 |
|
|
|
490 |
|
|
FeatureDef: |
491 |
|
|
@featureQName: fe|SuikaWikiDML |
492 |
|
|
@QName: SWDMLFeature |
493 |
|
|
@FeatureVerDef: |
494 |
|
|
@@QName: SWDMLFeature010 |
495 |
|
|
@@Version: 0.10 |
496 |
|
|
@@f:instanceOf: SWDMLFeature |
497 |
|
|
@@f:requires: tx|XMLFeature30 |
498 |
|
|
@@enDesc: |
499 |
|
|
The SuikaWiki Document Markup Language DOM, version 0.10. |
500 |
|
|
|
501 |
|
|
## -- Implementation |
502 |
|
|
|
503 |
|
|
## TODO: |
504 |
|
|
|
505 |
|
|
## -- Elements |
506 |
|
|
|
507 |
|
|
IFClsDef: |
508 |
|
|
@IFQName: SWDMLElement |
509 |
|
|
@ClsQName: ManakaiSWDMLElement |
510 |
|
|
|
511 |
|
|
@IFISA: Element |
512 |
|
|
@ClsISA: te|ManakaiDOMElement |
513 |
|
|
|
514 |
wakaba |
1.8 |
@s:elementType: AnySW09Element |
515 |
|
|
@s:elementType: AnySW010Element |
516 |
wakaba |
1.1 |
##SWDMLElement |
517 |
|
|
|
518 |
|
|
ResourceDef: |
519 |
|
|
@QName: AnySW09Element |
520 |
|
|
@DISCore:resourceType: s|AnyElementInNS |
521 |
|
|
@AppName: |
522 |
|
|
@@@: sw09|* |
523 |
|
|
@@ContentType: DISCore|QName |
524 |
|
|
@ForCheck: =ManakaiDOM|all |
525 |
|
|
|
526 |
|
|
ResourceDef: |
527 |
|
|
@QName: AnySW010Element |
528 |
|
|
@DISCore:resourceType: s|AnyElementInNS |
529 |
|
|
@AppName: |
530 |
|
|
@@@: sw010|* |
531 |
|
|
@@ContentType: DISCore|QName |
532 |
|
|
@ForCheck: =ManakaiDOM|all |
533 |
|
|
|
534 |
|
|
IFClsETDef: |
535 |
|
|
@IFQName: SWDMLDocumentElement |
536 |
|
|
@ETQName: sw09|document |
537 |
|
|
@ClsQName: ManakaiSWDMLDocumentElement |
538 |
|
|
|
539 |
|
|
@IFISA: SWDMLElement |
540 |
|
|
@ClsISA: ManakaiSWDMLElement |
541 |
|
|
|
542 |
|
|
@Attr: |
543 |
|
|
@@Name: headElement |
544 |
|
|
@@enDesc: |
545 |
|
|
The <XE::xhtml2|head> child element of the node. |
546 |
|
|
@@Type: SWDMLElement |
547 |
|
|
@@Get: |
548 |
|
|
@@@enDesc: |
549 |
|
|
It <kwd:MUST> <I::return a <XE::xhtml2|head> child element> |
550 |
|
|
of the node. |
551 |
|
|
@@@nullCase: |
552 |
|
|
@@@@enDesc: |
553 |
|
|
If the algorithm returns <DOM::null>. |
554 |
|
|
@@@NodeReadOnlyError: |
555 |
|
|
@@@PerlDef: |
556 |
|
|
__CODE{mat|returnChildElement:: |
557 |
|
|
$node => $self, |
558 |
|
|
$namespaceURI => {<Q::xhtml2|>}, |
559 |
|
|
$localName => 'head', |
560 |
|
|
$r => $r, |
561 |
|
|
}__; |
562 |
|
|
|
563 |
|
|
@Attr: |
564 |
|
|
@@Name: bodyElement |
565 |
|
|
@@enDesc: |
566 |
|
|
The <XE::xhtml2|body> child element of the node. |
567 |
|
|
@@Type: SWDMLElement |
568 |
|
|
@@Get: |
569 |
|
|
@@@enDesc: |
570 |
|
|
It <kwd:MUST> <I::return a <XE::xhtml2|body> child element> |
571 |
|
|
of the node. |
572 |
|
|
@@@nullCase: |
573 |
|
|
@@@@enDesc: |
574 |
|
|
If the algorithm returns <DOM::null>. |
575 |
|
|
@@@NodeReadOnlyError: |
576 |
|
|
@@@PerlDef: |
577 |
|
|
__CODE{mat|returnChildElement:: |
578 |
|
|
$node => $self, |
579 |
|
|
$namespaceURI => {<Q::xhtml2|>}, |
580 |
|
|
$localName => 'body', |
581 |
|
|
$r => $r, |
582 |
|
|
}__; |
583 |
|
|
|
584 |
|
|
@Attr: |
585 |
|
|
@@Name: markupLanguageName |
586 |
|
|
@@enDesc: |
587 |
|
|
The markup language name. |
588 |
|
|
|
589 |
|
|
It <kwd:MUST> <I::reflect the string value |
590 |
|
|
of the <XA::sw09|Name> attribute> of the node. It default |
591 |
|
|
value <kwd:MUST> be <CODE::SuikaWiki>. |
592 |
|
|
@@Type: DOMString |
593 |
|
|
@@Get: |
594 |
|
|
@@@nullCase: |
595 |
|
|
@@@@enDesc: |
596 |
|
|
If the algorithm returns <DOM::null>. |
597 |
|
|
@@@PerlDef: |
598 |
|
|
__CODE{mat|getReflectAttrStringValue:: |
599 |
|
|
$node => $self, |
600 |
|
|
$namespaceURI => {<Q::sw09|>}, |
601 |
|
|
$localName => 'Name', |
602 |
|
|
$r => $r, |
603 |
|
|
$defaultValue => 'SuikaWiki', |
604 |
|
|
}__; |
605 |
|
|
@@Set: |
606 |
|
|
@@@nullCase: |
607 |
|
|
@@@@enDesc: |
608 |
|
|
Removes the attribute. |
609 |
|
|
@@@NodeReadOnlyError: |
610 |
|
|
@@@PerlDef: |
611 |
|
|
__CODE{mat|setReflectAttrStringValue:: |
612 |
|
|
$node => $self, |
613 |
|
|
$namespaceURI => {<Q::sw09|>}, |
614 |
|
|
$localName => 'Name', |
615 |
|
|
$given => $given, |
616 |
|
|
}__; |
617 |
|
|
|
618 |
|
|
@Attr: |
619 |
|
|
@@Name: markupLanguageVersion |
620 |
|
|
@@enDesc: |
621 |
|
|
The markup language version. |
622 |
|
|
|
623 |
|
|
It <kwd:MUST> <I::reflect the string value |
624 |
|
|
of the <XA::sw09|Version> attribute> of the node. It default |
625 |
|
|
value <kwd:MUST> be <CODE::0.9>. |
626 |
|
|
@@Type: DOMString |
627 |
|
|
@@Get: |
628 |
|
|
@@@nullCase: |
629 |
|
|
@@@@enDesc: |
630 |
|
|
If the algorithm returns <DOM::null>. |
631 |
|
|
@@@PerlDef: |
632 |
|
|
__CODE{mat|getReflectAttrStringValue:: |
633 |
|
|
$node => $self, |
634 |
|
|
$namespaceURI => {<Q::sw09|>}, |
635 |
|
|
$localName => 'Version', |
636 |
|
|
$r => $r, |
637 |
|
|
$defaultValue => '0.9', |
638 |
|
|
}__; |
639 |
|
|
@@Set: |
640 |
|
|
@@@nullCase: |
641 |
|
|
@@@@enDesc: |
642 |
|
|
Removes the attribute. |
643 |
|
|
@@@NodeReadOnlyError: |
644 |
|
|
@@@PerlDef: |
645 |
|
|
__CODE{mat|setReflectAttrStringValue:: |
646 |
|
|
$node => $self, |
647 |
|
|
$namespaceURI => {<Q::sw09|>}, |
648 |
|
|
$localName => 'Version', |
649 |
|
|
$given => $given, |
650 |
|
|
}__; |
651 |
|
|
##SWDMLDocumentElement |
652 |
|
|
|
653 |
|
|
ElementTypeBinding: |
654 |
|
|
@Name: NodeReadOnlyError |
655 |
|
|
@ElementType: |
656 |
|
|
dx:raises |
657 |
|
|
@ShadowContent: |
658 |
|
|
@@@: MDOMX|NOMOD_THIS |
659 |
|
|
@@Description: |
660 |
|
|
@@@lang:en |
661 |
|
|
@@@@: |
662 |
|
|
If the node or a descendant of it, which |
663 |
|
|
is to be modified, is read-only. |
664 |
|
|
|
665 |
|
|
## -- Parser |
666 |
|
|
|
667 |
|
|
IFClsDef: |
668 |
|
|
@IFQName: SWDMLParser |
669 |
|
|
@ClsQName: ManakaiSWDMLParser |
670 |
|
|
|
671 |
wakaba |
1.8 |
@Implement: ecore|MUErrorTarget |
672 |
wakaba |
1.1 |
|
673 |
|
|
@DISLang:role: gls|ParserRole |
674 |
|
|
|
675 |
|
|
@f:implements: SWDMLFeature010 |
676 |
|
|
@f:provides: |
677 |
|
|
@@@: SWDMLFeature010 |
678 |
|
|
@@f:through: c|ManakaiDOMImplementation |
679 |
|
|
|
680 |
|
|
@enDesc: |
681 |
|
|
A <IF::SWDMLParser> object parses a SuikaWiki/0.9, |
682 |
|
|
SuikaWikiImage/0.9, or SuikaWiki/0.10 textual document and |
683 |
|
|
returns it as an object. |
684 |
|
|
|
685 |
|
|
@Attr: |
686 |
|
|
@@Name: domConfig |
687 |
|
|
@@enDesc: |
688 |
|
|
The configuration of the parser. |
689 |
|
|
|
690 |
|
|
@@Get: |
691 |
|
|
@@@Type: c|DOMConfiguration |
692 |
|
|
@@@enDesc: The DOM configuration object. |
693 |
|
|
@@@PerlDef: |
694 |
|
|
__CODE{c|getConfigObject:: |
695 |
|
|
$target => $self, |
696 |
|
|
$targetHash => $self, |
697 |
|
|
$targetType => {<IFName::SWDMLParser>}, |
698 |
|
|
$result => $r, |
699 |
|
|
}__; |
700 |
|
|
|
701 |
|
|
@Method: |
702 |
|
|
@@ManakaiDOM:isForInternal:1 |
703 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
704 |
|
|
@@Operator: DISPerl|NewMethod |
705 |
|
|
@@enDesc: |
706 |
|
|
Creates a new instance of the object. |
707 |
|
|
@@Param: |
708 |
|
|
@@@Name: impl |
709 |
|
|
@@@Type: gls|GLSImplementation |
710 |
|
|
@@@enDesc: |
711 |
|
|
The implementation from which the parser is created. |
712 |
|
|
@@Param: |
713 |
|
|
@@@Name: features |
714 |
|
|
@@@Type: DOMString |
715 |
|
|
@@@dis:actualType: f|FeaturesString |
716 |
|
|
@@@enDesc: |
717 |
|
|
The set of features requested for the parser. |
718 |
|
|
@@Return: |
719 |
|
|
@@@Type: DOMMain|DOMObject |
720 |
|
|
@@@enDesc: |
721 |
|
|
The newly created parser. |
722 |
|
|
@@@PerlDef: |
723 |
|
|
$r = bless { |
724 |
wakaba |
1.4 |
<H::f|implementation> => $impl->get_feature ('XML' => '3.0'), |
725 |
wakaba |
1.1 |
}, $self; |
726 |
|
|
|
727 |
|
|
@Method: |
728 |
|
|
@@Name: parseString |
729 |
|
|
@@enDesc: |
730 |
|
|
Parses a string as SWDML textual document and converts it into |
731 |
|
|
DOM tree. |
732 |
|
|
@@Param: |
733 |
|
|
@@@Name: sourceText |
734 |
|
|
@@@Type: DOMString |
735 |
|
|
@@@enDesc: |
736 |
|
|
The text to parse. |
737 |
|
|
@@Return: |
738 |
|
|
@@@Type: DISPerl|HASH |
739 |
|
|
@@@enDesc: |
740 |
|
|
An object representation of <P::sourceText>. |
741 |
|
|
@@@PerlDef: |
742 |
|
|
$self->{scanner} = $self->can ('_scan_Body'); |
743 |
|
|
$self->{char} = [0x000A]; |
744 |
|
|
$self->{token} = []; |
745 |
|
|
$self->{source} = $sourceText; |
746 |
wakaba |
1.2 |
pos ($self->{source}) = 0; |
747 |
wakaba |
1.1 |
$self->{location} = {}; |
748 |
|
|
$self->{doc} = $self->{<H::f|implementation>} |
749 |
|
|
->create_document (<Q::sw09|>, 'document'); |
750 |
|
|
$self->{doc}->strict_error_checking (false); |
751 |
|
|
$self->{docel} = $self->{doc}->document_element; |
752 |
|
|
$self->{docel}->set_attribute_ns (<Q::xmlns|>, 'xmlns', <Q::sw09|>); |
753 |
|
|
$self->{docel}->set_attribute_ns (<Q::xmlns|>, 'xmlns:h2', <Q::xhtml2|>); |
754 |
wakaba |
1.3 |
$self->{docel}->markup_language_name ('SuikaWiki'); |
755 |
wakaba |
1.1 |
$self->{docel}->markup_language_version ('0.10'); |
756 |
|
|
$self->{docel}->append_child |
757 |
|
|
($self->{doc}->create_element_ns |
758 |
|
|
(<Q::xhtml2|>, 'h2:head')); |
759 |
|
|
$self->{docel}->append_child |
760 |
|
|
($self->{doc}->create_element_ns |
761 |
|
|
(<Q::xhtml2|>, 'h2:body')); |
762 |
|
|
__DEEP{ |
763 |
|
|
$self->_parse_Document; |
764 |
|
|
}__; |
765 |
|
|
|
766 |
|
|
$r = $self->{doc}; |
767 |
|
|
|
768 |
|
|
@Method: |
769 |
|
|
@@Name: shiftChar |
770 |
|
|
@@ManakaiDOM:isForInternal:1 |
771 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
772 |
|
|
@@enDesc: |
773 |
|
|
Returns the next character. |
774 |
|
|
@@Return: |
775 |
wakaba |
1.8 |
@@@Type: idl|long |
776 |
wakaba |
1.1 |
@@@enDesc: |
777 |
|
|
The code position number of the next character, if any, |
778 |
|
|
or <CODE::-2>. |
779 |
|
|
@@@PerlDef: |
780 |
|
|
if (@{$self->{char}}) { |
781 |
|
|
$r = shift @{$self->{char}}; |
782 |
|
|
} else { |
783 |
|
|
my $char = substr ($self->{source}, pos ($self->{source}), 1); |
784 |
|
|
pos ($self->{source})++; |
785 |
|
|
|
786 |
|
|
if (length $char) { |
787 |
|
|
$r = ord $char; |
788 |
|
|
if ($r == 0x000D) { |
789 |
|
|
my $char2 = substr ($self->{source}, pos ($self->{source}), 1); |
790 |
|
|
if (length $char2) { |
791 |
|
|
if (ord $char2 == 0x000A) { |
792 |
|
|
pos ($self->{source})++; |
793 |
|
|
} |
794 |
|
|
push @{$self->{char}}, 0x000A; |
795 |
|
|
} |
796 |
|
|
} elsif ($r == 0x000A) { |
797 |
|
|
$r = 0x000D; |
798 |
|
|
push @{$self->{char}}, 0x000A; |
799 |
|
|
} |
800 |
|
|
} else { ## ISSUE: The last |RE| |
801 |
|
|
$r = -1; |
802 |
|
|
} |
803 |
|
|
} |
804 |
|
|
|
805 |
|
|
@Method: |
806 |
|
|
@@ManakaiDOM:isForInternal: 1 |
807 |
|
|
@@Operator: ManakaiDOM|MUErrorHandler |
808 |
|
|
@@enDesc: |
809 |
wakaba |
1.8 |
When a <IF::ecore|ErrorInterface> is <Perl::report>ed, |
810 |
wakaba |
1.1 |
then this method is invoked. |
811 |
|
|
|
812 |
|
|
The method calls the <cfg::DOMCore|error-handler> if the error is of |
813 |
|
|
<IF::DOMCore|DOMError>. Otherwise, the error is re-thrown so that |
814 |
|
|
corresponding <Perl::catch> clause, if any, can catch the error. |
815 |
|
|
@@Param: |
816 |
|
|
@@@Name: err |
817 |
wakaba |
1.8 |
@@@Type: ecore|ErrorInterface |
818 |
wakaba |
1.1 |
@@@enDesc: |
819 |
|
|
The reported error object. |
820 |
|
|
@@Return: |
821 |
|
|
@@@Type: DISPerl|Any |
822 |
|
|
@@@enDesc: |
823 |
|
|
If the <P::err> is a <IF::DOMCore|DOMError>, then the return value |
824 |
|
|
of the error handler. |
825 |
|
|
|
826 |
|
|
{NOTE:: If the error is thrown, the method never returns. |
827 |
|
|
} |
828 |
|
|
@@@nullCase: |
829 |
|
|
@@@@enDesc: |
830 |
|
|
No error handler. |
831 |
|
|
@@@PerlDef: |
832 |
wakaba |
1.6 |
if ($err->isa (<IFName::DOMCore|DOMError>)) { |
833 |
wakaba |
1.1 |
__DEEP{ |
834 |
|
|
A: { |
835 |
|
|
my $cfg = $self-><AG::SWDMLParser.domConfig>; |
836 |
|
|
my $h = $cfg-><M::DOMCore|DOMConfiguration.getParameter> |
837 |
|
|
('error-handler'); |
838 |
|
|
$r = $h-><M::DOMCore|DOMErrorHandler.handleError> ($err); |
839 |
|
|
} # A |
840 |
|
|
}__; |
841 |
|
|
} else { |
842 |
wakaba |
1.8 |
$err-><M::ecore|ErrorInterface.throw>; |
843 |
wakaba |
1.1 |
} |
844 |
|
|
|
845 |
|
|
@DISPerl:dpgDef: |
846 |
|
|
|
847 |
|
|
lexmode WSP { |
848 |
|
|
$wsp := [U+0009 U+0020]; |
849 |
|
|
|
850 |
|
|
/* |
851 |
|
|
U+000D and U+000A characters in source stream are |
852 |
|
|
replaced to record separators by |shiftChar|. |
853 |
|
|
*/ |
854 |
|
|
$rs := [U+000A]; |
855 |
|
|
$re := [U+000D]; |
856 |
|
|
$nonRSRE := [^U+000D U+000A]; |
857 |
|
|
} |
858 |
|
|
|
859 |
|
|
lexmode Body |
860 |
|
|
: extends => 'WSP' |
861 |
|
|
: initial |
862 |
|
|
: standalone |
863 |
|
|
{ |
864 |
|
|
$digit := [U+0030..U+0039]; |
865 |
|
|
$ltagchar := [U+0041..U+005A U+0061..U+007A U+0030..U+0039 '-' '_']; |
866 |
|
|
$classchar := [^'(' ')' U+005C U+000D U+000A]; |
867 |
|
|
|
868 |
|
|
magicVersionS : value |
869 |
|
|
:= $rs ['#'] ['?'] ['S'] ['u'] ['i'] ['k'] ['a'] |
870 |
|
|
['W'] ['i'] ['k'] ['i'] ['/'] ['0'] ['.'] ['9'] $wsp* |
871 |
|
|
-> MagicParameter; |
872 |
|
|
magicVersionI : value |
873 |
|
|
:= $rs ['#'] ['?'] ['S'] ['u'] ['i'] ['k'] ['a'] |
874 |
|
|
['W'] ['i'] ['k'] ['i'] ['I'] ['m'] ['a'] ['g'] ['e'] |
875 |
|
|
['/'] ['0'] ['.'] ['9'] $wsp* |
876 |
|
|
-> MagicParameter; |
877 |
|
|
otherRS : ignore := $rs; |
878 |
|
|
headingStart : value := $rs ['*']+ $wsp*; |
879 |
|
|
listStart : value := $rs ['-' '=']+ $wsp*; |
880 |
|
|
dlistStart : value := $rs [':'] [^':' U+000D U+000A]* [':'] $wsp*; |
881 |
|
|
quote : value := $rs ['>']+ $wsp*; |
882 |
|
|
eol := $re; |
883 |
|
|
anchorNumberDef : value := ['['] $digit+ [']']; |
884 |
|
|
anchorNumberRef : value := ['>'] ['>'] $digit+; |
885 |
|
|
externalRefStart := ['<'] -> ExternalRefBody; |
886 |
|
|
startTag : value := ['['] [U+0041..U+005A]+ ['[']; |
887 |
|
|
startTagClass : value := ['['] [U+0041..U+005A]+ |
888 |
|
|
['('] $classchar* [')'] ['[']; |
889 |
|
|
startTagClassLang : value := ['['] [U+0041..U+005A]+ |
890 |
|
|
['('] $classchar* [')'] |
891 |
|
|
['@'] $ltagchar* ['[']; |
892 |
|
|
startTagLang : value := ['['] [U+0041..U+005A]+ ['@'] $ltagchar* ['[']; |
893 |
|
|
termStartTag := ['['] ['[']; |
894 |
|
|
midTag : value := [']'] $wsp* ['[']; |
895 |
wakaba |
1.2 |
midTagLang : value := [']'] $wsp* ['@'] $ltagchar* ['[']; |
896 |
wakaba |
1.1 |
endTag := [']'] [']']; |
897 |
|
|
endTagAnchorNumberRef : value := [']'] ['>'] ['>'] $digit+ [']']; |
898 |
|
|
endTagExternalRefStart := [']'] ['<'] -> EndTagExternalRefBody; |
899 |
wakaba |
1.2 |
preStartTag : value := $rs ['['] ['P'] ['R'] ['E'] ['['] $wsp* $re; |
900 |
|
|
preStartTagClass : value := $rs ['['] ['P'] ['R'] ['E'] |
901 |
|
|
['('] $classchar* [')'] ['['] $wsp* $re; |
902 |
|
|
insStartTag : value := $rs ['['] ['I'] ['N'] ['S'] ['['] $wsp* $re; |
903 |
|
|
insStartTagClass : value := $rs ['['] ['I'] ['N'] ['S'] |
904 |
|
|
['('] $classchar* [')'] ['['] $wsp* $re; |
905 |
|
|
delStartTag : value := $rs ['['] ['D'] ['E'] ['L'] ['['] $wsp* $re; |
906 |
|
|
delStartTagClass : value := $rs ['['] ['D'] ['E'] ['L'] |
907 |
|
|
['('] $classchar* [')'] ['['] $wsp* $re; |
908 |
|
|
preEndTag : value := $rs [']'] ['P'] ['R'] ['E'] [']'] $wsp* $re; |
909 |
|
|
insEndTag : value := $rs [']'] ['I'] ['N'] ['S'] [']'] $wsp* $re; |
910 |
|
|
delEndTag : value := $rs [']'] ['D'] ['E'] ['L'] [']'] $wsp* $re; |
911 |
wakaba |
1.1 |
formStart : value := ['['] ['['] ['#'] [U+0061..U+007A '-']+ |
912 |
|
|
-> FormBody; |
913 |
|
|
emphasis2 := [U+0027] [U+0027]; |
914 |
|
|
emphasis3 := [U+0027] [U+0027] [U+0027]; |
915 |
|
|
entityRef : value := ['_'] ['_'] ['&'] ['&'] |
916 |
|
|
[^'&' U+000D U+000A]+ |
917 |
|
|
['&'] ['&'] ['_'] ['_']; |
918 |
|
|
obsPreStart : value := $rs $wsp; |
919 |
wakaba |
1.2 |
noteStart : value := $rs [';'] [';'] $wsp*; |
920 |
|
|
edStart : value := $rs ['@'] ['@'] $wsp*; |
921 |
wakaba |
1.1 |
tableLine : value := $rs [','] $nonRSRE* $re; |
922 |
|
|
imageStart : value := $rs ['_'] ['_'] ['I'] ['M'] ['A'] ['G'] ['E'] |
923 |
|
|
['_'] ['_'] $re; |
924 |
|
|
?default-token text : value; |
925 |
|
|
} |
926 |
|
|
|
927 |
|
|
lexmode MagicParameter |
928 |
|
|
: extends => 'WSP' |
929 |
|
|
: standalone |
930 |
|
|
{ |
931 |
|
|
name : value := [U+0041..U+005A U+0061..U+007A U+0030..U+0039 '-']+; |
932 |
|
|
vi := ['=']; |
933 |
|
|
lit := ['"'] -> MagicParameterValue; |
934 |
|
|
s : ignore := $wsp+; |
935 |
|
|
eol := $re -> Body; |
936 |
|
|
} |
937 |
|
|
|
938 |
|
|
lexmode MagicParameterValue |
939 |
|
|
: standalone |
940 |
wakaba |
1.2 |
: extends => WSP |
941 |
wakaba |
1.1 |
{ |
942 |
wakaba |
1.2 |
quotedPair : value := [U+005C] $nonRSRE; |
943 |
wakaba |
1.1 |
?default-token text : value; |
944 |
|
|
lit := ['"'] -> MagicParameter; |
945 |
|
|
} |
946 |
|
|
|
947 |
|
|
lexmode ExternalRefBody |
948 |
|
|
: standalone |
949 |
|
|
{ |
950 |
|
|
lit := ['"'] -> ExternalRefQuotedStringBody; |
951 |
|
|
externalRefEnd := ['>'] -> Body; |
952 |
|
|
?default-token text : value; |
953 |
|
|
} |
954 |
|
|
lexmode EndTagExternalRefBody |
955 |
|
|
: standalone |
956 |
|
|
{ |
957 |
|
|
lit := ['"'] -> EndTagExternalRefQuotedStringBody; |
958 |
|
|
endTagExternalRefEnd := ['>'] [']'] -> Body; |
959 |
|
|
?default-token text : value; |
960 |
|
|
} |
961 |
|
|
|
962 |
|
|
lexmode ExternalRefQuotedStringBody |
963 |
|
|
: standalone |
964 |
wakaba |
1.2 |
: extends => WSP |
965 |
wakaba |
1.1 |
{ |
966 |
|
|
lit := ['"'] -> ExternalRefBody; |
967 |
wakaba |
1.2 |
quotedPair : value := [U+005C] $nonRSRE; |
968 |
wakaba |
1.1 |
?default-token text : value; |
969 |
|
|
} |
970 |
|
|
lexmode EndTagExternalRefQuotedStringBody |
971 |
|
|
: standalone |
972 |
wakaba |
1.2 |
: extends => WSP |
973 |
wakaba |
1.1 |
{ |
974 |
|
|
lit := ['"'] -> EndTagExternalRefBody; |
975 |
wakaba |
1.2 |
quotedPair : value := [U+005C] $nonRSRE; |
976 |
wakaba |
1.1 |
?default-token text : value; |
977 |
|
|
} |
978 |
|
|
|
979 |
|
|
lexmode FormBody |
980 |
|
|
: standalone |
981 |
|
|
{ |
982 |
|
|
lita := [U+0027] -> FormQuotedStringBody; |
983 |
|
|
formEnd := [']'] [']'] -> Body; |
984 |
|
|
?default-token text : value; |
985 |
|
|
} |
986 |
|
|
|
987 |
|
|
lexmode FormQuotedStringBody |
988 |
|
|
: standalone |
989 |
wakaba |
1.2 |
: extends => WSP |
990 |
wakaba |
1.1 |
{ |
991 |
|
|
lita := [U+0027] -> FormBody; |
992 |
wakaba |
1.2 |
quotedPair : value := [U+005C] $nonRSRE; |
993 |
wakaba |
1.1 |
?default-token text : value; |
994 |
|
|
} |
995 |
|
|
|
996 |
|
|
|
997 |
|
|
rule Document |
998 |
|
|
: standalone |
999 |
|
|
{ |
1000 |
|
|
~? (magicVersionS) { |
1001 |
|
|
lang:Perl { |
1002 |
|
|
$self->{docel} |
1003 |
|
|
->set_attribute_ns (<Q::sw09|>, 'sw9:Name' => 'SuikaWiki'); |
1004 |
|
|
$self->{docel}->set_attribute_ns (<Q::sw09|>, 'sw9:Version' => '0.9'); |
1005 |
|
|
} |
1006 |
|
|
&MagicParam; |
1007 |
|
|
} (magicVersionI) { |
1008 |
|
|
lang:Perl { |
1009 |
|
|
$self->{docel} |
1010 |
|
|
->set_attribute_ns (<Q::sw09|>, 'sw9:Name' => 'SuikaWikiImage'); |
1011 |
|
|
$self->{docel}->set_attribute_ns (<Q::sw09|>, 'sw9:Version' => '0.9'); |
1012 |
|
|
} |
1013 |
|
|
&MagicParam; |
1014 |
|
|
} |
1015 |
|
|
|
1016 |
|
|
my $parent; |
1017 |
wakaba |
1.2 |
lang:Perl { |
1018 |
|
|
$parent->{block} = [$self->{doc}->document_element->body_element]; |
1019 |
|
|
$parent->{quote} = [$parent->{block}->[-1]]; |
1020 |
|
|
$parent->{section}->[1] = $parent->{block}->[-1]; |
1021 |
|
|
$parent->{edit} = []; |
1022 |
|
|
} |
1023 |
|
|
|
1024 |
|
|
&Body ($parent => $parent); |
1025 |
|
|
} // Document |
1026 |
|
|
|
1027 |
|
|
rule Body ($parent) |
1028 |
|
|
: standalone |
1029 |
|
|
{ |
1030 |
|
|
/* $parent |
1031 |
|
|
block i For block-level elements. |
1032 |
wakaba |
1.1 |
section i For i-th-level sections. Null if no (i-1)-th |
1033 |
|
|
level section. |
1034 |
|
|
list i For i-th-level list items. Null if no i-th-level |
1035 |
|
|
list. |
1036 |
wakaba |
1.2 |
text i For texts or inline-level elements |
1037 |
wakaba |
1.1 |
Null if no container for inlines. |
1038 |
wakaba |
1.2 |
quote i Contains i-th-level quotation's |bodytext| element. |
1039 |
|
|
edit i Contains |parent| state restored when i-th-level |
1040 |
|
|
editing element is closed. |
1041 |
|
|
tr For |tr| elements. |
1042 |
wakaba |
1.1 |
*/ |
1043 |
|
|
my $state; |
1044 |
|
|
/* |
1045 |
|
|
heading Next |eol| closes the heading. |
1046 |
wakaba |
1.2 |
pre In |pre| element. |
1047 |
wakaba |
1.1 |
section Otherwise. |
1048 |
|
|
*/ |
1049 |
|
|
lang:Perl { |
1050 |
|
|
$state = 'section'; |
1051 |
|
|
} |
1052 |
|
|
|
1053 |
|
|
~* (text) { |
1054 |
|
|
lang:Perl ($v => $token.value) { |
1055 |
wakaba |
1.2 |
CORE::delete $parent->{tr}; |
1056 |
|
|
__CODE{setTextParent}__; |
1057 |
|
|
$parent->{text}->[-1]->manakai_append_text ($v); |
1058 |
wakaba |
1.1 |
} |
1059 |
|
|
} (startTag) { |
1060 |
|
|
my $element_type; |
1061 |
|
|
my $class_names; |
1062 |
|
|
my $lang_tag; |
1063 |
|
|
lang:Perl ($v => $token.value) { |
1064 |
|
|
$v =~ /([A-Z]+)/; |
1065 |
|
|
$element_type = $1; |
1066 |
|
|
$class_names = ''; |
1067 |
|
|
} |
1068 |
|
|
|
1069 |
|
|
&_StartTag ($element_type => $element_type, $class_names => $class_names, |
1070 |
|
|
$lang_tag => $lang_tag, $parent => $parent); |
1071 |
|
|
} (startTagClass) { |
1072 |
|
|
my $element_type; |
1073 |
|
|
my $class_names; |
1074 |
|
|
my $lang_tag; |
1075 |
|
|
lang:Perl ($v => $token.value) { |
1076 |
|
|
$v =~ /([A-Z]+)\(([^()]+)/; |
1077 |
|
|
$element_type = $1; |
1078 |
|
|
$class_names = $2; |
1079 |
|
|
} |
1080 |
|
|
|
1081 |
|
|
&_StartTag ($element_type => $element_type, $class_names => $class_names, |
1082 |
|
|
$lang_tag => $lang_tag, $parent => $parent); |
1083 |
|
|
} (startTagClassLang) { |
1084 |
|
|
my $element_type; |
1085 |
|
|
my $class_names; |
1086 |
|
|
my $lang_tag; |
1087 |
|
|
lang:Perl ($v => $token.value) { |
1088 |
|
|
$v =~ /([A-Z]+)\(([^()]+)\@([^\[\]]*)/; |
1089 |
|
|
$element_type = $1; |
1090 |
|
|
$class_names = $2; |
1091 |
|
|
$lang_tag = $2; |
1092 |
|
|
} |
1093 |
|
|
|
1094 |
|
|
&_StartTag ($element_type => $element_type, $class_names => $class_names, |
1095 |
|
|
$lang_tag => $lang_tag, $parent => $parent); |
1096 |
|
|
} (startTagLang) { |
1097 |
|
|
my $element_type; |
1098 |
|
|
my $class_names; |
1099 |
|
|
my $lang_tag; |
1100 |
|
|
lang:Perl ($v => $token.value) { |
1101 |
|
|
$v =~ /([A-Z]+)\@([^\[\]]*)/; |
1102 |
|
|
$element_type = $1; |
1103 |
|
|
$class_names = ''; |
1104 |
|
|
$lang_tag = $2; |
1105 |
|
|
} |
1106 |
|
|
|
1107 |
|
|
&_StartTag ($element_type => $element_type, $class_names => $class_names, |
1108 |
|
|
$lang_tag => $lang_tag, $parent => $parent); |
1109 |
wakaba |
1.2 |
} (termStartTag) { |
1110 |
|
|
lang:Perl { |
1111 |
|
|
CORE::delete $parent->{tr}; |
1112 |
|
|
__CODE{setTextParent}__; |
1113 |
|
|
my $a_el = $self->{doc}->create_element_ns (<Q::sw09|>, 'anchor'); |
1114 |
|
|
$parent->{text}->[-1]->append_child ($a_el); |
1115 |
|
|
push @{$parent->{text}}, $a_el; |
1116 |
|
|
} |
1117 |
|
|
} (midTag) { |
1118 |
|
|
lang:Perl ($v => $token.value) { |
1119 |
|
|
CORE::delete $parent->{tr}; |
1120 |
|
|
if (defined $parent->{text}->[0]) { |
1121 |
|
|
my $xuri = $parent->{text}->[-1]->manakai_expanded_uri; |
1122 |
|
|
if ($xuri eq <Q::xhtml2|rb> or $xuri eq <Q::xhtml2|rt>) { |
1123 |
|
|
push @{$parent->{text}}, |
1124 |
|
|
$parent->{text}->[-1]->parent_node |
1125 |
|
|
->append_child |
1126 |
|
|
($self->{doc}->create_element_ns |
1127 |
|
|
(<Q::xhtml2|>, |
1128 |
|
|
'h2:rt')); |
1129 |
|
|
} elsif ($xuri eq <Q::sw010|qname>) { |
1130 |
|
|
push @{$parent->{text}}, |
1131 |
|
|
$parent->{text}->[-1]->parent_node |
1132 |
|
|
->append_child |
1133 |
|
|
($self->{doc}->create_element_ns |
1134 |
|
|
(<Q::sw010|>, |
1135 |
|
|
'nsuri')); |
1136 |
|
|
} else { |
1137 |
|
|
__CODE{setTextParent}__; |
1138 |
|
|
$parent->{text}->[-1]->manakai_append_text ($v); |
1139 |
|
|
} |
1140 |
|
|
} else { |
1141 |
|
|
__CODE{setTextParent}__; |
1142 |
|
|
$parent->{text}->[-1]->manakai_append_text ($v); |
1143 |
|
|
} |
1144 |
|
|
} |
1145 |
|
|
} (midTagLang) { |
1146 |
|
|
lang:Perl ($v => $token.value) { |
1147 |
|
|
CORE::delete $parent->{tr}; |
1148 |
|
|
if (defined $parent->{text}->[0]) { |
1149 |
|
|
my $xuri = $parent->{text}->[-1]->manakai_expanded_uri; |
1150 |
|
|
$v =~ /\@([A-Za-z0-9-]*)/; |
1151 |
|
|
my $lang = $1; |
1152 |
|
|
if ($xuri eq <Q::xhtml2|rb> or $xuri eq <Q::xhtml2|rt>) { |
1153 |
|
|
push @{$parent->{text}}, |
1154 |
|
|
$parent->{text}->[-1]->parent_node |
1155 |
|
|
->append_child |
1156 |
|
|
($self->{doc}->create_element_ns |
1157 |
|
|
(<Q::xhtml2|>, |
1158 |
|
|
'h2:rt')); |
1159 |
|
|
$parent->{text}->[-1] |
1160 |
|
|
->set_attribute_ns (<Q::xml|>, 'xml:lang', $lang); |
1161 |
|
|
} elsif ($xuri eq <Q::sw010|qname>) { |
1162 |
|
|
push @{$parent->{text}}, |
1163 |
|
|
$parent->{text}->[-1]->parent_node |
1164 |
|
|
->append_child |
1165 |
|
|
($self->{doc}->create_element_ns |
1166 |
|
|
(<Q::sw010|>, |
1167 |
|
|
'nsuri')); |
1168 |
|
|
$parent->{text}->[-1] |
1169 |
|
|
->set_attribute_ns (<Q::xml|>, 'xml:lang', $lang); |
1170 |
|
|
} else { |
1171 |
|
|
__CODE{setTextParent}__; |
1172 |
|
|
$parent->{text}->[-1]->manakai_append_text ($v); |
1173 |
|
|
} |
1174 |
|
|
} else { |
1175 |
|
|
__CODE{setTextParent}__; |
1176 |
|
|
$parent->{text}->[-1]->manakai_append_text ($v); |
1177 |
|
|
} |
1178 |
|
|
} |
1179 |
|
|
} (endTag) { |
1180 |
|
|
lang:Perl { |
1181 |
|
|
my $iref; |
1182 |
|
|
my $xref; |
1183 |
|
|
__CODE{endTag:: $tagString => ']]'}__; |
1184 |
|
|
} |
1185 |
|
|
} (endTagAnchorNumberRef) { |
1186 |
|
|
lang:Perl ($v => $token.value) { |
1187 |
|
|
$v =~ />>([0-9]+)/; |
1188 |
|
|
my $iref = $1; |
1189 |
|
|
my $xref; |
1190 |
|
|
__CODE{endTag:: $tagString => $v}__; |
1191 |
|
|
} |
1192 |
|
|
} (endTagExternalRefStart) { |
1193 |
|
|
my $xref; |
1194 |
|
|
lang:Perl { |
1195 |
|
|
$xref = ''; |
1196 |
|
|
} |
1197 |
|
|
~* (text) { |
1198 |
|
|
lang:Perl ($v => $token.value) { |
1199 |
|
|
$xref .= $v; |
1200 |
|
|
} |
1201 |
|
|
} (quotedPair) { |
1202 |
|
|
lang:Perl ($v => $token.value) { |
1203 |
|
|
$xref .= $v; |
1204 |
|
|
} |
1205 |
|
|
} (lit) { |
1206 |
|
|
lang:Perl { |
1207 |
|
|
$xref .= '"'; |
1208 |
|
|
} |
1209 |
|
|
} |
1210 |
|
|
~ (endTagExternalRefEnd) { } |
1211 |
|
|
lang:Perl { |
1212 |
|
|
my $iref; |
1213 |
|
|
__CODE{endTag:: $tagString => {']<'.$xref.'>]'}}__; |
1214 |
|
|
} |
1215 |
wakaba |
1.1 |
} (eol) { |
1216 |
|
|
~? (eol) { |
1217 |
|
|
lang:Perl { |
1218 |
wakaba |
1.2 |
CORE::delete $parent->{tr}; |
1219 |
|
|
if ($state eq 'pre') { |
1220 |
|
|
$parent->{text}->[-1]->manakai_append_text ("\x0A\x0A"); |
1221 |
|
|
} elsif ($state eq 'obspre') { |
1222 |
|
|
$#{$parent->{block}}--; |
1223 |
|
|
$parent->{text} = []; |
1224 |
|
|
$state = 'section'; |
1225 |
|
|
} else { |
1226 |
|
|
$parent->{block} = [$parent->{section}->[-1]]; |
1227 |
|
|
$parent->{quote} = [$parent->{block}->[-1]]; |
1228 |
|
|
$parent->{list} = []; |
1229 |
|
|
$parent->{text} = []; |
1230 |
|
|
$state = 'section'; |
1231 |
|
|
} |
1232 |
wakaba |
1.1 |
} |
1233 |
|
|
} else { |
1234 |
|
|
lang:Perl { |
1235 |
wakaba |
1.2 |
CORE::delete $parent->{tr}; |
1236 |
wakaba |
1.1 |
if ($state eq 'heading') { |
1237 |
wakaba |
1.2 |
$parent->{text} = []; |
1238 |
wakaba |
1.1 |
$state = 'section'; |
1239 |
wakaba |
1.2 |
} elsif ($state eq 'pre') { |
1240 |
|
|
$parent->{text}->[-1]->manakai_append_text ("\x0A"); |
1241 |
|
|
} elsif (defined $parent->{text}->[0]) { |
1242 |
|
|
$parent->{text}->[-1]->manakai_append_text ("\x0A"); |
1243 |
wakaba |
1.1 |
} |
1244 |
|
|
} |
1245 |
|
|
} |
1246 |
wakaba |
1.2 |
} (anchorNumberDef) { |
1247 |
|
|
lang:Perl ($v => $token.value) { |
1248 |
|
|
CORE::delete $parent->{tr}; |
1249 |
|
|
__CODE{setTextParent}__; |
1250 |
|
|
my $a_el = $self->{doc}->create_element_ns (<Q::sw09|>, 'anchor-end'); |
1251 |
|
|
$a_el->set_attribute_ns (<Q::sw09|>, 'sw9:anchor', |
1252 |
|
|
0+substr ($v, 1, length ($v) - 2)); |
1253 |
|
|
$a_el->text_content ($v); |
1254 |
|
|
$parent->{text}->[-1]->append_child ($a_el); |
1255 |
|
|
} |
1256 |
|
|
} (anchorNumberRef) { |
1257 |
|
|
lang:Perl ($v => $token.value) { |
1258 |
|
|
CORE::delete $parent->{tr}; |
1259 |
|
|
__CODE{setTextParent}__; |
1260 |
|
|
my $a_el = $self->{doc} |
1261 |
|
|
->create_element_ns (<Q::sw09|>, 'anchor-internal'); |
1262 |
|
|
$a_el->set_attribute_ns (<Q::sw09|>, 'sw9:anchor', |
1263 |
|
|
0+substr ($v, 2)); |
1264 |
|
|
$a_el->text_content ($v); |
1265 |
|
|
$parent->{text}->[-1]->append_child ($a_el); |
1266 |
|
|
} |
1267 |
|
|
} (externalRefStart) { |
1268 |
|
|
my $xref; |
1269 |
|
|
~ (text) { |
1270 |
|
|
lang:Perl ($v => $token.value) { |
1271 |
|
|
$xref .= $v; |
1272 |
|
|
} |
1273 |
|
|
} (quotedPair) { |
1274 |
|
|
lang:Perl ($v => $token.value) { |
1275 |
|
|
$xref .= $v; |
1276 |
|
|
} |
1277 |
|
|
} (lit) { |
1278 |
|
|
lang:Perl { |
1279 |
|
|
$xref .= '"'; |
1280 |
|
|
} |
1281 |
|
|
} |
1282 |
|
|
~ (externalRefEnd) { } |
1283 |
|
|
lang:Perl { |
1284 |
|
|
CORE::delete $parent->{tr}; |
1285 |
|
|
__CODE{setTextParent}__; |
1286 |
|
|
my $a_el = $self->{doc} |
1287 |
|
|
->create_element_ns (<Q::sw09|>, 'anchor-external'); |
1288 |
|
|
my $data = $xref; |
1289 |
|
|
my $scheme; |
1290 |
|
|
if ($data =~ s/^([A-Z]+)://) { |
1291 |
|
|
$scheme = $1; |
1292 |
|
|
} else { |
1293 |
|
|
$scheme = 'URI'; |
1294 |
|
|
} |
1295 |
|
|
$a_el->set_attribute_ns (<Q::sw09|>, 'sw9:resScheme', $scheme); |
1296 |
|
|
$a_el->set_attribute_ns (<Q::sw09|>, 'sw9:resParameter', $data); |
1297 |
|
|
$a_el->text_content ($xref); |
1298 |
|
|
$parent->{text}->[-1]->append_child ($a_el); |
1299 |
|
|
} |
1300 |
wakaba |
1.1 |
} (listStart) { |
1301 |
|
|
lang:Perl ($v => $token.value) { |
1302 |
wakaba |
1.2 |
CORE::delete $parent->{tr}; |
1303 |
|
|
if ($state eq 'pre' or $state eq 'obspre') { |
1304 |
|
|
$parent->{text}->[-1]->manakai_append_text (substr $v, 1); |
1305 |
|
|
} else { |
1306 |
|
|
$v =~ /([-=]+)/; |
1307 |
|
|
my $level = length ($1) - 1; |
1308 |
|
|
my $type = substr ($1, -1) eq '-' ? 'ul' : 'ol'; |
1309 |
|
|
if (defined $parent->{list}->[$level]) { |
1310 |
|
|
unless ($parent->{list}->[$level]->local_name eq $type) { |
1311 |
|
|
$parent->{list}->[$level] |
1312 |
|
|
= $parent->{list}->[$level]->parent_node |
1313 |
|
|
->append_child |
1314 |
|
|
($self->{doc}->create_element_ns |
1315 |
|
|
(<Q::xhtml2|>, 'h2:'.$type)); |
1316 |
|
|
} |
1317 |
|
|
} elsif (defined $parent->{list}->[0]) { |
1318 |
|
|
my $parent_list = $parent->{list}->[-1]; |
1319 |
|
|
my $parent_lc = $parent_list->last_child; |
1320 |
|
|
if (defined $parent_lc and |
1321 |
|
|
$parent_lc->node_type eq <C::Node.ELEMENT_NODE>) { |
1322 |
|
|
$parent->{list}->[$level] |
1323 |
|
|
= $parent_lc->append_child |
1324 |
|
|
($self->{doc}->create_element_ns |
1325 |
wakaba |
1.1 |
(<Q::xhtml2|>, 'h2:'.$type)); |
1326 |
wakaba |
1.2 |
} else { |
1327 |
|
|
$parent->{list}->[$level] |
1328 |
|
|
= $parent_list->append_child |
1329 |
|
|
($self->{doc}->create_element_ns |
1330 |
|
|
(<Q::xhtml2|>, 'h2:li')) |
1331 |
|
|
->append_child |
1332 |
|
|
($self->{doc}->create_element_ns |
1333 |
|
|
(<Q::xhtml2|>, 'h2:'.$type)); |
1334 |
|
|
} |
1335 |
wakaba |
1.1 |
} else { |
1336 |
|
|
$parent->{list}->[$level] |
1337 |
wakaba |
1.2 |
= $parent->{block}->[-1]->append_child |
1338 |
|
|
($self->{doc}->create_element_ns |
1339 |
wakaba |
1.1 |
(<Q::xhtml2|>, 'h2:'.$type)); |
1340 |
|
|
} |
1341 |
wakaba |
1.2 |
push @{$parent->{block}}, |
1342 |
|
|
$parent->{list}->[$level]->append_child |
1343 |
|
|
($self->{doc}->create_element_ns |
1344 |
|
|
(<Q::xhtml2|>, 'h2:li')); |
1345 |
|
|
$parent->{text} = [$parent->{block}->[-1]]; |
1346 |
|
|
$state = 'section'; |
1347 |
|
|
} |
1348 |
|
|
} |
1349 |
|
|
} (dlistStart) { |
1350 |
|
|
lang:Perl ($v => $token.value) { |
1351 |
|
|
CORE::delete $parent->{tr}; |
1352 |
|
|
if ($state eq 'pre' or $state eq 'obspre') { |
1353 |
|
|
$parent->{text}->[-1]->manakai_append_text (substr ($v, 1)); |
1354 |
|
|
} else { |
1355 |
|
|
$v =~ /:([^:]*)/; |
1356 |
|
|
my $dt_src = $1; |
1357 |
|
|
|
1358 |
|
|
my $dr_el = $self->{doc}->create_element_ns (<Q::sw09|>, 'dr'); |
1359 |
|
|
my $dt_el = $self->{doc}->create_element_ns (<Q::xhtml2|>, 'h2:dt'); |
1360 |
|
|
my $dd_el = $self->{doc}->create_element_ns (<Q::xhtml2|>, 'h2:dd'); |
1361 |
|
|
$dr_el->append_child ($dt_el); |
1362 |
|
|
$dr_el->append_child ($dd_el); |
1363 |
|
|
|
1364 |
|
|
if ($parent->{block}->[-1]->manakai_expanded_uri eq <Q::xhtml2|dd>) { |
1365 |
|
|
$parent->{block}->[-1]->parent_node->parent_node |
1366 |
|
|
->append_child ($dr_el); |
1367 |
|
|
} else { |
1368 |
|
|
my $dl_el = $self->{doc}->create_element_ns |
1369 |
|
|
(<Q::xhtml2|>, 'h2:dl'); |
1370 |
|
|
$dl_el->append_child ($dr_el); |
1371 |
|
|
$parent->{block}->[-1]->append_child ($dl_el); |
1372 |
|
|
} |
1373 |
|
|
push @{$parent->{block}}, $dd_el; |
1374 |
|
|
$parent->{text} = [$dd_el]; |
1375 |
|
|
$parent->{list} = []; |
1376 |
|
|
$parent->{edit} = []; |
1377 |
|
|
$state = 'section'; |
1378 |
|
|
|
1379 |
|
|
my $original_pos = pos $self->{source}; |
1380 |
|
|
{ |
1381 |
|
|
local $self->{token} = []; |
1382 |
|
|
local $self->{char} = []; |
1383 |
|
|
local $self->{source} = $dt_src; |
1384 |
|
|
pos ($self->{source}) = 0; |
1385 |
|
|
local $self->{location} = {}; |
1386 |
|
|
local $self->{scanner} = $self->can ('_scan_Body'); |
1387 |
|
|
$self->_parse_Body ({ |
1388 |
|
|
block => [$dt_el], |
1389 |
|
|
quote => [$dt_el], |
1390 |
|
|
section => [null, $dt_el], |
1391 |
|
|
text => [$dt_el], |
1392 |
|
|
}); |
1393 |
|
|
} |
1394 |
|
|
pos ($self->{source}) = $original_pos; |
1395 |
|
|
} |
1396 |
|
|
} |
1397 |
|
|
} (emphasis2) { |
1398 |
|
|
lang:Perl { |
1399 |
|
|
CORE::delete $parent->{tr}; |
1400 |
|
|
if (defined $parent->{text}->[1] and |
1401 |
|
|
$parent->{text}->[-1]->manakai_expanded_uri eq <Q::xhtml2|em>) { |
1402 |
|
|
$#{$parent->{text}}--; |
1403 |
|
|
} else { |
1404 |
|
|
__CODE{setTextParent}__; |
1405 |
|
|
my $em_el = $self->{doc}->create_element_ns (<Q::xhtml2|>, 'h2:em'); |
1406 |
|
|
$parent->{text}->[-1]->append_child ($em_el); |
1407 |
|
|
push @{$parent->{text}}, $em_el; |
1408 |
|
|
} |
1409 |
|
|
} |
1410 |
|
|
} (emphasis3) { |
1411 |
|
|
lang:Perl { |
1412 |
|
|
CORE::delete $parent->{tr}; |
1413 |
|
|
if (defined $parent->{text}->[1] and |
1414 |
|
|
$parent->{text}->[-1]->manakai_expanded_uri |
1415 |
|
|
eq <Q::xhtml2|strong>) { |
1416 |
|
|
$#{$parent->{text}}--; |
1417 |
wakaba |
1.1 |
} else { |
1418 |
wakaba |
1.2 |
__CODE{setTextParent}__; |
1419 |
|
|
my $em_el = $self->{doc}->create_element_ns |
1420 |
|
|
(<Q::xhtml2|>, 'h2:strong'); |
1421 |
|
|
$parent->{text}->[-1]->append_child ($em_el); |
1422 |
|
|
push @{$parent->{text}}, $em_el; |
1423 |
|
|
} |
1424 |
|
|
} |
1425 |
|
|
} (quote) { |
1426 |
|
|
lang:Perl ($v => $token.value) { |
1427 |
|
|
CORE::delete $parent->{tr}; |
1428 |
|
|
if ($state eq 'pre' or $state eq 'obspre') { |
1429 |
|
|
$parent->{text}->[-1]->manakai_append_text (substr ($v, 1)); |
1430 |
|
|
} else { |
1431 |
|
|
$v =~ /(>+)/; |
1432 |
|
|
my $level = length $1; |
1433 |
|
|
if (defined $parent->{quote}->[$level]) { |
1434 |
|
|
if (defined $parent->{quote}->[$level + 1]) { |
1435 |
|
|
$#{$parent->{quote}} = $level; |
1436 |
|
|
} |
1437 |
|
|
} else { |
1438 |
|
|
L: for my $i (1..$level) { |
1439 |
|
|
next L if defined $parent->{quote}->[$i]; |
1440 |
|
|
$parent->{quote}->[$i] |
1441 |
|
|
= $parent->{quote}->[$i - 1] |
1442 |
|
|
->append_child ($self->{doc}->create_element_ns |
1443 |
|
|
(<Q::xhtml2|>, 'h2:blockquote')) |
1444 |
|
|
->append_child |
1445 |
|
|
($self->{doc}->create_element_ns |
1446 |
|
|
(<Q::html3|>, 'h3:bodytext')); |
1447 |
|
|
} # L |
1448 |
|
|
} |
1449 |
|
|
push @{$parent->{block}}, $parent->{quote}->[$level]; |
1450 |
|
|
$parent->{text} = []; |
1451 |
|
|
$parent->{list} = []; |
1452 |
|
|
$state = 'section'; |
1453 |
wakaba |
1.1 |
} |
1454 |
|
|
} |
1455 |
|
|
} (headingStart) { |
1456 |
|
|
lang:Perl ($v => $token.value) { |
1457 |
wakaba |
1.2 |
CORE::delete $parent->{tr}; |
1458 |
|
|
if ($state eq 'pre' or $state eq 'obspre') { |
1459 |
|
|
$parent->{text}->[-1]->manakai_append_text (substr ($v, 1)); |
1460 |
|
|
} else { |
1461 |
|
|
$v =~ /(\*+)/; |
1462 |
|
|
my $level = length $1; |
1463 |
|
|
if (defined $parent->{section}->[$level]) { |
1464 |
|
|
if (defined $parent->{section}->[$level + 1]) { |
1465 |
|
|
$#{$parent->{section}} = $level; |
1466 |
|
|
} |
1467 |
|
|
} else { |
1468 |
|
|
L: for my $i (2..$level) { |
1469 |
|
|
next L if defined $parent->{section}->[$i]; |
1470 |
|
|
$parent->{section}->[$i] |
1471 |
|
|
= $self->{doc}->create_element_ns |
1472 |
|
|
(<Q::xhtml2|>, 'h2:section'); |
1473 |
|
|
$parent->{section}->[$i - 1] |
1474 |
|
|
->append_child ($parent->{section}->[$i]); |
1475 |
|
|
} # L |
1476 |
wakaba |
1.1 |
} |
1477 |
wakaba |
1.2 |
$parent->{section}->[$level + 1] |
1478 |
|
|
= $self->{doc}->create_element_ns (<Q::xhtml2|>, 'h2:section'); |
1479 |
|
|
$parent->{section}->[$level] |
1480 |
|
|
->append_child ($parent->{section}->[$level + 1]); |
1481 |
|
|
$parent->{block} = [$parent->{section}->[$level + 1]]; |
1482 |
|
|
$parent->{quote} = [$parent->{block}->[-1]]; |
1483 |
|
|
$parent->{text} = [$self->{doc}->create_element_ns |
1484 |
|
|
(<Q::xhtml2|>, 'h2:h')]; |
1485 |
|
|
$parent->{block}->[-1]->append_child ($parent->{text}->[-1]); |
1486 |
|
|
$parent->{list} = []; |
1487 |
|
|
$state = 'heading'; |
1488 |
|
|
} |
1489 |
|
|
} |
1490 |
|
|
} (noteStart) { |
1491 |
|
|
lang:Perl ($v => $token.value) { |
1492 |
|
|
CORE::delete $parent->{tr}; |
1493 |
|
|
if ($state eq 'pre' or $state eq 'obspre') { |
1494 |
|
|
$parent->{text}->[-1]->manakai_append_text |
1495 |
|
|
(substr ($v, 1, length ($v) - 2) . "\x0A"); |
1496 |
wakaba |
1.1 |
} else { |
1497 |
wakaba |
1.2 |
my $ed_el = $self->{doc}->create_element_ns |
1498 |
|
|
(<Q::sw010|>, 'sw10:comment-p'); |
1499 |
|
|
$parent->{block}->[-1]->append_child ($ed_el); |
1500 |
|
|
push @{$parent->{block}}, $ed_el; |
1501 |
|
|
$parent->{list} = []; |
1502 |
|
|
$parent->{quote} = [$ed_el]; |
1503 |
|
|
$parent->{text} = [$ed_el]; |
1504 |
|
|
$state = 'section'; |
1505 |
|
|
} |
1506 |
|
|
} |
1507 |
|
|
} (edStart) { |
1508 |
|
|
lang:Perl ($v => $token.value) { |
1509 |
|
|
CORE::delete $parent->{tr}; |
1510 |
|
|
if ($state eq 'pre' or $state eq 'obspre') { |
1511 |
|
|
$parent->{text}->[-1]->manakai_append_text |
1512 |
|
|
(substr ($v, 1, length ($v) - 2) . "\x0A"); |
1513 |
|
|
} else { |
1514 |
|
|
my $ed_el = $self->{doc}->create_element_ns (<Q::sw010|>, 'sw10:ed'); |
1515 |
|
|
$parent->{block}->[-1]->append_child ($ed_el); |
1516 |
|
|
push @{$parent->{block}}, $ed_el; |
1517 |
|
|
$parent->{list} = []; |
1518 |
|
|
$parent->{quote} = [$ed_el]; |
1519 |
|
|
$parent->{text} = [$ed_el]; |
1520 |
|
|
$state = 'section'; |
1521 |
|
|
} |
1522 |
|
|
} |
1523 |
|
|
} (preStartTag) { |
1524 |
|
|
lang:Perl ($v => $token.value) { |
1525 |
|
|
CORE::delete $parent->{tr}; |
1526 |
|
|
if ($state eq 'pre' or $state eq 'obspre') { |
1527 |
|
|
$parent->{text}->[-1]->manakai_append_text |
1528 |
|
|
(substr ($v, 1, length ($v) - 2) . "\x0A"); |
1529 |
|
|
} else { |
1530 |
|
|
my $pre_el = $self->{doc}->create_element_ns |
1531 |
|
|
(<Q::xhtml2|>, 'h2:pre'); |
1532 |
|
|
$pre_el->set_attribute_ns (<Q::xml|>, 'xml:space', 'preserve'); |
1533 |
|
|
$parent->{block}->[-1]->append_child ($pre_el); |
1534 |
|
|
push @{$parent->{block}}, $pre_el; |
1535 |
|
|
$parent->{text} = [$pre_el]; |
1536 |
|
|
$state = 'pre'; |
1537 |
|
|
} |
1538 |
|
|
} |
1539 |
|
|
} (preStartTagClass) { |
1540 |
|
|
lang:Perl ($v => $token.value) { |
1541 |
|
|
CORE::delete $parent->{tr}; |
1542 |
|
|
if ($state eq 'pre' or $state eq 'obspre') { |
1543 |
|
|
$parent->{text}->[-1]->manakai_append_text |
1544 |
|
|
(substr ($v, 1, length ($v) - 2) . "\x0A"); |
1545 |
|
|
} else { |
1546 |
|
|
my $pre_el = $self->{doc}->create_element_ns |
1547 |
|
|
(<Q::xhtml2|>, 'h2:pre'); |
1548 |
|
|
$pre_el->set_attribute_ns (<Q::xml|>, 'xml:space', 'preserve'); |
1549 |
|
|
$v =~ /\(([^()]*)/; |
1550 |
|
|
$pre_el->set_attribute_ns (null, class => $1); |
1551 |
|
|
$parent->{block}->[-1]->append_child ($pre_el); |
1552 |
|
|
push @{$parent->{block}}, $pre_el; |
1553 |
|
|
$parent->{text} = [$pre_el]; |
1554 |
|
|
$state = 'pre'; |
1555 |
|
|
} |
1556 |
|
|
} |
1557 |
|
|
} (obsPreStart) { |
1558 |
|
|
lang:Perl ($v => $token.value) { |
1559 |
|
|
CORE::delete $parent->{tr}; |
1560 |
|
|
unless ($state eq 'pre' or $state eq 'obspre') { |
1561 |
|
|
my $pre_el = $self->{doc}->create_element_ns |
1562 |
|
|
(<Q::xhtml2|>, 'h2:pre'); |
1563 |
|
|
$pre_el->set_attribute_ns (<Q::xml|>, 'xml:space', 'preserve'); |
1564 |
|
|
$parent->{block}->[-1]->append_child ($pre_el); |
1565 |
|
|
push @{$parent->{block}}, $pre_el; |
1566 |
|
|
$parent->{text} = [$pre_el]; |
1567 |
|
|
$state = 'obspre'; |
1568 |
|
|
} |
1569 |
|
|
$parent->{text}->[-1]->manakai_append_text (substr ($v, 1)); |
1570 |
|
|
} |
1571 |
|
|
} (preEndTag) { |
1572 |
|
|
lang:Perl ($v => $token.value) { |
1573 |
|
|
CORE::delete $parent->{tr}; |
1574 |
|
|
if ($state eq 'pre' or $state eq 'obspre') { |
1575 |
|
|
$#{$parent->{block}}--; |
1576 |
|
|
$parent->{text} = []; |
1577 |
|
|
$parent->{list} = []; |
1578 |
|
|
$parent->{quote} = [$parent->{block}->[-1]]; |
1579 |
|
|
$state = 'section'; |
1580 |
|
|
} else { |
1581 |
|
|
__CODE{setTextParent}__; |
1582 |
|
|
$parent->{text}->[-1]->manakai_append_text |
1583 |
|
|
(substr ($v, 1, length ($v) - 2) . "\x0A"); |
1584 |
|
|
} |
1585 |
|
|
} |
1586 |
|
|
} (insStartTag) { |
1587 |
|
|
lang:Perl ($v => $token.value) { |
1588 |
|
|
CORE::delete $parent->{tr}; |
1589 |
|
|
if ($state eq 'pre' or $state eq 'obspre') { |
1590 |
|
|
$parent->{text}->[-1]->manakai_append_text |
1591 |
|
|
(substr ($v, 1, length ($v) - 2) . "\x0A"); |
1592 |
|
|
} else { |
1593 |
|
|
my $ins_el = $self->{doc}->create_element_ns (<Q::sw09|>, 'insert'); |
1594 |
|
|
$parent->{block}->[-1]->append_child ($ins_el); |
1595 |
|
|
push @{$parent->{edit}}, { |
1596 |
|
|
section => $parent->{section}, |
1597 |
|
|
block => $parent->{block}, |
1598 |
|
|
text => $parent->{text}, |
1599 |
|
|
list => $parent->{list}, |
1600 |
|
|
quote => $parent->{quote}, |
1601 |
|
|
type => 'insert', |
1602 |
|
|
}; |
1603 |
|
|
$parent->{section} = [null, $ins_el]; |
1604 |
|
|
$parent->{block} = [$ins_el]; |
1605 |
|
|
$parent->{text} = []; |
1606 |
|
|
$parent->{list} = []; |
1607 |
|
|
$parent->{quote} = [$parent->{block}->[-1]]; |
1608 |
|
|
} |
1609 |
|
|
} |
1610 |
|
|
} (insStartTagClass) { |
1611 |
|
|
lang:Perl ($v => $token.value) { |
1612 |
|
|
CORE::delete $parent->{tr}; |
1613 |
|
|
if ($state eq 'pre' or $state eq 'obspre') { |
1614 |
|
|
$parent->{text}->[-1]->manakai_append_text |
1615 |
|
|
(substr ($v, 1, length ($v) - 2) . "\x0A"); |
1616 |
|
|
} else { |
1617 |
|
|
my $ins_el = $self->{doc}->create_element_ns (<Q::sw09|>, 'insert'); |
1618 |
|
|
$parent->{block}->[-1]->append_child ($ins_el); |
1619 |
|
|
$v =~ /\(([^()]*)/; |
1620 |
|
|
$ins_el->set_attribute_ns (null, class => $1); |
1621 |
|
|
push @{$parent->{edit}}, { |
1622 |
|
|
section => $parent->{section}, |
1623 |
|
|
block => $parent->{block}, |
1624 |
|
|
list => $parent->{list}, |
1625 |
|
|
quote => $parent->{quote}, |
1626 |
|
|
type => 'insert', |
1627 |
|
|
}; |
1628 |
|
|
$parent->{section} = [null, $ins_el]; |
1629 |
|
|
$parent->{block} = [$ins_el]; |
1630 |
|
|
$parent->{text} = []; |
1631 |
|
|
$parent->{list} = []; |
1632 |
|
|
$parent->{quote} = [$parent->{block}->[-1]]; |
1633 |
|
|
} |
1634 |
|
|
} |
1635 |
|
|
} (insEndTag) { |
1636 |
|
|
lang:Perl ($v => $token.value) { |
1637 |
|
|
CORE::delete $parent->{tr}; |
1638 |
|
|
if ($state eq 'pre' or $state eq 'obspre') { |
1639 |
|
|
$parent->{text}->[-1]->manakai_append_text |
1640 |
|
|
(substr ($v, 1, length ($v) - 2) . "\x0A"); |
1641 |
|
|
} else { |
1642 |
|
|
if (defined $parent->{edit}->[0] and |
1643 |
|
|
$parent->{edit}->[-1]->{type} eq 'insert') { |
1644 |
|
|
my $rp = pop @{$parent->{edit}}; |
1645 |
|
|
$parent->{$_} = $rp->{$_} |
1646 |
|
|
for qw/section block list quote/; |
1647 |
|
|
$parent->{text} = []; |
1648 |
|
|
} else { |
1649 |
|
|
$parent->{text}->[-1]->manakai_append_text |
1650 |
|
|
(substr ($v, 1, length ($v) - 2) . "\x0A"); |
1651 |
|
|
} |
1652 |
|
|
} |
1653 |
|
|
} |
1654 |
|
|
} (delStartTag) { |
1655 |
|
|
lang:Perl ($v => $token.value) { |
1656 |
|
|
CORE::delete $parent->{tr}; |
1657 |
|
|
if ($state eq 'pre' or $state eq 'obspre') { |
1658 |
|
|
$parent->{text}->[-1]->manakai_append_text |
1659 |
|
|
(substr ($v, 1, length ($v) - 2) . "\x0A"); |
1660 |
|
|
} else { |
1661 |
|
|
my $ins_el = $self->{doc}->create_element_ns (<Q::sw09|>, 'delete'); |
1662 |
|
|
$parent->{block}->[-1]->append_child ($ins_el); |
1663 |
|
|
push @{$parent->{edit}}, { |
1664 |
|
|
section => $parent->{section}, |
1665 |
|
|
block => $parent->{block}, |
1666 |
|
|
list => $parent->{list}, |
1667 |
|
|
quote => $parent->{quote}, |
1668 |
|
|
type => 'delete', |
1669 |
|
|
}; |
1670 |
|
|
$parent->{section} = [null, $ins_el]; |
1671 |
|
|
$parent->{block} = [$ins_el]; |
1672 |
|
|
$parent->{text} = []; |
1673 |
|
|
$parent->{list} = []; |
1674 |
|
|
$parent->{quote} = [$parent->{block}->[-1]]; |
1675 |
|
|
} |
1676 |
|
|
} |
1677 |
|
|
} (delStartTagClass) { |
1678 |
|
|
lang:Perl ($v => $token.value) { |
1679 |
|
|
CORE::delete $parent->{tr}; |
1680 |
|
|
if ($state eq 'pre' or $state eq 'obspre') { |
1681 |
|
|
$parent->{text}->[-1]->manakai_append_text |
1682 |
|
|
(substr ($v, 1, length ($v) - 2) . "\x0A"); |
1683 |
|
|
} else { |
1684 |
|
|
my $ins_el = $self->{doc}->create_element_ns (<Q::sw09|>, 'delete'); |
1685 |
|
|
$parent->{block}->[-1]->append_child ($ins_el); |
1686 |
|
|
$v =~ /\(([^()]*)/; |
1687 |
|
|
$ins_el->set_attribute_ns (null, class => $1); |
1688 |
|
|
push @{$parent->{edit}}, { |
1689 |
|
|
section => $parent->{section}, |
1690 |
|
|
block => $parent->{block}, |
1691 |
|
|
list => $parent->{list}, |
1692 |
|
|
quote => $parent->{quote}, |
1693 |
|
|
type => 'delete', |
1694 |
|
|
}; |
1695 |
|
|
$parent->{section} = [null, $ins_el]; |
1696 |
|
|
$parent->{block} = [$ins_el]; |
1697 |
|
|
$parent->{text} = []; |
1698 |
|
|
$parent->{list} = []; |
1699 |
|
|
$parent->{quote} = [$parent->{block}->[-1]]; |
1700 |
|
|
} |
1701 |
|
|
} |
1702 |
|
|
} (delEndTag) { |
1703 |
|
|
lang:Perl ($v => $token.value) { |
1704 |
|
|
CORE::delete $parent->{tr}; |
1705 |
|
|
if ($state eq 'pre' or $state eq 'obspre') { |
1706 |
|
|
$parent->{text}->[-1]->manakai_append_text |
1707 |
|
|
(substr ($v, 1, length ($v) - 2) . "\x0A"); |
1708 |
|
|
} else { |
1709 |
|
|
if (defined $parent->{edit}->[0] and |
1710 |
|
|
$parent->{edit}->[-1]->{type} eq 'delete') { |
1711 |
|
|
my $rp = pop @{$parent->{edit}}; |
1712 |
|
|
$parent->{$_} = $rp->{$_} |
1713 |
|
|
for qw/section block list quote/; |
1714 |
|
|
$parent->{text} = []; |
1715 |
|
|
} else { |
1716 |
|
|
$parent->{text}->[-1]->manakai_append_text |
1717 |
|
|
(substr ($v, 1, length ($v) - 2) . "\x0A"); |
1718 |
|
|
} |
1719 |
|
|
} |
1720 |
|
|
} |
1721 |
|
|
} (tableLine) { |
1722 |
|
|
lang:Perl ($v => $token.value) { |
1723 |
|
|
if ($state eq 'pre' or $state eq 'obspre') { |
1724 |
|
|
$parent->{text}->[-1]->manakai_append_text (substr ($v, 1)); |
1725 |
|
|
} else { |
1726 |
|
|
my $tbody_el; |
1727 |
|
|
if (defined $parent->{tr}) { |
1728 |
|
|
$tbody_el = $parent->{tr}; |
1729 |
|
|
} else { |
1730 |
|
|
my $tbl_el = $self->{doc}->create_element_ns |
1731 |
|
|
(<Q::xhtml2|>, 'h2:table'); |
1732 |
|
|
my $tbody_el = $self->{doc}->create_element_ns |
1733 |
|
|
(<Q::xhtml2|>, 'h2:tbody'); |
1734 |
|
|
$tbl_el->append_child ($tbody_el); |
1735 |
|
|
$parent->{block}->[-1]->append_child ($tbl_el); |
1736 |
|
|
$parent->{tr} = $tbody_el; |
1737 |
|
|
} |
1738 |
|
|
|
1739 |
|
|
my $tr_el = $self->{doc}->create_element_ns (<Q::xhtml2|>, 'h2:tr'); |
1740 |
|
|
$parent->{tr}->append_child ($tr_el); |
1741 |
|
|
my $src = substr ($v, 1, length ($v) - 2); |
1742 |
|
|
my $prev_cell; |
1743 |
|
|
C: while ($src =~ /\G,\s*/gc) { |
1744 |
|
|
$src =~ /\G([^,"][^,]*|"(?>[^"\\]*)(?>(?>[^"\\]+|\\.)*)"\s*)/gc; |
1745 |
|
|
my $cell = defined $1 ? $1 : ''; |
1746 |
|
|
if ($cell =~ s/^"//) { |
1747 |
|
|
$cell =~ s/"\s*$//g; |
1748 |
|
|
$cell =~ s/\\(.)/$1/gs; |
1749 |
|
|
} else { |
1750 |
|
|
$cell =~ s/\s+$//g; |
1751 |
|
|
if ($cell eq '==') { |
1752 |
|
|
if (ref $prev_cell) { |
1753 |
|
|
my $colspan = $prev_cell->get_attribute_ns (null, 'colspan'); |
1754 |
|
|
$colspan = defined $colspan ? $colspan + 1 : 1; |
1755 |
|
|
$prev_cell->set_attribute_ns (null, colspan => $colspan); |
1756 |
|
|
next C; |
1757 |
|
|
} |
1758 |
|
|
} |
1759 |
|
|
} |
1760 |
|
|
$prev_cell = $self->{doc}->create_element_ns |
1761 |
|
|
(<Q::xhtml2|>, 'h2:td'); |
1762 |
|
|
$tr_el->append_child ($prev_cell); |
1763 |
|
|
|
1764 |
|
|
my $original_pos = pos $self->{source}; |
1765 |
|
|
{ |
1766 |
|
|
local $self->{token} = []; |
1767 |
|
|
local $self->{char} = []; |
1768 |
|
|
local $self->{source} = $cell; |
1769 |
|
|
pos ($self->{source}) = 0; |
1770 |
|
|
local $self->{location} = {}; |
1771 |
|
|
local $self->{scanner} = $self->can ('_scan_Body'); |
1772 |
|
|
$self->_parse_Body ({ |
1773 |
|
|
block => [$prev_cell], |
1774 |
|
|
quote => [$prev_cell], |
1775 |
|
|
section => [null, $prev_cell], |
1776 |
|
|
text => [$prev_cell], |
1777 |
|
|
}); |
1778 |
|
|
} |
1779 |
|
|
pos ($self->{source}) = $original_pos; |
1780 |
|
|
} |
1781 |
|
|
$parent->{text} = []; |
1782 |
|
|
$state = 'section'; |
1783 |
|
|
} |
1784 |
|
|
} |
1785 |
|
|
} (formStart) { |
1786 |
|
|
my $form_el; |
1787 |
|
|
my $param; |
1788 |
|
|
my $ref; |
1789 |
|
|
lang:Perl ($v => $token.value) { |
1790 |
|
|
CORE::delete $parent->{tr}; |
1791 |
|
|
$form_el = $self->{doc}->create_element_ns (<Q::sw09|>, 'form'); |
1792 |
|
|
$v =~ /#([a-z-]+)/; |
1793 |
|
|
$form_el->set_attribute_ns (null, ref => $ref = $1); |
1794 |
|
|
$param = ''; |
1795 |
|
|
} |
1796 |
|
|
|
1797 |
|
|
~* (text) { |
1798 |
|
|
lang:Perl ($v => $token.value) { |
1799 |
|
|
$param .= $v; |
1800 |
|
|
} |
1801 |
|
|
} (quotedPair) { |
1802 |
|
|
lang:Perl ($v => $token.value) { |
1803 |
|
|
$param .= $v; |
1804 |
|
|
} |
1805 |
|
|
} (lita) { |
1806 |
|
|
lang:Perl ($v => $token.value) { |
1807 |
|
|
$param .= "'"; |
1808 |
|
|
} |
1809 |
|
|
} |
1810 |
|
|
|
1811 |
|
|
~ (formEnd) { } |
1812 |
|
|
|
1813 |
|
|
lang:Perl { |
1814 |
|
|
if ($param =~ s/^\(([^()]*)\)//) { |
1815 |
|
|
$form_el->set_attribute_ns (null, id => $1); |
1816 |
|
|
} |
1817 |
|
|
if ($ref eq 'form' and |
1818 |
|
|
$param =~ m{\A |
1819 |
|
|
: ' ((?>[^\\']*)(?>(?>[^\\']+|\\.)*)) ' ## input |
1820 |
|
|
(?> : ' ((?>[^\\']*)(?>(?>[^\\']+|\\.)*)) ' ## template |
1821 |
|
|
(?> : ' ((?>[^\\']*)(?>(?>[^\\']+|\\.)*)) ' )? )? ## option |
1822 |
|
|
\z}x) { |
1823 |
|
|
my ($in, $te, $op) = ($1, defined $2 ? $2 : '', |
1824 |
|
|
defined $3 ? $3 : ''); |
1825 |
|
|
s/\\(.)/$1/g for $in, $te, $op; |
1826 |
|
|
$form_el->set_attribute_ns (null, input => $1); |
1827 |
|
|
$form_el->set_attribute_ns (null, template => defined $2 ? $2 : ''); |
1828 |
|
|
$form_el->set_attribute_ns (null, option => defined $3 ? $3 : ''); |
1829 |
|
|
} else { |
1830 |
|
|
$param =~ s/^://; |
1831 |
|
|
$form_el->set_attribute_ns (null, parameter => $param); |
1832 |
|
|
} |
1833 |
|
|
|
1834 |
|
|
if (defined $parent->{text}->[0]) { |
1835 |
|
|
$parent->{text}->[-1]->append_child ($form_el); |
1836 |
|
|
} else { |
1837 |
|
|
$parent->{block}->[-1]->append_child ($form_el); |
1838 |
|
|
} |
1839 |
|
|
} |
1840 |
|
|
} (magicVersionS) { |
1841 |
|
|
lang:Perl ($v => $token.value) { |
1842 |
|
|
CORE::delete $parent->{tr}; |
1843 |
|
|
__CODE{setTextParent}__; |
1844 |
|
|
$parent->{text}->[-1]->manakai_append_text (substr ($v, 1)); |
1845 |
|
|
} |
1846 |
|
|
?lexmode Body; |
1847 |
|
|
} (magicVersionI) { |
1848 |
|
|
lang:Perl ($v => $token.value) { |
1849 |
|
|
CORE::delete $parent->{tr}; |
1850 |
|
|
__CODE{setTextParent}__; |
1851 |
|
|
$parent->{text}->[-1]->manakai_append_text ($v); |
1852 |
|
|
} |
1853 |
|
|
?lexmode Body; |
1854 |
|
|
} (entityRef) { |
1855 |
|
|
lang:Perl ($v => $token.value) { |
1856 |
|
|
CORE::delete $parent->{tr}; |
1857 |
|
|
my $ref_el = $self->{doc}->create_element_ns (<Q::sw09|>, 'replace'); |
1858 |
|
|
$ref_el->set_attribute_ns |
1859 |
|
|
(null, 'by', substr ($v, 4, length ($v) - 8)); |
1860 |
|
|
if (defined $parent->{text}->[0]) { |
1861 |
|
|
$parent->{text}->[-1]->append_child ($ref_el); |
1862 |
|
|
} else { |
1863 |
|
|
$parent->{block}->[-1]->append_child ($ref_el); |
1864 |
|
|
} |
1865 |
|
|
} |
1866 |
|
|
} (imageStart) { |
1867 |
|
|
lang:Perl { |
1868 |
|
|
my $img_el = $self->{doc}->create_element_ns (<Q::sw09|>, 'image'); |
1869 |
|
|
|
1870 |
|
|
my $value = ''; |
1871 |
|
|
while (my $token = shift @{$self->{token}}) { |
1872 |
|
|
$value .= $token->{value} if defined $token->{value}; |
1873 |
|
|
} |
1874 |
|
|
$value =~ tr/\x0D//d; |
1875 |
|
|
$img_el->manakai_append_text ($value); |
1876 |
|
|
$value = ''; |
1877 |
|
|
|
1878 |
|
|
while ((my $char = $self->_shift_char) >= 0) { |
1879 |
|
|
if ($char == 0x000D) { |
1880 |
|
|
$img_el->manakai_append_text ($value); |
1881 |
|
|
$value = ''; |
1882 |
|
|
} else { |
1883 |
|
|
$value .= ord $char; |
1884 |
|
|
} |
1885 |
|
|
} |
1886 |
|
|
$img_el->manakai_append_text ($value); |
1887 |
|
|
|
1888 |
|
|
$self->{doc}->document_element->append_child ($img_el); |
1889 |
|
|
} |
1890 |
|
|
} (name) { |
1891 |
|
|
lang:Perl ($v => $token.value) { |
1892 |
|
|
CORE::delete $parent->{tr}; |
1893 |
|
|
__CODE{setTextParent}__; |
1894 |
|
|
$parent->{text}->[-1]->manakai_append_text ($v); |
1895 |
|
|
} |
1896 |
|
|
} (vi) { |
1897 |
|
|
lang:Perl ($v => $token.value) { |
1898 |
|
|
CORE::delete $parent->{tr}; |
1899 |
|
|
__CODE{setTextParent}__; |
1900 |
|
|
$parent->{text}->[-1]->manakai_append_text ('='); |
1901 |
|
|
} |
1902 |
|
|
} (lit) { |
1903 |
|
|
lang:Perl ($v => $token.value) { |
1904 |
|
|
CORE::delete $parent->{tr}; |
1905 |
|
|
__CODE{setTextParent}__; |
1906 |
|
|
$parent->{text}->[-1]->manakai_append_text ($v); |
1907 |
wakaba |
1.1 |
} |
1908 |
|
|
} |
1909 |
wakaba |
1.2 |
} // Body |
1910 |
wakaba |
1.1 |
|
1911 |
|
|
rule MagicParam { |
1912 |
|
|
~* (name) { |
1913 |
|
|
my $param_el; |
1914 |
|
|
my $value; |
1915 |
|
|
lang:Perl ($v => $token.value) { |
1916 |
|
|
$param_el = $self->{doc}->create_element_ns |
1917 |
|
|
(<Q::sw09|>, 'parameter'); |
1918 |
|
|
$param_el->set_attribute_ns (null, 'name', $v); |
1919 |
|
|
$value = ''; |
1920 |
|
|
} |
1921 |
|
|
|
1922 |
|
|
~ (vi) { } |
1923 |
|
|
~ (lit) { } |
1924 |
|
|
~* (text) { |
1925 |
|
|
lang:Perl ($v => $token.value) { |
1926 |
|
|
$value .= $v; |
1927 |
|
|
} |
1928 |
|
|
} (quotedPair) { |
1929 |
|
|
lang:Perl ($v => $token.value) { |
1930 |
|
|
$value .= substr ($v, 1); |
1931 |
|
|
} |
1932 |
|
|
} |
1933 |
|
|
~ (lit) { } |
1934 |
|
|
|
1935 |
|
|
lang:Perl { |
1936 |
|
|
for (split /,/, $value) { |
1937 |
|
|
$param_el->append_child ($self->{doc}->create_element_ns |
1938 |
|
|
(<Q::sw09|>, 'value')) |
1939 |
|
|
->manakai_append_text ($_); |
1940 |
|
|
} |
1941 |
|
|
|
1942 |
|
|
$self->{docel}->head_element->append_child ($param_el); |
1943 |
|
|
} |
1944 |
|
|
} |
1945 |
|
|
|
1946 |
|
|
~ (eol) { } |
1947 |
|
|
} // MagicParam |
1948 |
|
|
|
1949 |
|
|
rule _StartTag ($parent, $element_type, $class_names, $lang_tag) { |
1950 |
|
|
lang:Perl { |
1951 |
wakaba |
1.2 |
__CODE{setTextParent}__; |
1952 |
wakaba |
1.1 |
my @class_names = split /\s+/, $class_names; |
1953 |
|
|
my $et = { |
1954 |
|
|
ABBR => [<Q::xhtml2|>, 'abbr'], |
1955 |
|
|
CODE => [<Q::xhtml2|>, 'code'], |
1956 |
|
|
DEL => [<Q::xhtml2|>, 'del'], |
1957 |
|
|
DFN => [<Q::xhtml2|>, 'dfn'], |
1958 |
|
|
INS => [<Q::xhtml2|>, 'ins'], |
1959 |
|
|
KBD => [<Q::xhtml2|>, 'kbd'], |
1960 |
|
|
Q => [<Q::xhtml2|>, 'q'], |
1961 |
|
|
RUBY => [<Q::xhtml2|>, 'ruby'], |
1962 |
|
|
RUBYB=> [<Q::sw09|>, 'rubyb'], |
1963 |
|
|
SAMP => [<Q::xhtml2|>, 'samp'], |
1964 |
|
|
SUB => [<Q::xhtml2|>, 'sub'], |
1965 |
|
|
SUP => [<Q::xhtml2|>, 'sup'], |
1966 |
|
|
VAR => [<Q::xhtml2|>, 'var'], |
1967 |
|
|
WEAK => [<Q::sw09|>, 'weak'], |
1968 |
|
|
AA => [<Q::aa|>, 'aa'], |
1969 |
|
|
CITE => [<Q::xhtml2|>, 'cite'], |
1970 |
|
|
CSECTION => [<Q::sw010|>, 'csection'], |
1971 |
|
|
KEY => [<Q::sw010|>, 'key'], |
1972 |
|
|
QN => [<Q::sw010|>, 'qn'], |
1973 |
|
|
SPAN => [<Q::xhtml2|>, 'span'], |
1974 |
|
|
SRC => [<Q::sw010|>, 'src'], |
1975 |
|
|
}->{$element_type}; |
1976 |
|
|
unless (defined $et) { |
1977 |
|
|
$et = [<Q::xhtml2|>, 'code']; |
1978 |
|
|
push @class_names, $element_type; |
1979 |
|
|
} |
1980 |
wakaba |
1.2 |
my $el = $self->{doc}->create_element_ns ($et->[0], $et->[1]); |
1981 |
|
|
$parent->{text}->[-1]->append_child ($el); |
1982 |
|
|
$el->set_attribute_ns (null, 'class' => join ' ', @class_names) |
1983 |
wakaba |
1.1 |
if @class_names; |
1984 |
wakaba |
1.2 |
$el->set_attribute_ns (<Q::xml|>, 'xml:lang', $lang_tag) |
1985 |
wakaba |
1.1 |
if defined $lang_tag; |
1986 |
wakaba |
1.2 |
|
1987 |
|
|
if ($element_type eq 'RUBY' or $element_type eq 'RUBYB' or |
1988 |
|
|
$element_type eq 'RUBYB') { |
1989 |
|
|
$el = $el->append_child ($self->{doc}->create_element_ns |
1990 |
|
|
(<Q::xhtml2|>, 'rb')); |
1991 |
|
|
} elsif ($element_type eq 'QN') { |
1992 |
|
|
$el = $el->append_child ($self->{doc}->create_element_ns |
1993 |
|
|
(<Q::sw010|>, 'qname')); |
1994 |
|
|
} |
1995 |
|
|
|
1996 |
|
|
push @{$parent->{text}}, $el; |
1997 |
wakaba |
1.1 |
} |
1998 |
|
|
} // _StartTag |
1999 |
|
|
|
2000 |
wakaba |
1.2 |
token-error default : default { |
2001 |
|
|
// |
2002 |
|
|
} |
2003 |
|
|
|
2004 |
|
|
@CODE: |
2005 |
|
|
@@QName: setTextParent |
2006 |
wakaba |
1.1 |
@@PerlDef: |
2007 |
wakaba |
1.2 |
unless (defined $parent->{text}->[0]) { |
2008 |
|
|
$parent->{text} = [$parent->{block}->[-1] |
2009 |
|
|
->append_child |
2010 |
|
|
($self->{doc}->create_element_ns |
2011 |
|
|
(<Q::xhtml2|>, 'h2:p'))]; |
2012 |
wakaba |
1.1 |
} |
2013 |
|
|
|
2014 |
wakaba |
1.2 |
@CODE: |
2015 |
|
|
@@QName: endTag |
2016 |
|
|
@@PerlDef: |
2017 |
|
|
if (defined $parent->{text}->[1]) { |
2018 |
|
|
if (defined $iref) { |
2019 |
|
|
$parent->{text}->[-1]->set_attribute_ns |
2020 |
|
|
(<Q::sw09|>, 'sw9:anchor', 0+$iref); |
2021 |
|
|
} |
2022 |
|
|
if (defined $xref) { |
2023 |
|
|
if ($xref =~ s/^([A-Z]+)://) { |
2024 |
|
|
$parent->{text}->[-1]->set_attribute_ns |
2025 |
|
|
(<Q::sw09|>, 'sw9:resScheme', $1); |
2026 |
|
|
$parent->{text}->[-1]->set_attribute_ns |
2027 |
|
|
(<Q::sw09|>, 'sw9:resParameter', $xref); |
2028 |
|
|
} else { |
2029 |
|
|
$parent->{text}->[-1]->set_attribute_ns |
2030 |
|
|
(<Q::sw09|>, 'sw9:resScheme', 'URI'); |
2031 |
|
|
$parent->{text}->[-1]->set_attribute_ns |
2032 |
|
|
(<Q::sw09|>, 'sw9:resParameter', $xref); |
2033 |
|
|
} |
2034 |
|
|
} |
2035 |
|
|
$#{$parent->{text}}--; |
2036 |
|
|
} else { |
2037 |
|
|
__CODE{setTextParent}__; |
2038 |
|
|
$parent->{text}->[-1]->manakai_append_text ($tagString); |
2039 |
|
|
} |
2040 |
wakaba |
1.3 |
|
2041 |
|
|
@PTests: |
2042 |
|
|
@@PTest: |
2043 |
|
|
@@@QName: p.empty.test |
2044 |
|
|
@@@DEnt: |
2045 |
|
|
@@@@test:value: |
2046 |
|
|
\ |
2047 |
|
|
@@@test:domTree: |
2048 |
|
|
document { |
2049 |
|
|
element { |
2050 |
|
|
namespace-uri: 'urn:x-suika-fam-cx:markup:suikawiki:0:9:'; |
2051 |
|
|
local-name: 'document'; |
2052 |
|
|
markup-language-name: 'SuikaWiki'; |
2053 |
|
|
markup-language-version: '0.10'; |
2054 |
|
|
element { |
2055 |
|
|
namespace-uri: 'http://www.w3.org/2002/06/xhtml2/'; |
2056 |
|
|
local-name: 'head'; |
2057 |
|
|
has-child-nodes: false; |
2058 |
|
|
} |
2059 |
|
|
element { |
2060 |
|
|
namespace-uri: 'http://www.w3.org/2002/06/xhtml2/'; |
2061 |
|
|
local-name: 'body'; |
2062 |
|
|
has-child-nodes: false; |
2063 |
|
|
} |
2064 |
|
|
} |
2065 |
|
|
} |
2066 |
|
|
@@PTest: |
2067 |
|
|
@@@QName: p.magic.sw09.test |
2068 |
|
|
@@@DEnt: |
2069 |
|
|
@@@@test:value: |
2070 |
|
|
#?SuikaWiki/0.9 |
2071 |
|
|
@@@test:domTree: |
2072 |
|
|
document { |
2073 |
|
|
element { |
2074 |
|
|
namespace-uri: 'urn:x-suika-fam-cx:markup:suikawiki:0:9:'; |
2075 |
|
|
local-name: 'document'; |
2076 |
|
|
markup-language-name: 'SuikaWiki'; |
2077 |
|
|
markup-language-version: '0.9'; |
2078 |
|
|
element { |
2079 |
|
|
namespace-uri: 'http://www.w3.org/2002/06/xhtml2/'; |
2080 |
|
|
local-name: 'head'; |
2081 |
|
|
has-child-nodes: false; |
2082 |
|
|
} |
2083 |
|
|
element { |
2084 |
|
|
namespace-uri: 'http://www.w3.org/2002/06/xhtml2/'; |
2085 |
|
|
local-name: 'body'; |
2086 |
|
|
has-child-nodes: false; |
2087 |
|
|
} |
2088 |
|
|
} |
2089 |
|
|
} |
2090 |
|
|
@@PTest: |
2091 |
|
|
@@@QName: p.magic.swimg09.test |
2092 |
|
|
@@@DEnt: |
2093 |
|
|
@@@@test:value: |
2094 |
|
|
#?SuikaWikiImage/0.9 |
2095 |
|
|
@@@test:domTree: |
2096 |
|
|
document { |
2097 |
|
|
element { |
2098 |
|
|
namespace-uri: 'urn:x-suika-fam-cx:markup:suikawiki:0:9:'; |
2099 |
|
|
local-name: 'document'; |
2100 |
|
|
markup-language-name: 'SuikaWikiImage'; |
2101 |
|
|
markup-language-version: '0.9'; |
2102 |
|
|
element { |
2103 |
|
|
namespace-uri: 'http://www.w3.org/2002/06/xhtml2/'; |
2104 |
|
|
local-name: 'head'; |
2105 |
|
|
has-child-nodes: false; |
2106 |
|
|
} |
2107 |
|
|
element { |
2108 |
|
|
namespace-uri: 'http://www.w3.org/2002/06/xhtml2/'; |
2109 |
|
|
local-name: 'body'; |
2110 |
|
|
has-child-nodes: false; |
2111 |
|
|
} |
2112 |
|
|
} |
2113 |
|
|
} |
2114 |
|
|
|
2115 |
|
|
@@PerlDef: |
2116 |
wakaba |
1.5 |
my $impl = $Message::DOM::ImplementationRegistry->get_dom_implementation ({ |
2117 |
wakaba |
1.3 |
'Core' => '3.0', |
2118 |
|
|
'XML' => '3.0', |
2119 |
|
|
}); |
2120 |
|
|
|
2121 |
|
|
for my $test_data (@$TestData) { |
2122 |
|
|
my $parser = <Class::ManakaiSWDMLParser>->new ($impl); |
2123 |
|
|
|
2124 |
|
|
$test->start_new_test ($test_data->{uri}); |
2125 |
|
|
my $doc_ent = $test_data->{entity}->{$test_data->{root_uri}}; |
2126 |
|
|
my $not_ok; |
2127 |
|
|
|
2128 |
|
|
## -- DOM Configuration Parameters |
2129 |
|
|
|
2130 |
|
|
my $pcfg = $parser->dom_config; |
2131 |
|
|
for (keys %{$test_data->{dom_config}}) { |
2132 |
|
|
$pcfg->set_parameter ($_ => $test_data->{dom_config}->{$_}); |
2133 |
|
|
} |
2134 |
|
|
|
2135 |
|
|
# $pcfg->set_parameter ('error-handler' => sub ($$) { |
2136 |
|
|
# my (undef, $err) = @_; |
2137 |
|
|
# my $err_type = $err->type; |
2138 |
|
|
# if ($test_data->{dom_error}->{$err_type}) { |
2139 |
|
|
# $test->assert_error_equals |
2140 |
|
|
# (actual_value => $err, |
2141 |
|
|
# expected_hash => shift @{$test_data->{dom_error} |
2142 |
|
|
# ->{$err_type}}); |
2143 |
|
|
# } else { # Uncatched error |
2144 |
|
|
# warn $err; |
2145 |
|
|
# unless ($err->severity == <C::c|DOMError.SEVERITY_WARNING>) { |
2146 |
|
|
# $test->failure_comment ('Unexpected error |'.$err->type.'|'); |
2147 |
|
|
# $not_ok = true; |
2148 |
|
|
# } |
2149 |
|
|
# } |
2150 |
|
|
# return true; # continue as far as possible |
2151 |
|
|
# }); |
2152 |
|
|
|
2153 |
|
|
## -- Test and Result |
2154 |
|
|
|
2155 |
|
|
my $doc; |
2156 |
|
|
try { |
2157 |
|
|
$doc = $parser->parse_string ($doc_ent->{<Q::test|value>}); |
2158 |
|
|
$test->assert_dom_tree_equals |
2159 |
|
|
(actual_value => $doc, |
2160 |
|
|
expected_hash => $test_data->{dom_tree}); |
2161 |
|
|
for (values %{$test_data->{dom_error}||{}}) { |
2162 |
|
|
if (@$_) { |
2163 |
|
|
$test->failure_comment |
2164 |
|
|
(@$_.' |DOMError|s of type |'. |
2165 |
|
|
$_->[0]->{type}->{value}.'| are not reported'); |
2166 |
|
|
$not_ok = true; |
2167 |
|
|
} |
2168 |
|
|
} |
2169 |
|
|
$not_ok ? $test->not_ok : $test->ok; |
2170 |
|
|
undef $doc; |
2171 |
|
|
} catch Message::Util::IF::DTException with { |
2172 |
|
|
require Message::DOM::SimpleLS; |
2173 |
|
|
my $ls = Message::DOM::SimpleLS::ManakaiDOMSimpleXMLSerializer->new; |
2174 |
|
|
print STDERR $ls->write_to_string ($doc); |
2175 |
|
|
} otherwise { |
2176 |
|
|
my $err = shift; |
2177 |
|
|
warn $err; |
2178 |
|
|
$test->not_ok; |
2179 |
|
|
}; |
2180 |
|
|
} |
2181 |
|
|
##SWDMLParser |
2182 |
wakaba |
1.1 |
|