pandocomatic 0.2.5.0.alpha → 0.2.5.0.beta

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: e0830abb917ca87c8d072ee5a4f88fee1f2f2d8da6359f14e74f9160614b23f9
4
- data.tar.gz: 68f2dbf9325b3ccaeeeae4c2c99b3de4486ff00a2e6c1951a6b14f3f4260232a
3
+ metadata.gz: 55328031107054bb5f4c803fd3991da2709faf82fed6910c018f63547bbbda33
4
+ data.tar.gz: 5ee5ae08ebfd6bc3c23e5421f680924e2247034582a54b9af0e6e320f547333d
5
5
  SHA512:
6
- metadata.gz: e8c034acc735d84f56c95765a070a129bb522bfe2b6536d407dc067c86f954fad64c7679cb561551689f837d1c54186a9e6c69e7f9fa192eaf548dc948395a0b
7
- data.tar.gz: a625b92f99fdccfc5786cb8e2e234b572f4157f4efc894bdc6ed2be39eaad54cb4d33895014e410abfc37e3e983fa9bb6b9de805fa693fa5e1bab54a1f0cebf0
6
+ metadata.gz: a42e71a975cce7d4bae39f81d8fc2211c3598787283e146e66b72ed3ab106b539ce847077346b49ff04f268717495e4eb203f2e0f38c20126e0c06c7048e4c62
7
+ data.tar.gz: 8b84109ff30f598fa8974d93cd6244ee32a572abb4571f2590c72e589ca01aa4e7ebfc4a23aa5ba4933e388b0c81c23b04e49895c642d59328aa71640975e51b
@@ -22,7 +22,6 @@ module Pandocomatic
22
22
  require_relative './error/cli_error.rb'
23
23
  require_relative './configuration.rb'
24
24
 
25
-
26
25
  ##
27
26
  # Command line options parser for pandocomatic using optimist.
28
27
  #
@@ -75,7 +75,7 @@ module Pandocomatic
75
75
  @input = if input.nil? or input.empty? then
76
76
  nil
77
77
  elsif 1 < input.size then
78
- MultipleFilesInput.new(input)
78
+ MultipleFilesInput.new(input, self)
79
79
  else
80
80
  Input.new(input)
81
81
  end
@@ -347,7 +347,6 @@ module Pandocomatic
347
347
  @settings.has_key? 'match-files' and 'first' == @settings['match-files']
348
348
  end
349
349
 
350
-
351
350
  # Set the extension of the destination file given this Confguration,
352
351
  # template, and metadata
353
352
  #
@@ -28,8 +28,9 @@ module Pandocomatic
28
28
  # is created as well containing the content of all the files in input.
29
29
  #
30
30
  # @param input [String[]] a list with input files
31
- def initialize(input)
31
+ def initialize(input, config)
32
32
  super(input)
33
+ @config = config
33
34
  create_temp_file
34
35
  end
35
36
 
@@ -69,10 +70,25 @@ module Pandocomatic
69
70
  # Concatenate all input files into one (temporary) input file
70
71
  # created in the same directory as the first input file
71
72
  @tmp_file = Tempfile.new(@input_files.first, File.dirname(self.absolute_path))
72
-
73
+
74
+ # Read first file and its metadata
75
+ metadata = PandocMetadata.load_file @input_files.first
76
+
77
+ strip_metadata =
78
+ "markdown" == if metadata.pandoc_options.has_key? "from" then
79
+ metadata.pandoc_options["from"]
80
+ else
81
+ template = @config.determine_template @input_files.first
82
+ if not template.nil? and not template.dig("pandoc", "from").nil? then
83
+ template["pandoc"]["from"]
84
+ else
85
+ "unknown"
86
+ end
87
+ end
88
+
73
89
  @input_files.each_with_index do |filename, index|
74
90
  input = File.read File.absolute_path(filename)
75
- input = if 0 === index then input else PandocMetadata.remove_metadata(input) end
91
+ input = if 0 == index or not strip_metadata then input else PandocMetadata.remove_metadata(input) end
76
92
  @tmp_file.write input
77
93
  end
78
94
 
@@ -47,7 +47,7 @@ module Pandocomatic
47
47
  ERROR_STATUS = 1266 # This is the sum of the ascii values of the characters in 'pandocomatic'
48
48
 
49
49
  # Pandocomatic's current version
50
- VERSION = [0, 2, 5, 0, "α"]
50
+ VERSION = [0, 2, 5, 0, "beta"]
51
51
 
52
52
  # Run pandocomatic given options
53
53
  #
@@ -40,7 +40,7 @@ module Pandocomatic
40
40
 
41
41
  # Calculate the duration of the whole conversion process
42
42
  #
43
- # @erturn [Number]
43
+ # @return [Number]
44
44
  def duration()
45
45
  seconds = @end_time - @start_time
46
46
  if seconds > MINUTE
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.alpha
4
+ version: 0.2.5.0.beta
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-09 00:00:00.000000000 Z
11
+ date: 2019-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: paru
@@ -56,28 +56,28 @@ dependencies:
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '0'
59
+ version: '1.3'
60
60
  type: :development
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: '0'
66
+ version: '1.3'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: yard
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
71
  - - "~>"
72
72
  - !ruby/object:Gem::Version
73
- version: 0.9.8
73
+ version: 0.9.18
74
74
  type: :development
75
75
  prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - "~>"
79
79
  - !ruby/object:Gem::Version
80
- version: 0.9.8
80
+ version: 0.9.18
81
81
  description: Pandocomatic is a tool to automate using pandoc (<http://pandoc.org>).
82
82
  With pandocomatic you can express common patterns of using pandoc for generating
83
83
  your documents. Applied to a directory, pandocomatic can act as a static site generator.