pandocomatic 0.1.4.8 → 0.1.4.9
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 +2 -9
- data/lib/pandocomatic/pandocomatic.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b790fdc99211b28030f3e6c2fb83ec9a68dcbf2c
|
4
|
+
data.tar.gz: b3bce488828fd3f610b922d012022b9fa2c880ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: daa6fea415f430f87d4806e15d405a8b2bd469005eec21530c1799ccde8dc19736ff8af34559a0d91e1ef6f9814531193301697c8f209bbb75dcd1f655672ac3
|
7
|
+
data.tar.gz: cd9553189cb5f60350073d79192980e5ed4d205df5f79cf87a582f1bf6177b91fa875e535e6d05a722e80de93aa2ab6bca704c5e705773214bf693d4c9553a58
|
@@ -21,6 +21,7 @@ module Pandocomatic
|
|
21
21
|
require 'json'
|
22
22
|
require 'yaml'
|
23
23
|
require 'paru'
|
24
|
+
require 'paru/pandoc2yaml'
|
24
25
|
|
25
26
|
require_relative './error/pandoc_error.rb'
|
26
27
|
require_relative './error/io_error.rb'
|
@@ -29,20 +30,12 @@ module Pandocomatic
|
|
29
30
|
|
30
31
|
def self.extract_metadata input_document
|
31
32
|
begin
|
32
|
-
|
33
|
+
Paru::Pandoc2Yaml.extract_metadata(input_document)
|
33
34
|
rescue StandardError => e
|
34
35
|
raise IOError.new(:error_opening_file, e, input_document)
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
38
|
-
def self.pandoc2yaml(input)
|
39
|
-
input
|
40
|
-
.scan(/^---[ \t]*\n(.+?)^(?:---|\.\.\.)[ \t]*\n/m)
|
41
|
-
.flatten
|
42
|
-
.map{|yaml| yaml.strip}
|
43
|
-
.join("\n")
|
44
|
-
end
|
45
|
-
|
46
39
|
# Collect the metadata embedded in the src file
|
47
40
|
def self.load_file src
|
48
41
|
yaml_metadata = extract_metadata src
|