erb_latex 0.3.0 → 1.0.0

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: ff1d232589ee66eab16df483e4a00650123023e2
4
- data.tar.gz: 812988816e5f7b00cc11e535feb0e898d49f8dd4
3
+ metadata.gz: e8b825b8d2a9b6081794d78c2e7fc175e5421137
4
+ data.tar.gz: 38dcda7203964f63909e59ac7db46066ed853bfc
5
5
  SHA512:
6
- metadata.gz: 6914c9b7f198d049f633176ad2902f4e2a537c879303ad989842badbd7a488fa12b2b95db64e12a11b39fe2e0327766ed37153d760b5d52a444973386554518f
7
- data.tar.gz: f7657b33f14bbc3ed55e20ec1d7f0ded2f5a83cc155ffc2123de7d58bc86685a57e491e233c4eb224543ebb62199dd117c4b920835a4e3894f1274f07259f45c
6
+ metadata.gz: 0db92f74e5ef160be972bd6a3452ebb158b5725b852429ef8794cebe3f043a469b81da7ff56ce2b493260bfedea08bdbe946484e4690df5edac8a76caff077b1
7
+ data.tar.gz: f685266897821c197c3bd724bfbfb01e3b91077d601b37b75cf5932d02e7cc82d2eafe988f2a7df86a1f7ae9d8cffe143d449c3773f7b489a02382bc9e0f84dd
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # ERB LaTeX
2
2
 
3
- Applies ERB template processing to a LaTeX file and compiles it to a PDF.
3
+ Applies ERB template processing to a LaTeX file and compiles it to a PDF using xelatex.
4
4
 
5
- Supports layouts, partials, and string escaping.
5
+ Supports layouts, partials, string escaping and packages installed in custom directories.
6
6
 
7
7
  Also supplies a Guard task to watch for modifications and auto-building files.
8
8
 
