OSDN Git Service
(root)
/
lbw
/
ldblogwriter2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
66c7ad9
)
add pretyprint
master
author
masahino
<masahino@gmail.com>
Sun, 19 May 2013 11:51:12 +0000
(20:51 +0900)
committer
masahino
<masahino@gmail.com>
Sun, 19 May 2013 11:51:12 +0000
(20:51 +0900)
lib/ldblogwriter/parser.rb
patch
|
blob
|
history
diff --git
a/lib/ldblogwriter/parser.rb
b/lib/ldblogwriter/parser.rb
index
3168892
..
3598795
100644
(file)
--- a/
lib/ldblogwriter/parser.rb
+++ b/
lib/ldblogwriter/parser.rb
@@
-101,7
+101,7
@@
module LDBlogWriter
end
buf
end
-
+
def syntax_highlight(lines, lang)
require 'syntax/convertors/html'
convertor = Syntax::Convertors::HTML.for_syntax lang
@@
-113,6
+113,9
@@
module LDBlogWriter
if lines.first =~ /\Ahighlight\((.*)\)/
lines.shift
syntax_highlight(lines, $1)
+ elsif lines.first =~ /\A#prettyprint/
+ lines.shift
+ ["<pre class=\"prettyprint\">", lines.join("\n"), "</pre>"]
else
["<pre>", lines.map {|line| escape_html(line) }.join("\n"),
'</pre>']