asciidoctor-latex 1.5.0.2.dev → 1.5.0.3.dev

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +17 -0
  3. data/README.adoc +18 -4
  4. data/doc/Asciidoctor.html +131 -0
  5. data/doc/Asciidoctor/Block.html +1700 -0
  6. data/doc/Asciidoctor/Converter/Html5Converter.html +120 -0
  7. data/doc/Asciidoctor/Document.html +327 -0
  8. data/doc/Asciidoctor/Inline.html +594 -0
  9. data/doc/Asciidoctor/LaTeX.html +167 -0
  10. data/doc/Asciidoctor/LaTeX/Chem.html +210 -0
  11. data/doc/Asciidoctor/LaTeX/ChemInlineMacro.html +194 -0
  12. data/doc/Asciidoctor/LaTeX/ClickBlock.html +344 -0
  13. data/doc/Asciidoctor/LaTeX/ClickStyleInsert.html +283 -0
  14. data/doc/Asciidoctor/LaTeX/Converter.html +321 -0
  15. data/doc/Asciidoctor/LaTeX/Dollar.html +203 -0
  16. data/doc/Asciidoctor/LaTeX/EntToUni.html +194 -0
  17. data/doc/Asciidoctor/LaTeX/EnvironmentBlock.html +420 -0
  18. data/doc/Asciidoctor/LaTeX/HTMLPostprocessor.html +204 -0
  19. data/doc/Asciidoctor/LaTeX/Html5ConverterExtensions.html +905 -0
  20. data/doc/Asciidoctor/LaTeX/InjectHTML.html +192 -0
  21. data/doc/Asciidoctor/LaTeX/MacroInsert.html +300 -0
  22. data/doc/Asciidoctor/LaTeX/TeXBlock.html +644 -0
  23. data/doc/Asciidoctor/LaTeX/TeXPostProcess.html +504 -0
  24. data/doc/Asciidoctor/LaTeX/TeXPreprocessor.html +287 -0
  25. data/doc/Asciidoctor/LaTeX/TexPostprocessor.html +209 -0
  26. data/doc/Asciidoctor/List.html +483 -0
  27. data/doc/Asciidoctor/Section.html +219 -0
  28. data/doc/Asciidoctor/Table.html +227 -0
  29. data/doc/PreambleProcessor.html +202 -0
  30. data/doc/String.html +587 -0
  31. data/doc/_index.html +382 -0
  32. data/doc/class_list.html +58 -0
  33. data/doc/css/common.css +1 -0
  34. data/doc/css/full_list.css +57 -0
  35. data/doc/css/style.css +339 -0
  36. data/doc/file.LICENSE.html +96 -0
  37. data/doc/file.README.html +335 -0
  38. data/doc/file.manual.html +479 -0
  39. data/doc/file_list.html +63 -0
  40. data/doc/frames.html +26 -0
  41. data/doc/index.html +335 -0
  42. data/doc/js/app.js +219 -0
  43. data/doc/js/full_list.js +181 -0
  44. data/doc/js/jquery.js +4 -0
  45. data/doc/method_list.html +549 -0
  46. data/doc/top-level-namespace.html +114 -0
  47. data/lib/asciidoctor/latex/converter.rb +2 -4
  48. data/lib/asciidoctor/latex/tex_preprocessor.rb +19 -4
  49. data/lib/asciidoctor/latex/version.rb +1 -1
  50. data/test/examples/adoc/exponent1.adoc +2 -0
  51. data/test/examples/adoc/exponent2.adoc +4 -0
  52. data/test/examples/adoc/macro_underscore.adoc +5 -0
  53. data/test/examples/adoc/math.adoc +2 -2
  54. metadata +51 -29
  55. data/rspec/README.adoc +0 -45
  56. data/rspec/a.rb +0 -79
  57. data/rspec/b.rb +0 -111
  58. data/rspec/c.rb +0 -121
  59. data/rspec/data/tex1 +0 -65
  60. data/rspec/data/tex2 +0 -5
  61. data/rspec/data/tex2.expect +0 -5
  62. data/rspec/transform.rb +0 -36
  63. data/spec/README.adoc +0 -45
  64. data/spec/a.rb +0 -79
  65. data/spec/b.rb +0 -111
  66. data/spec/c.rb +0 -121
  67. data/spec/data/foo +0 -1
  68. data/spec/data/lorem +0 -1
  69. data/spec/data/tex1 +0 -65
  70. data/spec/data/tex2 +0 -5
  71. data/spec/data/tex2.expect +0 -5
  72. data/spec/transform.rb +0 -36
