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