natour 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96d45e360af42e65ff67db55ff6e9814013e0a884ceb5b601ceec10731312181
4
- data.tar.gz: f495db38dbdef792422945c891ddf830850a812513663e6cffd72fd4757f1b97
3
+ metadata.gz: 59d15bbec4750fd92158c6cbff64a201bad92792600a03a0f430e0c77ddcbea0
4
+ data.tar.gz: 1b6dedc5f83f66173d77a176d2d20815b4055e2b93c98ecd6d6b26117219c03f
5
5
  SHA512:
6
- metadata.gz: 2a520888a91305d5cd924d133d1356bc1021b0cf75c2ad7753e577e1a7455afbb610991c080a88ca5dc3e4c0bdc9895e36d518694a9e0b8faa6d27bfe0552ba8
7
- data.tar.gz: eb6ca2cbc565dfd79e2ea06413a00a9362996cd45aca70b601e06fca58e6acae5d1bd47f2bbf0d8962f6b1a03922f3477446eca019d5648a1b4ad0334a509938
6
+ metadata.gz: 7dd61ac963164d480e626414bef161e1f1a702d26a2ff71e733a796610b18b7942a5f6ce400329a7c9b3f0566ea501d20f7926285d923d85a4eda4835331f14f
7
+ data.tar.gz: 1ad29625fc06e4f738c7e7127d3381aa701ec033618c9d2a5c1b7167b56b1890f3ba4c8035a8bfe4f6dba33ddf5a3d6b842f0650a1da22c19b04b149c51c5977
data/CHANGELOG.adoc CHANGED
@@ -6,6 +6,21 @@ The format is based on https://keepachangelog.com/en/1.0.0/[Keep a Changelog^],
6
6
 
7
7
  == Unreleased
8
8
 
9
+ == 0.9.0 - 2022-10-08
10
+
11
+ === Added
12
+
13
+ - Support colors for GPS tracks, waypoints and routes (`natour map create` command only).
14
+
15
+ === Changed
16
+
17
+ - Omit empty columns of species lists in AsciiDoc output.
18
+
19
+ === Fixed
20
+
21
+ - Fix inconsistent handling of file errors in the command line interface.
22
+ - Fix the creation of map images.
23
+
9
24
  == 0.8.0 - 2022-04-22
10
25
 
11
26
  === 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 << "[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 << ''