Sha256: e46cb92fbd1a091980c22f883ccea641ee4666d95873b0885f828abc712601dd
Contents?: true
Size: 1.7 KB
Versions: 10
Compression:
Stored size: 1.7 KB
Contents
require 'spec_helper' describe ReverseAsciidoctor::Converters::Text do let(:converter) { ReverseAsciidoctor::Converters::Text.new } it 'treats newline within text as a single whitespace' do input = node_for("<p>foo\nbar</p>") result = converter.convert(input) expect(result).to eq 'foo bar' end it 'removes leading newlines' do input = node_for("<p>\n\nfoo bar</p>") result = converter.convert(input) expect(result).to eq 'foo bar' end it 'removes trailing newlines' do input = node_for("<p>foo bar\n\n</p>") result = converter.convert(input) expect(result).to eq 'foo bar' end it 'keeps nbsps' do input = node_for("<p>foo\u00A0bar \u00A0</p>") result = converter.convert(input) expect(result).to eq "foo bar " end it 'keeps escaped HTML-ish characters' do input = node_for("<p><foo></p>") result = converter.convert(input) expect(result).to eq '\<foo\>' end context 'within backticks' do it "preserves single underscores" do input = node_for("<p>`foo_bar`</p>") result = converter.convert(input) expect(result).to eq '`foo_bar`' end it "preserves multiple underscores" do input = node_for("<p>`foo_bar __example__`</p>") result = converter.convert(input) expect(result).to eq '`foo_bar __example__`' end it "preserves single asterisks" do input = node_for("<p>`def foo *args`</p>") result = converter.convert(input) expect(result).to eq '`def foo *args`' end it "preserves multiple asterisks" do input = node_for("<p>`def foo 2***3`</p>") result = converter.convert(input) expect(result).to eq '`def foo 2***3`' end end end
Version data entries
10 entries across 10 versions & 2 rubygems