darioteixeira / lambdoc

Lambdoc is a library providing support for semantically complex documents in Ocsigen web applications
GNU General Public License v2.0
17 stars 1 forks source link

markdown: assertion failed when parsing inline html #25

Closed edwintorok closed 8 years ago

edwintorok commented 9 years ago
$ cat >x.md <<EOF
X<sup>2</sup>
EOF
$ lambcmd.native -i x.md -o x.html
Fatal error: exception File "lib/lambdoc_read_markdown_impl/mapper.ml", line 102, characters 12-18: Assertion failed

The file x.md was obtained by trying to use pandoc to generate a markdown without extensions, so that omd can parse it:

$ cat >y.md <<EOF
X^2^
EOF
$ pandoc -f markdown -t markdown_strict y.md >x.md

For now I've added this so that lambcmd doesn't crash when trying to parse my files, but it reports the error at an incorrect location like in this bug so I'm not sending a pull request on this yet:

--- a/src/lib/lambdoc_read_markdown_impl/mapper.ml
+++ b/src/lib/lambdoc_read_markdown_impl/mapper.ml
@@ -99,7 +99,7 @@ let ast_of_omd frag =
                                | Some (href, _title) -> Inline (dummy, Ast.Link ( href, Some ([(dummy, Ast.Plain txt)])))
                                | None -> Inline (dummy, Ast.Plain fallback#to_string)
                        end
-               | _                             -> assert false
+               | e -> raise (Unsupported_feature (Omd.to_markdown [e]))
darioteixeira commented 9 years ago

Well, the Markdown support is still experimental and largely a proof a concept. Stil, I'll add your patch so that users are not confronted with assertion failures...

darioteixeira commented 8 years ago

Since commit f59a2aebcbd3990c41b501210052e20e5725f186, there is now a Lamblite parser that handles both Markdown and Wiki syntaxes, bypassing OMD altogether. This issue is therefore moot.