pandocomatic 1.0.0 → 1.0.3
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c076c8f5e123d032fb9f61b0f7cb2b8db675d496a9171827e34ef5f5b47ddbe
|
4
|
+
data.tar.gz: 1e5dfe4ae9c1c47c93b671060da64990649756dd4b2d10e25c77c843cfc23f56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f71e622fd7e58a44680c7215fd2fa21f33745b86096fa83fdd5afaf1dcff282686314e940b612bc9c20217e01c52f9e716c93057b6790dbd6975dc8ff3e341ae
|
7
|
+
data.tar.gz: 0e83c27eec99ae024c7002caca9c063a51d39f621d345c19f4118c3cc1b667bedfc9558d5f4bba1be01d9ae54433d752a472248f9c512b75ecb9b23e22b54f28
|
@@ -28,7 +28,7 @@ module Pandocomatic
|
|
28
28
|
require_relative './pandocomatic_yaml'
|
29
29
|
|
30
30
|
# Regular expression to find metadata blocks in a string.
|
31
|
-
METADATA_BLOCK = /^---[ \t]*(\r\n|\r|\n)(.+?)^(?:---|\.\.\.)[ \t]*(\r\n|\r|\n)/m
|
31
|
+
METADATA_BLOCK = /^---[ \t]*(\r\n|\r|\n)(.+?)^(?:---|\.\.\.)[ \t]*(\r\n|\r|\n)/m.freeze
|
32
32
|
|
33
33
|
# PandocMetadata represents the metadata with pandoc options set in
|
34
34
|
# templates and input files.
|
@@ -184,7 +184,7 @@ module Pandocomatic
|
|
184
184
|
# If more than one pandocomatic property is contained in the input,
|
185
185
|
# all but the first are discarded and are not present in the
|
186
186
|
# extracted metadata YAML string.
|
187
|
-
private_class_method def self.extract_metadata(input, path)
|
187
|
+
private_class_method def self.extract_metadata(input, path = nil)
|
188
188
|
metadata_blocks = MetadataBlockList.new input, path
|
189
189
|
|
190
190
|
["#{YAML.dump(metadata_blocks.full)}...", metadata_blocks.count_pandocomatic_blocks]
|
@@ -19,6 +19,7 @@
|
|
19
19
|
# with pandocomatic. If not, see <http://www.gnu.org/licenses/>.
|
20
20
|
#++
|
21
21
|
module Pandocomatic
|
22
|
+
require 'date'
|
22
23
|
require 'yaml'
|
23
24
|
|
24
25
|
require_relative './error/template_error'
|
@@ -31,7 +32,7 @@ module Pandocomatic
|
|
31
32
|
PERMITTED_YAML_CLASSES = [Date].freeze
|
32
33
|
|
33
34
|
# Regular expression representing environment variables in templates
|
34
|
-
VAR_PATTERN = /\$\((?<var>[a-zA-Z_][a-zA-Z0-9_]*)\)
|
35
|
+
VAR_PATTERN = /\$\((?<var>[a-zA-Z_][a-zA-Z0-9_]*)\)\$/.freeze
|
35
36
|
|
36
37
|
# Load a string, substitute any variables, and parse as YAML.
|
37
38
|
#
|
@@ -60,7 +61,7 @@ module Pandocomatic
|
|
60
61
|
str.gsub(VAR_PATTERN) do |_match|
|
61
62
|
key = Regexp.last_match(1)
|
62
63
|
|
63
|
-
raise TemplateError.new :environment_variable_does_not_exist, { key
|
64
|
+
raise TemplateError.new :environment_variable_does_not_exist, { key: key, path: path } unless ENV.key? key
|
64
65
|
|
65
66
|
ENV[key]
|
66
67
|
end
|
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: 1.0.
|
4
|
+
version: 1.0.3
|
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: 2022-08-
|
11
|
+
date: 2022-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: paru
|