jekyll-latex-pdf 0.5.2 → 0.6.1

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
- SHA1:
3
- metadata.gz: bb414493da4d0f568ad70493dc8bd4aa1b2b88b7
4
- data.tar.gz: 290cdc7166bd3af0a4b3a763810520e7ea2e2e71
2
+ SHA256:
3
+ metadata.gz: 528b0923672e030fff38180111c258f1b0a9aa4d2663657c238a7a3716bd7d04
4
+ data.tar.gz: 800092a839aac68c8fc436c1ca0895c0d63615f6d71afe1dfab8e6e81f345ee7
5
5
  SHA512:
6
- metadata.gz: 2bbf080ba02afc431613d576a3ea25706ba5ad772d5b4c8ea6ae69cd998cdfd138005daed24bc822b7664eaeb3b18d3287fd3f0b2254147dca65cdd5191ccedd
7
- data.tar.gz: c287947cffb62facfc8e9e2d1661a181a94c741c37dc94f17b6f458486913187445ad81868200dbb97ac6730e1fa2fc4cdf151957e567d8bad9f42e43efd0539
6
+ metadata.gz: b3c7417d69952ee5f49b09d925951ac3c1029d955ebd9f4d169a33af1836d3e135f996077406e6f691c9785682f9d52d3c137e863d7b48aa5e7ea0026a1b934f
7
+ data.tar.gz: bb0faef3661b909126e6c8467a66cf418772bbe6998a7fdf0f6a54bf545f13f9e8e7aeabe17973892e46fb959772e63f81f59fcf8403944b2ff0ca9d088c6584
data/CHANGELOG.md CHANGED
@@ -1,9 +1,19 @@
1
1
  # Changelog
2
2
 
3
- ## [current]
3
+ ## [0.5.4]
4
+ ### Added
5
+ - Make links gray in apa6 pdf.
6
+ - Making links absolute in pdf.
7
+
8
+ ### Bugfix
9
+ - Makeing links work in pdf.
10
+
11
+ ## [0.5.3]
4
12
  ### Added
5
13
  - Use libraries for tikz pictures.
6
14
  - Use md5 in tikz filenames forces reload in browser when changed.
15
+ - Added figref tag which was introducded by me to jekyll-figure
16
+ - No need to rebuild if latex source didn't change.
7
17
 
8
18
  ## [0.5.1]
9
19
  ### Added
data/Gemfile.lock CHANGED
@@ -1,122 +1,128 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-latex-pdf (0.5.2)
5
- jekyll (~> 3.8.5)
6
- kramdown (~> 1.17)
4
+ jekyll-latex-pdf (0.6.1)
5
+ jekyll (~> 4.2)
6
+ kramdown (~> 2.3)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.6.0)
12
- public_suffix (>= 2.0.2, < 4.0)
13
- ast (2.4.0)
14
- bibtex-ruby (4.4.7)
11
+ addressable (2.8.0)
12
+ public_suffix (>= 2.0.2, < 5.0)
13
+ ast (2.4.2)
14
+ bibtex-ruby (6.0.0)
15
15
  latex-decode (~> 0.0)
16
- citeproc (1.0.9)
16
+ citeproc (1.0.10)
17
17
  namae (~> 1.0)
18
- citeproc-ruby (1.1.10)
18
+ citeproc-ruby (1.1.14)
19
19
  citeproc (~> 1.0, >= 1.0.9)
20
- csl (~> 1.5)
21
- coderay (1.1.2)
20
+ csl (~> 1.6)
21
+ coderay (1.1.3)
22
22
  colorator (1.1.0)
23
- concurrent-ruby (1.1.5)
24
- csl (1.5.0)
23
+ concurrent-ruby (1.1.9)
24
+ csl (1.6.0)
25
25
  namae (~> 1.0)
26
- csl-styles (1.0.1.9)
26
+ rexml
27
+ csl-styles (1.0.1.11)
27
28
  csl (~> 1.0)
28
- em-websocket (0.5.1)
29
+ em-websocket (0.5.3)
29
30
  eventmachine (>= 0.12.9)
30
- http_parser.rb (~> 0.6.0)
31
+ http_parser.rb (~> 0)
31
32
  eventmachine (1.2.7)
