pandocomatic 0.2.5.0.betaa → 0.2.5.0.betac
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 +4 -4
- data/lib/pandocomatic/configuration.rb +12 -1
- data/lib/pandocomatic/multiple_files_input.rb +23 -3
- data/lib/pandocomatic/pandocomatic.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83da5ac4d9f87c0b60d2ec6275604fbc8c840448a0d4b2e8bcd3d814f43851a1
|
4
|
+
data.tar.gz: 6c2aa725f3476c529b743a337b26e19c3135440e6972a5d8121c100cd8c95202
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 142b4f1a64096eb3ae1b7311d2639020d6af74af98c0cc28acf90fe6018dcdb9b7685408114452ba4b50f54acbc8629afb1a40ebf64a886e0f7bdaf4a388b8aa
|
7
|
+
data.tar.gz: 1aa6c6e996c8c667f738ce40b09d5dafc2251536a1b2481502dca6627262fe2c84ca16597c0f62afcefec86b513e44bfaae2ec35926765b64f01d9f0061a6701
|
@@ -61,6 +61,8 @@ module Pandocomatic
|
|
61
61
|
# A Configuration object models a pandocomatic configuration.
|
62
62
|
class Configuration
|
63
63
|
|
64
|
+
attr_reader :input
|
65
|
+
|
64
66
|
# Pandocomatic's default configuration file
|
65
67
|
CONFIG_FILE = 'pandocomatic.yaml'
|
66
68
|
|
@@ -265,7 +267,7 @@ module Pandocomatic
|
|
265
267
|
# Get the input file name
|
266
268
|
#
|
267
269
|
# @return [String]
|
268
|
-
def
|
270
|
+
def input_file()
|
269
271
|
if @input.nil? then
|
270
272
|
nil
|
271
273
|
else
|
@@ -458,6 +460,15 @@ module Pandocomatic
|
|
458
460
|
extension
|
459
461
|
end
|
460
462
|
|
463
|
+
def is_markdown_file?(filename)
|
464
|
+
if filename.nil? then
|
465
|
+
false
|
466
|
+
else
|
467
|
+
ext = File.extname(filename).delete_prefix(".");
|
468
|
+
"markdown" == DEFAULT_EXTENSION.key(ext)
|
469
|
+
end
|
470
|
+
end
|
471
|
+
|
461
472
|
# Is there a template with template_name in this Configuration?
|
462
473
|
#
|
463
474
|
# @param template_name [String] a template's name
|
@@ -61,7 +61,19 @@ module Pandocomatic
|
|
61
61
|
#
|
62
62
|
# @return String
|
63
63
|
def to_s()
|
64
|
-
@input_files.
|
64
|
+
input_string = @input_files.first
|
65
|
+
previous_dir = File.dirname @input_files.first
|
66
|
+
@input_files.slice(1..-1).each do |f|
|
67
|
+
current_dir = File.dirname f
|
68
|
+
if current_dir == previous_dir
|
69
|
+
input_string += " + #{File.basename f}"
|
70
|
+
else
|
71
|
+
previous_dir = current_dir
|
72
|
+
input_string += " + #{f}"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
input_string
|
65
77
|
end
|
66
78
|
|
67
79
|
private
|
@@ -82,13 +94,21 @@ module Pandocomatic
|
|
82
94
|
if not template.nil? and not template.dig("pandoc", "from").nil? then
|
83
95
|
template["pandoc"]["from"]
|
84
96
|
else
|
85
|
-
|
97
|
+
if @config.is_markdown_file? @input_files.first then
|
98
|
+
"markdown"
|
99
|
+
else
|
100
|
+
"unknown"
|
101
|
+
end
|
86
102
|
end
|
87
103
|
end
|
88
104
|
|
89
105
|
@input_files.each_with_index do |filename, index|
|
90
106
|
input = File.read File.absolute_path(filename)
|
91
|
-
input = if 0 == index or not strip_metadata
|
107
|
+
input = if 0 == index or not strip_metadata or not @config.is_markdown_file? filename then
|
108
|
+
input
|
109
|
+
else
|
110
|
+
PandocMetadata.remove_metadata(input)
|
111
|
+
end
|
92
112
|
@tmp_file.write input
|
93
113
|
end
|
94
114
|
|
@@ -72,9 +72,9 @@ module Pandocomatic
|
|
72
72
|
# Pandocomatic has two modes: converting a directory tree or
|
73
73
|
# converting a single file. The mode is selected by the input.
|
74
74
|
if configuration.directory?
|
75
|
-
command = ConvertDirCommand.new(configuration, configuration.
|
75
|
+
command = ConvertDirCommand.new(configuration, configuration.input_file, configuration.output)
|
76
76
|
else
|
77
|
-
command = ConvertFileMultipleCommand.new(configuration, configuration.
|
77
|
+
command = ConvertFileMultipleCommand.new(configuration, configuration.input_file, configuration.output)
|
78
78
|
command.make_quiet unless command.subcommands.size > 1
|
79
79
|
end
|
80
80
|
|
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.2.5.0.
|
4
|
+
version: 0.2.5.0.betac
|
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: 2019-03-
|
11
|
+
date: 2019-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: paru
|
@@ -147,7 +147,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
147
|
requirements:
|
148
148
|
- - ">="
|
149
149
|
- !ruby/object:Gem::Version
|
150
|
-
version:
|
150
|
+
version: 2.4.4
|
151
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
152
|
requirements:
|
153
153
|
- - ">"
|