pl.po: update
[elinks.git] / contrib / lua / highlight.lua
blob03f0aab2f79e96092d3a263c646e1a735bef5ef5
1 -- Source-code highlighting hook
3 highlight_file_types = {
4 patch = "%.patch$",
5 python = "%.py$",
6 perl = "%.pl$",
7 awk = "%.awk$",
8 c = "%.[ch]$",
9 sh = "%.sh$",
12 function highlight (url, html)
13 for language,pattern in pairs(highlight_file_types) do
14 if string.find (url, pattern) then
15 local tmp = tmpname ()
16 writeto (tmp) write (html) writeto()
17 html = pipe_read ("(code2html -l "..language.." "..tmp.." - ) 2>/dev/null")
18 os.remove(tmp)
19 return html,nil
20 end
21 end
23 return nil,nil
24 end
26 table.insert(pre_format_html_hooks, highlight)