pandocomatic 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pandocomatic/pandoc_metadata.rb +27 -9
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efffec683c3637d515e38f52cb5bae086b6370fb
|
4
|
+
data.tar.gz: 0eaee541072d94c45269d15a922d4d9c7ff64d59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 015290673a49536d9201f385fcb6b33dc8d2d9242d1592607a01cd868c3f740b498824756cc177888f4cbdec11a2ff1b9c5a054b25070d843e7a28ca1cb7d107
|
7
|
+
data.tar.gz: db20487b149bca4f44634b2f675e11940e94bb364c4bb7427fce399bbf72461178f7060a5290e7070551e161acd688d360699718d60bde269c286efd9d9f212f
|
@@ -5,6 +5,18 @@ module Pandocomatic
|
|
5
5
|
require 'paru/pandoc'
|
6
6
|
|
7
7
|
class PandocMetadata < Hash
|
8
|
+
|
9
|
+
# Paru converters:
|
10
|
+
# Note. When converting metadata back to the pandoc markdown format, you have
|
11
|
+
# to use the option "standalone", otherwise the metadata is skipped
|
12
|
+
PANDOC_2_JSON = Paru::Pandoc.new {from "markdown"; to "json"}
|
13
|
+
JSON_2_PANDOC = Paru::Pandoc.new {from "json"; to "markdown"; standalone}
|
14
|
+
|
15
|
+
# When converting a pandoc document to JSON, or vice versa, the JSON object
|
16
|
+
# has the following three properties:
|
17
|
+
VERSION = "pandoc-api-version"
|
18
|
+
META = "meta"
|
19
|
+
BLOCKS = "blocks"
|
8
20
|
|
9
21
|
def initialize hash = {}
|
10
22
|
super
|
@@ -26,16 +38,22 @@ module Pandocomatic
|
|
26
38
|
end
|
27
39
|
|
28
40
|
def self.pandoc2yaml document
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
metadata =
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
41
|
+
json = JSON.parse(PANDOC_2_JSON << File.read(document))
|
42
|
+
yaml = ""
|
43
|
+
|
44
|
+
version, metadata = json.values_at(VERSION, META)
|
45
|
+
|
46
|
+
if not metadata.empty? then
|
47
|
+
metadata_document = {
|
48
|
+
VERSION => version,
|
49
|
+
META => metadata,
|
50
|
+
BLOCKS => []
|
51
|
+
}
|
52
|
+
|
53
|
+
yaml = JSON_2_PANDOC << JSON.generate(metadata_document)
|
37
54
|
end
|
38
|
-
|
55
|
+
|
56
|
+
yaml
|
39
57
|
end
|
40
58
|
|
41
59
|
def has_template?
|
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.10
|
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:
|
11
|
+
date: 2016-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: paru
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.2'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.0
|
22
|
+
version: 0.2.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0.
|
29
|
+
version: '0.2'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.0
|
32
|
+
version: 0.2.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: trollop
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -69,7 +69,7 @@ files:
|
|
69
69
|
- lib/pandocomatic/processor.rb
|
70
70
|
homepage: https://github.com/htdebeer/pandocomatic
|
71
71
|
licenses:
|
72
|
-
-
|
72
|
+
- GPL-3.0
|
73
73
|
metadata: {}
|
74
74
|
post_install_message:
|
75
75
|
rdoc_options: []
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
requirements:
|
89
89
|
- pandoc, a universal document converer <http://pandoc.org>
|
90
90
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.
|
91
|
+
rubygems_version: 2.5.1
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: Automate the use of pandoc
|