@@ -219,7 +219,7 @@ function parse_html($html, $path)
219
219
220
220
$ html = preg_replace_callback ('/<img\s+src="([^"]+)"\s+alt="([^"]+)"[^>]*\/>/ ' , array ($ this , 'include_image ' ), $ html );
221
221
222
- $ html = preg_replace_callback ('#<div class="hl-code">((.|\n)*? )</div># ' , array ($ this , 'escape_syntax ' ), $ html );
222
+ $ html = preg_replace_callback ('#<div class="hl-code">(.*?alltt\} )</div>#s ' , array ($ this , 'escape_syntax ' ), $ html );
223
223
$ html = preg_replace_callback ('/<code>([^<]*)<\/code>/ ' , array ($ this ,'escape_verb ' ), $ html );
224
224
$ html = preg_replace_callback ('/<pre>([^<]*)<\/pre>/ ' , array ($ this ,'escape_verbatim ' ), $ html );
225
225
@@ -238,12 +238,16 @@ function parse_html($html, $path)
238
238
$ html = preg_replace ('/<\/dl>/ ' , '\end{description} ' , $ html );
239
239
240
240
//item lists
241
- $ html = preg_replace ('/<ul[^>]*>/ ' , '\begin{itemize} ' , $ html );
242
- $ html = preg_replace ('/<\/ul>/ ' , '\end{itemize} ' , $ html );
243
- $ html = preg_replace ('/<ol[^>]*>/ ' , '\begin{enumerate} ' , $ html );
244
- $ html = preg_replace ('/<\/ol>/ ' , '\end{enumerate} ' , $ html );
245
- $ html = preg_replace ('/<li[^>]*>/ ' , '\item ' , $ html );
246
- $ html = preg_replace ('/<\/li>/ ' , '' , $ html );
241
+ // repeated 3 times to support nested lists up to 3 levels :-/
242
+ $ html = preg_replace ('/^<ul[^>]*>(.*?(?R)?.*?)<\/ul>/ms ' , '\begin{itemize}\1\end{itemize} ' , $ html );
243
+ $ html = preg_replace ('/^<ul[^>]*>(.*?(?R)?.*?)<\/ul>/ms ' , '\begin{itemize}\1\end{itemize} ' , $ html );
244
+ $ html = preg_replace ('/^<ul[^>]*>(.*?(?R)?.*?)<\/ul>/ms ' , '\begin{itemize}\1\end{itemize} ' , $ html );
245
+ $ html = preg_replace ('/^<ol[^>]*>(.*?(?R)?.*?)<\/ol>/ms ' , '\begin{enumerate}\1\end{enumerate} ' , $ html );
246
+ $ html = preg_replace ('/^<ol[^>]*>(.*?(?R)?.*?)<\/ol>/ms ' , '\begin{enumerate}\1\end{enumerate} ' , $ html );
247
+ $ html = preg_replace ('/^<ol[^>]*>(.*?(?R)?.*?)<\/ol>/ms ' , '\begin{enumerate}\1\end{enumerate} ' , $ html );
248
+ $ html = preg_replace ('/<li[^>]*>(.*?(?R)?.*?)<\/li>/s ' , '\item \1 ' , $ html );
249
+ $ html = preg_replace ('/<li[^>]*>(.*?(?R)?.*?)<\/li>/s ' , '\item \1 ' , $ html );
250
+ $ html = preg_replace ('/<li[^>]*>(.*?(?R)?.*?)<\/li>/s ' , '\item \1 ' , $ html );
247
251
248
252
//headings
249
253
$ html = preg_replace_callback ('/<h(1|2|3)\s+id="([^"]+)"[^>]*>([^<]+)<\/h(1|2|3)>/ ' , array ($ this , 'make_sections ' ), $ html );
0 commit comments