pandocomatic 0.0.10 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/pandocomatic +1 -1
- data/lib/pandocomatic/file_converter.rb +1 -0
- data/lib/pandocomatic/pandoc_metadata.rb +18 -18
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb7b5f8d314027e1992b652298a0b0a51a15c0f6
|
4
|
+
data.tar.gz: dddff694243f9ef06a50bb96c58807f948c9d7bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa659496dfb9041e85b0ecf536686f421b77dd2f4b7d8ff35c350a1a364f6b6cfb0b743adc31678d959565e1256846bf3165210580f613350ec49017f006f281
|
7
|
+
data.tar.gz: fea66ce86d26b5ff986417813ab62b9f40590effdc3f26d854153bbab35b14f2c22216010f225050381b6f0d14799bbbfad84f1463e5d8d5c2ef725b4516f768
|
data/bin/pandocomatic
CHANGED
@@ -8,7 +8,7 @@ require_relative '../lib/pandocomatic/file_converter.rb'
|
|
8
8
|
require_relative '../lib/pandocomatic/configuration.rb'
|
9
9
|
|
10
10
|
opts = Trollop::options do
|
11
|
-
version "pandocomatic 0.0.
|
11
|
+
version "pandocomatic 0.0.12"
|
12
12
|
banner <<-EOB
|
13
13
|
|
14
14
|
Pandocomatic automates the use of pandoc (<http://www.pandoc.org>). It can be
|
@@ -5,7 +5,7 @@ module Pandocomatic
|
|
5
5
|
require 'paru/pandoc'
|
6
6
|
|
7
7
|
class PandocMetadata < Hash
|
8
|
-
|
8
|
+
|
9
9
|
# Paru converters:
|
10
10
|
# Note. When converting metadata back to the pandoc markdown format, you have
|
11
11
|
# to use the option "standalone", otherwise the metadata is skipped
|
@@ -26,39 +26,39 @@ module Pandocomatic
|
|
26
26
|
# Collect the metadata embedded in the src file
|
27
27
|
def self.load_file src
|
28
28
|
begin
|
29
|
-
yaml_metadata = pandoc2yaml
|
29
|
+
yaml_metadata = PandocMetadata.pandoc2yaml src
|
30
30
|
if yaml_metadata.empty? then
|
31
|
-
|
31
|
+
return PandocMetadata.new
|
32
32
|
else
|
33
|
-
|
33
|
+
return PandocMetadata.new YAML.load(yaml_metadata)
|
34
34
|
end
|
35
35
|
rescue Exception => e
|
36
36
|
raise "Error while reading metadata from #{src}; Are you sure it is a pandoc markdown file?\n#{e.message}"
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
def self.pandoc2yaml
|
41
|
-
|
42
|
-
|
40
|
+
def self.pandoc2yaml path
|
41
|
+
json = JSON.parse(PANDOC_2_JSON << File.read(path))
|
42
|
+
yaml = ""
|
43
43
|
|
44
|
-
|
44
|
+
version, metadata = json.values_at(VERSION, META)
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
46
|
+
if not metadata.empty? then
|
47
|
+
metadata_document = {
|
48
|
+
VERSION => version,
|
49
|
+
META => metadata,
|
50
|
+
BLOCKS => []
|
51
|
+
}
|
52
52
|
|
53
|
-
|
54
|
-
|
53
|
+
yaml = JSON_2_PANDOC << JSON.generate(metadata_document)
|
54
|
+
end
|
55
55
|
|
56
|
-
|
56
|
+
yaml
|
57
57
|
end
|
58
58
|
|
59
59
|
def has_template?
|
60
60
|
self['pandocomatic'] and self['pandocomatic']['use-template'] and
|
61
|
-
|
61
|
+
not self['pandocomatic']['use-template'].empty?
|
62
62
|
end
|
63
63
|
|
64
64
|
def template_name
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pandocomatic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Huub de Beer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: paru
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '0.2'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.2.
|
22
|
+
version: 0.2.1
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '0.2'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.2.
|
32
|
+
version: 0.2.1
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: trollop
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|