File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,30 @@ def options
144144 expect ( htmlify ( "test {include:file:foo.rdoc}" , :rdoc ) . gsub ( /[\r ?\n ]+/ , '' ) ) . to eq '<p>test HI</p>'
145145 end
146146
147+ it "preserves syntax highlighting in {include:} snippets" do
148+ load_markup_provider ( :rdoc )
149+ expect ( File ) . to receive ( :file? ) . with ( 'foo.rdoc' ) . and_return ( true )
150+ expect ( File ) . to receive ( :read ) . with ( 'foo.rdoc' ) . and_return (
151+ " !!!ruby\n x = 1\n "
152+ )
153+ expect ( htmlify ( "{include:file:foo.rdoc}" , :rdoc ) . gsub ( /[\r ?\n ]+/ , '' ) ) .
154+ not_to include ( "<" )
155+ end
156+
157+ it "escapes {include:} html snippets only once" do
158+ expect ( self ) . to receive ( :html_syntax_highlight_html ) do |source |
159+ %(<strong>#{ CGI . escapeHTML ( source ) } </strong>)
160+ end . at_least ( :once )
161+
162+ load_markup_provider ( :rdoc )
163+ expect ( File ) . to receive ( :file? ) . with ( 'foo.md' ) . and_return ( true )
164+ expect ( File ) . to receive ( :read ) . with ( 'foo.md' ) . and_return (
165+ " !!!html\n <h1>\n "
166+ )
167+ expect ( htmlify ( "{include:file:foo.md}" , :markdown ) . gsub ( /[\r ?\n ]+/ , '' ) ) .
168+ to include ( %(<strong><h1></strong>) )
169+ end
170+
147171 it "does not autolink URLs inside of {} (markdown specific)" do
148172 log . enter_level ( Logger ::FATAL ) do
149173 pending 'This test depends on markdown' unless markup_class ( :markdown )
You can’t perform that action at this time.
0 commit comments