octopress-printable 0.1.0 → 0.1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/assets/config.yml +0 -17
- data/lib/octopress-printable/config.rb +1 -1
- data/lib/octopress-printable/plugin.rb +8 -25
- data/lib/octopress-printable/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a053215d4f4864452208d8fb8d17d5c27c3234a
|
4
|
+
data.tar.gz: b155ab563874ed00e1b7f3d54e5577cc45595399
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 955994de683ca03fae3fb43eea7129936e423ec0ca8fe743be85907e019baf4d10c3906cc2841ec21b3b5c143879524ba003b73a2b7d383da20e7c1aca32a246
|
7
|
+
data.tar.gz: d05b348316ad44874e4a8fe02fdd4262303f361a4283540fd1bfac4bd54b3776049e87291f8dc1018a972019f98c8bd86d09ed27be57ddb436263c0efa1a31e8
|
data/CHANGELOG.md
CHANGED
data/assets/config.yml
CHANGED
@@ -1,17 +0,0 @@
|
|
1
|
-
posts_dir: "_posts"
|
2
|
-
printables_dir: "assets/printables"
|
3
|
-
source_dir: "."
|
4
|
-
blog_url: "http://example.com" # used in pdf post_links
|
5
|
-
bibliography_dir: "_bibliography"
|
6
|
-
bibliography: "references.bib"
|
7
|
-
|
8
|
-
# only convert markdowns, without running pandoc and xelatex
|
9
|
-
dry_run : false
|
10
|
-
|
11
|
-
# debug files
|
12
|
-
dump_tex_file: false
|
13
|
-
dump_markdown_file: false
|
14
|
-
dump_bib_file: false
|
15
|
-
dump_cmds: false
|
16
|
-
keep_tmp_files: false
|
17
|
-
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module Octopress
|
2
2
|
module Printable
|
3
|
+
autoload :Config, 'octopress-printable/config'
|
3
4
|
autoload :Converter, 'octopress-printable/converter'
|
4
5
|
autoload :MathConverter, 'octopress-printable/math'
|
5
6
|
autoload :ImgConverter, 'octopress-printable/img'
|
@@ -40,7 +41,8 @@ module Octopress
|
|
40
41
|
|
41
42
|
if !File.exists?(pdf) || File.stat(post).mtime > File.stat(pdf).mtime
|
42
43
|
puts "Converting #{post} to #{pdf}"
|
43
|
-
gen_pdf(post, pdf, source_dir, posts_dir, blog_url,
|
44
|
+
gen_pdf(post, pdf, source_dir, posts_dir, blog_url,
|
45
|
+
bib_dir, bib, p.url)
|
44
46
|
if File.exists?(pdf)
|
45
47
|
site.static_files << Jekyll::StaticFile.new(site,
|
46
48
|
site.source, printables_dir, File.basename(pdf))
|
@@ -51,33 +53,11 @@ module Octopress
|
|
51
53
|
|
52
54
|
def inject_configs
|
53
55
|
@conf = self.config
|
54
|
-
@conf = Jekyll::Utils.deep_merge_hashes(YAML.load(
|
55
|
-
end
|
56
|
-
|
57
|
-
def self.default_config
|
58
|
-
<<-CONFIG
|
59
|
-
posts_dir: "_posts"
|
60
|
-
printables_dir: "assets/printables"
|
61
|
-
source_dir: "."
|
62
|
-
blog_url: "http://example.com" # used in pdf post_links
|
63
|
-
bibliography_dir: "_bibliography"
|
64
|
-
bibliography: "references.bib"
|
65
|
-
|
66
|
-
# only convert markdowns, without running pandoc and xelatex
|
67
|
-
dry_run : false
|
68
|
-
|
69
|
-
# debug files
|
70
|
-
dump_tex_file: false
|
71
|
-
dump_markdown_file: false
|
72
|
-
dump_bib_file: false
|
73
|
-
dump_cmds: false
|
74
|
-
keep_tmp_files: false
|
75
|
-
|
76
|
-
CONFIG
|
56
|
+
@conf = Jekyll::Utils.deep_merge_hashes(YAML.load(Config.default_config), @conf)
|
77
57
|
end
|
78
58
|
|
79
59
|
def gen_pdf(mdfile, pdffile, source_dir, posts_dir, blog_url,
|
80
|
-
bib_dir, bib_file)
|
60
|
+
bib_dir, bib_file, post_url)
|
81
61
|
pdfdir = File.dirname(pdffile)
|
82
62
|
if ! File.exists?(pdfdir)
|
83
63
|
FileUtils.mkdir_p pdfdir
|
@@ -133,6 +113,9 @@ CONFIG
|
|
133
113
|
post.puts line
|
134
114
|
end
|
135
115
|
end
|
116
|
+
|
117
|
+
url = "#{blog_url}/#{post_url}".gsub(/([^:])\/\/+/, '\1/')
|
118
|
+
post.puts "\\renewcommand{\\thefootnote}{}\\footnotetext{Online version at \\url{#{url}}}"
|
136
119
|
end
|
137
120
|
|
138
121
|
cts = []
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-printable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wang Jian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|