Skip to content

Commit

Permalink
Merge pull request #1002 from publify/remove-notextile
Browse files Browse the repository at this point in the history
Remove use of 'notextile'
  • Loading branch information
mvz committed May 23, 2021
2 parents 141f5c8 + 45132c7 commit 60b6fde
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion publify_core/lib/publify_textfilter_markdown.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def self.filtertext(text)
# FIXME: Workaround for BlueCloth not interpreting <publify:foo> as an
# HTML tag. See <http://deveiate.org/projects/BlueCloth/ticket/70>.
escaped_macros = text.gsub(%r{(</?publify):}, '\1X')
html = BlueCloth.new(escaped_macros).to_html.gsub(%r{</?notextile>}, "")
html = BlueCloth.new(escaped_macros).to_html
html.gsub(%r{(</?publify)X}, '\1:')
end
end
Expand Down
1 change: 0 additions & 1 deletion publify_textfilter_code/lib/publify_app/textfilter_code.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def self.macrofilter(attrib, text = "")
rescue
text = HTMLEntities.new("xhtml1").encode(text)
end
text = "<notextile>#{text}</notextile>"

titlecode = if title
"<div class=\"codetitle\">#{title}</div>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@ def filter_text(text, filters)
result = filter_text("<publify:code>foo-code</publify:code>",
[:macropre, :macropost])
expect(result).
to eq '<div class="CodeRay"><pre><notextile>foo-code</notextile></pre></div>'
to eq '<div class="CodeRay"><pre>foo-code</pre></div>'
end

it "parses ruby lang" do
result = filter_text('<publify:code lang="ruby">foo-code</publify:code>',
[:macropre, :macropost])
expect(result).
to eq('<div class="CodeRay"><pre><notextile><span class="CodeRay">' \
"foo-code</span></notextile></pre></div>")
to eq('<div class="CodeRay"><pre><span class="CodeRay">' \
"foo-code</span></pre></div>")
end

it "parses ruby and xml in same sentence but not in same place" do
result = filter_text('<publify:code lang="ruby">foo-code</publify:code> ' \
'blah blah <publify:code lang="xml">zzz</publify:code>',
[:macropre, :macropost])
expect(result).
to eq '<div class="CodeRay"><pre><notextile><span class="CodeRay">' \
"foo-code</span></notextile></pre></div> blah blah" \
' <div class="CodeRay"><pre><notextile><span class="CodeRay">' \
"zzz</span></notextile></pre></div>"
to eq '<div class="CodeRay"><pre><span class="CodeRay">' \
"foo-code</span></pre></div> blah blah" \
' <div class="CodeRay"><pre><span class="CodeRay">' \
"zzz</span></pre></div>"
end
end

Expand All @@ -52,11 +52,11 @@ def bar
HTML

expected_result = <<~HTML
<div class="CodeRay"><pre><notextile><span class="CodeRay"><span class="keyword">class</span> <span class="class">Foo</span>
<div class="CodeRay"><pre><span class="CodeRay"><span class="keyword">class</span> <span class="class">Foo</span>
<span class="keyword">def</span> <span class="function">bar</span>
<span class="instance-variable">@a</span> = <span class="string"><span class="delimiter">&quot;</span><span class="content">zzz</span><span class="delimiter">&quot;</span></span>
<span class="keyword">end</span>
<span class="keyword">end</span></span></notextile></pre></div>
<span class="keyword">end</span></span></pre></div>
HTML
expect(filter_text(original, [:macropre, :macropost])).to eq(expected_result)
end
Expand Down

0 comments on commit 60b6fde

Please sign in to comment.