projectmallard / mallard-ducktype

Parser for the lightweight Ducktype syntax for Mallard
MIT License
10 stars 4 forks source link

Escaped bracket before closing bracket breaks parser #16

Closed pwithnall closed 6 years ago

pwithnall commented 6 years ago

If I have some Ducktype:

Interface files for public API should be installed to
$code($var($$(datadir$))/dbus-1/interfaces) so that other services can load
them. Private APIs should not be installed. There should be one file installed
per D-Bus interface, named after the interface, containing a single top-level
$code(<node>) element with a single $code(<interface>) beneath it. For example,
interface $code(com.example.MyService1.Manager) would be described by file
$file($var($$(datadir$))/dbus-1/interfaces/com.example.MyService1.Manager.xml):

the following Mallard gets produced:

<p>Interface files for public API should be installed to
  <code><var>$(datadir))/dbus-1/interfaces</var> so that other services can load
them. Private APIs should not be installed. There should be one file installed
per D-Bus interface, named after the interface, containing a single top-level
<code>&lt;node></code> element with a single <code>&lt;interface></code> beneath it. For example,
interface <code>com.example.MyService1.Manager</code> would be described by file
<file><var>$(datadir))/dbus-1/interfaces/com.example.MyService1.Manager.xml</var>:</file></code></p>

Note that the <var> element doesn’t get closed after $(datadir), there’s a spurious ) after $(datadir), and the <code> element doesn’t get closed either.

You can see a rendered example here.

To be clear, the $(datadir) is supposed to be literal; I think the escaping on it is right, but I’m not 100% sure.

shaunix commented 6 years ago

Don't escape the right paren. I changed the parser to track non-markup parens in inlines, because you said so. :)

https://github.com/projectmallard/mallard-ducktype/issues/1 http://projectmallard.org/pipermail/mallard-list/2015-February/000205.html

pwithnall commented 6 years ago

Fixed in D-Bus then: https://bugs.freedesktop.org/show_bug.cgi?id=104925. Thanks!