Mercurial Hosting > freedit
comparison src/bbcode/Bbcode.luan @ 49:f225e82b2bf8
add code bbcode
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 17 Nov 2022 16:46:21 -0700 |
parents | 4e1a01db19ec |
children | cac477dd1f82 |
comparison
equal
deleted
inserted
replaced
48:4e1a01db19ec | 49:f225e82b2bf8 |
---|---|
70 %><a href="<%=url%>"><% to_html(bbcode.contents,options) %></a><% | 70 %><a href="<%=url%>"><% to_html(bbcode.contents,options) %></a><% |
71 end | 71 end |
72 end | 72 end |
73 | 73 |
74 function html.code(bbcode,options) | 74 function html.code(bbcode,options) |
75 local s = starting_cr_regex.gsub(bbcode.contents,"") | 75 if bbcode.param == "inline" then |
76 %><code><%= html_encode(s) %></code><% | 76 %><code inline><%= html_encode(bbcode.contents) %></code><% |
77 options.strip_newline = true | 77 else |
78 local s = starting_cr_regex.gsub(bbcode.contents,"") | |
79 %><code><%= html_encode(s) %></code><% | |
80 options.strip_newline = true | |
81 end | |
78 end | 82 end |
79 | 83 |
80 function html.img(bbcode,options) | 84 function html.img(bbcode,options) |
81 %><img src="<%= html_encode(bbcode.contents) %>"><% | 85 %><img src="<%= html_encode(bbcode.contents) %>"><% |
82 end | 86 end |
248 end | 252 end |
249 end | 253 end |
250 | 254 |
251 function Bbcode.to_html(bbcode) | 255 function Bbcode.to_html(bbcode) |
252 bbcode = bbcode_parse(bbcode) | 256 bbcode = bbcode_parse(bbcode) |
253 %><div message><% | 257 %><div from_bbcode><% |
254 to_html(bbcode,{strip_newline=false}) | 258 to_html(bbcode,{strip_newline=false}) |
255 %></div><% | 259 %></div><% |
256 end | 260 end |
257 | 261 |
258 | 262 |