summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-04-12 15:23:47 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-05-12 11:59:08 +0100
commit7eac3275e41339fadd118a0968bd890436a40db4 (patch)
treed29e18a55c96d47571093fb4581dcaa23f9ab7b1
parent891646261f67f4a0a00716db927e0a5c08b454c0 (diff)
docgen: add support for monospace markup highlights
-rw-r--r--gendoc.lua37
1 files changed, 35 insertions, 2 deletions
diff --git a/gendoc.lua b/gendoc.lua
index c7fa5fd..d9a31db 100644
--- a/gendoc.lua
+++ b/gendoc.lua
@@ -212,6 +212,39 @@ local notetypes = {
212 ["TODO: "] = "<note>\n**TODO:** " 212 ["TODO: "] = "<note>\n**TODO:** "
213} 213}
214 214
215local gen_doc_markup = function(str)
216 local f = str:gmatch(".")
217 local c = f()
218 local buf = {}
219 while c do
220 if c == "\\" then
221 c = f()
222 if c ~= "@" and c ~= "$" then
223 buf[#buf + 1] = "\\"
224 end
225 buf[#buf + 1] = c
226 c = f()
227 elseif c == "$" then
228 c = f()
229 if c and c:match("[a-zA-Z_]") then
230 local wbuf = { c }
231 c = f()
232 while c and c:match("[a-zA-Z0-9_]") do
233 wbuf[#wbuf + 1] = c
234 c = f()
235 end
236 buf[#buf + 1] = "''" .. table.concat(wbuf) .. "''"
237 else
238 buf[#buf + 1] = "$"
239 end
240 else
241 buf[#buf + 1] = c
242 c = f()
243 end
244 end
245 return table.concat(buf)
246end
247
215local gen_doc_par = function(str) 248local gen_doc_par = function(str)
216 local tag 249 local tag
217 for k, v in pairs(notetypes) do 250 for k, v in pairs(notetypes) do
@@ -222,9 +255,9 @@ local gen_doc_par = function(str)
222 end 255 end
223 end 256 end
224 if tag then 257 if tag then
225 return tag .. str .. "\n</note>" 258 return tag .. gen_doc_markup(str) .. "\n</note>"
226 end 259 end
227 return str 260 return gen_doc_markup(str)
228end 261end
229 262
230local gen_doc_refd = function(str) 263local gen_doc_refd = function(str)