32
- ffi (1.10.0)
33
+ ffi (1.15.4)
33
34
  forwardable-extended (2.6.0)
34
- http_parser.rb (0.6.0)
35
- i18n (0.9.5)
35
+ http_parser.rb (0.8.0)
36
+ i18n (1.8.11)
36
37
  concurrent-ruby (~> 1.0)
37
- jaro_winkler (1.5.2)
38
- jekyll (3.8.5)
38
+ jekyll (4.2.1)
39
39
  addressable (~> 2.4)
40
40
  colorator (~> 1.0)
41
41
  em-websocket (~> 0.5)
42
- i18n (~> 0.7)
43
- jekyll-sass-converter (~> 1.0)
42
+ i18n (~> 1.0)
43
+ jekyll-sass-converter (~> 2.0)
44
44
  jekyll-watch (~> 2.0)
45
- kramdown (~> 1.14)
45
+ kramdown (~> 2.3)
46
+ kramdown-parser-gfm (~> 1.0)
46
47
  liquid (~> 4.0)
47
- mercenary (~> 0.3.3)
48
+ mercenary (~> 0.4.0)
48
49
  pathutil (~> 0.9)
49
- rouge (>= 1.7, < 4)
50
+ rouge (~> 3.0)
50
51
  safe_yaml (~> 1.0)
51
- jekyll-sass-converter (1.5.2)
52
- sass (~> 3.4)
53
- jekyll-scholar (5.14.1)
54
- bibtex-ruby (~> 4.0, >= 4.0.13)
52
+ terminal-table (~> 2.0)
53
+ jekyll-sass-converter (2.1.0)
54
+ sassc (> 2.0.1, < 3.0)
55
+ jekyll-scholar (7.0.0)
56
+ bibtex-ruby (~> 6.0)
55
57
  citeproc-ruby (~> 1.0)
56
58
  csl-styles (~> 1.0)
57
- jekyll (~> 3.0)
59
+ jekyll (~> 4.0)
58
60
  jekyll-watch (2.2.1)
59
61
  listen (~> 3.0)
60
- kramdown (1.17.0)
61
- latex-decode (0.3.1)
62
+ kramdown (2.3.1)
63
+ rexml
64
+ kramdown-parser-gfm (1.1.0)
65
+ kramdown (~> 2.0)
66
+ latex-decode (0.3.2)
62
67
  liquid (4.0.3)
63
- listen (3.1.5)
64
- rb-fsevent (~> 0.9, >= 0.9.4)
65
- rb-inotify (~> 0.9, >= 0.9.7)
66
- ruby_dep (~> 1.2)
67
- mercenary (0.3.6)
68
- method_source (0.8.2)
69
- namae (1.0.1)
70
- parallel (1.17.0)
71
- parser (2.6.2.1)
72
- ast (~> 2.4.0)
68
+ listen (3.7.0)
69
+ rb-fsevent (~> 0.10, >= 0.10.3)
70
+ rb-inotify (~> 0.9, >= 0.9.10)
71
+ mercenary (0.4.0)
72
+ method_source (1.0.0)
73
+ namae (1.1.1)
74
+ parallel (1.21.0)
75
+ parser (3.0.3.0)
76
+ ast (~> 2.4.1)
73
77
  pathutil (0.16.2)
74
78
  forwardable-extended (~> 2.6)
75
- pry (0.11.0)
76
- coderay (~> 1.1.0)
77
- method_source (~> 0.8.1)
78
- pry-doc (0.6.0)
79
- pry (~> 0.9)
80
- yard (~> 0.8)
81
- psych (3.1.0)
82
- public_suffix (3.0.3)
79
+ pry (0.14.1)
80
+ coderay (~> 1.1)
81
+ method_source (~> 1.0)
82
+ pry-doc (1.2.0)
83
+ pry (~> 0.11)
84
+ yard (~> 0.9.11)
85
+ public_suffix (4.0.6)
83
86
  rainbow (3.0.0)
84
- rake (10.5.0)
85
- rb-fsevent (0.10.3)
86
- rb-inotify (0.10.0)
87
+ rake (13.0.6)
88
+ rb-fsevent (0.11.0)
89
+ rb-inotify (0.10.1)
87
90
  ffi (~> 1.0)
