jekyll-latex-pdf 0.5.2 → 0.5.3
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 +4 -4
- data/CHANGELOG.md +3 -1
- data/Gemfile.lock +1 -1
- data/README.md +8 -4
- data/data/kramdown/apa6.latex +4 -0
- data/data/kramdown/jekyll-latex-pdf.latex +4 -0
- data/lib/jekyll/latex/pdf/document.rb +2 -1
- data/lib/jekyll/latex/pdf/figure.rb +1 -0
- data/lib/jekyll/latex/pdf/figure/figref.rb +25 -0
- data/lib/jekyll/latex/pdf/figure/figure.rb +0 -2
- data/lib/jekyll/latex/pdf/latex.rb +25 -6
- data/lib/jekyll/latex/pdf/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2abba733d535e049de64ccd011708a34b83f5b8d
|
4
|
+
data.tar.gz: '092d4c49709239fee2c4470d516e2c03fd5bf093'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 400a256eaba9265f233975089671a0ee47b9e98f5ff8241a09b576f6d525f38d9e4910810f029aa102d178992d24c7c0e9755edaab2569f28ddf596aafa99605
|
7
|
+
data.tar.gz: 581f03a68105080d01984da4d5ff3c32fefefb389d6f1d1d31fbd365bdfcdeafa2aabc3d71c335238d9eba3d3aad52ba83ebac1b526a89ab487ec43bbbf74d4b
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## [
|
3
|
+
## [0.5.3]
|
4
4
|
### Added
|
5
5
|
- Use libraries for tikz pictures.
|
6
6
|
- Use md5 in tikz filenames forces reload in browser when changed.
|
7
|
+
- Added figref tag which was introducded by me to jekyll-figure
|
8
|
+
- No need to rebuild if latex source didn't change.
|
7
9
|
|
8
10
|
## [0.5.1]
|
9
11
|
### Added
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -44,8 +44,8 @@ If you want to use the `tikz` environment you additionally need to install
|
|
44
44
|
`pdf2svg` and `graphicsmagick`.
|
45
45
|
|
46
46
|
You may want to add `.latex-cache` (or whatever you set in your
|
47
|
-
`latex_cache_path`) to your `.gitignore`. This is where we
|
48
|
-
files for faster recompiling if needed.
|
47
|
+
`latex_cache_path`) and `assets/tikz/` to your `.gitignore`. This is where we
|
48
|
+
store the latex files for faster recompiling if needed.
|
49
49
|
|
50
50
|
## Usage
|
51
51
|
|
@@ -86,7 +86,7 @@ Variables to customize are:
|
|
86
86
|
| `template` | Defaults to `jekyll-latex-pdf` |
|
87
87
|
| `template_path` | Is where we look for your own templates. Defaults to `_latex`. |
|
88
88
|
| `date_as_note` | Is `false` by default. See apa6 |
|
89
|
-
| `tikz_path` | Defaults to `assets/
|
89
|
+
| `tikz_path` | Defaults to `assets/tikz`. See tikz section. |
|
90
90
|
| `latex_cache_dir` | Path where we hold the latex files. Default: `.latex_cache` |
|
91
91
|
| `tikz_md5` | Default: `false`. Use md5 digest in filename to force browser reload on changes. |
|
92
92
|
|
@@ -100,7 +100,11 @@ The default template is a good way to start. Copy it to your `_latex` folder,
|
|
100
100
|
and adjust it. Change the name and set the `template` in your config or the
|
101
101
|
yaml header of your post. Your template in `_latex` will be prefered to the one
|
102
102
|
shiped with this gem if it has the same name. Files should have the `.latex`
|
103
|
-
extension.
|
103
|
+
extension.
|
104
|
+
|
105
|
+
If you change the template when pdfs are allready created, make sure to delete
|
106
|
+
the `latex_cache_dir`, otherwise only changed posts will be recompiled with the
|
107
|
+
new template.
|
104
108
|
|
105
109
|
### jekyll-latex-pdf
|
106
110
|
|
data/data/kramdown/apa6.latex
CHANGED
@@ -21,6 +21,7 @@ encmap = {
|
|
21
21
|
}
|
22
22
|
%><%
|
23
23
|
enclang = {
|
24
|
+
'en' => 'english',
|
24
25
|
'de' => 'ngerman',
|
25
26
|
'sv' => 'swedish'
|
26
27
|
}
|
@@ -45,6 +46,9 @@ urlcolor=black
|
|
45
46
|
<% if data[:lang] %>
|
46
47
|
\usepackage[<%= enclang[data[:lang]] %>]{babel}
|
47
48
|
\usepackage[<%= enclang[data[:lang]] %>]{isodate}
|
49
|
+
<% else %>
|
50
|
+
\usepackage[english]{babel}
|
51
|
+
\usepackage[english]{isodate}
|
48
52
|
<% end %>
|
49
53
|
|
50
54
|
<% if data[:bibtex_files] %>
|
@@ -22,6 +22,7 @@ encmap = {
|
|
22
22
|
%>
|
23
23
|
<%
|
24
24
|
enclang = {
|
25
|
+
'en' => 'english',
|
25
26
|
'de' => 'ngerman',
|
26
27
|
'sv' => 'swedish'
|
27
28
|
}
|
@@ -44,6 +45,9 @@ enclang = {
|
|
44
45
|
<% if data[:lang] %>
|
45
46
|
\usepackage[<%= enclang[data[:lang]] %>]{babel}
|
46
47
|
\usepackage[<%= enclang[data[:lang]] %>]{isodate}
|
48
|
+
<% else %>
|
49
|
+
\usepackage[english]{babel}
|
50
|
+
\usepackage[english]{isodate}
|
47
51
|
<% end %>
|
48
52
|
|
49
53
|
<% if data[:bibtex_files] %>
|
@@ -31,7 +31,8 @@ module Jekyll
|
|
31
31
|
@config = Defaults.defaults.merge(site.config["pdf"] || {})
|
32
32
|
|
33
33
|
@kramdowndata = KramdownData.new data
|
34
|
-
@kramdowndata.add(site.config["pdf"] || {})
|
34
|
+
@kramdowndata.add(@site.config["pdf"] || {})
|
35
|
+
@kramdowndata.add(page.data || {})
|
35
36
|
|
36
37
|
check_scholar
|
37
38
|
check_figure
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Jekyll
|
3
|
+
module Latex
|
4
|
+
module Pdf
|
5
|
+
module Figure
|
6
|
+
# Overrides the figref tag from jekyll-figure
|
7
|
+
class FigRefTag < Liquid::Tag
|
8
|
+
|
9
|
+
include Utilities
|
10
|
+
|
11
|
+
def initialize(tag_name, markup, tokens)
|
12
|
+
@label = markup.gsub(/\s/, '')
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def render(_context)
|
17
|
+
nomarkdown "\\ref{#{@label}}"
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
TempLiquid.register_tag("figref", Figure::FigRefTag)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -33,8 +33,6 @@ module Jekyll
|
|
33
33
|
# Caption: convert markdown and remove paragraphs
|
34
34
|
unless @caption.nil?
|
35
35
|
figure_caption = @caption.gsub!(/\A"|"\Z/, "")
|
36
|
-
# figure_caption = converter.convert(figure_caption).gsub(/<\/?p[^>]*>/, "").chomp
|
37
|
-
# figure_caption = " <figcaption>#{figure_caption}</figcaption>\n"
|
38
36
|
figure_caption = Kramdown::Document.new(figure_caption).to_latex.strip
|
39
37
|
figure_caption = "\\caption{#{figure_caption}}\n"
|
40
38
|
end
|
@@ -24,7 +24,7 @@ module Jekyll
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def find_template
|
27
|
-
template = @
|
27
|
+
template = @kramdowndata.data[:template]
|
28
28
|
|
29
29
|
template.concat(".latex") unless template.end_with?(".latex")
|
30
30
|
|
@@ -36,7 +36,7 @@ module Jekyll
|
|
36
36
|
if File.file? t
|
37
37
|
return t
|
38
38
|
else
|
39
|
-
Jekyll.
|
39
|
+
Jekyll.logger.error "jekyll-latex-pdf", "Could not find template #{t}."
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -80,6 +80,14 @@ module Jekyll
|
|
80
80
|
@kramdowndata.add(tikzlibraries: Tikz::TikzLibraries.render)
|
81
81
|
end
|
82
82
|
|
83
|
+
def latex_same?(file, code)
|
84
|
+
return false unless File.exist? file
|
85
|
+
|
86
|
+
File.open(file, 'r') do |latexfile|
|
87
|
+
latexfile.read == code
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
83
91
|
def prepare
|
84
92
|
prepare_abstract
|
85
93
|
prepare_date_as_note if @site.config["pdf"]["date_as_note"]
|
@@ -91,7 +99,15 @@ module Jekyll
|
|
91
99
|
FileUtils.mkdir_p @tempdir
|
92
100
|
@latexfile = basename + ".tex"
|
93
101
|
|
94
|
-
|
102
|
+
# stop here, if it does not need to compile
|
103
|
+
latex_full_path = File.join(@tempdir, @latexfile)
|
104
|
+
|
105
|
+
if latex_same? latex_full_path, latex
|
106
|
+
@no_need_to_compile = true
|
107
|
+
return
|
108
|
+
end
|
109
|
+
|
110
|
+
File.open(latex_full_path, "w:UTF-8") do |f|
|
95
111
|
f.write(latex)
|
96
112
|
end
|
97
113
|
|
@@ -130,11 +146,14 @@ module Jekyll
|
|
130
146
|
|
131
147
|
def compile
|
132
148
|
prepare
|
133
|
-
|
149
|
+
status = 0
|
150
|
+
if @no_need_to_compile.nil?
|
151
|
+
cmds = prepare_cmds
|
134
152
|
|
135
|
-
|
153
|
+
Jekyll.logger.debug "jekyll-latex-pdf", "compiling in tempdir: #{@tempdir}"
|
136
154
|
|
137
|
-
|
155
|
+
_out, status = run_cmds cmds, @tempdir
|
156
|
+
end
|
138
157
|
|
139
158
|
if 0 == status
|
140
159
|
@pdf_file = File.join(@tempdir, File.basename(@latexfile, ".*") + ".pdf")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-latex-pdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Kaffanke
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -163,6 +163,7 @@ files:
|
|
163
163
|
- lib/jekyll/latex/pdf/defaults.rb
|
164
164
|
- lib/jekyll/latex/pdf/document.rb
|
165
165
|
- lib/jekyll/latex/pdf/figure.rb
|
166
|
+
- lib/jekyll/latex/pdf/figure/figref.rb
|
166
167
|
- lib/jekyll/latex/pdf/figure/figure.rb
|
167
168
|
- lib/jekyll/latex/pdf/generator.rb
|
168
169
|
- lib/jekyll/latex/pdf/kramdown_data.rb
|