asciidoctor 1.5.7.1 → 1.5.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +95 -5
  3. data/Gemfile +23 -13
  4. data/README-de.adoc +482 -0
  5. data/README-fr.adoc +128 -119
  6. data/README-jp.adoc +2 -3
  7. data/README-zh_CN.adoc +2 -3
  8. data/README.adoc +131 -106
  9. data/asciidoctor.gemspec +9 -7
  10. data/data/locale/attributes-ar.adoc +1 -1
  11. data/data/locale/attributes-bg.adoc +1 -1
  12. data/data/locale/attributes-ca.adoc +1 -1
  13. data/data/locale/attributes-cs.adoc +1 -1
  14. data/data/locale/attributes-da.adoc +1 -1
  15. data/data/locale/attributes-de.adoc +1 -1
  16. data/data/locale/attributes-en.adoc +1 -1
  17. data/data/locale/attributes-es.adoc +1 -1
  18. data/data/locale/attributes-fa.adoc +1 -1
  19. data/data/locale/attributes-fi.adoc +1 -1
  20. data/data/locale/attributes-fr.adoc +1 -1
  21. data/data/locale/attributes-hu.adoc +1 -1
  22. data/data/locale/attributes-id.adoc +1 -1
  23. data/data/locale/attributes-it.adoc +1 -1
  24. data/data/locale/attributes-ja.adoc +1 -1
  25. data/data/locale/attributes-kr.adoc +1 -1
  26. data/data/locale/attributes-nb.adoc +1 -1
  27. data/data/locale/attributes-nl.adoc +1 -1
  28. data/data/locale/attributes-nn.adoc +1 -1
  29. data/data/locale/attributes-pl.adoc +1 -1
  30. data/data/locale/attributes-pt.adoc +1 -1
  31. data/data/locale/attributes-pt_BR.adoc +1 -1
  32. data/data/locale/attributes-ro.adoc +1 -1
  33. data/data/locale/attributes-ru.adoc +1 -1
  34. data/data/locale/attributes-sr.adoc +5 -4
  35. data/data/locale/attributes-sr_Latn.adoc +5 -4
  36. data/data/locale/attributes-sv.adoc +23 -0
  37. data/data/locale/attributes-tr.adoc +1 -1
  38. data/data/locale/attributes-uk.adoc +1 -1
  39. data/data/locale/attributes-zh_CN.adoc +1 -1
  40. data/data/locale/attributes-zh_TW.adoc +1 -1
  41. data/data/stylesheets/asciidoctor-default.css +23 -23
  42. data/lib/asciidoctor.rb +110 -104
  43. data/lib/asciidoctor/abstract_block.rb +55 -32
  44. data/lib/asciidoctor/abstract_node.rb +32 -17
  45. data/lib/asciidoctor/attribute_list.rb +8 -7
  46. data/lib/asciidoctor/block.rb +5 -7
  47. data/lib/asciidoctor/cli/options.rb +5 -9
  48. data/lib/asciidoctor/converter.rb +2 -2
  49. data/lib/asciidoctor/converter/docbook45.rb +7 -20
  50. data/lib/asciidoctor/converter/docbook5.rb +36 -37
  51. data/lib/asciidoctor/converter/factory.rb +10 -8
  52. data/lib/asciidoctor/converter/html5.rb +90 -65
  53. data/lib/asciidoctor/converter/manpage.rb +72 -62
  54. data/lib/asciidoctor/converter/template.rb +8 -6
  55. data/lib/asciidoctor/core_ext/1.8.7/concurrent/hash.rb +5 -0
  56. data/lib/asciidoctor/document.rb +62 -10
  57. data/lib/asciidoctor/extensions.rb +74 -16
  58. data/lib/asciidoctor/helpers.rb +11 -14
  59. data/lib/asciidoctor/list.rb +2 -2
  60. data/lib/asciidoctor/parser.rb +223 -195
  61. data/lib/asciidoctor/path_resolver.rb +15 -7
  62. data/lib/asciidoctor/reader.rb +65 -36
  63. data/lib/asciidoctor/section.rb +6 -4
  64. data/lib/asciidoctor/substitutors.rb +170 -149
  65. data/lib/asciidoctor/table.rb +16 -8
  66. data/lib/asciidoctor/version.rb +1 -1
  67. data/man/asciidoctor.1 +6 -5
  68. data/man/asciidoctor.adoc +3 -2
  69. data/test/api_test.rb +236 -0
  70. data/test/attribute_list_test.rb +242 -0
  71. data/test/attributes_test.rb +65 -52
  72. data/test/blocks_test.rb +408 -260
  73. data/test/converter_test.rb +7 -7
  74. data/test/document_test.rb +60 -54
  75. data/test/extensions_test.rb +218 -32
  76. data/test/fixtures/doctime-localtime.adoc +2 -0
  77. data/test/fixtures/section-a.adoc +4 -0
  78. data/test/fixtures/subs.adoc +0 -1
  79. data/test/invoker_test.rb +56 -18
  80. data/test/links_test.rb +105 -81
  81. data/test/lists_test.rb +636 -265
  82. data/test/logger_test.rb +1 -1
  83. data/test/manpage_test.rb +140 -3
  84. data/test/paragraphs_test.rb +42 -42
  85. data/test/parser_test.rb +63 -183
  86. data/test/paths_test.rb +21 -4
  87. data/test/preamble_test.rb +9 -9
  88. data/test/reader_test.rb +78 -28
  89. data/test/sections_test.rb +273 -151
  90. data/test/substitutions_test.rb +53 -19
  91. data/test/tables_test.rb +286 -163
  92. data/test/test_helper.rb +4 -3
  93. data/test/text_test.rb +65 -65
  94. metadata +16 -21
