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 05:36:12 +0400
committerkoray kavukcuoglu <koray@kavukcuoglu.org>2012-02-09 05:36:12 +0400
commit598592409abb522577d0a74db07c2543707cb2ec (patch)
tree0fa0bf6a1244d46da6f62df863623525e4af9342
parent5d3ea7e32c7ee8706913291c86d41bb94a708cd7 (diff)
added c/cpp syntax highlighting brush.
-rw-r--r--init.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/init.lua b/init.lua
index aec89fa..e9a7ac5 100644
--- a/init.lua
+++ b/init.lua
@@ -218,6 +218,7 @@ function dok.dok2html(txt)
local anch = {}
local code = {}
local file = {}
+ local lang = {}
local pict = {}
local foot = {}
local issection = false;
@@ -230,8 +231,9 @@ function dok.dok2html(txt)
end)
-- note: we do not support code-specific colorization yet
- txt = txt:gsub('<file.->(.-)</file>', function(str)
+ txt = txt:gsub('<file%s-(%w-)>(.-)</file>', function(langstr,str)
table.insert(file, str)
+ table.insert(lang,langstr)
return '\019' .. #file .. '\019'
end)
@@ -501,7 +503,7 @@ function dok.dok2html(txt)
end)
txt = txt:gsub('\019(%d+)\019', function(id)
id = tonumber(id) -- file
- return '<pre class="brush: lua;">' .. file[id] .. '</pre>'
+ return '<pre class="brush: ' .. lang[id].. ';">' .. file[id] .. '</pre>'
end)
return txt