88
- rouge (3.3.0)
89
- rubocop (0.67.2)
90
- jaro_winkler (~> 1.5.1)
91
+ regexp_parser (2.1.1)
92
+ rexml (3.2.5)
93
+ rouge (3.26.1)
94
+ rubocop (1.23.0)
91
95
  parallel (~> 1.10)
92
- parser (>= 2.5, != 2.5.1.1)
93
- psych (>= 3.1.0)
96
+ parser (>= 3.0.0.0)
94
97
  rainbow (>= 2.2.2, < 4.0)
98
+ regexp_parser (>= 1.8, < 3.0)
99
+ rexml
100
+ rubocop-ast (>= 1.12.0, < 2.0)
95
101
  ruby-progressbar (~> 1.7)
96
- unicode-display_width (>= 1.4.0, < 1.6)
97
- ruby-progressbar (1.10.0)
98
- ruby_dep (1.5.0)
102
+ unicode-display_width (>= 1.4.0, < 3.0)
103
+ rubocop-ast (1.13.0)
104
+ parser (>= 3.0.1.1)
105
+ ruby-progressbar (1.11.0)
99
106
  safe_yaml (1.0.5)
100
- sass (3.7.4)
101
- sass-listen (~> 4.0.0)
102
- sass-listen (4.0.0)
103
- rb-fsevent (~> 0.9, >= 0.9.4)
104
- rb-inotify (~> 0.9, >= 0.9.7)
105
- unicode-display_width (1.5.0)
106
- yard (0.9.19)
107
+ sassc (2.4.0)
108
+ ffi (~> 1.9)
109
+ terminal-table (2.0.0)
110
+ unicode-display_width (~> 1.1, >= 1.1.1)
111
+ unicode-display_width (1.8.0)
112
+ yard (0.9.26)
107
113
 
108
114
  PLATFORMS
109
- ruby
115
+ x86_64-linux
110
116
 
111
117
  DEPENDENCIES
112
- bundler (~> 1.16)
118
+ bundler (~> 2.2)
113
119
  jekyll-latex-pdf!
114
- jekyll-scholar (~> 5.14.1)
115
- method_source (~> 0.8.2)
116
- pry
117
- pry-doc (~> 0.6.0)
118
- rake (~> 10.0)
119
- rubocop (~> 0.67)
120
+ jekyll-scholar (~> 7.0)
121
+ method_source (~> 1.0)
122
+ pry (~> 0.14)
123
+ pry-doc (~> 1.2.0)
124
+ rake (~> 13)
125
+ rubocop (~> 1.23)
120
126
 
121
127
  BUNDLED WITH
122
- 1.16.1
128
+ 2.2.32
data/README.md CHANGED
@@ -36,6 +36,13 @@ Or install it yourself as:
36
36
  To make it work with jekyll, you need to add `- jekyll-latex-pdf` to the plugins
37
37
  section in your `_config.yml` file of your jekyll site.
38
38
 
39
+ In `_config.yml` you need to add a section for the pdf config:
40
+ `pdf:
41
+ pdf_engine: lualatex
42
+ author: The Default Author
43
+ `
44
+ See below for other options and what the options control.
45
+
39
46
  You need to have Latex installed on your system. Default is to use `lualatex`
40
47
  and `biber` which depends on your system how to install. Look for texlive and
41
48
  biblatex to see how it works.
@@ -44,8 +51,8 @@ If you want to use the `tikz` environment you additionally need to install
44
51
  `pdf2svg` and `graphicsmagick`.
45
52
 
46
53
  You may want to add `.latex-cache` (or whatever you set in your
47
- `latex_cache_path`) to your `.gitignore`. This is where we store the latex
48
- files for faster recompiling if needed.
54
+ `latex_cache_path`) and `assets/tikz/` to your `.gitignore`. This is where we
55
+ store the latex files for faster recompiling if needed.
49
56
 
50
57
  ## Usage
51
58
 
@@ -60,6 +67,12 @@ In your post template use
60
67
  to get a link to the pdf version of your page. Maybe you want to surround this
61
68
  in an if clause if you have posts which should not be rendered to pdf too.
62
69
 
70
+ Please note that if you use a baseurl, this is not automatically included. In this case you should use:
71
+ ```
72
+ <a href="{{ page.pdf_url | prepend:site.baseurl }}" target="_blank">PDF</a>
73
+ ```
74
+
75
+
63
76
  ## Configuration
64
77
 
65
78
  We ship a latex template which is derived from the kramdown original to add
@@ -86,7 +99,7 @@ Variables to customize are:
86
99
  | `template` | Defaults to `jekyll-latex-pdf` |
87
100
  | `template_path` | Is where we look for your own templates. Defaults to `_latex`. |
88
101
  | `date_as_note` | Is `false` by default. See apa6 |
89
- | `tikz_path` | Defaults to `assets/tikz_svg`. See tikz section. |
102
+ | `tikz_path` | Defaults to `assets/tikz`. See tikz section. |
90
103
  | `latex_cache_dir` | Path where we hold the latex files. Default: `.latex_cache` |
91
104
  | `tikz_md5` | Default: `false`. Use md5 digest in filename to force browser reload on changes. |
92
105
 
@@ -100,7 +113,11 @@ The default template is a good way to start. Copy it to your `_latex` folder,
100
113
  and adjust it. Change the name and set the `template` in your config or the
101
114
  yaml header of your post. Your template in `_latex` will be prefered to the one
102
115
  shiped with this gem if it has the same name. Files should have the `.latex`
103
- extension.
116
+ extension.
117
+
118
+ If you change the template when pdfs are allready created, make sure to delete
119
+ the `latex_cache_dir`, otherwise only changed posts will be recompiled with the
120
+ new template.
104
121
 
105
122
  ### jekyll-latex-pdf
106
123
 
@@ -159,6 +176,17 @@ in a customized template.
159
176
  Use this to create figure environments inside html. With jekyll-latex-pdf you
160
177
  get also the figure environment inside latex files.
161
178
 
179
+ jekyll-figure did not use label and reference, which is often used in latex
180
+ documents. So I implemented this to jekyll-figure, see my (pull
181
+ request)[https://github.com/paulrobertlloyd/jekyll-figure/pull/7]. As long as
182
+ the pull isn't activated, you can use
183
+
184
+ ```
185
+ gem 'jekyll-figure', git: 'https://github.com/grauschnabel/jekyll-figure.git', branch: 'figure_label'
186
+ ```
187
+
188
+ in your jekyll sites Gemfile to have that feature activated for websites.
189
+
162
190
  ## Other extras
163
191
 
164
192
  ### Tikz
@@ -21,11 +21,14 @@ encmap = {
21
21
  }
22
22
  %><%
23
23
  enclang = {
24
+ 'en' => 'english',
24
25
  'de' => 'ngerman',
25
26
  'sv' => 'swedish'
26
27
  }
27
28
  %>
28
29
  \documentclass[a4paper,jou,biblatex]{apa6}
30
+ \usepackage[utf8]{luainputenc}
31
+ %\usepackage{fontspec}
29
32
 
30
33
  \usepackage{amsmath}
31
34
  \usepackage{graphicx}
@@ -40,11 +43,15 @@ colorlinks,
40
43
  citecolor=black,
41
44
  filecolor=black,
42
45
  linkcolor=black,
43
- urlcolor=black
46
+ urlcolor=darkgray
44
47
  }
48
+
45
49
  <% if data[:lang] %>
46
50
  \usepackage[<%= enclang[data[:lang]] %>]{babel}
47
51
  \usepackage[<%= enclang[data[:lang]] %>]{isodate}
52
+ <% else %>
53
+ \usepackage[english]{babel}
54
+ \usepackage[english]{isodate}
48
55
  <% end %>
49
56
 
50
57
  <% 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] %>
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.email = ["martin@kaffanke.at"]
12
12
 
13
13
  spec.summary = "Crates pdfs using just latex for jekyll posts. (needs kramdown)"
14
- spec.description = "The aim is to have a very comfortable and configurabe latex interface for jekyll posts."
14
+ spec.description = "Create PDFs for download from your posts, using latex flexible and comfortable."
15
15
  spec.homepage = "https://gitlab.com/grauschnabel/jekyll-latex-pdf"
16
16
  spec.license = "MIT"
17
17
 
@@ -22,17 +22,17 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r!^exe/!) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
- spec.add_development_dependency "bundler", "~> 1.16"
26
- spec.add_development_dependency "method_source", "~> 0.8.2"
27
- spec.add_development_dependency "pry"
28
- spec.add_development_dependency "pry-doc", "~> 0.6.0"
29
- spec.add_development_dependency "rake", "~> 10.0"
30
- spec.add_development_dependency "rubocop", "~> 0.67"
31
- spec.add_development_dependency "jekyll-scholar", "~> 5.14.1"
25
+ spec.add_development_dependency "bundler", "~> 2.2"
26
+ spec.add_development_dependency "method_source", "~> 1.0"
27
+ spec.add_development_dependency "pry", "~> 0.14"
28
+ spec.add_development_dependency "pry-doc", "~> 1.2.0"
29
+ spec.add_development_dependency "rake", "~> 13"
30
+ spec.add_development_dependency "rubocop", "~> 1.23"
31
+ spec.add_development_dependency "jekyll-scholar", "~> 7.0"
32
32
  #spec.add_development_dependency "minitest", "~> 5.0.0"
33
33
  #spec.add_development_dependency "rouge"
34
34
  #spec.add_development_dependency "stringex", "~> 1.5.1"
35
35
 
36
- spec.add_runtime_dependency "jekyll", "~> 3.8.5"
37
- spec.add_runtime_dependency "kramdown", "~> 1.17"
36
+ spec.add_runtime_dependency "jekyll", "~> 4.2"
37
+ spec.add_runtime_dependency "kramdown", "~> 2.3"
38
38
  end
@@ -13,11 +13,11 @@ module Jekyll
13
13
 
14
14
  def initialize(site, page)
15
15
  @site = site
16
+ @page = page
16
17
  @base = site.source
17
18
  @dir = File.dirname(page.url)
18
19
  @name = File.basename(page.url, File.extname(page.url)) + ".pdf"
19
20
  @texname = File.basename(page.url, File.extname(page.url)) + ".tex"
20
- # @settings = site.config["pdf"] ? site.config["pdf"].clone : {}
21
21
 
22
22
  process(@name)
23
23
 
@@ -25,13 +25,14 @@ module Jekyll
25
25
  self.content = page.content.clone
26
26
  self.source = page.content.dup
27
27
  page.data["pdf_url"] = url
28
- # data["layout"] = layout
28
+
29
29
  data["html_url"] = page.url
30
30
  data["date_str"] = data["date"].strftime("%Y-%m-%d")
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
@@ -61,8 +62,10 @@ module Jekyll
61
62
  def write(dest)
62
63
  path = File.join(dest, CGI.unescape(url))
63
64
 
64
- latex = Latex.new(source, @site, @kramdowndata, @name)
65
+ latex = Latex.new(source, @site, @page, @kramdowndata, @name)
65
66
  if 0 == latex.compile
67
+ # Create target directory if not existing yet (in case of a new post - the HTML rendering which creates folders if needed happens later, so we need to do it here first)
68
+ FileUtils.mkdir_p(File.dirname(path.to_s))
66
69
  FileUtils.cp(latex.pdf_file, path)
67
70
  Jekyll.logger.debug "cp " + latex.pdf_file.to_s + " " + path.to_s
68
71
  end
@@ -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
@@ -1,2 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
  require "jekyll/latex/pdf/figure/figure"
3
+ require "jekyll/latex/pdf/figure/figref"
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Latex
5
+ module Pdf
6
+ module JekyllBase
7
+ # Overrides the default Link tag with it not usable for pdf, where we
8
+ # don't want to have relative pathes.
9
+ class LinkTag < Jekyll::Tags::Link
10
+
11
+ def render(context)
12
+ site = context.registers[:site]
13
+
14
+ site.config["url"] + super
15
+ end
16
+
17
+ end
18
+ end
19
+ TempLiquid.register_tag("link", JekyllBase::LinkTag)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll/latex/pdf/jekyll/link"
@@ -12,10 +12,10 @@ module Jekyll
12
12
 
13
13
  attr_accessor :source, :latex
14
14
  attr_reader :pdf_file
15
- def initialize(source, site, data, name)
16
- # @options = options
15
+ def initialize(source, site, page, data, name)
17
16
  @kramdowndata = data
18
17
  @site = site
18
+ @page = page
19
19
  @name = name
20
20
  @engine = @site.config["pdf"]["pdf_engine"] # @options.options[:pdf_engine]
21
21
  @bibengine = @site.config["pdf"]["bib_engine"] # @options.options[:bib_engine]
@@ -24,7 +24,7 @@ module Jekyll
24
24
  end
25
25
 
26
26
  def find_template
27
- template = @site.config["pdf"]["template"]
27
+ template = @kramdowndata.data[:template]
28
28
 
29
29
  template.concat(".latex") unless template.end_with?(".latex")
30
30
 
@@ -36,27 +36,30 @@ module Jekyll
36
36
  if File.file? t
37
37
  return t
38
38
  else
39
- Jekyll.warn "jekyll-latex-pdf", "Could not find template #{t}."
39
+ Jekyll.logger.error "jekyll-latex-pdf", "Could not find template #{t}."
40
40
  end
41
41
  end
42
42
  end
43
43
 
44
44
  def prepare_latex
45
45
  TempLiquid.run do
46
- liquid_parsed = Liquid::Template.parse(@source, error_mode: :strict)
47
- unless liquid_parsed.errors.empty?
48
- Jekyll.logger.warn("Liquid parse errors", liquid_parsed.errors.join(", "))
49
- end
50
- prep_latex = liquid_parsed.render(strict_filters: true,
51
- strict_variables: true)
52
- unless liquid_parsed.errors.empty?
53
- Jekyll.logger.warn liquid_parsed.errors.join ", "
46
+ info = {
47
+ registers: {site: @site, page: @site.site_payload["page"]},
48
+ strict_filters: true,
49
+ strict_variables: true,
50
+ }
51
+
52
+ template = Liquid::Template.parse(@source)
53
+ template.warnings.each do |e|
54
+ Jekyll.logger.warn "Liquid Warning:",
55
+ LiquidRenderer.format_error(e, path || document.relative_path)
54
56
  end
57
+ prep_latex = template.render!(@site.site_payload, info)
58
+
59
+
55
60
  options = {"data" => @kramdowndata.data,
56
61
  "template" => find_template}
57
- @latex = Kramdown::Document.
58
- new(prep_latex, options).
59
- to_latex
62
+ @latex = Kramdown::Document.new(prep_latex, options).to_latex
60
63
  end
61
64
  end
62
65
 
@@ -68,7 +71,7 @@ module Jekyll
68
71
  Jekyll.logger.debug "Trying to get the abstract from the excerpt."
69
72
  abstract, _, @source = @source.to_s.partition(excerpt_separator)
70
73
  @kramdowndata.add(abstract: Kramdown::Document.new(abstract).to_latex)
71
- end
74
+ end
72
75
  end
73
76
  end
74
77
 
@@ -80,6 +83,14 @@ module Jekyll
80
83
  @kramdowndata.add(tikzlibraries: Tikz::TikzLibraries.render)
81
84
  end
82
85
 
86
+ def latex_same?(file, code)
87
+ return false unless File.exist? file
88
+
89
+ File.open(file, 'r') do |latexfile|
90
+ latexfile.read == code
91
+ end
92
+ end
93
+
83
94
  def prepare
84
95
  prepare_abstract
85
96
  prepare_date_as_note if @site.config["pdf"]["date_as_note"]
@@ -91,7 +102,15 @@ module Jekyll
91
102
  FileUtils.mkdir_p @tempdir
92
103
  @latexfile = basename + ".tex"
93
104
 
94
- File.open(File.join(@tempdir, @latexfile), "w:UTF-8") do |f|
105
+ # stop here, if it does not need to compile
106
+ latex_full_path = File.join(@tempdir, @latexfile)
107
+
108
+ if latex_same? latex_full_path, latex
109
+ @no_need_to_compile = true
110
+ return
111
+ end
112
+
113
+ File.open(latex_full_path, "w:UTF-8") do |f|
95
114
  f.write(latex)