@@ -154,7 +154,7 @@ Sidebar content
154
154
  ****
155
155
  EOS
156
156
 
157
- output = render_embedded_string input, :template_dir => (fixture_path 'custom-backends/haml'), :template_cache => false
157
+ output = convert_string_to_embedded input, :template_dir => (fixture_path 'custom-backends/haml'), :template_cache => false
158
158
  assert_xpath '/*[@class="sect1"]/*[@class="sectionbody"]/p', output, 1
159
159
  assert_xpath '//aside', output, 1
160
160
  assert_xpath '/*[@class="sect1"]/*[@class="sectionbody"]/p/following-sibling::aside', output, 1
@@ -171,8 +171,8 @@ Sidebar content
171
171
  doc = Asciidoctor::Document.new [], :template_dir => template_dir
172
172
  doc.converter
173
173
  caches = Asciidoctor::Converter::TemplateConverter.caches
174
- if defined? ::ThreadSafe::Cache
175
- assert_kind_of ::ThreadSafe::Cache, caches[:templates]
174
+ if defined? ::Concurrent::Hash
175
+ assert_kind_of ::Concurrent::Hash, caches[:templates]
176
176
  refute_empty caches[:templates]
177
177
  paragraph_template_before = caches[:templates].values.find {|t| File.basename(t.file) == 'block_paragraph.html.haml' }
178
178
  refute_nil paragraph_template_before
@@ -293,7 +293,7 @@ Sidebar content
293
293
  ****
294
294
  EOS
295
295
 
296
- output = render_embedded_string input, :template_dir => (fixture_path 'custom-backends/slim'), :template_cache => false
296
+ output = convert_string_to_embedded input, :template_dir => (fixture_path 'custom-backends/slim'), :template_cache => false
297
297
  assert_xpath '/*[@class="sect1"]/*[@class="sectionbody"]/p', output, 1
298
298
  assert_xpath '//aside', output, 1
299
299
  assert_xpath '/*[@class="sect1"]/*[@class="sectionbody"]/p/following-sibling::aside', output, 1
@@ -325,7 +325,7 @@ content
325
325
  end
326
326
  end
327
327
 
328
- output = render_string input, :converter => CustomConverterA
328
+ output = convert_string input, :converter => CustomConverterA
329
329
  assert 'document', output
330
330
  end
331
331
 
@@ -348,7 +348,7 @@ content
348
348
  converters = Asciidoctor::Converter::Factory.converters
349
349
  assert converters.size == 1
350
350
  assert converters['foobar'] == CustomConverterB
351
- output = render_string input, :backend => 'foobar'
351
+ output = convert_string input, :backend => 'foobar'
352
352
  assert 'foobar content', output
353
353
  ensure
354
354
  Asciidoctor::Converter::Factory.unregister_all
@@ -460,7 +460,7 @@ content
460
460
 
461
461
  converters = Asciidoctor::Converter::Factory.converters
462
462
  assert converters['*'] == CustomConverterF
463
- output = render_string input, :backend => 'foobaz'
463
+ output = convert_string input, :backend => 'foobaz'
464
464
  assert 'foobaz content', output
465
465
  ensure
466
466
  Asciidoctor::Converter::Factory.unregister_all
@@ -116,7 +116,7 @@ context 'Document' do
116
116
 
117
117
  content
118
118
  EOS
119
- result = render_string input, :backend => 'docbook'
119
+ result = convert_string input, :backend => 'docbook'
120
120
  assert_xpath '/article', result, 1
