fix for underscore escape when using markdown.lua; do not use in prettified code blocks
steve donovan
9 years ago
13 | 13 | |
14 | 14 | -- inline <references> use same lookup as @see |
15 | 15 | local function resolve_inline_references (ldoc, txt, item, plain) |
16 | local do_escape = not plain and not ldoc.dont_escape_underscore | |
16 | 17 | local res = (txt:gsub('@{([^}]-)}',function (name) |
17 | 18 | if name:match '^\\' then return '@{'..name:sub(2)..'}' end |
18 | 19 | local qname,label = utils.splitv(name,'%s*|') |
41 | 42 | if not label then |
42 | 43 | label = ref.label |
43 | 44 | end |
44 | local do_escape = not plain and not ldoc.dont_escape_underscore | |
45 | 45 | if label and do_escape then -- a nastiness with markdown.lua and underscores |
46 | 46 | label = label:gsub('_','\\_') |
47 | 47 | end |
134 | 134 | -- If we omit the following '\n', a '--' (or '//') comment on the |
135 | 135 | -- last line won't be recognized. |
136 | 136 | code, err = prettify.code(lang,filename,code..'\n',L,false) |
137 | code = resolve_inline_references(ldoc, code, err_item) | |
137 | code = resolve_inline_references(ldoc, code, err_item,true) | |
138 | 138 | append(res,'<pre>') |
139 | 139 | append(res, code) |
140 | 140 | append(res,'</pre>') |