Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/dok.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkoray kavukcuoglu <koray@kavukcuoglu.org>2012-02-09 06:20:46 +0400
committerkoray kavukcuoglu <koray@kavukcuoglu.org>2012-02-09 06:20:46 +0400
commit6c0511b67f2a522317fac06148d8f0ff6128eb7c (patch)
tree90b0305b59194d50e78151c2a40b05ad852529d5
parent598592409abb522577d0a74db07c2543707cb2ec (diff)
add Bash/Shell highlighting.
-rw-r--r--init.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/init.lua b/init.lua
index e9a7ac5..b7404a7 100644
--- a/init.lua
+++ b/init.lua
@@ -231,7 +231,7 @@ function dok.dok2html(txt)
end)
-- note: we do not support code-specific colorization yet
- txt = txt:gsub('<file%s-(%w-)>(.-)</file>', function(langstr,str)
+ txt = txt:gsub('<file%s-(%w-)%s->(.-)</file>', function(langstr,str)
table.insert(file, str)
table.insert(lang,langstr)
return '\019' .. #file .. '\019'
@@ -503,7 +503,8 @@ function dok.dok2html(txt)
end)
txt = txt:gsub('\019(%d+)\019', function(id)
id = tonumber(id) -- file
- return '<pre class="brush: ' .. lang[id].. ';">' .. file[id] .. '</pre>'
+ local lng = lang[id] or 'lua'
+ return '<pre class="brush: ' .. lng .. ';">' .. file[id] .. '</pre>'
end)
return txt