121
121
  assert_xpath '/article/info', result, 0
122
122
  end
@@ -364,7 +364,7 @@ content
364
364
 
365
365
  context 'MathJax' do
366
366
  test 'should add MathJax script to HTML head if stem attribute is set' do
367
- output = render_string '', :attributes => {'stem' => ''}
367
+ output = convert_string '', :attributes => {'stem' => ''}
368
368
  assert_match('<script type="text/x-mathjax-config">', output)
369
369
  assert_match('inlineMath: [["\\\\(", "\\\\)"]]', output)
370
370
  assert_match('displayMath: [["\\\\[", "\\\\]"]]', output)
@@ -420,7 +420,7 @@ content
420
420
  '/favicon.ico' => %w(/favicon.ico image/x-icon),
421
421
  '/img/favicon.png' => %w(/img/favicon.png image/png)
422
422
  }.each {|val, (href, type)|
423
- result = render_string %(= Untitled), :attributes => { 'favicon' => val }
423
+ result = convert_string %(= Untitled), :attributes => { 'favicon' => val }
424
424
  assert_css 'link[rel="icon"]', result, 1
425
425
  assert_css %(link[rel="icon"][href="#{href}"]), result, 1
426
426
  assert_css %(link[rel="icon"][type="#{type}"]), result, 1
@@ -679,11 +679,17 @@ preamble
679
679
 
680
680
  text
681
681
  EOS
682
- output = render_string input, :safe => Asciidoctor::SafeMode::SAFE
682
+ output = convert_string input, :safe => Asciidoctor::SafeMode::SAFE
683
683
  assert_css '#header h1', output, 1
684
684
  assert_css '#content h1', output, 0
685
685
  end
686
686
 
687
+ test 'document with multiline attribute entry but only one line should not crash' do
688
+ input = ':foo: bar' + Asciidoctor::LINE_CONTINUATION
689
+ doc = document_from_string input
690
+ assert_equal 'bar', doc.attributes['foo']
691
+ end
692
+
687
693
  test 'should sanitize contents of HTML title element' do
688
694
  input = <<-EOS
689
695
  = *Document* image:logo.png[] _Title_ image:another-logo.png[another logo]
@@ -691,7 +697,7 @@ text
691
697
  content
692
698
  EOS
693
699
 
694
- output = render_string input
700
+ output = convert_string input
695
701
  assert_xpath '/html/head/title[text()="Document Title"]', output, 1
696
702
  nodes = xmlnodes_at_xpath('//*[@id="header"]/h1', output)
697
703
  assert_equal 1, nodes.size
@@ -727,7 +733,7 @@ v8.6.8, 2012-07-12: See changelog.
727
733
 
728
734
  more info...
729
735
  EOS
730
- output = render_string input
736
+ output = convert_string input
731
737
  assert_xpath '//meta[@name="author"][@content="Stuart Rackham"]', output, 1
732
738
  assert_xpath '//meta[@name="description"][@content="AsciiDoc user guide"]', output, 1
733
739
  assert_xpath '//meta[@name="keywords"][@content="asciidoc,documentation"]', output, 1
@@ -764,7 +770,7 @@ Author Name
764
770
  content
765
771
  EOS
766
772
 
767
- output = render_string input, :backend => 'docbook'
773
+ output = convert_string input, :backend => 'docbook'
768
774
  assert_css 'revhistory', output, 1
769
775
  assert_css 'revhistory > revision', output, 1
770
776
  assert_css 'revhistory > revision > date', output, 1
@@ -781,7 +787,7 @@ Author Name
781
787
  content
782
788
  EOS
783
789
 
784
- output = render_string input, :backend => 'docbook'
790
+ output = convert_string input, :backend => 'docbook'
785
791
  assert_css 'revhistory', output, 1
786
792
  assert_css 'revhistory > revision', output, 1
787
793
  assert_css 'revhistory > revision > date', output, 1
@@ -797,7 +803,7 @@ Author Name
797
803
  content
798
804
  EOS
799
805
 
800
- output = render_string input, :backend => 'docbook'
806
+ output = convert_string input, :backend => 'docbook'
801
807
  assert_css 'revhistory', output, 0
802
808
  end
803
809
 
@@ -811,7 +817,7 @@ v8.6.8, 2012-07-12: See changelog.
811
817
 
812
818
  more info...
813
819
  EOS
814
- output = render_string input, :backend => 'docbook45'
820
+ output = convert_string input, :backend => 'docbook45'
815
821
  assert_xpath '/article/articleinfo', output, 1
816
822
  assert_xpath '/article/articleinfo/title[text() = "AsciiDoc"]', output, 1
817
823
  assert_xpath '/article/articleinfo/date[text() = "2012-07-12"]', output, 1
@@ -835,7 +841,7 @@ Stuart Rackham <founder@asciidoc.org>
835
841
 
836
842
  more info...
837
843
  EOS
838
- output = render_string input, :backend => 'docbook5'
844
+ output = convert_string input, :backend => 'docbook5'
839
845
  assert_xpath '/article/info', output, 1
840
846
  assert_xpath '/article/info/title[text() = "AsciiDoc"]', output, 1
841
847
  assert_xpath '/article/info/author/personname', output, 1
@@ -853,7 +859,7 @@ more info...
853
859
  content
854
860
  EOS
855
861
 
856
- output = render_string input, :backend => 'docbook45'
862
+ output = convert_string input, :backend => 'docbook45'
857
863
  assert_xpath '//articleinfo/author', output, 1
858
864
  assert_xpath '//articleinfo/author/firstname[text() = "Doc"]', output, 1
859
865
  assert_xpath '//articleinfo/author/surname[text() = "Writer"]', output, 1
@@ -869,7 +875,7 @@ content
869
875
  content
870
876
  EOS
871
877
 
872
- output = render_string input
878
+ output = convert_string input
873
879
  assert_xpath '//meta[@name="author"][@content="Ze Product team"]', output, 1
874
880
  end
875
881
 
@@ -881,7 +887,7 @@ R&D Lab
881
887
  {author}
882
888
  EOS
883
889
 
884
- output = render_string input
890
+ output = convert_string input
885
891
  assert_includes output, 'R&amp;D Lab', 2
886
892
  end
887
893
 
@@ -893,7 +899,7 @@ Doc Writer <thedoctor@asciidoc.org>; Junior Writer <junior@asciidoctor.org>
893
899
  content
894
900
  EOS
895
901
 
896
- output = render_string input
902
+ output = convert_string input
897
903
  assert_xpath '//span[@id="author"]', output, 1
898
904
  assert_xpath '//span[@id="author"][text()="Doc Writer"]', output, 1
899
905
  assert_xpath '//span[@id="email"]', output, 1
@@ -914,7 +920,7 @@ Doc Writer <thedoctor@asciidoc.org>; Junior Writer <junior@asciidoctor.org>
914
920
  content
915
921
  EOS
916
922
 
917
- output = render_string input, :backend => 'docbook45'
923
+ output = convert_string input, :backend => 'docbook45'
918
924
  assert_xpath '//articleinfo/author', output, 0
919
925
  assert_xpath '//articleinfo/authorgroup', output, 1
920
926
  assert_xpath '//articleinfo/authorgroup/author', output, 2
@@ -945,7 +951,7 @@ content
945
951
  content
946
952
  EOS
947
953
 
948
- output = render_string input, :backend => 'docbook45'
954
+ output = convert_string input, :backend => 'docbook45'
949
955
  assert_xpath '//articleinfo/author', output, 0
950
956
  assert_xpath '//articleinfo/authorgroup', output, 1
951
957
  assert_xpath '//articleinfo/authorgroup/author', output, 2
@@ -962,7 +968,7 @@ content
962
968
 
963
969
  Essential for catching road runners.
964
970
  EOS
965
- output = render_string input, :backend => 'docbook5'
971
+ output = convert_string input, :backend => 'docbook5'
966
972
  assert_xpath '/article/info/copyright', output, 1
967
973
  assert_xpath '/article/info/copyright/holder[text()="ACME, Inc."]', output, 1
968
974
  end
@@ -974,7 +980,7 @@ Essential for catching road runners.
974
980
 
975
981
  Essential for catching road runners.
976
982
  EOS
977
- output = render_string input, :backend => 'docbook5'
983
+ output = convert_string input, :backend => 'docbook5'
978
984
  assert_xpath '/article/info/copyright', output, 1
979
985
  assert_xpath '/article/info/copyright/holder[text()="ACME, Inc."]', output, 1
980
986
  assert_xpath '/article/info/copyright/year', output, 1
@@ -988,7 +994,7 @@ Essential for catching road runners.
988
994
 
989
995
  Essential for catching road runners.
990
996
  EOS
991
- output = render_string input, :backend => 'docbook5'
997
+ output = convert_string input, :backend => 'docbook5'
992
998
  assert_xpath '/article/info/copyright', output, 1
993
999
  assert_xpath '/article/info/copyright/holder[text()="ACME, Inc."]', output, 1
994
1000
  assert_xpath '/article/info/copyright/year', output, 1
@@ -1006,14 +1012,14 @@ Essential for catching road runners.
1006
1012
  assert_xpath '//*[@id="content"]', result, 1
1007
1013
  end
1008
1014
 
1009
- test 'does not render footer if nofooter is set' do
1015
+ test 'does not output footer if nofooter is set' do
1010
1016
  input = <<-EOS
1011
1017
  :nofooter:
1012
1018
 
1013
1019
  content
1014
1020
  EOS
1015
1021
 
1016
- result = render_string input
1022
+ result = convert_string input
1017
1023
  assert_xpath '//*[@id="footer"]', result, 0
1018
1024
  end
1019
1025
 
@@ -1042,7 +1048,7 @@ content
1042
1048
  content
1043
1049
  EOS
1044
1050
 
1045
- result = render_embedded_string input, :attributes => {'notitle!' => ''}
1051
+ result = convert_string_to_embedded input, :attributes => {'notitle!' => ''}
1046
1052
  assert_xpath '/html', result, 0
1047
1053
  assert_xpath '/h1', result, 1
1048
1054
  assert_xpath '/*[@id="header"]', result, 0
@@ -1059,7 +1065,7 @@ content
1059
1065
  content
1060
1066
  EOS
1061
1067
 
1062
- result = render_embedded_string input, :attributes => {'showtitle' => ''}
1068
+ result = convert_string_to_embedded input, :attributes => {'showtitle' => ''}
1063
1069
  assert_xpath '/html', result, 0
1064
1070
  assert_xpath '/h1', result, 1
1065
1071
  assert_xpath '/*[@id="header"]', result, 0
@@ -1086,14 +1092,14 @@ preamble
1086
1092
  assert_equal 0, doc.blocks.size
1087
1093
  end
1088
1094
 
1089
- test 'renders footnotes in footer' do
1095
+ test 'outputs footnotes in footer' do
1090
1096
  input = <<-EOS
1091
1097
  A footnote footnote:[An example footnote.];
1092
1098
  a second footnote with a reference ID footnoteref:[note2,Second footnote.];
1093
1099
  finally a reference to the second footnote footnoteref:[note2].
1094
1100
  EOS
1095
1101
 
1096
- output = render_string input
1102
+ output = convert_string input
1097
1103
  assert_css '#footnotes', output, 1
1098
1104
  assert_css '#footnotes .footnote', output, 2
1099
1105
  assert_css '#footnotes .footnote#_footnotedef_1', output, 1
@@ -1106,12 +1112,12 @@ finally a reference to the second footnote footnoteref:[note2].
1106
1112
  assert_equal '. Second footnote.', text.text.strip
1107
1113
  end
1108
1114
 
1109
- test 'renders footnotes block in embedded document by default' do
1115
+ test 'outputs footnotes block in embedded document by default' do
1110
1116
  input = <<-EOS
1111
1117
  Text that has supporting information{empty}footnote:[An example footnote.].
1112
1118
  EOS
1113
1119
 
1114
- output = render_embedded_string input
1120
+ output = convert_string_to_embedded input
1115
1121
  assert_css '#footnotes', output, 1
1116
1122
  assert_css '#footnotes .footnote', output, 1
1117
1123
  assert_css '#footnotes .footnote#_footnotedef_1', output, 1
@@ -1120,12 +1126,12 @@ Text that has supporting information{empty}footnote:[An example footnote.].
1120
1126
  assert_equal '. An example footnote.', text.text.strip
1121
1127
  end
1122
1128
 
1123
- test 'does not render footnotes block in embedded document if nofootnotes attribute is set' do
1129
+ test 'does not output footnotes block in embedded document if nofootnotes attribute is set' do
1124
1130
  input = <<-EOS
1125
1131
  Text that has supporting information{empty}footnote:[An example footnote.].
1126
1132
  EOS
1127
1133
 
1128
- output = render_embedded_string input, :attributes => {'nofootnotes' => ''}
1134
+ output = convert_string_to_embedded input, :attributes => {'nofootnotes' => ''}
1129
1135
  assert_css '#footnotes', output, 0
1130
1136
  end
1131
1137
  end
@@ -1167,13 +1173,13 @@ image::inner.png[]
1167
1173
  images = doc.catalog[:images]
1168
1174
  refute_empty images
1169
1175
  assert_equal 2, images.size
1170
- assert_equal images, ['outer.png', 'inner.png']
1176
+ assert_equal images.map {|it| it.target }, ['outer.png', 'inner.png']
1171
1177
  end
1172
1178
  end
1173
1179
 
1174
1180
  context 'Backends and Doctypes' do
1175
1181
  test 'html5 backend doctype article' do
1176
- result = render_string("= Title\n\nparagraph", :attributes => {'backend' => 'html5'})
1182
+ result = convert_string("= Title\n\nparagraph", :attributes => {'backend' => 'html5'})
1177
1183
  assert_xpath '/html', result, 1
1178
1184
  assert_xpath '/html/body[@class="article"]', result, 1
1179
1185
  assert_xpath '/html//*[@id="header"]/h1[text() = "Title"]', result, 1
@@ -1181,7 +1187,7 @@ image::inner.png[]
1181
1187
  end
1182
1188
 
1183
1189
  test 'html5 backend doctype book' do
1184
- result = render_string("= Title\n\nparagraph", :attributes => {'backend' => 'html5', 'doctype' => 'book'})
1190
+ result = convert_string("= Title\n\nparagraph", :attributes => {'backend' => 'html5', 'doctype' => 'book'})
1185
1191
  assert_xpath '/html', result, 1
1186
1192
  assert_xpath '/html/body[@class="book"]', result, 1
1187
1193
  assert_xpath '/html//*[@id="header"]/h1[text() = "Title"]', result, 1
@@ -1238,7 +1244,7 @@ content
1238
1244
 
1239
1245
  ---
1240
1246
  EOS
1241
- result = render_embedded_string input, :safe => :safe
1247
+ result = convert_string_to_embedded input, :safe => :safe
1242
1248
  assert_equal '<hr>', result
1243
1249
  end
1244
1250
 
@@ -1289,7 +1295,7 @@ two
1289
1295
 
1290
1296
  '''
1291
1297
  EOS
1292
- result = render_string input, :safe => :safe, :backend => :xhtml
1298
+ result = convert_string input, :safe => :safe, :backend => :xhtml
1293
1299
  begin
1294
1300
  Nokogiri::XML::Document.parse(result) {|config|
1295
1301
  config.options = Nokogiri::XML::ParseOptions::STRICT | Nokogiri::XML::ParseOptions::NONET
@@ -1303,7 +1309,7 @@ two
1303
1309
  input = <<-EOS
1304
1310
  content
1305
1311
  EOS
1306
- result = render_string input, :safe => :safe, :backend => :xhtml, :keep_namespaces => true
1312
+ result = convert_string input, :safe => :safe, :backend => :xhtml, :keep_namespaces => true
1307
1313
  assert_xpath '//*[not(namespace-uri() = "http://www.w3.org/1999/xhtml")]', result, 0
1308
1314
  end
1309
1315
 
@@ -1317,7 +1323,7 @@ preamble
1317
1323
 
1318
1324
  section body
1319
1325
  EOS
1320
- result = render_string(input, :attributes => {'backend' => 'docbook45'})
1326
+ result = convert_string(input, :attributes => {'backend' => 'docbook45'})
1321
1327
  assert_xpath '/article', result, 1
1322
1328
  assert_xpath '/article/articleinfo/title[text() = "Title"]', result, 1
1323
1329
  assert_xpath '/article/simpara[text() = "preamble"]', result, 1
@@ -1327,14 +1333,14 @@ section body
1327
1333
  end
1328
1334
 
1329
1335
  test 'docbook45 backend doctype article no title' do
1330
- result = render_string('text', :attributes => {'backend' => 'docbook45'})
1336
+ result = convert_string('text', :attributes => {'backend' => 'docbook45'})
1331
1337
  assert_xpath '/article', result, 1
1332
1338
  assert_xpath '/article/articleinfo/date', result, 1
1333
1339
  assert_xpath '/article/simpara[text() = "text"]', result, 1
1334
1340
  end
1335
1341
 
1336
1342
  test 'docbook45 backend doctype article no xmlns' do
1337
- result = render_string('text', :keep_namespaces => true, :attributes => {'backend' => 'docbook45', 'doctype' => 'article'})
1343
+ result = convert_string('text', :keep_namespaces => true, :attributes => {'backend' => 'docbook45', 'doctype' => 'article'})
1338
1344
  refute_match(RE_XMLNS_ATTRIBUTE, result)
1339
1345
  end
1340
1346
 
@@ -1354,7 +1360,7 @@ some text
1354
1360
 
1355
1361
  section body
1356
1362
  EOS
1357
- result = render_string(input, :attributes => {'backend' => 'docbook45', 'doctype' => 'manpage'})
1363
+ result = convert_string(input, :attributes => {'backend' => 'docbook45', 'doctype' => 'manpage'})
1358
1364
  assert_xpath '/refentry', result, 1
1359
1365
  assert_xpath '/refentry/refentryinfo/title[text() = "asciidoctor(1)"]', result, 1
1360
1366
  assert_xpath '/refentry/refmeta/refentrytitle[text() = "asciidoctor"]', result, 1
@@ -1378,7 +1384,7 @@ preamble
1378
1384
 
1379
1385
  chapter body
1380
1386
  EOS
1381
- result = render_string(input, :attributes => {'backend' => 'docbook45', 'doctype' => 'book'})
1387
+ result = convert_string(input, :attributes => {'backend' => 'docbook45', 'doctype' => 'book'})
1382
1388
  assert_xpath '/book', result, 1
1383
1389
  assert_xpath '/book/bookinfo/title[text() = "Title"]', result, 1
1384
1390
  assert_xpath '/book/preface/simpara[text() = "preamble"]', result, 1
@@ -1388,7 +1394,7 @@ chapter body
1388
1394
  end
1389
1395
 
1390
1396
  test 'docbook45 backend doctype book no title' do
1391
- result = render_string('text', :attributes => {'backend' => 'docbook45', 'doctype' => 'book'})
1397
+ result = convert_string('text', :attributes => {'backend' => 'docbook45', 'doctype' => 'book'})
1392
1398
  assert_xpath '/book', result, 1
1393
1399
  assert_xpath '/book/bookinfo/date', result, 1
1394
1400
  # NOTE simpara cannot be a direct child of book, so content must be treated as a preface
@@ -1396,7 +1402,7 @@ chapter body
1396
1402
  end
1397
1403
 
1398
1404
  test 'docbook45 backend doctype book no xmlns' do
1399
- result = render_string('text', :keep_namespaces => true, :attributes => {'backend' => 'docbook45', 'doctype' => 'book'})
1405
+ result = convert_string('text', :keep_namespaces => true, :attributes => {'backend' => 'docbook45', 'doctype' => 'book'})
1400
1406
  refute_match(RE_XMLNS_ATTRIBUTE, result)
1401
1407
  end
1402
1408
 
@@ -1407,7 +1413,7 @@ chapter body
1407
1413
 
1408
1414
  text
1409
1415
  EOS
1410
- result = render_string input, :backend => 'docbook45'
1416
+ result = convert_string input, :backend => 'docbook45'
1411
1417
  assert_xpath '/book', result, 1
1412
1418
  assert_xpath '/book/bookinfo/title[text() = "Document Title"]', result, 1
1413
1419
  assert_xpath '/book/bookinfo/subtitle[text() = "Subtitle"]', result, 1
@@ -1424,7 +1430,7 @@ preamble
1424
1430
 
1425
1431
  section body
1426
1432
  EOS
1427
- result = render_string(input, :keep_namespaces => true, :attributes => {'backend' => 'docbook5'})
1433
+ result = convert_string(input, :keep_namespaces => true, :attributes => {'backend' => 'docbook5'})
1428
1434
  assert_xpath '/xmlns:article', result, 1
1429
1435
  doc = xmlnodes_at_xpath('/xmlns:article', result, 1)
1430
1436
  assert_equal 'http://docbook.org/ns/docbook', doc.namespaces['xmlns']
@@ -1460,7 +1466,7 @@ some text
1460
1466
 
1461
1467
  section body
1462
1468
  EOS
1463
- result = render_string(input, :keep_namespaces => true, :attributes => {'backend' => 'docbook5', 'doctype' => 'manpage'})
1469
+ result = convert_string(input, :keep_namespaces => true, :attributes => {'backend' => 'docbook5', 'doctype' => 'manpage'})
1464
1470
  assert_xpath '/xmlns:refentry', result, 1
1465
1471
  doc = xmlnodes_at_xpath('/xmlns:refentry', result, 1)
1466
1472
  assert_equal 'http://docbook.org/ns/docbook', doc.namespaces['xmlns']
@@ -1497,7 +1503,7 @@ asciidoctor - Process text
1497
1503
 
1498
1504
  some text
1499
1505
  EOS
1500
- result = render_string(input, :keep_namespaces => true, :attributes => {'backend' => 'docbook5', 'doctype' => 'manpage'})
1506
+ result = convert_string(input, :keep_namespaces => true, :attributes => {'backend' => 'docbook5', 'doctype' => 'manpage'})
1501
1507
  assert_xpath %(/xmlns:refentry/xmlns:refmeta/xmlns:refmiscinfo[@class="source"][text() = "#{decode_char 160}"]), result, 1
1502
1508
  assert_xpath %(/xmlns:refentry/xmlns:refmeta/xmlns:refmiscinfo[@class="manual"][text() = "#{decode_char 160}"]), result, 1
1503
1509
  end
@@ -1513,7 +1519,7 @@ preamble
1513
1519
 
1514
1520
  chapter body
1515
1521
  EOS
1516
- result = render_string(input, :keep_namespaces => true, :attributes => {'backend' => 'docbook5', 'doctype' => 'book'})
1522
+ result = convert_string(input, :keep_namespaces => true, :attributes => {'backend' => 'docbook5', 'doctype' => 'book'})
1517
1523
  assert_xpath '/xmlns:book', result, 1
1518
1524
  doc = xmlnodes_at_xpath('/xmlns:book', result, 1)
1519
1525
  assert_equal 'http://docbook.org/ns/docbook', doc.namespaces['xmlns']
@@ -1549,7 +1555,7 @@ eve, islifeform - analyzes an image to determine if it's a picture of a life for
1549
1555
  *eve* ['OPTION']... 'FILE'...
1550
1556
  EOS
1551
1557
 
1552
- result = render_string input, :backend => 'docbook5'
1558
+ result = convert_string input, :backend => 'docbook5'
1553
1559
  assert_xpath '/refentry/refnamediv/refname', result, 2
1554
1560
  assert_xpath '(/refentry/refnamediv/refname)[1][text()="eve"]', result, 1
1555
1561
  assert_xpath '(/refentry/refnamediv/refname)[2][text()="islifeform"]', result, 1
@@ -1570,7 +1576,7 @@ preamble
1570
1576
  chapter body
1571
1577
  EOS
1572
1578
 
1573
- result = render_string input, :attributes => {'backend' => 'docbook5'}
1579
+ result = convert_string input, :attributes => {'backend' => 'docbook5'}
1574
1580
  assert_xpath '//info/cover[@role="front"]', result, 1
1575
1581
  assert_xpath '//info/cover[@role="front"]//imagedata[@fileref="images/front-cover.jpg"]', result, 1
1576
1582
  assert_xpath '//info/cover[@role="back"]', result, 1
@@ -1605,7 +1611,7 @@ Stuart Rackham <founder@asciidoc.org>
1605
1611
 
1606
1612
  more info...
1607
1613
  EOS
1608
- output = render_string input, :attributes => {'backend' => 'docbook45'}
1614
+ output = convert_string input, :attributes => {'backend' => 'docbook45'}
1609
1615
  assert_xpath '/article/articleinfo/authorinitials[text()="SJR"]', output, 1
1610
1616
  end
1611
1617
 
@@ -1735,7 +1741,7 @@ asciidoctor - converts AsciiDoc source files to HTML, DocBook and other formats
1735
1741
  *asciidoctor* ['OPTION']... 'FILE'..
1736
1742
  EOS
1737
1743
 
1738
- output = render_string input
1744
+ output = convert_string input
1739
1745
  assert_css 'body.manpage', output, 1
1740
1746
  assert_xpath '//body/*[@id="header"]/h1[text()="asciidoctor(1) Manual Page"]', output, 1
1741
1747
  assert_xpath '//body/*[@id="header"]/h1/following-sibling::h2[text()="NAME"]', output, 1
@@ -1760,7 +1766,7 @@ asciidoctor - converts AsciiDoc source files to HTML, DocBook and other formats
1760
1766
  *asciidoctor* ['OPTION']... 'FILE'..
1761
1767
  EOS
1762
1768
 
1763
- output = render_embedded_string input
1769
+ output = convert_string_to_embedded input
1764
1770
  assert_xpath '/h1[text()="asciidoctor(1) Manual Page"]', output, 1
1765
1771
  assert_xpath '/h1/following-sibling::h2[text()="NAME"]', output, 1
1766
1772
  assert_xpath '/h2[@id="_name"][text()="NAME"]', output, 1
@@ -1782,7 +1788,7 @@ asciidoctor - converts AsciiDoc source files to HTML, DocBook and other formats
1782
1788
  doc = empty_document
1783
1789
  secure_path = doc.normalize_asset_path naughty_path
1784
1790
  refute_equal naughty_path, secure_path
1785
- assert_equal (::File.join doc.base_dir, 'etc/passwd'), secure_path
1791
+ assert_equal ::File.join(doc.base_dir, 'etc/passwd'), secure_path
1786
1792
  assert_message logger, :WARN, 'path is outside of jail; recovering automatically'
1787
1793
  end
1788
1794
  end