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
data/rspec/b.rb DELETED
@@ -1,111 +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
-
30
-
31
- it 'handles the edge case of a dollar sign at the beginning of the line (A)' do
32
-
33
- input = '$a^2 = 1$ ho ho ho'
34
- expected_output = '\\(a^2 = 1\\) ho ho ho'
35
- compare_transform input, expected_output, $fixmath
36
-
37
- end
38
-
39
- it 'handles the edge case of a dollar sign at the beginning of the line in latexmath (B)' do
40
-
41
- input = '$a^2 = 1$ ho ho ho'
42
- expected_output = 'latexmath:[a^2 = 1] ho ho ho'
43
- compare_transform input, expected_output, $fixmath2
44
-
45
- end
46
-
47
- it 'handles the edge case of a dollar sign at the end of the line (C)' do
48
-
49
- input = 'ha ha ha $a^2 = 1$'
50
- expected_output = 'ha ha ha \\(a^2 = 1\\)'
51
- compare_transform input, expected_output, $fixmath
52
-
53
- end
54
-
55
- it 'handles the edge case of a dollar sign at the end of the line wth latexmath (D)' do
56
-
57
- input = 'ha ha ha $a^2 = 1$'
58
- expected_output = 'ha ha ha latexmath:[a^2 = 1]'
59
- compare_transform input, expected_output, $fixmath2
60
-
61
- end
62
-
63
- it 'handles the edge case of a dollar sign at the beginnng and end of the line (E)' do
64
-
65
- input = '$a^2 = 1$'
66
- expected_output = '\\(a^2 = 1\\)'
67
- compare_transform input, expected_output, $fixmath
68
-
69
- end
70
-
71
- it 'handles the edge case of a dollar sign at the beginnng and end of the line plus a little space in mode 2 (F)' do
72
-
73
- input = ' $a^2 = 1 $'
74
- expected_output = ' latexmath:[a^2 = 1]'
75
- compare_transform input, expected_output, $fixmath2
76
-
77
- end
78
-
79
- it 'handles the edge case of a dollar sign at the beginnng and end of the line in mode 2 (G)' do
80
-
81
- input = '$a^2 = 1$'
82
- expected_output = 'latexmath:[a^2 = 1]'
83
- compare_transform input, expected_output, $fixmath2
84
-
85
- end
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
- =begin
95
- it 'applies the fixmath transform to files to files' do
96
-
97
- Transform.map_file 'data/tex2', 'data/tmp', $fixmath
98
-
99
- original_content = Transform.read_string 'data/tex2'
100
- transformed_content = Transform.read_string 'data/tmp'
101
- expected_content = Transform.read_string 'data/tex2.expect'
102
-
103
- warn ('|||'+original_content+'|||').blue if VERBOSE
104
- warn ('|||'+transformed_content+'|||').cyan if VERBOSE
105
- warn ('|||'+expected_content+'|||').blue if VERBOSE
106
- expect(transformed_content).to eq expected_content
107
- end
108
- =end
109
-
110
-
111
- end
data/rspec/c.rb DELETED
@@ -1,121 +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
-
30
- it 'maps the text "$x$" correctly (A)' do
31
-
32
- input = '$x$'
33
- expected_output = '\(x\)'
34
- compare_transform input, expected_output, $fixmath
35
-
36
- end
37
-
38
- it 'maps the text "$x$?" correctly (B)' do
39
-
40
- input = '$x$?'
41
- expected_output = '\(x\)?'
42
- compare_transform input, expected_output, $fixmath
43
-
44
- end
45
-
46
- it 'maps the text "$x$-axis" correctly (C)' do
47
-
48
- input = '$x$?-axis'
49
- expected_output = '\(x\)-axis'
50
- compare_transform input, expected_output, $fixmath
51
-
52
- end
53
-
54
- it 'maps the text "$Fe^{3+}$" correctly (D)' do
55
-
56
- input = '$Fe^{3+}$'
57
- expected_output = '\(Fe^{3+}\)'
58
- compare_transform input, expected_output, $fixmath
59
-
60
- end
61
-
62
- it 'maps the text "$Cr^{+2}$ $Fe^{3+}$" correctly (E)' do
63
-
64
- input = '$Cr^{+2}$ $Fe^{3+}$'
65
- expected_output = '\(Cr^{+2}\) \(Fe^{3+}\)'
66
- compare_transform input, expected_output, $fixmath
67
-
68
- end
69
-
70
- it 'maps the text "$\pi:U^+ \map U$" correctly (E)' do
71
-
72
- input = '$\pi:U^+ \map U$'
73
- expected_output = '\(\pi:U^+ \map U\)'
74
- compare_transform input, expected_output, $fixmath
75
-
76
- end
77
-
78
- it 'maps the text "$\pi^{-1}(U) = U^+ \cup U^-" correctly (E)' do
79
-
80
- input = '$\pi^{-1}(U) = U^+ \cup U^-$'
81
- expected_output = '\(\pi^{-1}(U) = U^+ \cup U^-\)'
82
- compare_transform input, expected_output, $fixmath
83
-
84
- end
85
-
86
- it 'maps the text "Then $\pi^{-1}(U) = U^+ \cup U^-$ is the disjoint union of two\nopen sets and $\pi:U^+ \map U$ is a local coordinate." correctly (E)' do
87
-
88
- input = 'Then $\pi^{-1}(U) = U^+ \cup U^-$ is the disjoint union of two\nopen sets and $\pi:U^+ \map U$ is a local coordinate.'
89
- expected_output = 'Then \(\pi^{-1}(U) = U^+ \cup U^-\) is the disjoint union of two\nopen sets and \(\pi:U^+ \map U\) is a local coordinate.'
90
- compare_transform input, expected_output, $fixmath
91
-
92
- end
93
-
94
- it 'parses a complicated expression correctly (1)' do
95
-
96
- input = <<EOF
97
- iLet $a$ be a point of the set $\\CC - B$ let $U$ be a neighborhood of $a$ in
98
- that set. Then $\pi^{-1}(U) = U^+ \\cup U^-$ is the disjoint union of two
99
- open sets and $\pi:U^+ \map U$ is a local coordinate.
100
- EOF
101
-
102
- expected_output = <<EOF
103
- Let \(a\) be a point of the set \(\\CC - B\) let \(U\) be a neighborhood of \(a\) in
104
- that set. Then \(pi^{-1}(U) = U^+ \\cup U^-\) is the disjoint union of two
105
- open sets and \(\pi:U^+ \map U\)is a local coordinate.
106
- EOF
107
-
108
- compare_transform input, expected_output, $fixmath
109
-
110
- end
111
-
112
- it 'maps the text "Call these $y_+$ and $y_-$." correctly (E)' do
113
-
114
- input = 'Call these $y_+$ and $y_-$.'
115
- expected_output = 'Call these \(y_+\) and \(y_-\).'
116
- compare_transform input, expected_output, $fixmath
117
-
118
- end
119
-
120
-
121
- end
data/rspec/data/tex1 DELETED
@@ -1,65 +0,0 @@
1
- ==== The tautological and Hopf bundles
2
-
3
- Projective space may also be viewed as the quotient under
4
- a group action. Consider a space $Y$ and a group $G$. An
5
- action of $G$ on $Y$ is a map $G\times Y \map Y$,
6
- written $(g,y) \mapsto g.y$, that satisfies $e.y = y$ for all
7
- $y$, where $e$ is the neutral element, and $g.(h.y) = (gh).y$
8
- for all $g,h \in G$, $y \in Y$. The _orbit_ of point $y \in Y$
9
- under the action of $G$ is the set $G.y = \sett{g.y}{ g \in G}$.
10
- The quotient of $Y$ by $G$, written $Y/G$, is the set of orbits.
11
- Note that $Y/G$ is just the set of equivalence classes of elements
12
- of $Y$ under the relation $y' \sim y$ if there is an element $g \in G$
13
- such that $y' = g.y$.
14
-
15
- Returning to the construction of projective space,
16
- the map
17
- $(\lambda, Z) \mapsto \lambda Z$
18
- defines an
19
- action of the group $\CC^*$ on
20
- $\CC^{n+1} - \set{0}$, and
21
- \[
22
- \CP^n = (\CC^{n+1} - \set{0})\big/\CC^*
23
- \]
24
- is the quotient. If $p: \CC^{n+1} - \set{0} \map \CP^n$
25
- is the projection map, then the set
26
- \[
27
- p^{-1}([Z]) = \set{ Z \in [Z]} \cong \CC^*,
28
- \]
29
- the so-called
30
- _fiber_ of $p$ at $[Z]$ can be identified with $\CC^*$.
31
- This leads to the important diagram
32
- \[
33
- \CC^* \map \CC^{n+1} - \set{0} \mapright{p} \CP^n,
34
- \]
35
- which defines a $\CC^*$ bundle over $\CP^n$ called the
36
- _tautological bundle_.
37
- It plays a key role in the theory of projective varieties.
38
-
39
- FIG
40
-
41
- Consider now the unit sphere
42
- \[
43
- S^{2n+1} = \sett{ Z \in \CC^{n+1} } { ||Z|| = 1 }.
44
- \]
45
- It is stable under the action of unit circle subgroup
46
- \[
47
- U = \sett{ \lambda \in \CC}{ |\lambda| = 1 }.
48
- \]
49
- The natural map
50
- \[
51
- S^{2n+1} \map \CC^{n+1} - \set{0}
52
- \]
53
- restricts ot a map of quotient spaces
54
- \[
55
- S^{2n+1}/U \map (\CC^{n+1} - \set{0})/\CC^*,
56
- \]
57
- and it is easy to see that this map is an isomorphism.
58
- This gives a second presentation of projective space
59
- as the quotient of a sphere, and it leads to the famous
60
- _Hopf fibration_,
61
- \[
62
- S^1 \map S^{2n+1} \mapright{h} \CP^n.
63
- \]
64
- The Hopf map is, by the way, the generator of the homotopy
65
- group $\pi_3(S^2)$.
data/rspec/data/tex2 DELETED
@@ -1,5 +0,0 @@
1
- Returning to the construction of projective space,
2
- the map
3
- $(\lambda, Z) \mapsto \lambda Z$
4
- defines an
5
- action of the group $\CC^*$ on
@@ -1,5 +0,0 @@
1
- Returning to the construction of projective space,
2
- the map
3
- \(\lambda, Z) \mapsto \lambda Z\)
4
- defines an
5
- action of the group \()\CC^*\) on
data/rspec/transform.rb DELETED
@@ -1,36 +0,0 @@
1
- # TEX_DOLLAR_SUB = '\1latexmath:[\2]\3'
2
-
3
- module Transform
4
-
5
- # Map $...$ to stem:[...]
6
- # Map $...$ to \( ... \)
7
-
8
-
9
- TEX_DOLLAR_RX = /(^|\s|\()\$(.*?)\$($|\s|\)|,|\.)/
10
- TEX_DOLLAR_SUB = '\1\\\(\2\\\)\3'
11
- TEX_DOLLAR_SUB2 = '\1latexmath:[\2]\3'
12
-
13
- $fixmath = lambda { |x| x.gsub TEX_DOLLAR_RX, TEX_DOLLAR_SUB }
14
- $fixmath2 = lambda { |x| x.gsub TEX_DOLLAR_RX, TEX_DOLLAR_SUB2 }
15
-
16
- $identity = lambda { |x| x }
17
-
18
- def self.read_string in_file
19
- return File.open(in_file, 'r') { |f| f.read }
20
- end
21
-
22
- def self.map_string str, transformer
23
- return transformer.call str
24
- end
25
-
26
- def self.map_file in_file, out_file, transform_string
27
-
28
- input = File.open(in_file, 'r') { |f| f.read }
29
- output = transform_string.call(input)
30
- File.open(out_file, 'w' ) { |f| f.write output }
31
-
32
- end
33
-
34
-
35
-
36
- end
data/spec/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/spec/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