@@ -0,0 +1,114 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Top Level Namespace
8
+
9
+ &mdash; Asciidoctor LaTeX Documentation
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!top-level-namespace.html";
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index</a> &raquo;
35
+
36
+
37
+ <span class="title">Top Level Namespace</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Top Level Namespace
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ </dl>
82
+ <div class="clear"></div>
83
+
84
+ <h2>Defined Under Namespace</h2>
85
+ <p class="children">
86
+
87
+
88
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Asciidoctor.html" title="Asciidoctor (module)">Asciidoctor</a></span>
89
+
90
+
91
+
92
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="PreambleProcessor.html" title="PreambleProcessor (class)">PreambleProcessor</a></span>, <span class='object_link'><a href="String.html" title="String (class)">String</a></span>
93
+
94
+
95
+ </p>
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+ </div>
106
+
107
+ <div id="footer">
108
+ Generated on Sun Apr 19 18:37:45 2015 by
109
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
110
+ 0.8.7.6 (ruby-2.1.2).
111
+ </div>
112
+
113
+ </body>
114
+ </html>
@@ -189,7 +189,6 @@ module Asciidoctor::LaTeX
189
189
  end
190
190
 
191
191
  def click node
192
-
193
192
  node.lines = [ENV_CSS] + node.lines + [DIV_END]
194
193
  node.attributes['roles'] = (node.roles + ['click']) * ' '
195
194
  self.open node
@@ -336,7 +335,6 @@ module Asciidoctor::LaTeX
336
335
  end
337
336
 
338
337
 
339
-
340
338
  TOP_TYPES = %w(document section)
341
339
  LIST_TYPES = %w(dlist olist ulist colist)
342
340
  INLINE_TYPES = %w(inline_anchor inline_break inline_footnote inline_quoted inline_callout)
@@ -365,8 +363,8 @@ module Asciidoctor::LaTeX
365
363
 
366
364
  end
367
365
 
368
- end
369
- end
366
+ end # class Converter
367
+ end # module Asciidoctor::LaTeX
370
368
 
371
369
 
372
370
  class Asciidoctor::Converter::Html5Converter
@@ -49,12 +49,27 @@ module Asciidoctor::LaTeX
49
49
  if line.include? '$'
50
50
  line = line.gsub TEX_DOLLAR_RX, TEX_DOLLAR_SUB2
51
51
  end
52
- if line.include? '^\\['
53
- line = line.gsub '\\[', '+\\['
52
+ # protect math, e.g., (a^2)^3 from Asciidoc subsitutions:
53
+ if line =~ /^\\\[/
54
+ line = line.gsub /^\\\[/, '+\\['
54
55
  end
55
- if line.include? '^\\]'
56
- line = line.gsub '\\]', '\\]+'
56
+ if line =~ /^\\\]/
57
+ line = line.gsub /^\\\]/, '\\]+'
57
58
  end
59
+ # We would like to ensure that underscores in names,
60
+ # e.g., MACRO_NAME, do not cause LaTeX bugs. However,
61
+ # the code below introduces a more serious bug: expressons
62
+ # lik4 $\int_0^1 x^n dx$ are mapped to $\int\_0^1 x^n dx$.
63
+ # I'm not sure this problem can be solved using regex's:
64
+ # we need to apply a substitution to a line when there is a match
65
+ # with '_' AND the word containing the '_' IS NOT in any enclosng
66
+ # $ ... $ or \[ ... \]. If we had a parser that would recognize
67
+ # $ ... $ and \[ ... \] and build them into the AST as nodes,
68
+ # then there would be an easy solution. This issue may
69
+ # have to wait.
70
+ # if line =~ /_/
71
+ # line = line.gsub /_/, '\_'
72
+ # end
58
73
  line
