natour 0.8.0 → 0.10.0

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: 96d45e360af42e65ff67db55ff6e9814013e0a884ceb5b601ceec10731312181
4
- data.tar.gz: f495db38dbdef792422945c891ddf830850a812513663e6cffd72fd4757f1b97
3
+ metadata.gz: c05b80ae3025c95c49b590b0356f88f8217503a33afde1a879c7c2490ffc10c5
4
+ data.tar.gz: 7ff5fbd624b347de6c605e0eb7d83dc7face9b2d5a6bf8fa293c3ffe6963190d
5
5
  SHA512:
6
- metadata.gz: 2a520888a91305d5cd924d133d1356bc1021b0cf75c2ad7753e577e1a7455afbb610991c080a88ca5dc3e4c0bdc9895e36d518694a9e0b8faa6d27bfe0552ba8
7
- data.tar.gz: eb6ca2cbc565dfd79e2ea06413a00a9362996cd45aca70b601e06fca58e6acae5d1bd47f2bbf0d8962f6b1a03922f3477446eca019d5648a1b4ad0334a509938
6
+ metadata.gz: 6dce357c6e74546c484ab06ce83f5aab0cf2782ccdf2711d788e6cd155813c0b19397ceb1c8754b11307fbe15f3ae4dc67fdd1b6f7a313e9038d4ecbe04ab193
7
+ data.tar.gz: 1cd2542ec0a0761b275b4bc9b27a270354af178beba158bcb7896aa652ebb8c39795abae62afb80827778bbcd22088f4e466f205a51466b77c0fcfe60cbfaf62
data/CHANGELOG.adoc CHANGED
@@ -6,6 +6,29 @@ The format is based on https://keepachangelog.com/en/1.0.0/[Keep a Changelog^],
6
6
 
7
7
  == Unreleased
8
8
 
9
+ == 0.10.0 - 2023-02-18
10
+
11
+ === Fixed
12
+
13
+ - Prevent orphaned section titles and table captions in PDF output.
14
+ +
15
+ IMPORTANT: This is a breaking change for existing AsciiDoc files that are converted again. Apply the breakable option to tables containing species lists; otherwise the numbering of the tables will not be consecutive.
16
+
17
+ == 0.9.0 - 2022-10-08
18
+
19
+ === Added
20
+
21
+ - Support colors for GPS tracks, waypoints and routes (`natour map create` command only).
22
+
23
+ === Changed
24
+
25
+ - Omit empty columns of species lists in AsciiDoc output.
26
+
27
+ === Fixed
28
+
29
+ - Fix inconsistent handling of file errors in the command line interface.
30
+ - Fix the creation of map images.
31
+
9
32
  == 0.8.0 - 2022-04-22
10
33
 
11
34
  === Added
data/README.adoc CHANGED
@@ -119,6 +119,7 @@ The configuration is built by loading https://yaml.org/[YAML^] files in hierarch
119
119
  :out_dir: null
120
120
  :out_file: null
121
121
  :overwrite: false
122
+ :gps_colors: []
122
123
  :map_layers: []
123
124
  :image_size: [1200, 900]
124
125
  ----
data/bin/natour CHANGED
@@ -35,7 +35,7 @@ class NatourCmd < Clamp::Command
35
35
  map_layers: map_layers || config[:map_layers],
36
36
  adoc_author: adoc_author || config[:adoc_author]
37
37
  )
38
- rescue Errno::EEXIST, Errno::ENOENT, Errno::EACCES, Errno::EINVAL => e
38
+ rescue Errno::EEXIST, Errno::ENOENT, Errno::EACCES, Errno::EISDIR, Errno::EINVAL => e
39
39
  message, _, path = Natour::ErrnoUtils.split_message(e)
40
40
  abort("ERROR: #{message} '#{path}'")
41
41
  end
@@ -66,7 +66,7 @@ class NatourCmd < Clamp::Command
66
66
  draft_backend: draft_backend || config[:draft_backend],
67
67
  image_maxdim: image_maxdim || config[:image_maxdim]
68
68
  )
69
- rescue Errno::EEXIST, Errno::ENOENT, Errno::EACCES, Errno::EISDIR => e
69
+ rescue Errno::EEXIST, Errno::ENOENT, Errno::EACCES, Errno::EISDIR, Errno::EINVAL => e
70
70
  message, _, path = Natour::ErrnoUtils.split_message(e)