@@ -11,14 +11,12 @@ Also supplies a Guard task to watch for modifications and auto-building files.
11
11
  [Argosity](http://argosity.com/) uses this for several different projects
12
12
 
13
13
  * I originally used a bare-bones & hacky version to generate my resume in both HTML & PDF
14
- * [Stockor](http://stockor.org/), our open-source ERP platform. It's used for building all the form that output as PDF.
14
+ * [Stockor](http://stockor.org/), my open-source ERP platform. It's used for building all the form that output as PDF.
15
15
  * Generating proposals for client projects. Hit me up with a consulting request and you'll probably receive one!
16
16
 
17
17
  ## Links
18
18
 
19
- API docs are hosted at [nathan.stitt.org/code/erb-latex/](http://nathan.stitt.org/code/erb-latex/)
20
-
21
- The source is on github at [github.com/nathanstitt/erb_latex](https://github.com/nathanstitt/erb_latex)
19
+ [API docs](http://www.rubydoc.info/gems/erb_latex), Source on github at [github.com/nathanstitt/erb_latex](https://github.com/nathanstitt/erb_latex)
22
20
 
23
21
  ## Installation
24
22
 
@@ -36,6 +34,16 @@ Or install it yourself as:
36
34
 
37
35
  $ gem install erb_latex
38
36
 
37
+ ## Configuration
38
+
39
+ ```ruby
40
+ ErbLatex.configure do | config |
41
+ config.file_extesion = '.tex' # defaults to .tex.erb
42
+ config.verbose_logs = true # will output failure diagnostics to STDERR when enabled
43
+ config.xelatex_path = '/opt/texlive/bin/xelatex' # for cases where xelatex is not located in PATH
44
+ end
45
+ ```
46
+
39
47
  ## Usage
40
48
 
41
49
  Given a LaTeX layout template: ``layout.tex``
@@ -66,10 +74,12 @@ and a simple LaTeX body: ``body.tex``
66
74
 
67
75
  ```latex
68
76
  \lettrine[lines=2]{T}{hank} you for your your consideration.
69
- Please let us know if we can help you any further at all and don't forget to fill out the speakers notes.
77
+ Please let us know if we can help you!
70
78
 
71
79
  <%=q @message %>
72
80
 
81
+ So long and thanks for all the fish.
82
+
73
83
  Thank you,
74
84
  <%=q @author %>
75
85
  ```
@@ -106,12 +116,13 @@ guard :erb_latex do
106
116
  end
107
117
  ```
108
118
 
109
- While the one below would compile the hypothetical body.tex file above
119
+ While the one below would compile the hypothetical body.tex file above.
110
120
 
111
121
  ```ruby
112
122
  require 'erb_latex/guard'
113
123
 
114
- guard :erb_latex, :layout=>'proposal.tex', :data=>{:author=>'Nathan Stitt', :message=>'Buy low, Sell High!'} do
124
+ data = {:author=>'Nathan Stitt', :message=>'Buy low, Sell High!'}
125
+ guard :erb_latex, :layout=>'proposal.tex', :data => data do
115
126
  watch 'body.tex'
116
127
  end
117
128
  ```
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "rake", "~> 10.5"
22
- spec.add_development_dependency "bundler", "~> 1.10"
23
- spec.add_development_dependency "yard", "~> 0.8"
24
- spec.add_development_dependency "guard", "~> 2.13"
25
- spec.add_development_dependency "guard-minitest", "~> 2.4"
21
+ spec.add_development_dependency "rake"
22
+ spec.add_development_dependency "bundler"
23
+ spec.add_development_dependency "yard"
24
+ spec.add_development_dependency "guard"
25
+ spec.add_development_dependency "guard-minitest"
26
26
  end
@@ -30,13 +30,13 @@ module ErbLatex
30
30
 
31
31
  # include another latex file into the current template
32
32
  def partial( template, data={} )
33
- context = Context.new( @directory, data )
33
+ context = self.class.new( @directory, data )
34
34
  ErbLatex::File.evaluate(Pathname.new(template), context.getBinding, @directory)
35
35
  end
36
36
 
37
- # convert newline characters into latex '\\newline'
37
+ # convert newline characters into latex '\\linebreak'
38
38
  def break_lines( txt )
39
- q(txt.to_s).gsub("\n",'\\newline ')
39
+ q(txt.to_s).gsub("\n",'\\linebreak ')
40
40
  end
41
41
 
42
42
  # return a reference to the instance's scope or 'binding'
@@ -5,15 +5,17 @@ module ErbLatex
5
5
  # simualar to File.read, except:
6
6
  # * Will search in_directory for file if given, otherwise expects file to be an absolute path
7
7
  # * appends ErbLatex.config.file_extension to the file if it's not found as-is.
8
- def self.read(file, in_directory = nil)
8
+ def self.read(requested_file, in_directory = nil)
9
+ file = requested_file
9
10
  if in_directory
10
11
  file = Pathname.new(in_directory.to_s).join(file)
11
12
  end
12
- unless file.exist?
13
- file = Pathname.new(file.to_s + ErbLatex.config.file_extension) unless file.exist?
13
+ if file.to_s !~ /#{ErbLatex.config.file_extension}$/ && !file.exist?
14
+ file = Pathname.new(file.to_s + ErbLatex.config.file_extension)
14
15
  end
15
16
  unless file.exist?
16
- msg = "Unable to read from #{@view.to_s}. Also tried extension #{ErbLatex.config.file_extension}"
17
+ msg = "Unable to read from #{requested_file}."
18
+ msg << " Also tried extension #{file}" if file != requested_file
17
19
  raise LatexError.new(msg)
18
20
  end
19
21
  file.read
@@ -34,10 +34,13 @@ module ErbLatex
34
34
  # create a new Template
35
35
  # @param view_file [String] path to the latex template
36
36
  # @option options [String] :layout path to a latex template that calls yield
37
- # @option options [Hash] :data an instance variable will be created in the view for each key/value pair
37
+ # @option options [Hash] :data an instance variable will be created in the view for each key/value pair
38
+ # @option context [Class] : a class that will be instantiated to provide helper methods to ERB templates. Defaults to ErbLatex:Context
39
+
38
40
  def initialize( view_file, options={} )
39
41
  @data = options[:data] || {}
40
42
  @layout = options[:layout]
43
+ @context = options[:context] || ErbLatex::Context
41
44
  @packages_path = options[:packages_path]
42
45
  @partials_path = options[:partials_path]
43
46
  @view = Pathname.new( view_file )
@@ -113,14 +116,14 @@ module ErbLatex
113
116
  # @raise [LatexError] if the xelatex process does not complete successfully
114
117
  def compile_latex
115
118
  begin
116
- context = ErbLatex::Context.new( @partials_path || @view.dirname, @data )
119
+ context = @context.new( @partials_path || @view.dirname, @data )
117
120
  content = ErbLatex::File.evaluate(@view, context.getBinding)
118
121
  if layout
119
122
  ErbLatex::File.evaluate(layout_file, context.getBinding{ content })
120
123
  else
121
124
  content
122
125
  end
123
- rescue RuntimeError,LocalJumpError=>e
126
+ rescue LocalJumpError=>e
124
127
  raise LatexError.new( "ERB compile raised #{e.class} on #{@view}", e.backtrace )
125
128
  end
126
129
  end
@@ -1,5 +1,5 @@
1
1
  module ErbLatex
2
2
 
3
- VERSION = "0.3.0"
3
+ VERSION = "1.0.0"
4
4
 
5
5
  end
@@ -27,7 +27,10 @@ class ErbLatexTest < MiniTest::Test
27
27
  end
28
28
 
29
29
  def test_multiple_runs
30
- tmpl = ErbLatex::Template.new( document(:multi_page) )
30
+ tmpl = ErbLatex::Template.new(
31
+ document(:multi_page),
32
+ packages_path: Pathname.new(__FILE__).dirname.join('fixtures')
33
+ )
31
34
  tmpl.to_file tmp_output_file
32
35
  assert_equal 2, tmpl.pass_count
33
36
  text = text_output
@@ -48,5 +51,12 @@ class ErbLatexTest < MiniTest::Test
48
51
  assert_match "a test ’ of a partial", text_output
49
52
  end
50
53
 
51
-
54
+ def test_custom_context
55
+ tmpl = ErbLatex::Template.new(
56
+ document('custom_context.tex.erb'),
57
+ context: CustomContext
58
+ )
59
+ tmpl.to_file tmp_output_file
60
+ assert_match "custom helper method", text_output
61
+ end
52
62
  end
@@ -0,0 +1,4 @@
1
+ \documentclass{article}
2
+ \begin{document}
3
+ <%= output_test_string %>
4
+ \end{document}
@@ -0,0 +1,283 @@
1
+ %%
2
+ %% This is file `lastpage.sty',
3
+ %% generated with the docstrip utility.
4
+ %%
5
+ %% The original source files were:
6
+ %%
7
+ %% lastpage.dtx (with options: `package')
8
+ %%
9
+ %% This is a generated file.
10
+ %%
11
+ %% Project: lastpage
12
+ %% Version: 2015/03/29 v1.2m
13
+ %%
14
+ %% Copyright (C) 2010 - 2015 by
15
+ %% H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de>
16
+ %% Portions of code copyrighted by other people as marked.
17
+ %%
18
+ %% The usual disclaimer applies:
19
+ %% If it doesn't work right that's your problem.
20
+ %% (Nevertheless, send an e-mail to the maintainer
21
+ %% when you find an error in this package.)
22
+ %%
23
+ %% This work may be distributed and/or modified under the
24
+ %% conditions of the LaTeX Project Public License, either
25
+ %% version 1.3c of this license or (at your option) any later
26
+ %% version. This version of this license is in
27
+ %% http://www.latex-project.org/lppl/lppl-1-3c.txt
28
+ %% and the latest version of this license is in
29
+ %% http://www.latex-project.org/lppl.txt
30
+ %% and version 1.3c or later is part of all distributions of
31
+ %% LaTeX version 2005/12/01 or later.
32
+ %%
33
+ %% This work has the LPPL maintenance status "maintained".
34
+ %%
35
+ %% The Current Maintainer of this work is H.-Martin Muench.
36
+ %%
37
+ %% This package was invented by
38
+ %% Jeffrey P. Goldberg (jeffrey+news at goldmark dot org).
39
+ %% I thought that a replacement was needed and therefore created the pageslts package,
40
+ %% https://www.ctan.org/pkg/pageslts
41
+ %% . Nevertheless, for compatibility with existing documents/packages as well as for
42
+ %% the low amount of resources needed by the lastpage package (no new counter!),
43
+ %% I updated this package.
44
+ %% Thanks go to Jeffrey P. Goldberg for allowing me to do this.
45
+ %%
46
+ %% This work consists of the main source file lastpage.dtx,
47
+ %% the README, and the derived files
48
+ %% lastpage.sty, lastpage.pdf,
49
+ %% lastpage.ins, lastpage.drv,
50
+ %% lastpage-example.tex, lastpage-example.pdf.
51
+ %%
52
+ %% In memoriam
53
+ %% Claudia Simone Barth + 1996/01/30
54
+ %% Tommy Muench + 2014/01/02
55
+ %% Hans-Klaus Muench + 2014/08/24
56
+ %%
57
+ \NeedsTeXFormat{LaTeX2e}[2014/05/01]
58
+ \ProvidesPackage{lastpage}%
59
+ [2015/03/29 v1.2m Refers to last page's name (HMM; JPG)]%
60
+
61
+ %% lastpage may work with earlier versions of LaTeX,
62
+ %% but this was not tested. Please consider updating
63
+ %% your LaTeX (and packages) to the most recent version
64
+ %% (if it is/they are not already the most recent version).
65
+
66
+ %% Allows for things like
67
+ %% Page \thepage{} of \pageref{LastPage}
68
+ %% to get
69
+ %% 'Page 7 of 9'.
70
+ %% For LaTeX 2.09 use lastpage209.sty.
71
+ %% For LaTeX 2e maybe consider upgrading to the pageslts package.
72
+ %% lastpage may work with earlier versions of LaTeX2e,
73
+ %% but this was not tested. Please consider updating your LaTeX
74
+ %% contribution to the most recent version (if it is not already
75
+ %% the most recent version).
76
+
77
+ %% The recent version of the endfloat package is v2.5d as of 2011/12/25.
78
+ %% The lastpage package is not fully compatible with version 2.0
79
+ %% (and earlier) of the endfloat package, because those versions
80
+ %% redefined the \enddocument command.
81
+
82
+ \def\lastpage@one{1}
83
+ \gdef\lastpage@hyper{0}
84
+ \gdef\lastpage@nameref{0}
85
+ \gdef\lastpage@LTS{0}
86
+ \def\lastpage@firstpage{1}
87
+
88
+ \AtBeginDocument{%
89
+ \@ifpackageloaded{tikz}{\gdef\lastpage@tikz{1}}{}%
90
+ \@ifpackageloaded{hyperref}{\gdef\lastpage@hyper{1}}{}%
91
+ \@ifpackageloaded{nameref}{\gdef\lastpage@nameref{1}}{}%
92
+ \@ifpackageloaded{pageslts}{%
93
+ \PackageWarning{lastpage}{Package pageslts found.\MessageBreak%
94
+ Therefore the lastpage package is no longer\MessageBreak%
95
+ necessary.%
96
+ }%
97
+ \gdef\lastpage@LTS{1}%
98
+ }{\PackageInfo{lastpage}{%
99
+ Please have a look at the pageslts package at\MessageBreak%
100
+ https://www.ctan.org/pkg/pageslts\MessageBreak%
101
+ !}%
102
+ }%
103
+ \@ifpackageloaded{pagesLTS}{%
104
+ \PackageWarning{lastpage}{%
105
+ Outdated pagesLTS package found.\MessageBreak%
106
+ Please replace by a recent version of\MessageBreak%
107
+ pageslts package, see e.g. at\MessageBreak%
108
+ https://www.ctan.org/pkg/pageslts\MessageBreak%
109
+ !\MessageBreak%
110
+ With pagesLTS as well as pageslts package\MessageBreak%
111
+ the lastpage package is no longer necessary.\MessageBreak%
112
+ }%
113
+ \gdef\lastpage@LTS{1}%
114
+ }{}%
115
+ \gdef\lastpage@putlabel{\relax}%
116
+ }
117
+
118
+ \newcommand{\lastpage@putl@bel}{%
119
+ \@ifundefined{Hy@Warning}{% hyperref not loaded
120
+ }{\gdef\lastpage@hyper{1}% hyperref loaded
121
+ }%
122
+ \ifx\lastpage@LTS\lastpage@one%
123
+ \else%
124
+ \ifx\lastpage@hyper\lastpage@one%
125
+ \lastpage@putlabelhyper%
126
+ \else%
127
+ \ifx\lastpage@nameref\lastpage@one%
128
+ \lastpage@putlabelNR%
129
+ \else%
130
+ \begingroup%
131
+ \addtocounter{page}{-1}%
132
+ \immediate\write\@auxout{\string\newlabel{LastPage}{{}{\thepage}}}%
133
+ \immediate\write\@auxout{\string\xdef\string\lastpage@lastpage{\thepage}}%
134
+ \immediate\write\@auxout{\string\gdef\string\lastpage@lastpageHy{}}%
135
+ \addtocounter{page}{+1}%
136
+ \endgroup%
137
+ \fi%
138
+ \fi%
139
+ \fi%
140
+ }
141
+
142
+ \newcommand{\lastpage@putlabelhyper}{%
143
+ \ifHy@pageanchor%
144
+ \else%
145
+ \PackageError{lastpage}{hyperref option pageanchor disabled}{%
146
+ The \string\pageref{LastPage} link doesn't work\MessageBreak%
147
+ using hyperref with disabled option `pageanchor'.\MessageBreak%
148
+ }%
149
+ \fi%
150
+ \begingroup%
151
+ \addtocounter{page}{-1}%
152
+ %% The following code is from the hyperref package %%
153
+ %% [2010/04/17 v6.80x; newer versions are available] %%
154
+ %% by Heiko Oberdiek (Big Thanks!). %%
155
+ \let\@number\@firstofone
156
+ \ifHy@pageanchor
157
+ \ifHy@hypertexnames
158
+ \ifHy@plainpages
159
+ \def\Hy@temp{\arabic{page}}%
160
+ \else
161
+ \Hy@unicodefalse
162
+ %% Code not from hyperref package: %%
163
+ %% The following lines are taken from the pageslts package, %%
164
+ %% which in turn got them from the hyperref package and %%
165
+ %% modified them. %%
166
+ %% Without the modification, after the first shipout "PD1" %%
167
+ %% is inserted each time |\pdfstringdef\Hy@temp{\thepage}| %%
168
+ %% is executed. %%
169
+ \ifnum \value{page}=1%
170
+ \ifx \lastpage@firstpage\lastpage@one
171
+ \def\Hy@temp{\thepage}%
172
+ \gdef\lastpage@firstpage{0}%
173
+ \else%
174
+ %% Code from hyperref package again: %%
175
+ \pdfstringdef\Hy@temp{\thepage}%
176
+ %% End of code from the hyperref package. %%
177
+ \fi%
178
+ %% The pageslts package would even check for fnsymbol page %%
179
+ %% numbering scheme and adapt the code correspondingly. %%
180
+ \else%
181
+ %% Code from hyperref package again: %%
182
+ \pdfstringdef\Hy@temp{\thepage}%
183
+ %% Code from pageslts package again: %%
184
+ \fi%
185
+ %% Code from hyperref package again: %%
186
+ \fi
187
+ \else
188
+ \def\Hy@temp{\the\Hy@pagecounter}%
189
+ \fi
190
+ \fi
191
+ \immediate\write\@auxout{%
192
+ \string\newlabel
193
+ {LastPage}{{}{\thepage}{}{%
194
+ \ifHy@pageanchor page.\Hy@temp\fi}{}}%
195
+ }%
196
+ %% End of code from the hyperref package. %%
197
+ \immediate\write\@auxout{%
198
+ \string\xdef\string\lastpage@lastpage{\thepage}}%
199
+ \ifHy@pageanchor%
200
+ \immediate\write\@auxout{%
201
+ \string\xdef\string\lastpage@lastpageHy{\Hy@temp}}%
202
+ \else%
203
+ \immediate\write\@auxout{%
204
+ \string\gdef\string\lastpage@lastpageHy{}}%
205
+ \fi%
206
+ \addtocounter{page}{+1}%
207
+ \endgroup%
208
+ }
209
+
210
+ \newcommand{\lastpage@putlabelNR}{%
211
+ \begingroup%
212
+ \addtocounter{page}{-1}%
213
+ \immediate\write\@auxout{\string\newlabel{LastPage}{{}{\thepage}{}{}{}}}%
214
+ \immediate\write\@auxout{\string\xdef\string\lastpage@lastpage{\thepage}}%
215
+ \immediate\write\@auxout{\string\gdef\string\lastpage@lastpageHy{}}%
216
+ \addtocounter{page}{+1}%
217
+ \endgroup%
218
+ }
219
+
220
+ \newcommand{\lastpage@fileswtest}[2]{%
221
+ \edef\lastpage@testa{#1}%
222
+ \edef\lastpage@testb{#2}%
223
+ \ifx\lastpage@testa\lastpage@testb% OK
224
+ \else%
225
+ \ifx\lastpage@tikz\lastpage@one%
226
+ \PackageWarning{lastpage}%
227
+ {The lastpage package was not allowed to write to an\MessageBreak%
228
+ .aux file. This package does not work without access\MessageBreak%
229
+ to an .aux file.\MessageBreak%
230
+ It is OK if the .aux file was already updated\MessageBreak%
231
+ by a previouse compiler run\MessageBreak%
232
+ and would not have changed anyway.\MessageBreak%
233
+ }%
234
+ \else%
235
+ \PackageError{lastpage}{No auxiliary file allowed}%
236
+ {The lastpage package was not allowed to write to an .aux file.\MessageBreak%
237
+ This package does not work without access to an .aux file.\MessageBreak%
238
+ Press Ctrl+Z to exit.\MessageBreak%
239
+ }%
240
+ \fi%
241
+ \fi%
242
+ }
243
+ \newcommand{\lastpage@fileswtestHy}{%
244
+ \ifHy@pageanchor%
245
+ \lastpage@fileswtest{\Hy@temp}{\lastpage@lastpageHy}%
246
+ \else%
247
+ \lastpage@fileswtest{\empty}{\lastpage@lastpageHy}%
248
+ \fi%
249
+ }
250
+
251
+ \AtEndDocument{%
252
+ \gdef\lastpage@putlabel{\relax}%
253
+ \ifx\lastpage@LTS\lastpage@one%
254
+ \else%
255
+ \@ifundefined{lastpage@lastpage}%
256
+ {\gdef\lastpage@lastpage{LastpagePackageError}%
257
+ % If there really is a page numbered (!) "LastpagePackageError",
258
+ % you will get the rerun warning whether it is necessary or not.
259
+ \PackageWarning{lastpage}{Rerun to get the references right}%
260
+ }{% already defined, nothing to be done.
261
+ }%
262
+ \@ifundefined{lastpage@lastpageHy}%
263
+ {\gdef\lastpage@lastpageHy{LastpagePackageError}%
264
+ }{% already defined, nothing to be done.
265
+ }%
266
+ \fi%
267
+ \if@filesw%
268
+ \message{^^JAED: lastpage setting LastPage^^J}%
269
+ \clearpage\lastpage@putl@bel%
270
+ \else%
271
+ \ifx\lastpage@LTS\lastpage@one%
272
+ \else%
273
+ \lastpage@fileswtest{\thepage}{\lastpage@lastpage}%
274
+ \ifx\lastpage@hyper\lastpage@one%
275
+ \lastpage@fileswtestHy%
276
+ \fi%
277
+ \fi%
278
+ \fi%
279
+ }
280
+
281
+ \endinput
282
+ %%
283
+ %% End of file `lastpage.sty'.
@@ -0,0 +1,70 @@
1
+ %%
2
+ %% This is file `lastpage209.sty',
3
+ %% generated with the docstrip utility.
4
+ %%
5
+ %% The original source files were:
6
+ %%
7
+ %% lastpage.dtx (with options: `lastpage209')
8
+ %%
9
+ %% This is a generated file.
10
+ %%
11
+ %% Project: lastpage
12
+ %% Version: 2015/03/29 v1.2m
13
+ %%
14
+ %% Copyright (C) 2010 - 2015 by
15
+ %% H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de>
16
+ %% Portions of code copyrighted by other people as marked.
17
+ %%
18
+ %% The usual disclaimer applies:
19
+ %% If it doesn't work right that's your problem.
20
+ %% (Nevertheless, send an e-mail to the maintainer
21
+ %% when you find an error in this package.)
22
+ %%
23
+ %% This work may be distributed and/or modified under the
24
+ %% conditions of the LaTeX Project Public License, either
25
+ %% version 1.3c of this license or (at your option) any later
26
+ %% version. This version of this license is in
27
+ %% http://www.latex-project.org/lppl/lppl-1-3c.txt
28
+ %% and the latest version of this license is in
29
+ %% http://www.latex-project.org/lppl.txt
30
+ %% and version 1.3c or later is part of all distributions of
31
+ %% LaTeX version 2005/12/01 or later.
32
+ %%
33
+ %% This work has the LPPL maintenance status "maintained".
34
+ %%
35
+ %% The Current Maintainer of this work is H.-Martin Muench.
36
+ %%
37
+ %% This package was invented by
38
+ %% Jeffrey P. Goldberg (jeffrey+news at goldmark dot org).
39
+ %% I thought that a replacement was needed and therefore created the pageslts package,
40
+ %% https://www.ctan.org/pkg/pageslts
41
+ %% . Nevertheless, for compatibility with existing documents/packages as well as for
42
+ %% the low amount of resources needed by the lastpage package (no new counter!),
43
+ %% I updated this package.
44
+ %% Thanks go to Jeffrey P. Goldberg for allowing me to do this.
45
+ %%
46
+ %% This work consists of the main source file lastpage.dtx,
47
+ %% the README, and the derived files
48
+ %% lastpage.sty, lastpage.pdf,
49
+ %% lastpage.ins, lastpage.drv,
50
+ %% lastpage-example.tex, lastpage-example.pdf.
51
+ %%
52
+ %% In memoriam
53
+ %% Claudia Simone Barth + 1996/01/30
54
+ %% Tommy Muench + 2014/01/02
55
+ %% Hans-Klaus Muench + 2014/08/24
56
+ %%
57
+ % FOR LaTeX 2.09 ONLY - FOR LaTeX 2e USE lastpage.sty OR pageslts.sty!
58
+ % This is lastpage209.sty invented by Jeffrey P. Goldberg
59
+ % (jeffrey+news at goldmark dot org), maintained by
60
+ % H.-Martin M\"{u}ench (Martin dot Muench at Uni-Bonn dot de).
61
+ \let\origenddocument=\enddocument%
62
+ \def\enddocument{\clearpage%
63
+ {\addtocounter{page}{-1}%
64
+ \immediate\write\@mainaux{\string\newlabel{LastPage}{{}{\thepage}}}}%
65
+ \addtocounter{page}{+1}%
66
+ \origenddocument%
67
+ }%
68
+ \endinput
69
+ %%
70
+ %% End of file `lastpage209.sty'.
@@ -9,6 +9,12 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
9
9
  $LOAD_PATH.unshift(File.dirname(__FILE__))
10
10
  require 'erb_latex'
11
11
 
12
+ class CustomContext < ErbLatex::Context
13
+ def output_test_string
14
+ 'A string from custom helper method'
15
+ end
16
+ end
17
+
12
18
  class MiniTest::Test
13
19
 
14
20
  def document( name )
metadata CHANGED
@@ -1,85 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erb_latex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Stitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-11 00:00:00.000000000 Z
11
+ date: 2016-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '10.5'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '10.5'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.10'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.10'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: yard
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0.8'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0.8'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: guard
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '2.13'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '2.13'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: guard-minitest
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '2.4'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '2.4'
82
+ version: '0'
83
83
  description: Applies ERB template processing to a Latex file and compiles it to a
84
84
  PDF. Supports layouts, partials, and string escaping. Also supplies a Guard task
85
85
  to watch for modifications and auto-building files.
@@ -108,6 +108,9 @@ files:
108
108
  - lib/erb_latex/version.rb
109
109
  - test/erb_latex_test.rb
110
110
  - test/fixtures/body.tex.erb
111
+ - test/fixtures/custom_context.tex.erb
112
+ - test/fixtures/lastpage.sty
113
+ - test/fixtures/lastpage209.sty
111
114
  - test/fixtures/layout.tex.erb
112
115
  - test/fixtures/multi_page.tex.erb
113
116
  - test/fixtures/partial.tex.erb
@@ -137,13 +140,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
140
  version: '0'
138
141
  requirements: []
139
142
  rubyforge_project:
140
- rubygems_version: 2.4.5.1
143
+ rubygems_version: 2.5.1
141
144
  signing_key:
142
145
  specification_version: 4
143
146
  summary: Applies ERB template processing to a Latex file and compiles it to a PDF
144
147
  test_files:
145
148
  - test/erb_latex_test.rb
146
149
  - test/fixtures/body.tex.erb
150
+ - test/fixtures/custom_context.tex.erb
151
+ - test/fixtures/lastpage.sty
152
+ - test/fixtures/lastpage209.sty
147
153
  - test/fixtures/layout.tex.erb
148
154
  - test/fixtures/multi_page.tex.erb
149
155
  - test/fixtures/partial.tex.erb