File tree Expand file tree Collapse file tree
main/java/org/commonmark/internal/inline
test/java/org/commonmark/test Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -164,17 +164,13 @@ private boolean tryProcessingInstruction(Scanner scanner) {
164164 return false ;
165165 }
166166 scanner .next ();
167- int found ;
168- while ((found = scanner .find ('?' )) > 0 ) {
167+ while (scanner .find ('?' ) >= 0 ) {
169168 scanner .next ();
170169 if (scanner .next ('>' )) {
171170 return true ;
172171 }
173172 }
174- // The loop also ends when a `?` is found directly at the current position (`found == 0`),
175- // which is not the end of the input, so only remember the miss when the scan really did
176- // reach the end.
177- noProcessingInstructionEnd = found < 0 ;
173+ noProcessingInstructionEnd = true ;
178174 return false ;
179175 }
180176
Original file line number Diff line number Diff line change @@ -21,11 +21,17 @@ public void cdata() {
2121 assertRendering ("inline <![CDATA[ ] ]] ]]>" , "<p>inline <![CDATA[ ] ]] ]]></p>\n " );
2222 }
2323
24+ @ Test
25+ public void processingInstruction () {
26+ assertRendering ("inline <??>" , "<p>inline <??></p>\n " );
27+ assertRendering ("inline <?a??>" , "<p>inline <?a??></p>\n " );
28+ assertRendering ("inline <?? <?php ?>" , "<p>inline <?? <?php ?></p>\n " );
29+ }
30+
2431 @ Test
2532 public void afterFailedAttempt () {
2633 // A `<` that doesn't start inline HTML must not stop a later one from being parsed
2734 assertRendering ("inline <!- <!-- a -->" , "<p>inline <!- <!-- a --></p>\n " );
28- assertRendering ("inline <?? <?php ?>" , "<p>inline <?? <?php ?></p>\n " );
2935 assertRendering (
3036 "inline <![x]]> <![CDATA[a]]>" , "<p>inline <![x]]> <![CDATA[a]]></p>\n " );
3137 assertRendering ("inline <!foo> <!bar baz>" , "<p>inline <!foo> <!bar baz></p>\n " );
You can’t perform that action at this time.
0 commit comments