59
74
  end
60
75
  reader.unshift_lines replacement_lines
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module LaTeX
3
- VERSION = '1.5.0.2.dev'
3
+ VERSION = '1.5.0.3.dev'
4
4
  end
5
5
  end
@@ -0,0 +1,2 @@
1
+ //.expnent1
2
+ $(a^2)^3 = 1$
@@ -0,0 +1,4 @@
1
+ //.exponent2
2
+ \[
3
+ (a^2)^3 = 1
4
+ \]
@@ -0,0 +1,5 @@
1
+ //.macro_underscore
2
+ === Underscore use bug
3
+
4
+ [quote]
5
+ This is a quote which uses a MACRO_NAME to trigger a bug
@@ -7,6 +7,6 @@ Some finance: that theorem costs \$100!
7
7
 
8
8
  An integral:
9
9
 
10
- \[
10
+ \[
11
11
  \int_0^1 x^n dx = \frac{1}{n+1}
12
- \]
12
+ \]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-latex
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0.2.dev
4
+ version: 1.5.0.3.dev
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Carlson
@@ -90,6 +90,7 @@ executables:
90
90
  extensions: []
91
91
  extra_rdoc_files: []
92
92
  files:
93
+ - CHANGELOG.adoc
93
94
  - LICENSE.adoc
94
95
  - README.adoc
95
96
  - Rakefile
@@ -98,6 +99,49 @@ files:
98
99
  - data/extras.css
99
100
  - data/preamble_article.tex
100
101
  - data/preamble_book.tex
102
+ - doc/Asciidoctor.html
103
+ - doc/Asciidoctor/Block.html
104
+ - doc/Asciidoctor/Converter/Html5Converter.html
105
+ - doc/Asciidoctor/Document.html
106
+ - doc/Asciidoctor/Inline.html
107
+ - doc/Asciidoctor/LaTeX.html
108
+ - doc/Asciidoctor/LaTeX/Chem.html
109
+ - doc/Asciidoctor/LaTeX/ChemInlineMacro.html
110
+ - doc/Asciidoctor/LaTeX/ClickBlock.html
111
+ - doc/Asciidoctor/LaTeX/ClickStyleInsert.html
112
+ - doc/Asciidoctor/LaTeX/Converter.html
113
+ - doc/Asciidoctor/LaTeX/Dollar.html
114
+ - doc/Asciidoctor/LaTeX/EntToUni.html
115
+ - doc/Asciidoctor/LaTeX/EnvironmentBlock.html
116
+ - doc/Asciidoctor/LaTeX/HTMLPostprocessor.html
117
+ - doc/Asciidoctor/LaTeX/Html5ConverterExtensions.html
118
+ - doc/Asciidoctor/LaTeX/InjectHTML.html
119
+ - doc/Asciidoctor/LaTeX/MacroInsert.html
120
+ - doc/Asciidoctor/LaTeX/TeXBlock.html
121
+ - doc/Asciidoctor/LaTeX/TeXPostProcess.html
122
+ - doc/Asciidoctor/LaTeX/TeXPreprocessor.html
123
+ - doc/Asciidoctor/LaTeX/TexPostprocessor.html
124
+ - doc/Asciidoctor/List.html
125
+ - doc/Asciidoctor/Section.html
126
+ - doc/Asciidoctor/Table.html
127
+ - doc/PreambleProcessor.html
128
+ - doc/String.html
129
+ - doc/_index.html
130
+ - doc/class_list.html
131
+ - doc/css/common.css
132
+ - doc/css/full_list.css
133
+ - doc/css/style.css
134
+ - doc/file.LICENSE.html
135
+ - doc/file.README.html
136
+ - doc/file.manual.html
137
+ - doc/file_list.html
138
+ - doc/frames.html
139
+ - doc/index.html
140
+ - doc/js/app.js
141
+ - doc/js/full_list.js
142
+ - doc/js/jquery.js
143
+ - doc/method_list.html
144
+ - doc/top-level-namespace.html
101
145
  - examples/README.adoc
