rulex 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48ab31fba5ef554feb4384f82952d3c4a5d862f2
4
- data.tar.gz: 4a3c7fdb779b6699113bbe24a4a2a508a3f5707a
3
+ metadata.gz: 0cf20eb535ac1da63faf659b6a8adc218a8c668d
4
+ data.tar.gz: d597b856dbc1584e6bb58e8d1882444ad9a439df
5
5
  SHA512:
6
- metadata.gz: e8539de0be9ecdfad57d95f911e8c892de3eaead4e46e0f78db35785147b963898b38c6a88b6d6751ab90240ae5f724463baf5b3fbab88ee76984cc8e2c0c7bc
7
- data.tar.gz: 7ffb697045a62a4cba6ee8ea0e9057c8110dfef505ffdd26280a0af1c527533c267fab8e606f8a20966aca07fdaeaf48e2c5ebd5a912f8f84f9352ceadd43aa7
6
+ metadata.gz: 6184f8d0366f77597729c749dba54a6e4d78a5aede1db6107566f314e2f4b2a146a9920f70327c75ac9f893b7dc72d4d81e3b3f44d151f3bf4089a3ef8b0d445
7
+ data.tar.gz: 165875c0edbb36db64c69033a29f392c8fe3163581633b063268fc6d56b8ac4530e56ea414bc5cf9ff4fc2755f44823446e7ff522fa70eda9dfc511264aa1b3c
data/README.md CHANGED
@@ -4,6 +4,7 @@
4
4
  [![Code Climate](https://codeclimate.com/github/Nicowcow/rulex/badges/gpa.svg)](https://codeclimate.com/github/Nicowcow/rulex)
5
5
  [![Test Coverage](https://codeclimate.com/github/Nicowcow/rulex/badges/coverage.svg)](https://codeclimate.com/github/Nicowcow/rulex/coverage)
6
6
  [![Inline docs](http://inch-ci.org/github/Nicowcow/rulex.svg?branch=master)](http://inch-ci.org/github/Nicowcow/rulex)
7
+
7
8
  Rulex is a rubygem allowing you to use Ruby while writing LaTex files. It reads rulex `.rex` files, and converts them into LaTex `.tex` files. A `.rex` file is a Ruby file; you can use (almost) everything the way you would in a Ruby script.
8
9
 
9
10
  ## Installation
@@ -69,6 +70,8 @@ end
69
70
  document do
70
71
  section "A Short Lecture on How to Count"
71
72
 
73
+ # You can use markdown
74
+ md "Pay attention, the following is *very* important."
72
75
 
73
76
  # You can of course call the functions you defined (AND NOT BE LIMITED TO 9 ******* ARGUMENTS)
74
77
 
@@ -78,8 +81,8 @@ document do
78
81
  # At any time, you can prefix a method call with `pure_`. This will return the LaTeX text
79
82
  # (`String`) that would have been produced, instead of writing the command to the
80
83
  # document tree. For instance, we want to write the whole text "Good job, ... " to the
81
- # document tree, while referencing the next section; we don't want to write the reference
82
- # to the tree on top of that!
84
+ # document tree, while referencing the next section; we don't want to write it to the
85
+ # tree on top of that!
83
86
  raw "Good job, now off to section #{pure_ref :acks}\n"
84
87
 
85
88
  section "Acknowledgements"
@@ -96,7 +99,7 @@ document do
96
99
 
97
100
 
98
101
  # At any time, you can use the delimiters `<##` and `##>` to inject LaTeX code. Note that the following characters won't be escaped: '\\', '\]', '\['.. The delimiters are part of the Rulex file syntax, and are translated into Ruby calls when the file is process; they aren't some kind of Ruby magic.
99
- <## \subsection{Some pure \latex}
102
+ <## \subsection{Some pure \LaTeX}
100
103
 
101
104
  And some more here.
102
105
 
@@ -110,6 +113,8 @@ Run `rulex example.rex > example.tex` to get
110
113
  \documentclass{article}
111
114
  \begin{document}
112
115
  \section{A Short Lecture on How to Count}
116
+ Pay attention, the following is \emph{very}
117
+ important.
113
118
  \subsection{how to count from 1 to 5}
114
119
  Let's try to count.\begin{itemize}
115
120
  \item{1}
@@ -141,7 +146,11 @@ Finally I would like to thank
141
146
  \item{Mr. Donald Knuth}
142
147
  \item{Mr. Yukihiro Matsumoto}
143
148
  \end{enumerate}
144
- \end{document}
149
+ \subsection{Some pure \LaTeX}
150
+
151
+ And some more here.
152
+
153
+ \end{document}
145
154
  ```
146
155
 
147
156
  ## Development
data/examples/count.rex CHANGED
@@ -28,6 +28,8 @@ end
28
28
  document do
29
29
  section "A Short Lecture on How to Count"
30
30
 
31
+ # You can use markdown
32
+ md "Pay attention, the following is *very* important."
31
33
 
32
34
  # You can of course call the functions you defined (AND NOT BE LIMITED TO 9 ******* ARGUMENTS)
33
35
 
@@ -55,7 +57,7 @@ document do
55
57
 
56
58
 
57
59
  # At any time, you can use the delimiters `<##` and `##>` to inject LaTeX code. Note that the following characters won't be escaped: '\\', '\]', '\['.. The delimiters are part of the Rulex file syntax, and are translated into Ruby calls when the file is process; they aren't some kind of Ruby magic.
58
- <## \subsection{Some pure \latex}
60
+ <## \subsection{Some pure \LaTeX}
59
61
 
60
62
  And some more here.
61
63
 
data/examples/count.tex CHANGED
@@ -1,6 +1,8 @@
1
1
  \documentclass{article}
2
2
  \begin{document}
3
3
  \section{A Short Lecture on How to Count}
4
+ Pay attention, the following is \emph{very}
5
+ important.
4
6
  \subsection{how to count from 1 to 5}
5
7
  Let's try to count.\begin{itemize}
6
8
  \item{1}
@@ -32,7 +34,7 @@ Finally I would like to thank
32
34
  \item{Mr. Donald Knuth}
33
35
  \item{Mr. Yukihiro Matsumoto}
34
36
  \end{enumerate}
35
- \subsection{Some pure \latex}
37
+ \subsection{Some pure \LaTeX}
36
38
 
37
39
  And some more here.
38
40
 
@@ -1,3 +1,5 @@
1
+ require 'pandoc-ruby'
2
+
1
3
  module Rulex
2
4
  module Rex
3
5
  class Reader
@@ -44,7 +46,9 @@ module Rulex
44
46
  end
45
47
 
46
48
  def md str
47
- raise RuntimeError, "not implemented"
49
+ latex_str = PandocRuby.new(str).to_latex
50
+ arr = @latex_reader.read(latex_str).to_a
51
+ append_nodes_to_content arr
48
52
  end
49
53
 
50
54
  def tex str
data/lib/rulex/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rulex
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
data/rulex.gemspec CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_runtime_dependency "treetop"
21
+ spec.add_runtime_dependency "pandoc-ruby"
21
22
 
22
23
  spec.add_development_dependency "bundler"
23
24
  spec.add_development_dependency "rake"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rulex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Mattia
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pandoc-ruby
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement