jekyll-latex-pdf 0.3.0 → 0.3.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
2
  SHA1:
3
- metadata.gz: 2e0209dea3ec7987e45a52b5c0f453577a9238e7
4
- data.tar.gz: ed0f2f71363b70fd06160ae0375a1de354cd97a0
3
+ metadata.gz: c206e73833eec7f40f7d9478b400f2b7b04d375a
4
+ data.tar.gz: 6bc6c41424c049589a90d65ee8d482730738568d
5
5
  SHA512:
6
- metadata.gz: 2cbd9e7a478ca257ce21a8f16c09ccb076d79f551a13ba7a606b3f9f91b489d1b368e3cc8df95ac546ae15be7190e49e946d7fdfb5e14b4eff17e5df937b9225
7
- data.tar.gz: 00d99d438bad40a8c8fdc5c0c476959eff09a54f9e268d3493fd25d9a8ea8228858238e8acc9dacabbea8b7f8d26c046f04da287efac0f293984c679fc7f2294
6
+ metadata.gz: 903a0808e458235e79ff210dd7206fc04609a5202b2bfc4a175c875cbf9739723084d4b299e9ee3b55c00df77dea04f5685c70c8c4f04eacbe04428d062a4036
7
+ data.tar.gz: cf4f8283d2bfc800b76f08b43c2a9eda039476cd345ab1b19627af8c5385edc29ce91dc86d8083c6fdb0b74c136f18cd95202347cf60dcd294444ff4292bc9fe
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-latex-pdf (0.3.0)
4
+ jekyll-latex-pdf (0.3.1)
5
5
  jekyll (~> 3.8.5)
6
6
  kramdown (~> 1.17)
7
7
 
data/README.md CHANGED
@@ -35,9 +35,8 @@ to get a link to the pdf version of your page.
35
35
 
36
36
  ## Configuration
37
37
 
38
- We ship a new latex template which is derived from the kramdown original to add
39
- title, author and date from the post. This will be configurable in future
40
- versions.
38
+ We ship a latex template which is derived from the kramdown original to add
39
+ title, author and date from the post. See section below.
41
40
 
42
41
  jekyll-latex-pdf uses `lualatex` as default engine. You can change this in
43
42
  `_config.yml` by adding. There you can also set a default author:
@@ -46,10 +45,22 @@ jekyll-latex-pdf uses `lualatex` as default engine. You can change this in
46
45
  pdf:
47
46
  pdf_engine: pdflatex
48
47
  author: Martin Kaffanke
48
+ template: myowntemplate
49
+ ```
49
50
 
50
51
  Just set up a ticket on https://gitlab.com/grauschnabel/jekyll-latex-pdf/issues
51
52
  to add feature requests you need.
52
53
 
54
+ ## Template
55
+
56
+ For the configuration above we need a template in the `_latex` directory, called
57
+ `myowntemplate.latex`. It could be a good way to start using the shiped
58
+ template and adjust it to your needs.
59
+
60
+ ## TODO:
61
+
62
+ - Language support (date, babel, ...)
63
+
53
64
  ## Development
54
65
 
55
66
  This packages is hardly in development at the moment. Feel free to add feature
@@ -30,23 +30,39 @@ module Jekyll
30
30
  'template' => template,
31
31
  'pdf_engine' => 'lualatex'
32
32
  }
33
-
33
+
34
+ if @settings['template']
35
+ @settings['template'] = File.expand_path(File.join("_latex", @settings['template']))
36
+ unless @settings['template'].end_with?(".latex")
37
+ @settings['template'].concat(".latex")
38
+ end
39
+ end
40
+
34
41
  @options = defaults.merge( @settings.merge(self.data) )
42
+ puts @options
35
43
  end
36
44
 
37
45
  def write(dest)
38
46
  path = File.join(dest, CGI.unescape(self.url))
47
+ tempdir = Dir.mktmpdir('jekyll-latex-pdf')
48
+ latexfile = File.join(tempdir, "texput.tex")
39
49
 
40
50
  latex_string = Kramdown::Document.new(self.content, @options).to_latex
51
+ File.open(latexfile, "w:UTF-8") do |f|
52
+ f.write(latex_string)
53
+ end
41
54
 
42
- # using latex (default lualatex) to convert the things to pdf
43
- tempdir = Dir.mktmpdir('jekyll-latex-pdf')
44
- Open3.popen3(@options['pdf_engine'], "--output-directory=#{tempdir}") do |i,o,e,t|
45
- i.puts latex_string
46
- if (t.value == 0)
47
- FileUtils.mv(File.join(tempdir, "texput.pdf"), path)
48
- end
55
+ stdout_str, status = Open3.capture2(@options['pdf_engine'], "--output-directory=#{tempdir}", "--output-format=pdf",
56
+ "--interaction=batchmode", latexfile)
57
+ #puts stdout_str
58
+
59
+
60
+ if (status == 0)
61
+ FileUtils.mv(File.join(tempdir, "texput.pdf"), path)
62
+ else
63
+ puts "Error when trying to run #{@options['pdf_engine']}. See #{tempdir}/texput.log"
49
64
  end
65
+
50
66
  end
51
67
  end
52
68
  end
@@ -1,7 +1,7 @@
1
1
  module Jekyll
2
2
  module Latex
3
3
  module Pdf
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
6
6
  end
7
7
  end
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.3.0
4
+ version: 0.3.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-04-02 00:00:00.000000000 Z
11
+ date: 2019-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler