Skip to content

Commit

Permalink
Support documents starting with a literal block marker
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj committed Mar 5, 2021
1 parent 119b18e commit 426b67a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Parser/DocumentParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ private function parseLine(string $line): bool
return false;
}

if (trim($line) === '::') {
$this->isCode = true;

return true;
}

if ($this->lineChecker->isBlockLine($line)) {
if ($this->isCode) {
$this->setState(State::CODE);
Expand Down
2 changes: 2 additions & 0 deletions tests/Functional/tests/code/code.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<pre><code class="">This is a code block
</code></pre>
<p>Code block:</p>
<pre><code class="">This is a code block You hou!
</code></pre>
4 changes: 4 additions & 0 deletions tests/Functional/tests/code/code.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
::

This is a code block

Code block::

This is a code block
Expand Down
5 changes: 5 additions & 0 deletions tests/Functional/tests/code/code.tex
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
\lstset{language=}
\begin{lstlisting}
This is a code block

\end{lstlisting}
Code block:
\lstset{language=}
\begin{lstlisting}
Expand Down

0 comments on commit 426b67a

Please sign in to comment.