Skip to content

Commit dc77903

Browse files
committed
Fix parsing PlantUML code blocks with lines starting with @
Also finish corresponding test case.
1 parent 7fc69aa commit dc77903

2 files changed

Lines changed: 71 additions & 76 deletions

File tree

flexmark-ext-plantuml/src/main/java/com/vladsch/flexmark/ext/plantuml/internal/PlantUmlCodeBlockParser.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ public BlockContinue tryContinue(ParserState state) {
5252
this.blockNode.setEndMarker(blockData.endMarker);
5353
this.blockData.finished = true;
5454
return BlockContinue.finished();
55-
} else {
56-
// this case should never happen since we made a look-ahead before
57-
this.blockNode.unlink();
58-
state.blockRemoved(this.blockNode);
59-
return BlockContinue.none();
6055
}
6156
}
6257

flexmark-ext-plantuml/src/test/resources/ext_plantuml_ast_spec.md

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -239,85 +239,85 @@ A paragraph following.
239239
.
240240
<h1>Timing diagram example</h1>
241241
<figure>
242-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" data-diagram-type="TIMING" style="background: #FFFFFF; max-width: 100%;" version="1.1" viewBox="0 0 496 229" width="496px" zoomAndPan="magnify">
242+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" data-diagram-type="TIMING" style="background: #FFFFFF; max-width: 100%;" version="1.1" viewBox="0 0 499 225" width="499px" zoomAndPan="magnify">
243243
<defs/>
244244
<g>
245-
<line style="stroke:#333333;stroke-width:0.5;" x1="10" x2="10" y1="10" y2="198.8281"/>
246-
<line style="stroke:#333333;stroke-width:0.5;" x1="479.3613" x2="479.3613" y1="10" y2="198.8281"/>
247-
<line style="stroke:#333333;stroke-width:0.5;stroke-dasharray:3,5;" x1="74.3613" x2="74.3613" y1="10" y2="198.8281"/>
248-
<line style="stroke:#333333;stroke-width:0.5;stroke-dasharray:3,5;" x1="124.3613" x2="124.3613" y1="10" y2="198.8281"/>
249-
<line style="stroke:#333333;stroke-width:0.5;stroke-dasharray:3,5;" x1="174.3613" x2="174.3613" y1="10" y2="198.8281"/>
250-
<line style="stroke:#333333;stroke-width:0.5;stroke-dasharray:3,5;" x1="224.3613" x2="224.3613" y1="10" y2="198.8281"/>
251-
<line style="stroke:#333333;stroke-width:0.5;stroke-dasharray:3,5;" x1="274.3613" x2="274.3613" y1="10" y2="198.8281"/>
252-
<line style="stroke:#333333;stroke-width:0.5;stroke-dasharray:3,5;" x1="324.3613" x2="324.3613" y1="10" y2="198.8281"/>
253-
<line style="stroke:#333333;stroke-width:0.5;stroke-dasharray:3,5;" x1="374.3613" x2="374.3613" y1="10" y2="198.8281"/>
254-
<line style="stroke:#333333;stroke-width:0.5;stroke-dasharray:3,5;" x1="424.3613" x2="424.3613" y1="10" y2="198.8281"/>
255-
<line style="stroke:#333333;stroke-width:0.5;stroke-dasharray:3,5;" x1="474.3613" x2="474.3613" y1="10" y2="198.8281"/>
256-
<line style="stroke:#333333;stroke-width:0.5;" x1="10" x2="479.3613" y1="10" y2="10"/>
257-
<text fill="#333333" font-family="sans-serif" font-size="14" font-weight="bold" lengthAdjust="spacing" textLength="92.5928" x="15" y="24.5332">DNS Resolver</text>
258-
<line style="stroke:#333333;stroke-width:0.5;" x1="10" x2="108.5928" y1="28.6094" y2="28.6094"/>
259-
<line style="stroke:#333333;stroke-width:0.5;" x1="108.5928" x2="118.5928" y1="28.6094" y2="10"/>
260-
<text fill="#333333" font-family="sans-serif" font-size="12" lengthAdjust="spacing" textLength="19.3477" x="15" y="59.5195">Idle</text>
261-
<text fill="#333333" font-family="sans-serif" font-size="12" lengthAdjust="spacing" textLength="59.3613" x="15" y="39.5195">Processing</text>
262-
<line style="stroke:#006400;stroke-width:2;" x1="74.3613" x2="274.3613" y1="53.6094" y2="53.6094"/>
263-
<line style="stroke:#006400;stroke-width:2;" x1="274.3613" x2="424.3613" y1="33.6094" y2="33.6094"/>
264-
<line style="stroke:#006400;stroke-width:2;" x1="424.3613" x2="474.3613" y1="53.6094" y2="53.6094"/>
265-
<line style="stroke:#006400;stroke-width:2;" x1="274.3613" x2="274.3613" y1="33.6094" y2="53.6094"/>
266-
<line style="stroke:#006400;stroke-width:2;" x1="424.3613" x2="424.3613" y1="33.6094" y2="53.6094"/>
267-
<line style="stroke:#333333;stroke-width:0.5;" x1="10" x2="479.3613" y1="65.6094" y2="65.6094"/>
268-
<text fill="#333333" font-family="sans-serif" font-size="14" font-weight="bold" lengthAdjust="spacing" textLength="89.4619" x="15" y="80.1426">Web Browser</text>
269-
<line style="stroke:#333333;stroke-width:0.5;" x1="10" x2="105.4619" y1="84.2188" y2="84.2188"/>
270-
<line style="stroke:#333333;stroke-width:0.5;" x1="105.4619" x2="115.4619" y1="84.2188" y2="65.6094"/>
271-
<text fill="#333333" font-family="sans-serif" font-size="12" lengthAdjust="spacing" textLength="19.3477" x="15" y="135.1289">Idle</text>
272-
<text fill="#333333" font-family="sans-serif" font-size="12" lengthAdjust="spacing" textLength="59.3613" x="15" y="115.1289">Processing</text>
273-
<text fill="#333333" font-family="sans-serif" font-size="12" lengthAdjust="spacing" textLength="40.0137" x="15" y="95.1289">Waiting</text>
274-
<line style="stroke:#006400;stroke-width:2;" x1="74.3613" x2="124.3613" y1="129.2188" y2="129.2188"/>
275-
<line style="stroke:#006400;stroke-width:2;" x1="124.3613" x2="224.3613" y1="109.2188" y2="109.2188"/>
276-
<line style="stroke:#006400;stroke-width:2;" x1="224.3613" x2="474.3613" y1="89.2188" y2="89.2188"/>
277-
<line style="stroke:#006400;stroke-width:2;" x1="124.3613" x2="124.3613" y1="109.2188" y2="129.2188"/>
278-
<line style="stroke:#006400;stroke-width:2;" x1="224.3613" x2="224.3613" y1="89.2188" y2="109.2188"/>
279-
<line style="stroke:#333333;stroke-width:0.5;" x1="10" x2="479.3613" y1="141.2188" y2="141.2188"/>
280-
<text fill="#333333" font-family="sans-serif" font-size="14" font-weight="bold" lengthAdjust="spacing" textLength="64.5723" x="15" y="155.752">Web User</text>
281-
<line style="stroke:#333333;stroke-width:0.5;" x1="10" x2="80.5723" y1="159.8281" y2="159.8281"/>
282-
<line style="stroke:#333333;stroke-width:0.5;" x1="80.5723" x2="90.5723" y1="159.8281" y2="141.2188"/>
283-
<polygon fill="#E2E2F0" points="86.3613,164.8281,112.3613,164.8281,124.3613,176.8281,112.3613,188.8281,86.3613,188.8281,74.3613,176.8281" style="stroke:#006400;stroke-width:1.5;"/>
284-
<polygon fill="#E2E2F0" points="136.3613,164.8281,474.3613,164.8281,474.3613,188.8281,136.3613,188.8281,124.3613,176.8281" style="stroke:#E2E2F0;stroke-width:1.5;"/>
285-
<path d="M474.3613,164.8281 L136.3613,164.8281 L124.3613,176.8281 L136.3613,188.8281 L474.3613,188.8281" fill="#E2E2F0" style="stroke:#006400;stroke-width:1.5;"/>
286-
<text fill="#333333" font-family="sans-serif" font-size="12" font-weight="bold" lengthAdjust="spacing" textLength="20.6719" x="89.0254" y="181.7383">Idle</text>
287-
<text fill="#333333" font-family="sans-serif" font-size="12" font-weight="bold" lengthAdjust="spacing" textLength="43.3242" x="136.3613" y="181.7383">Waiting</text>
288-
<line style="stroke:#333333;stroke-width:2;" x1="74.3613" x2="74.3613" y1="198.8281" y2="203.8281"/>
289-
<line style="stroke:#333333;stroke-width:2;" x1="124.3613" x2="124.3613" y1="198.8281" y2="203.8281"/>
290-
<line style="stroke:#333333;stroke-width:2;" x1="174.3613" x2="174.3613" y1="198.8281" y2="203.8281"/>
291-
<line style="stroke:#333333;stroke-width:2;" x1="224.3613" x2="224.3613" y1="198.8281" y2="203.8281"/>
292-
<line style="stroke:#333333;stroke-width:2;" x1="274.3613" x2="274.3613" y1="198.8281" y2="203.8281"/>
293-
<line style="stroke:#333333;stroke-width:2;" x1="324.3613" x2="324.3613" y1="198.8281" y2="203.8281"/>
294-
<line style="stroke:#333333;stroke-width:2;" x1="374.3613" x2="374.3613" y1="198.8281" y2="203.8281"/>
295-
<line style="stroke:#333333;stroke-width:2;" x1="424.3613" x2="424.3613" y1="198.8281" y2="203.8281"/>
296-
<line style="stroke:#333333;stroke-width:2;" x1="474.3613" x2="474.3613" y1="198.8281" y2="203.8281"/>
297-
<line style="stroke:#333333;stroke-width:2;" x1="74.3613" x2="474.3613" y1="198.8281" y2="198.8281"/>
298-
<text fill="#333333" font-family="sans-serif" font-size="11" lengthAdjust="spacing" textLength="6.1177" x="71.3025" y="216.2471">0</text>
299-
<text fill="#333333" font-family="sans-serif" font-size="11" lengthAdjust="spacing" textLength="18.353" x="115.1848" y="216.2471">100</text>
300-
<text fill="#333333" font-family="sans-serif" font-size="11" lengthAdjust="spacing" textLength="18.353" x="215.1848" y="216.2471">300</text>
301-
<text fill="#333333" font-family="sans-serif" font-size="11" lengthAdjust="spacing" textLength="18.353" x="265.1848" y="216.2471">400</text>
302-
<text fill="#333333" font-family="sans-serif" font-size="11" lengthAdjust="spacing" textLength="18.353" x="415.1848" y="216.2471">700</text>
303-
<line style="stroke:#00008B;stroke-width:1.5;" x1="124.3613" x2="124.3613" y1="176.8281" y2="129.2188"/>
304-
<polygon fill="#00008B" points="127.0975,136.7363,121.6252,136.7363,124.3613,129.2188" style="stroke:#00008B;stroke-width:1.5;"/>
305-
<text fill="#00008B" font-family="Serif" font-size="14" lengthAdjust="spacing" textLength="28" x="124.3613" y="151.4062">URL</text>
306-
<line style="stroke:#00008B;stroke-width:1.5;" x1="224.3613" x2="249.3613" y1="89.2188" y2="53.6094"/>
307-
<polygon fill="#00008B" points="247.2812,61.3342,242.8024,58.1898,249.3613,53.6094" style="stroke:#00008B;stroke-width:1.5;"/>
308-
<text fill="#00008B" font-family="Serif" font-size="14" lengthAdjust="spacing" textLength="76.6035" x="245.0418" y="74.4319">Resolve URL</text>
245+
<line style="stroke:#333333;stroke-width:0.5;" x1="10" x2="10" y1="10" y2="195.4648"/>
246+
<line style="stroke:#333333;stroke-width:0.5;" x1="482.3789" x2="482.3789" y1="10" y2="195.4648"/>
247+
<line style="stroke:#333333;stroke-width:0.5;stroke-dasharray:3,5;" x1="77.3789" x2="77.3789" y1="10" y2="195.4648"/>
248+
<line style="stroke:#333333;stroke-width:0.5;stroke-dasharray:3,5;" x1="127.3789" x2="127.3789" y1="10" y2="195.4648"/>
249+
<line style="stroke:#333333;stroke-width:0.5;stroke-dasharray:3,5;" x1="177.3789" x2="177.3789" y1="10" y2="195.4648"/>
250+
<line style="stroke:#333333;stroke-width:0.5;stroke-dasharray:3,5;" x1="227.3789" x2="227.3789" y1="10" y2="195.4648"/>
251+
<line style="stroke:#333333;stroke-width:0.5;stroke-dasharray:3,5;" x1="277.3789" x2="277.3789" y1="10" y2="195.4648"/>
252+
<line style="stroke:#333333;stroke-width:0.5;stroke-dasharray:3,5;" x1="327.3789" x2="327.3789" y1="10" y2="195.4648"/>
253+
<line style="stroke:#333333;stroke-width:0.5;stroke-dasharray:3,5;" x1="377.3789" x2="377.3789" y1="10" y2="195.4648"/>
254+
<line style="stroke:#333333;stroke-width:0.5;stroke-dasharray:3,5;" x1="427.3789" x2="427.3789" y1="10" y2="195.4648"/>
255+
<line style="stroke:#333333;stroke-width:0.5;stroke-dasharray:3,5;" x1="477.3789" x2="477.3789" y1="10" y2="195.4648"/>
256+
<line style="stroke:#333333;stroke-width:0.5;" x1="10" x2="482.3789" y1="10" y2="10"/>
257+
<text fill="#333333" font-family="sans-serif" font-size="14" font-weight="bold" lengthAdjust="spacing" textLength="96.6191" x="15" y="23.5352">DNS Resolver</text>
258+
<line style="stroke:#333333;stroke-width:0.5;" x1="10" x2="112.6191" y1="27.4883" y2="27.4883"/>
259+
<line style="stroke:#333333;stroke-width:0.5;" x1="112.6191" x2="122.6191" y1="27.4883" y2="10"/>
260+
<text fill="#333333" font-family="sans-serif" font-size="12" lengthAdjust="spacing" textLength="21.1641" x="15" y="58.0234">Idle</text>
261+
<text fill="#333333" font-family="sans-serif" font-size="12" lengthAdjust="spacing" textLength="62.3789" x="15" y="38.0234">Processing</text>
262+
<line style="stroke:#006400;stroke-width:2;" x1="77.3789" x2="277.3789" y1="52.4883" y2="52.4883"/>
263+
<line style="stroke:#006400;stroke-width:2;" x1="277.3789" x2="427.3789" y1="32.4883" y2="32.4883"/>
264+
<line style="stroke:#006400;stroke-width:2;" x1="427.3789" x2="477.3789" y1="52.4883" y2="52.4883"/>
265+
<line style="stroke:#006400;stroke-width:2;" x1="277.3789" x2="277.3789" y1="32.4883" y2="52.4883"/>
266+
<line style="stroke:#006400;stroke-width:2;" x1="427.3789" x2="427.3789" y1="32.4883" y2="52.4883"/>
267+
<line style="stroke:#333333;stroke-width:0.5;" x1="10" x2="482.3789" y1="64.4883" y2="64.4883"/>
268+
<text fill="#333333" font-family="sans-serif" font-size="14" font-weight="bold" lengthAdjust="spacing" textLength="93.4336" x="15" y="78.0234">Web Browser</text>
269+
<line style="stroke:#333333;stroke-width:0.5;" x1="10" x2="109.4336" y1="81.9766" y2="81.9766"/>
270+
<line style="stroke:#333333;stroke-width:0.5;" x1="109.4336" x2="119.4336" y1="81.9766" y2="64.4883"/>
271+
<text fill="#333333" font-family="sans-serif" font-size="12" lengthAdjust="spacing" textLength="21.1641" x="15" y="132.5117">Idle</text>
272+
<text fill="#333333" font-family="sans-serif" font-size="12" lengthAdjust="spacing" textLength="62.3789" x="15" y="112.5117">Processing</text>
273+
<text fill="#333333" font-family="sans-serif" font-size="12" lengthAdjust="spacing" textLength="43.248" x="15" y="92.5117">Waiting</text>
274+
<line style="stroke:#006400;stroke-width:2;" x1="77.3789" x2="127.3789" y1="126.9766" y2="126.9766"/>
275+
<line style="stroke:#006400;stroke-width:2;" x1="127.3789" x2="227.3789" y1="106.9766" y2="106.9766"/>
276+
<line style="stroke:#006400;stroke-width:2;" x1="227.3789" x2="477.3789" y1="86.9766" y2="86.9766"/>
277+
<line style="stroke:#006400;stroke-width:2;" x1="127.3789" x2="127.3789" y1="106.9766" y2="126.9766"/>
278+
<line style="stroke:#006400;stroke-width:2;" x1="227.3789" x2="227.3789" y1="86.9766" y2="106.9766"/>
279+
<line style="stroke:#333333;stroke-width:0.5;" x1="10" x2="482.3789" y1="138.9766" y2="138.9766"/>
280+
<text fill="#333333" font-family="sans-serif" font-size="14" font-weight="bold" lengthAdjust="spacing" textLength="67.5391" x="15" y="152.5117">Web User</text>
281+
<line style="stroke:#333333;stroke-width:0.5;" x1="10" x2="83.5391" y1="156.4648" y2="156.4648"/>
282+
<line style="stroke:#333333;stroke-width:0.5;" x1="83.5391" x2="93.5391" y1="156.4648" y2="138.9766"/>
283+
<polygon fill="#E2E2F0" points="89.3789,161.4648,115.3789,161.4648,127.3789,173.4648,115.3789,185.4648,89.3789,185.4648,77.3789,173.4648" style="stroke:#006400;stroke-width:1.5;"/>
284+
<polygon fill="#E2E2F0" points="139.3789,161.4648,477.3789,161.4648,477.3789,185.4648,139.3789,185.4648,127.3789,173.4648" style="stroke:#E2E2F0;stroke-width:1.5;"/>
285+
<path d="M477.3789,161.4648 L139.3789,161.4648 L127.3789,173.4648 L139.3789,185.4648 L477.3789,185.4648" fill="#E2E2F0" style="stroke:#006400;stroke-width:1.5;"/>
286+
<text fill="#333333" font-family="sans-serif" font-size="12" font-weight="bold" lengthAdjust="spacing" textLength="22.8633" x="90.9473" y="178">Idle</text>
287+
<text fill="#333333" font-family="sans-serif" font-size="12" font-weight="bold" lengthAdjust="spacing" textLength="46.3652" x="139.3789" y="178">Waiting</text>
288+
<line style="stroke:#333333;stroke-width:2;" x1="77.3789" x2="77.3789" y1="195.4648" y2="200.4648"/>
289+
<line style="stroke:#333333;stroke-width:2;" x1="127.3789" x2="127.3789" y1="195.4648" y2="200.4648"/>
290+
<line style="stroke:#333333;stroke-width:2;" x1="177.3789" x2="177.3789" y1="195.4648" y2="200.4648"/>
291+
<line style="stroke:#333333;stroke-width:2;" x1="227.3789" x2="227.3789" y1="195.4648" y2="200.4648"/>
292+
<line style="stroke:#333333;stroke-width:2;" x1="277.3789" x2="277.3789" y1="195.4648" y2="200.4648"/>
293+
<line style="stroke:#333333;stroke-width:2;" x1="327.3789" x2="327.3789" y1="195.4648" y2="200.4648"/>
294+
<line style="stroke:#333333;stroke-width:2;" x1="377.3789" x2="377.3789" y1="195.4648" y2="200.4648"/>
295+
<line style="stroke:#333333;stroke-width:2;" x1="427.3789" x2="427.3789" y1="195.4648" y2="200.4648"/>
296+
<line style="stroke:#333333;stroke-width:2;" x1="477.3789" x2="477.3789" y1="195.4648" y2="200.4648"/>
297+
<line style="stroke:#333333;stroke-width:2;" x1="77.3789" x2="477.3789" y1="195.4648" y2="195.4648"/>
298+
<text fill="#333333" font-family="sans-serif" font-size="11" lengthAdjust="spacing" textLength="6.9556" x="73.9011" y="212.0996">0</text>
299+
<text fill="#333333" font-family="sans-serif" font-size="11" lengthAdjust="spacing" textLength="20.8667" x="116.9456" y="212.0996">100</text>
300+
<text fill="#333333" font-family="sans-serif" font-size="11" lengthAdjust="spacing" textLength="20.8667" x="216.9456" y="212.0996">300</text>
301+
<text fill="#333333" font-family="sans-serif" font-size="11" lengthAdjust="spacing" textLength="20.8667" x="266.9456" y="212.0996">400</text>
302+
<text fill="#333333" font-family="sans-serif" font-size="11" lengthAdjust="spacing" textLength="20.8667" x="416.9456" y="212.0996">700</text>
303+
<line style="stroke:#00008B;stroke-width:1.5;" x1="127.3789" x2="127.3789" y1="173.4648" y2="126.9766"/>
304+
<polygon fill="#00008B" points="130.1151,134.4941,124.6427,134.4941,127.3789,126.9766" style="stroke:#00008B;stroke-width:1.5;"/>
305+
<text fill="#00008B" font-family="Serif" font-size="14" lengthAdjust="spacing" textLength="28" x="127.3789" y="147.5644">URL</text>
306+
<line style="stroke:#00008B;stroke-width:1.5;" x1="227.3789" x2="252.3789" y1="86.9766" y2="52.4883"/>
307+
<polygon fill="#00008B" points="250.1822,60.1808,245.7515,56.969,252.3789,52.4883" style="stroke:#00008B;stroke-width:1.5;"/>
308+
<text fill="#00008B" font-family="Serif" font-size="14" lengthAdjust="spacing" textLength="76.6035" x="247.9668" y="71.6452">Resolve URL</text>
309309
<!--SRC=[NO_12i8m38RlUOgmwn2guiM3bE954959wNchGGfZXMRgwzlEED5Ro9V_-ziKkpkFMErF5so8O_-WL67Bc1UG13hgqAJuP67EW8-33qnlPcTW0RG2Pp4m7guzWJFpM2e-C-XwgQR3nIxhS8ksEKhEjM4CmqsYvnGzCPT53grAoFnTPKLswtgZiaS-CVcaHOf_JUilA2zw0G00]-->
310310
</g>
311311
</svg>
312312
</figure>
313313
<p>A paragraph following.</p>
314314
.
315-
Document[0, 87]
316-
Heading[0, 9] textOpen:[0, 1, "#"] text:[2, 9, "Heading"]
317-
Text[2, 9] chars:[2, 9, "Heading"]
318-
PlantUmlBlockNode[10, 85]
319-
Paragraph[125, 143]
320-
Text[125, 143] chars:[125, 143, "Anoth … raph."]
315+
Document[0, 332]
316+
Heading[0, 24] textOpen:[0, 1, "#"] text:[2, 24, "Timing diagram example"]
317+
Text[2, 24] chars:[2, 24, "Timin … ample"]
318+
PlantUmlBlockNode[26, 308]
319+
Paragraph[310, 332]
320+
Text[310, 332] chars:[310, 332, "A par … wing."]
321321
````````````````````````````````
322322

323323
---

0 commit comments

Comments
 (0)