rails-latex 1.0.14 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CODE_OF_CONDUCT.md +42 -6
- data/Gemfile +0 -5
- data/LICENSE.txt +21 -0
- data/Rakefile +8 -18
- data/examples/rails-latex-demo/app/views/layouts/application.pdf.erbtex +2 -2
- data/lib/rails-latex/latex_to_pdf.rb +2 -5
- data/lib/rails-latex/version.rb +2 -4
- data/rails-latex.gemspec +23 -23
- metadata +73 -23
- data/MIT-LICENSE +0 -21
- data/test/test_broken_doc.tex +0 -9
- data/test/test_doc.tex +0 -8
- data/test/test_helper.rb +0 -5
- data/test/test_latex_to_pdf.rb +0 -90
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb31bffd5ef1b8e7a9f6205bd7ab585667fee417
|
4
|
+
data.tar.gz: a50a09e05e6c1ec0ac1e3697eabc5d96b62805c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 478c60ff7480b8fd6fb7b61e9dc8cab2ed58d2356e1a11a5e25c95c0db44cbf6817f3120a31b96edce2d02c3597bda0d2578b4b9137806cf1bff55b440c7b3d3
|
7
|
+
data.tar.gz: 34586f31f0e40388875fa72bf7686d5363f3a8e47ea81852a9c5b7e85542db4de8edaf8cc4e52f99c56ea35c0551496f76627a2194682f338d45f3fb538f91ec
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -1,13 +1,49 @@
|
|
1
1
|
# Contributor Code of Conduct
|
2
2
|
|
3
|
-
As contributors and maintainers of this project,
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
4
7
|
|
5
|
-
We are committed to making participation in this project a harassment-free
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
6
12
|
|
7
|
-
Examples of unacceptable behavior by participants include
|
13
|
+
Examples of unacceptable behavior by participants include:
|
8
14
|
|
9
|
-
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
10
22
|
|
11
|
-
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
12
28
|
|
13
|
-
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at jan.baier@amagical.net. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
CHANGED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2010-2016 Geoff Jacobsen, Jan Baier and contributors
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,21 +1,11 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
|
4
|
-
Rake::TestTask.new(:test) do |
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
3
|
+
|
4
|
+
Rake::TestTask.new(:test) do |t|
|
5
|
+
t.libs << "test"
|
6
|
+
t.libs << "lib"
|
7
|
+
t.test_files = FileList['test/**/test_*.rb']
|
8
|
+
t.verbose = true
|
8
9
|
end
|
9
10
|
|
10
11
|
task :default => :test
|
11
|
-
|
12
|
-
require 'rdoc/task'
|
13
|
-
Rake::RDocTask.new do |rdoc|
|
14
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
15
|
-
|
16
|
-
rdoc.rdoc_dir = 'rdoc'
|
17
|
-
rdoc.title = "Rails-LaTeX #{version}"
|
18
|
-
rdoc.rdoc_files.include('README.rdoc')
|
19
|
-
rdoc.rdoc_files.include('MIT-LICENSE')
|
20
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
-
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
\documentclass[12pt,a4paper,sloppy]{article}
|
2
|
-
<% @latex_config={:command => 'pdflatex',:
|
2
|
+
<% @latex_config={:command => 'pdflatex',:parse_runs => 2} # you can override the defaults if you wish; see LatexToPdf#config %>
|
3
3
|
\usepackage{lastpage}
|
4
4
|
\usepackage{graphics}
|
5
5
|
\begin{document}
|
6
6
|
|
7
|
-
This document uses \verb|
|
7
|
+
This document uses \verb|parse_runs = 2| to calculate the last page.
|
8
8
|
|
9
9
|
Other defaults can be overridden using \verb|LatexToPdf#config| and \verb|@latex_config|.
|
10
10
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
class LatexToPdf
|
3
3
|
def self.config
|
4
|
-
@config||={:command => 'pdflatex', :arguments => ['-halt-on-error'], :
|
4
|
+
@config||={:command => 'pdflatex', :arguments => ['-halt-on-error'], :parse_runs => 1}
|
5
5
|
end
|
6
6
|
|
7
7
|
# Converts a string of LaTeX +code+ into a binary string of PDF.
|
@@ -10,12 +10,9 @@ class LatexToPdf
|
|
10
10
|
# files.
|
11
11
|
#
|
12
12
|
# The config argument defaults to LatexToPdf.config but can be overridden using @latex_config.
|
13
|
-
#
|
14
|
-
# The parse_twice argument and using config[:parse_twice] is deprecated in favor of using config[:parse_runs] instead.
|
15
13
|
def self.generate_pdf(code,config,parse_twice=nil)
|
16
14
|
config=self.config.merge(config)
|
17
|
-
|
18
|
-
parse_runs=[config[:parse_runs], (parse_twice ? 2 : config[:parse_runs])].max
|
15
|
+
parse_runs=config[:parse_runs]
|
19
16
|
Rails.logger.info "Running Latex #{parse_runs} times..."
|
20
17
|
dir=File.join(Rails.root,'tmp','rails-latex',"#{Process.pid}-#{Thread.current.hash}")
|
21
18
|
input=File.join(dir,'input.tex')
|
data/lib/rails-latex/version.rb
CHANGED
data/rails-latex.gemspec
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rails-latex/version'
|
4
5
|
|
5
|
-
Gem::Specification.new do |
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
s.homepage = "https://github.com/baierjan/rails-latex"
|
11
|
-
s.summary = %q{A LaTeX to pdf rails 3 renderer.}
|
12
|
-
s.description = %q{rails-latex is a renderer for rails 3 which allows tex files with erb to be turned into an inline pdf.}
|
13
|
-
#s.licence = "MIT"
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rails-latex"
|
8
|
+
spec.version = RailsLatex::VERSION
|
9
|
+
spec.authors = ["Jan Baier", "Geoff Jacobsen"]
|
10
|
+
spec.email = ["jan.baier@amagical.net"]
|
14
11
|
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
spec.summary = %q{A LaTeX to PDF rails renderer.}
|
13
|
+
spec.description = %q{rails-latex is a renderer for rails 3 which allows tex files with erb to be turned into an inline pdf.}
|
14
|
+
spec.homepage = "https://github.com/amagical.net/rails-latex"
|
15
|
+
spec.license = "MIT"
|
18
16
|
|
19
|
-
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
s.add_development_dependency(%q<RedCloth>, [">= 4.2.7"])
|
22
|
+
spec.add_dependency "rails", "~> 3.0"
|
23
|
+
spec.add_development_dependency "RedCloth", "~> 4.2"
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
27
|
+
spec.add_development_dependency "minitest-reporters", "~> 1.1"
|
28
28
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-latex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Baier
|
8
8
|
- Geoff Jacobsen
|
9
9
|
autorequire:
|
10
|
-
bindir:
|
10
|
+
bindir: exe
|
11
11
|
cert_chain: []
|
12
12
|
date: 2016-07-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
@@ -15,44 +15,98 @@ dependencies:
|
|
15
15
|
name: rails
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 3.0
|
20
|
+
version: '3.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - "
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 3.0
|
27
|
+
version: '3.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: RedCloth
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 4.2
|
34
|
+
version: '4.2'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - "
|
39
|
+
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 4.2
|
41
|
+
version: '4.2'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: bundler
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.12'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.12'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rake
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '10.0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '10.0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: minitest
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '5.0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '5.0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: minitest-reporters
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '1.1'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '1.1'
|
42
98
|
description: rails-latex is a renderer for rails 3 which allows tex files with erb
|
43
99
|
to be turned into an inline pdf.
|
44
100
|
email:
|
45
101
|
- jan.baier@amagical.net
|
46
102
|
executables: []
|
47
103
|
extensions: []
|
48
|
-
extra_rdoc_files:
|
49
|
-
- MIT-LICENSE
|
50
|
-
- README.rdoc
|
104
|
+
extra_rdoc_files: []
|
51
105
|
files:
|
52
106
|
- ".gitignore"
|
53
107
|
- CODE_OF_CONDUCT.md
|
54
108
|
- Gemfile
|
55
|
-
-
|
109
|
+
- LICENSE.txt
|
56
110
|
- README.rdoc
|
57
111
|
- Rakefile
|
58
112
|
- examples/rails-latex-demo/Gemfile
|
@@ -91,16 +145,12 @@ files:
|
|
91
145
|
- lib/rails-latex/latex_to_pdf.rb
|
92
146
|
- lib/rails-latex/version.rb
|
93
147
|
- rails-latex.gemspec
|
94
|
-
|
95
|
-
|
96
|
-
-
|
97
|
-
- test/test_latex_to_pdf.rb
|
98
|
-
homepage: https://github.com/baierjan/rails-latex
|
99
|
-
licenses: []
|
148
|
+
homepage: https://github.com/amagical.net/rails-latex
|
149
|
+
licenses:
|
150
|
+
- MIT
|
100
151
|
metadata: {}
|
101
152
|
post_install_message:
|
102
|
-
rdoc_options:
|
103
|
-
- "--main=README.rdoc"
|
153
|
+
rdoc_options: []
|
104
154
|
require_paths:
|
105
155
|
- lib
|
106
156
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -118,5 +168,5 @@ rubyforge_project:
|
|
118
168
|
rubygems_version: 2.2.2
|
119
169
|
signing_key:
|
120
170
|
specification_version: 4
|
121
|
-
summary: A LaTeX to
|
171
|
+
summary: A LaTeX to PDF rails renderer.
|
122
172
|
test_files: []
|
data/MIT-LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
Copyright (c) 2010-2015 Geoff Jacobsen, Jan Baier and contributors
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
-
|
data/test/test_broken_doc.tex
DELETED
data/test/test_doc.tex
DELETED
data/test/test_helper.rb
DELETED
data/test/test_latex_to_pdf.rb
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require 'rails-latex/erb_latex'
|
3
|
-
require 'ostruct'
|
4
|
-
require 'pathname'
|
5
|
-
require 'logger'
|
6
|
-
|
7
|
-
Rails=OpenStruct.new(:root => TMP_DIR=File.expand_path("../tmp",__FILE__), :logger => Logger.new(STDERR))
|
8
|
-
|
9
|
-
class TestLatexToPdf < Minitest::Test
|
10
|
-
def setup
|
11
|
-
super
|
12
|
-
FileUtils.rm_rf("#{TMP_DIR}/tmp/rails-latex")
|
13
|
-
end
|
14
|
-
|
15
|
-
def teardown
|
16
|
-
super
|
17
|
-
LatexToPdf.instance_eval { @config=nil }
|
18
|
-
end
|
19
|
-
|
20
|
-
def write_pdf
|
21
|
-
FileUtils.mkdir_p(TMP_DIR)
|
22
|
-
pdf_file=File.join(TMP_DIR,'out.pdf')
|
23
|
-
File.delete(pdf_file) if File.exist?(pdf_file)
|
24
|
-
File.open(pdf_file,'wb') do |wio|
|
25
|
-
wio.write(yield)
|
26
|
-
end
|
27
|
-
pdf_file
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_escape
|
31
|
-
assert_equal "dsf \\textless{} \\textgreater{} \\& ! @ \\# \\$ \\% \\textasciicircum{} \\textasciitilde{} \\textbackslash{} fds", LatexToPdf.escape_latex('dsf < > & ! @ # $ % ^ ~ \\ fds')
|
32
|
-
LatexToPdf.instance_eval{@latex_escaper=nil}
|
33
|
-
require 'redcloth'
|
34
|
-
assert_equal "dsf \\textless{} \\textgreater{} \\& ! @ \\# \\$ \\% \\^{} \\~{} \\textbackslash{} fds", LatexToPdf.escape_latex('dsf < > & ! @ # $ % ^ ~ \\ fds')
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_broken_doc_halt_on_error
|
38
|
-
begin
|
39
|
-
LatexToPdf.generate_pdf(IO.read(File.expand_path('../test_broken_doc.tex',__FILE__)),{})
|
40
|
-
fail "Should throw exception"
|
41
|
-
rescue => e
|
42
|
-
assert(/^pdflatex failed: See / =~ e.message)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_broken_doc_overriding_halt_on_error
|
47
|
-
pdf_file=write_pdf do
|
48
|
-
LatexToPdf.generate_pdf(IO.read(File.expand_path('../test_broken_doc.tex',__FILE__)),{arguments: []})
|
49
|
-
end
|
50
|
-
assert_equal "file with error\n\n1\n\n\f", `pdftotext #{pdf_file} -`
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_generate_pdf_one_parse
|
54
|
-
pdf_file=write_pdf do
|
55
|
-
LatexToPdf.generate_pdf(IO.read(File.expand_path('../test_doc.tex',__FILE__)),{})
|
56
|
-
end
|
57
|
-
assert_equal "The last page is ??.\n\n1\n\n\f", `pdftotext #{pdf_file} -`
|
58
|
-
|
59
|
-
assert_equal ["#{TMP_DIR}/tmp/rails-latex/input.log"], Dir["#{TMP_DIR}/tmp/rails-latex/*.log"]
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_generate_pdf_two_parse
|
63
|
-
pdf_file=write_pdf do
|
64
|
-
LatexToPdf.config[:parse_twice]=true
|
65
|
-
LatexToPdf.generate_pdf(IO.read(File.expand_path('../test_doc.tex',__FILE__)),{})
|
66
|
-
end
|
67
|
-
assert_equal "The last page is 1.\n\n1\n\n\f", `pdftotext #{pdf_file} -`
|
68
|
-
|
69
|
-
assert_equal ["#{TMP_DIR}/tmp/rails-latex/input.log"], Dir["#{TMP_DIR}/tmp/rails-latex/*.log"]
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_generate_pdf_parse_runs
|
73
|
-
pdf_file=write_pdf do
|
74
|
-
LatexToPdf.config[:parse_runs]=2
|
75
|
-
LatexToPdf.generate_pdf(IO.read(File.expand_path('../test_doc.tex',__FILE__)),{})
|
76
|
-
end
|
77
|
-
assert_equal "The last page is 1.\n\n1\n\n\f", `pdftotext #{pdf_file} -`
|
78
|
-
|
79
|
-
assert_equal ["#{TMP_DIR}/tmp/rails-latex/input.log"], Dir["#{TMP_DIR}/tmp/rails-latex/*.log"]
|
80
|
-
end
|
81
|
-
|
82
|
-
def test_doc_log_written
|
83
|
-
begin
|
84
|
-
LatexToPdf.generate_pdf(IO.read(File.expand_path('../test_doc.tex',__FILE__)),{})
|
85
|
-
assert_equal ["#{TMP_DIR}/tmp/rails-latex/input.log"], Dir["#{TMP_DIR}/tmp/rails-latex/*.log"]
|
86
|
-
assert( File.read("#{TMP_DIR}/tmp/rails-latex/input.log") =~ /entering extended mode/ )
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
end
|