102
146
  - examples/box.adoc
103
147
  - examples/chem.adoc
@@ -132,32 +176,17 @@ files:
132
176
  - lib/asciidoctor/latex/tex_postprocessor.rb
133
177
  - lib/asciidoctor/latex/tex_preprocessor.rb
134
178
  - lib/asciidoctor/latex/version.rb
135
- - rspec/README.adoc
136
- - rspec/a.rb
137
- - rspec/b.rb
138
- - rspec/c.rb
139
- - rspec/data/tex1
140
- - rspec/data/tex2
141
- - rspec/data/tex2.expect
142
- - rspec/transform.rb
143
- - spec/README.adoc
144
- - spec/a.rb
145
- - spec/b.rb
146
- - spec/c.rb
147
- - spec/data/foo
148
- - spec/data/lorem
149
- - spec/data/tex1
150
- - spec/data/tex2
151
- - spec/data/tex2.expect
152
- - spec/transform.rb
153
179
  - test/examples/adoc/admonition.adoc
154
180
  - test/examples/adoc/box.adoc
155
181
  - test/examples/adoc/env.adoc
156
182
  - test/examples/adoc/eq.adoc
157
183
  - test/examples/adoc/eqalign.adoc
184
+ - test/examples/adoc/exponent1.adoc
185
+ - test/examples/adoc/exponent2.adoc
158
186
  - test/examples/adoc/line_break.adoc
159
187
  - test/examples/adoc/listing.adoc
160
188
  - test/examples/adoc/literal.adoc
189
+ - test/examples/adoc/macro_underscore.adoc
161
190
  - test/examples/adoc/math.adoc
162
191
  - test/examples/adoc/open_block.adoc
163
192
  - test/examples/adoc/page_break.adoc
@@ -214,24 +243,17 @@ signing_key:
214
243
  specification_version: 4
215
244
  summary: Converts AsciiDoc documents to LaTeX, provides LaTeX extensions to Asciidoc
216
245
  test_files:
217
- - spec/README.adoc
218
- - spec/a.rb
219
- - spec/b.rb
220
- - spec/c.rb
221
- - spec/data/foo
222
- - spec/data/lorem
223
- - spec/data/tex1
224
- - spec/data/tex2
225
- - spec/data/tex2.expect
226
- - spec/transform.rb
227
246
  - test/examples/adoc/admonition.adoc
228
247
  - test/examples/adoc/box.adoc
229
248
  - test/examples/adoc/env.adoc
230
249
  - test/examples/adoc/eq.adoc
231
250
  - test/examples/adoc/eqalign.adoc
251
+ - test/examples/adoc/exponent1.adoc
252
+ - test/examples/adoc/exponent2.adoc
232
253
  - test/examples/adoc/line_break.adoc
233
254
  - test/examples/adoc/listing.adoc
234
255
  - test/examples/adoc/literal.adoc
256
+ - test/examples/adoc/macro_underscore.adoc
235
257
  - test/examples/adoc/math.adoc
236
258
  - test/examples/adoc/open_block.adoc
237
259
  - test/examples/adoc/page_break.adoc