96
115
  end
97
116
 
@@ -130,11 +149,14 @@ module Jekyll
130
149
 
131
150
  def compile
132
151
  prepare
133
- cmds = prepare_cmds
152
+ status = 0
153
+ if @no_need_to_compile.nil?
154
+ cmds = prepare_cmds
134
155
 
135
- Jekyll.logger.debug "jekyll-latex-pdf", "compiling in tempdir: #{@tempdir}"
156
+ Jekyll.logger.debug "jekyll-latex-pdf", "compiling in tempdir: #{@tempdir}"
136
157
 
137
- out, status = run_cmds cmds, @tempdir
158
+ _out, status = run_cmds cmds, @tempdir
159
+ end
138
160
 
139
161
  if 0 == status
140
162
  @pdf_file = File.join(@tempdir, File.basename(@latexfile, ".*") + ".pdf")
@@ -3,7 +3,7 @@
3
3
  module Jekyll
4
4
  module Latex
5
5
  module Pdf
6
- VERSION = "0.5.2"
6
+ VERSION = "0.6.1"
7
7
  end
8
8
  end
9
9
  end
@@ -5,6 +5,7 @@ require "jekyll/latex/pdf/kramdown_data"
5
5
  require "jekyll/latex/pdf/utilities"
6
6
  require "jekyll/latex/pdf/liquid"
7
7
 
8
+ require "jekyll/latex/pdf/jekyll"
8
9
  require "jekyll/latex/pdf/tikz"
9
10
 
10
11
  require "jekyll/latex/pdf/latex"
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.2
4
+ version: 0.6.1
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-01 00:00:00.000000000 Z
11
+ date: 2021-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,128 +16,127 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: '2.2'
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: '1.16'
26
+ version: '2.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: method_source
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.8.2
33
+ version: '1.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: 0.8.2
40
+ version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '0.14'
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'
54
+ version: '0.14'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry-doc
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.6.0
61
+ version: 1.2.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: 0.6.0
68
+ version: 1.2.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '10.0'
75
+ version: '13'
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: '10.0'
82
+ version: '13'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rubocop
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.67'
89
+ version: '1.23'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.67'
96
+ version: '1.23'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: jekyll-scholar
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 5.14.1
103
+ version: '7.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 5.14.1
110
+ version: '7.0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: jekyll
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 3.8.5
117
+ version: '4.2'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 3.8.5
124
+ version: '4.2'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: kramdown
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '1.17'
131
+ version: '2.3'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '1.17'
139
- description: The aim is to have a very comfortable and configurabe latex interface
140
- for jekyll posts.
138
+ version: '2.3'
139
+ description: Create PDFs for download from your posts, using latex flexible and comfortable.
141
140
  email:
142
141
  - martin@kaffanke.at
143
142
  executables: []
@@ -163,8 +162,11 @@ files:
163
162
  - lib/jekyll/latex/pdf/defaults.rb
164
163
  - lib/jekyll/latex/pdf/document.rb
165
164
  - lib/jekyll/latex/pdf/figure.rb
165
+ - lib/jekyll/latex/pdf/figure/figref.rb
166
166
  - lib/jekyll/latex/pdf/figure/figure.rb
167
167
  - lib/jekyll/latex/pdf/generator.rb
168
+ - lib/jekyll/latex/pdf/jekyll.rb
169
+ - lib/jekyll/latex/pdf/jekyll/link.rb
168
170
  - lib/jekyll/latex/pdf/kramdown_data.rb
169
171
  - lib/jekyll/latex/pdf/latex.rb
170
172
  - lib/jekyll/latex/pdf/liquid.rb
@@ -197,8 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
199
  - !ruby/object:Gem::Version
198
200
  version: '0'
199
201
  requirements: []
200
- rubyforge_project:
201
- rubygems_version: 2.6.14
202
+ rubygems_version: 3.1.2
202
203
  signing_key:
203
204
  specification_version: 4
204
205
  summary: Crates pdfs using just latex for jekyll posts. (needs kramdown)