diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2013-01-03 05:43:43 -0700 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2013-01-03 05:43:43 -0700 |
| commit | fe13ace9ad2bef848a7105f86290d3e4b09a5be2 (patch) | |
| tree | 8871027042c1322e54c61e8863e19ddc6023a6a4 /test/text_test.rb | |
| parent | c8251210e324053a26c4884d8d86341c12dc8f88 (diff) | |
Add DocBook backend templates + loads of improvements
- make templates for docbook45 backend
- move backend templates to backends/ folder
- load backend templates lazily (based on backend attribute)
- namespace backend templates to avoid conflicts
- extend backend templates from a base template
- add view property to template class
- change InlineLink to InlineAnchor and assign type (:link or :xref)
- simplify shorthand methods (e.g., define attribute) in template classes
- set default backend to html5
- set backend attribute family (backend-*, basebackend, etc)
- set docdate and doctime attributes (match local* w/o file ref)
- prevent Reader from overriding attributes passed to Document.new
- fix list continuation bug in outline and labeled lists
- fold first paragraph properly in outline lists; document in TomDoc
- add convenience methods to String (trim, nuke)
- add TomDoc to methods added to String
- add tests for String monkeypatches
- fix compliance of attribute continuations in Reader
- perform attribute substitutions on document attributes and attribute lists
- apply normal subs to single-quoted attribute values
- cleanup how substitutions are called
- don't need Asciidoctor:: prefix in Substituter
- honor line pass: macro in document attribute value
- move regexs in Reader to Asciidoctor module
- use %r{} syntax to make some regex easier to read
- fix order of replacements
- add ellipsis and single quote replacements
- add space, quot and apos to instrinsics
- move Substituters mixin to AbstractBlock
- make Document an AbstractBlock
- use blocks instance variable in Document instead of elements
- document should store text of reference to match how docbook works
- allow Document.new to be called w/ no arguments
- rename level* regex to section*
- loads of tests to verify numerous compliance checks and for new functionality
- more TomDoc
Diffstat (limited to 'test/text_test.rb')
| -rw-r--r-- | test/text_test.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/test/text_test.rb b/test/text_test.rb index 24234092..f32fc21a 100644 --- a/test/text_test.rb +++ b/test/text_test.rb @@ -9,8 +9,20 @@ context "Text" do assert_xpath "//p", example_document(:encoding).render(:header_footer => false), 1 end + # NOTE this test ensures we have the encoding line on block templates too + test "proper encoding to handle utf8 characters in arbitrary block" do + input = [] + input << "[verse]\n" + input.concat(File.readlines(sample_doc_path(:encoding))) + doc = Asciidoctor::Document.new + reader = Asciidoctor::Reader.new input + block = Asciidoctor::Lexer.next_block(reader, doc) + assert_xpath '//pre', block.render.gnuke(/^\s*\n/), 1 + end + test 'escaped text markup' do - pending "Not done yet" + assert_match /All your <em>inline<\/em> markup belongs to <strong>us<\/strong>!/, + render_string('All your <em>inline</em> markup belongs to <strong>us</strong>!') end test "line breaks" do @@ -32,11 +44,15 @@ context "Text" do assert_xpath "//em", render_string("An 'emphatic' no") end + test "emphasized text with single quote" do + assert_xpath "//em[text()=\"Johnny#{[8217].pack('U*')}s\"]", render_string("It's 'Johnny's' phone") + end + test "emphasized text with escaped single quote" do assert_xpath "//em[text()=\"Johnny's\"]", render_string("It's 'Johnny\\'s' phone") end - test "escaped single quote is restore as single quote" do + test "escaped single quote is restored as single quote" do assert_xpath "//p[contains(text(), \"Let's do it!\")]", render_string("Let\\'s do it!") end |
