Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove use of 'notextile' #1002

Merged
merged 1 commit into from
May 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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