71
71
  abort("ERROR: #{message} '#{path}'")
72
72
  end
@@ -86,6 +86,7 @@ class NatourCmd < Clamp::Command
86
86
  option(%w[-d --out-dir], 'DIR', 'Output directory')
87
87
  option(%w[-f --out-file], 'FILE', 'Output filename')
88
88
  option(%W[--\[no-\]overwrite], :flag, 'Overwrite existing files')
89
+ option(%w[--gps-colors], 'COLORS', 'Colors for elements from GPS files') { |s| s.split(',') }
89
90
  option(%w[--map-layers], 'LAYERS', 'Add additional layers to map images') { |s| s.split(',') }
90
91
  option(%w[--image-size], 'WIDTH,HEIGHT', 'Image size') do |s|
91
92
  s.split(',', 2).map { |v| Integer(v) }
@@ -101,11 +102,12 @@ class NatourCmd < Clamp::Command
101
102
  filename,
102
103
  overwrite: Natour::BooleanUtils.to_boolean(overwrite?, default_value: config[:overwrite]),
103
104
  gps_files: paths,
105
+ gps_colors: gps_colors || config[:gps_colors],
104
106
  map_layers: map_layers || config[:map_layers],
105
107
  image_size: image_size || config[:image_size]
106
108
  )
107
109
  end
108
- rescue Errno::EEXIST, Errno::ENOENT, Errno::EACCES => e
110
+ rescue Errno::EEXIST, Errno::ENOENT, Errno::EACCES, Errno::EISDIR, Errno::EINVAL => e
109
111
  message, _, path = Natour::ErrnoUtils.split_message(e)
110
112
  abort("ERROR: #{message} '#{path}'")
111
113
  end
@@ -151,6 +153,7 @@ config = Natour::Config.load_file(
151
153
  out_dir: nil,
152
154
  out_file: nil,
153
155
  overwrite: false,
156
+ gps_colors: [],
154
157
  map_layers: [],
155
158
  image_size: [1200, 900]
156
159
  }
@@ -97,14 +97,18 @@ module Natour
97
97
  OpenStruct.new(
98
98
  group: :plants,
99
99
  title: 'Pflanzenarten',
100
- headers: ['Wissenschaftlicher Name', 'Deutscher Name'],
101
- columns: %i[name name_de]
100
+ columns: [
101
+ OpenStruct.new(header: 'Wissenschaftlicher Name', accessor: :name),
102
+ OpenStruct.new(header: 'Deutscher Name', accessor: :name_de)
103
+ ]
102
104
  ),
103
105
  OpenStruct.new(
104
106
  group: :birds,
105
107
  title: 'Vogelarten',
106
- headers: ['Deutscher Name', 'Wissenschaftlicher Name'],
107
- columns: %i[name_de name]
108
+ columns: [
109
+ OpenStruct.new(header: 'Deutscher Name', accessor: :name_de),
110
+ OpenStruct.new(header: 'Wissenschaftlicher Name', accessor: :name)
111
+ ]
108
112
  )
109
113
  ].each do |info|
110
114
  group = groups.fetch(info.group, [])
@@ -115,13 +119,18 @@ module Natour
115
119
  group.each do |species_list|
116
120
  caption = '.Tabelle {counter:species_lists}'
117
121
  caption << ": #{species_list.description}" if species_list.description
122
+ columns = info.columns.select do |column|
123
+ species_list.any? { |species| !species.public_send(column.accessor).nil? }
124
+ end
125
+ cols = [1] + [5 * info.columns.size / columns.size] * columns.size
118
126
  doc << caption
119
- doc << '[cols="1,5,5",options=header]'
127
+ doc << "[%breakable,cols=\"#{cols.join(',')}\",options=header]"
120
128
  doc << '|==='
121
- doc << "|Nr.|#{info.headers.join('|')}"
129
+ doc << "|Nr.|#{columns.map(&:header).join('|')}"
122
130
  species_list.each do |species|
123
131
  doc <<
124
- "|{counter:species_list#{index}}|#{info.columns.map { |method| species.public_send(method) }.join('|')}"
132
+ "|{counter:species_list#{index}}|#{columns.map { |column| species.public_send(column.accessor) }
133
+ .join('|')}"
125
134
  end
126
135
  doc << '|==='
127
136
  doc << ''