data/rspec/README.adoc DELETED
@@ -1,45 +0,0 @@
1
- == rspec
2
-
3
- At the moment there is just one set of tests, in
4
- `transform_spec.rb`, which test a tiny piece
5
- of a small part of the code. This is the
6
- `gsub` call in the `TeXPreprocessor`.
7
-
8
- I had been having some trouble with
9
- instances of $ ... $ not being mapped
10
- properly, and I think I've narrowd it down
11
- to a few small edge cases -- I am trying
12
- to collect these in the wild, as welll
13
- as t imagine them.
14
-
15
- I've organized the files as `a.rb`. `b.rb`,
16
- and `c.rb`. The first two pass, the third
17
- deos not. The strings that I try the
18
- transformer on in `c.rb` are only a few
19
- characters long.
20
-
21
- === Help
22
-
23
- @mojavelinux, my knowledge of regular expressions is not
24
- so great -- could you look at this?
25
-
26
- Please note that I had changed the output regular expression:
27
-
28
- ----
29
- TEX_DOLLAR_SUB = '\1\\\(\2\\\)\3'
30
- TEX_DOLLAR_SUB2 = '\1latexmath:[\2]\3'
31
- ----
32
-
33
- using the first, rather than the second, which is your original. I don't
34
- think that that is the problem -- it must be in the
35
- recognizer,
36
-
37
- ----
38
- TEX_DOLLAR_RX = /(^|\s|\()\$(.*?)\$($|\s|\)|,|\.)/
39
- ----
40
-
41
- We can change back to (2), though I must say I like
42
- (1) better since it parallels `\[ ... \]` and is more
43
- succinct. Is there any difference in their function or
44
- behavior _vis a vis_ Asciidoctor, i.e., in being
45
- protected from substitution?
data/rspec/a.rb DELETED
@@ -1,79 +0,0 @@
1
- require 'asciidoctor'
2
- require 'asciidoctor/latex'
3
- require 'asciidoctor/latex/core_ext/colored_string'
4
- require_relative 'transform'
5
-
6
- include Transform
7
-
8
- VERBOSE = true
9
-
10
- def compare_transform input, expected_output, transfomer
11
-
12
- warn ' ' if VERBOSE
13
- warn input.blue if VERBOSE
14
- warn expected_output.cyan if VERBOSE
15
- output = Transform.map_string input, transfomer
16
- warn output.blue if VERBOSE
17
- warn ' ' if VERBOSE
18
- expect(output).to eq expected_output
19
-
20
- end
21
-
22
-
23
- describe Transform do
24
-
25
- before :each do
26
-
27
- end
28
-
29
- it 'reads the contents of a file into a string (A1)' do
30
-
31
- contents = Transform.read_string 'data/foo'
32
- expect(contents.chomp).to eq 'foo.bar'
33
-
34
- end
35
-
36
- it 'implements the identity transform on strings (A2)' do
37
-
38
- input = 'foo'
39
- output = Transform.map_string input, $identity
40
- expect(input).to eq output
41
-
42
- end
43
-
44
- it 'maps dollar-delimted strings to escapa-paren delimited strings (A3)' do
45
-
46
- input = 'ha ha ha $a^2 = 1$ ho ho ho'
47
- expected_output = 'ha ha ha \\(a^2 = 1\\) ho ho ho'
48
- compare_transform input, expected_output, $fixmath
49
-
50
- end
51
-
52
- it 'maps dollar-delimted strings to latexmath-delimited strings' do
53
-
54
- input = 'ha ha ha $a^2 = 1$ ho ho ho'
55
- expected_output = 'ha ha ha latexmath:[a^2 = 1] ho ho ho'
56
- compare_transform input, expected_output, $fixmath2
57
-
58
- end
59
-
60
-
61
- it 'reads strings from files' do
62
-
63
- input = Transform.read_string 'data/lorem'
64
- expect(input.length).to be > 0
65
-
66
- end
67
-
68
- it 'implements the identity transform on files' do
69
-
70
- Transform.map_file 'data/lorem', 'data/tmp', $identity
71
- original_content = Transform.read_string 'data/lorem'
72
- transformed_content = Transform.read_string 'data/tmp'
73
- expect(transformed_content).to eq original_content
74
-
75
- end
76
-
77
-
78
-
79
- end