jekyll-latex-pdf 0.2.0 → 0.3.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 +4 -4
- data/Gemfile.lock +2 -3
- data/README.md +14 -1
- data/data/kramdown/jekyll-latex-pdf.latex +59 -0
- data/jekyll-latex-pdf.gemspec +2 -2
- data/lib/jekyll/latex/pdf/document.rb +22 -42
- data/lib/jekyll/latex/pdf/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e0209dea3ec7987e45a52b5c0f453577a9238e7
|
4
|
+
data.tar.gz: ed0f2f71363b70fd06160ae0375a1de354cd97a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cbd9e7a478ca257ce21a8f16c09ccb076d79f551a13ba7a606b3f9f91b489d1b368e3cc8df95ac546ae15be7190e49e946d7fdfb5e14b4eff17e5df937b9225
|
7
|
+
data.tar.gz: 00d99d438bad40a8c8fdc5c0c476959eff09a54f9e268d3493fd25d9a8ea8228858238e8acc9dacabbea8b7f8d26c046f04da287efac0f293984c679fc7f2294
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jekyll-latex-pdf (0.
|
4
|
+
jekyll-latex-pdf (0.3.0)
|
5
5
|
jekyll (~> 3.8.5)
|
6
|
-
|
6
|
+
kramdown (~> 1.17)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -45,7 +45,6 @@ GEM
|
|
45
45
|
rb-inotify (~> 0.9, >= 0.9.7)
|
46
46
|
ruby_dep (~> 1.2)
|
47
47
|
mercenary (0.3.6)
|
48
|
-
paru (0.3.2.0)
|
49
48
|
pathutil (0.16.2)
|
50
49
|
forwardable-extended (~> 2.6)
|
51
50
|
public_suffix (3.0.3)
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Jekyll::Latex::Pdf
|
2
2
|
|
3
|
-
This gem uses
|
3
|
+
This gem uses kramdown and latex to generate pdf files.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -35,7 +35,20 @@ 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
41
|
|
42
|
+
jekyll-latex-pdf uses `lualatex` as default engine. You can change this in
|
43
|
+
`_config.yml` by adding. There you can also set a default author:
|
44
|
+
|
45
|
+
```
|
46
|
+
pdf:
|
47
|
+
pdf_engine: pdflatex
|
48
|
+
author: Martin Kaffanke
|
49
|
+
|
50
|
+
Just set up a ticket on https://gitlab.com/grauschnabel/jekyll-latex-pdf/issues
|
51
|
+
to add feature requests you need.
|
39
52
|
|
40
53
|
## Development
|
41
54
|
|
@@ -0,0 +1,59 @@
|
|
1
|
+
<%
|
2
|
+
encmap = {
|
3
|
+
'UTF-8' => 'utf8x',
|
4
|
+
'US-ASCII' => 'ascii',
|
5
|
+
'ISO-8859-1' => 'latin1',
|
6
|
+
'ISO-8859-2' => 'latin2',
|
7
|
+
'ISO-8859-3' => 'latin3',
|
8
|
+
'ISO-8859-4' => 'latin4',
|
9
|
+
'ISO-8859-5' => 'latin5',
|
10
|
+
'ISO-8859-9' => 'latin9',
|
11
|
+
'ISO-8859-10' => 'latin10',
|
12
|
+
'CP850' => 'cp850',
|
13
|
+
'CP852' => 'cp852',
|
14
|
+
'CP858' => 'cp858',
|
15
|
+
'CP437' => 'cp437',
|
16
|
+
'CP865' => 'cp865',
|
17
|
+
'CP1250' => 'cp120',
|
18
|
+
'CP1252' => 'cp1252',
|
19
|
+
'CP1257' => 'cp1257'
|
20
|
+
}
|
21
|
+
%>
|
22
|
+
\documentclass{scrartcl}
|
23
|
+
<% if RUBY_VERSION >= '1.9' %>
|
24
|
+
\usepackage[<%= encmap[@body.encoding.name] %>]{inputenc}
|
25
|
+
<% else %>
|
26
|
+
\usepackage[mathletters]{ucs}
|
27
|
+
\usepackage[utf8x]{inputenc}
|
28
|
+
<% end %>
|
29
|
+
\usepackage[T1]{fontenc}
|
30
|
+
\usepackage{listings}
|
31
|
+
<% @converter.data[:packages].each {|pkg| %>\usepackage{<%= pkg %>}
|
32
|
+
<% } %>
|
33
|
+
\usepackage{hyperref}
|
34
|
+
|
35
|
+
<% if @converter.data[:packages].include?('fancyvrb') %>
|
36
|
+
\VerbatimFootnotes
|
37
|
+
<% end %>
|
38
|
+
|
39
|
+
<% if @converter.data[:packages].include?('acronym') %>
|
40
|
+
<% @converter.root.options[:abbrev_defs].each_pair do |k,v| %>\acrodef{<%= @converter.normalize_abbreviation_key(k) %>}[<%= k %>]{<%= @converter.escape(v) %>}
|
41
|
+
<% end %>
|
42
|
+
<% end %>
|
43
|
+
|
44
|
+
\setcounter{footnote}{<%= @converter.options[:footnote_nr] - 1 %>}
|
45
|
+
|
46
|
+
\hypersetup{colorlinks=true,urlcolor=blue}
|
47
|
+
|
48
|
+
<% if @converter.options[:title] %>
|
49
|
+
\title{<%= @converter.options[:title] %>}
|
50
|
+
\author{<%= @converter.options[:author] %>}
|
51
|
+
\date{<%= @converter.options[:date] %>}
|
52
|
+
<% end %>
|
53
|
+
|
54
|
+
\begin{document}
|
55
|
+
<% if @converter.options[:title] %>
|
56
|
+
\maketitle
|
57
|
+
<% end %>
|
58
|
+
<%= @body %>
|
59
|
+
\end{document}
|
data/jekyll-latex-pdf.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Martin Kaffanke"]
|
10
10
|
spec.email = ["martin@kaffanke.at"]
|
11
11
|
|
12
|
-
spec.summary = "Crates pdfs using
|
12
|
+
spec.summary = "Crates pdfs using just latex for jekyll posts. (needs kramdown)"
|
13
13
|
spec.description = "The aim is to have a very comfortable and configurabe latex interface for jekyll posts."
|
14
14
|
spec.homepage = "https://gitlab.com/grauschnabel/jekyll-latex-pdf"
|
15
15
|
spec.license = "MIT"
|
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
26
|
|
27
27
|
spec.add_runtime_dependency "jekyll", "~> 3.8.5"
|
28
|
-
spec.add_runtime_dependency "
|
28
|
+
spec.add_runtime_dependency "kramdown", "~> 1.17"
|
29
29
|
end
|
@@ -1,4 +1,8 @@
|
|
1
|
-
require "paru/pandoc"
|
1
|
+
#require "paru/pandoc"
|
2
|
+
require "kramdown"
|
3
|
+
require 'tmpdir'
|
4
|
+
require "open3"
|
5
|
+
require 'fileutils'
|
2
6
|
|
3
7
|
module Jekyll
|
4
8
|
module Latex
|
@@ -13,60 +17,36 @@ module Jekyll
|
|
13
17
|
@settings = site.config.key?('pdf') ? site.config['pdf'].clone : {}
|
14
18
|
|
15
19
|
self.process(@name)
|
16
|
-
# self.process(@texname) # switch on to get tex file for debugging
|
17
20
|
self.data = page.data.clone
|
18
21
|
self.content = page.content.clone
|
19
22
|
page.data['pdf_url'] = self.url
|
20
23
|
self.data['html_url'] = page.url
|
21
24
|
|
22
|
-
puts self.data
|
23
25
|
self.data['date'] = self.data['date'].strftime("%Y-%m-%d")
|
24
|
-
|
25
|
-
@pandoc = Paru::Pandoc.new do
|
26
|
-
from "markdown"
|
27
|
-
to "latex"
|
28
|
-
pdf_engine "lualatex"
|
29
|
-
standalone
|
30
|
-
end
|
31
26
|
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
def prepare_pandoc(options)
|
27
|
+
template = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'data', 'kramdown', 'jekyll-latex-pdf.latex'))
|
36
28
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
begin
|
44
|
-
@pandoc.send option, value
|
45
|
-
rescue Exception => e
|
46
|
-
begin
|
47
|
-
if value.is_a? String then
|
48
|
-
@pandoc.send "variable", "#{option}=#{value}"
|
49
|
-
elsif value.is_a? Array then
|
50
|
-
value.each do |v|
|
51
|
-
@pandoc.send "variable", "#{option}=#{v}"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
rescue Exception => e
|
56
|
-
warn "Option not supported: #{e.message}"
|
57
|
-
puts e
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
29
|
+
defaults = {
|
30
|
+
'template' => template,
|
31
|
+
'pdf_engine' => 'lualatex'
|
32
|
+
}
|
33
|
+
|
34
|
+
@options = defaults.merge( @settings.merge(self.data) )
|
61
35
|
end
|
62
36
|
|
63
37
|
def write(dest)
|
64
38
|
path = File.join(dest, CGI.unescape(self.url))
|
39
|
+
|
40
|
+
latex_string = Kramdown::Document.new(self.content, @options).to_latex
|
65
41
|
|
66
|
-
|
67
|
-
|
68
|
-
@
|
69
|
-
|
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
|
49
|
+
end
|
70
50
|
end
|
71
51
|
end
|
72
52
|
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.
|
4
|
+
version: 0.3.0
|
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-
|
11
|
+
date: 2019-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -53,19 +53,19 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 3.8.5
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: kramdown
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '1.17'
|
62
62
|
type: :runtime
|
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:
|
68
|
+
version: '1.17'
|
69
69
|
description: The aim is to have a very comfortable and configurabe latex interface
|
70
70
|
for jekyll posts.
|
71
71
|
email:
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- Rakefile
|
84
84
|
- bin/console
|
85
85
|
- bin/setup
|
86
|
+
- data/kramdown/jekyll-latex-pdf.latex
|
86
87
|
- jekyll-latex-pdf.gemspec
|
87
88
|
- lib/jekyll-latex-pdf.rb
|
88
89
|
- lib/jekyll/latex/pdf.rb
|
@@ -112,5 +113,5 @@ rubyforge_project:
|
|
112
113
|
rubygems_version: 2.6.14
|
113
114
|
signing_key:
|
114
115
|
specification_version: 4
|
115
|
-
summary: Crates pdfs using
|
116
|
+
summary: Crates pdfs using just latex for jekyll posts. (needs kramdown)
|
116
117
|
test_files: []
|