csv2dokuwiki_tab 0.2.2 → 0.3.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 +4 -4
- data/LICENSE +21 -0
- data/README.md +6 -8
- data/exe/csv2dokuwiki_tab.rb +2 -2
- data/lib/csv2dokuwiki_tab/version.rb +1 -1
- data/lib/csv2dokuwiki_tab.rb +8 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd1c67669591afc52a78975221128be1d2a8a480aa80039e40faf7e83112a018
|
4
|
+
data.tar.gz: a9834019908a5ac50d556dd3c918f41169f862d90a444b8b7276cacd64c4f6bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fe8bcb0cbe9e7df4bf83981ddde8b410f3e64226fd08a545ef57afbdf749f8520291b490146f2917022fb364f5a93c09235b3d89daa9edef6943da54cbdcdff
|
7
|
+
data.tar.gz: 1eef971ba167188ec852651446d9c89278bf28104cc7e037de813ba6c97cbe68930ce4e988ddefe018d646e644fe9ada529c551bfdd5cda9756de715cd3853b7
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 shujishigenobu
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,17 +1,11 @@
|
|
1
1
|
# Csv2dokuwikiTab
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/csv2dokuwiki_tab)
|
4
|
+
|
3
5
|
Read CSV and convert to DokuWiki table format.
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
7
|
-
Install the gem and add to the application's Gemfile by executing:
|
8
|
-
|
9
|
-
```bash
|
10
|
-
bundle add csv2dokuwiki_tab
|
11
|
-
```
|
12
|
-
|
13
|
-
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
|
-
|
15
9
|
```bash
|
16
10
|
gem install csv2dokuwiki_tab
|
17
11
|
```
|
@@ -31,3 +25,7 @@ Usage: csv_to_dokuwiki_tab.rb [options]
|
|
31
25
|
## Contributing
|
32
26
|
|
33
27
|
Bug reports and pull requests are welcome on GitHub at https://github.com/shujishigenobu/csv2dokuwiki_tab
|
28
|
+
|
29
|
+
## License
|
30
|
+
|
31
|
+
This repository is licensed under the [MIT License](./LICENSE). See the LICENSE file for details.
|
data/exe/csv2dokuwiki_tab.rb
CHANGED
@@ -7,7 +7,7 @@ def parse_options
|
|
7
7
|
options = {}
|
8
8
|
header_type = Csv2dokuwikiTab::HEADER_ROW
|
9
9
|
OptionParser.new do |opts|
|
10
|
-
|
10
|
+
opts.banner = "Usage: csv_to_dokuwiki_tab.rb [options]\n (use -f - for STDIN)"
|
11
11
|
|
12
12
|
opts.on("-f FILE", "--file FILE", "CSV file to convert") do |f|
|
13
13
|
options[:file] = f
|
@@ -40,7 +40,7 @@ def parse_options
|
|
40
40
|
end
|
41
41
|
end.parse!
|
42
42
|
unless options[:file]
|
43
|
-
warn "Error: CSV file must be specified with -f"
|
43
|
+
warn "Error: CSV file must be specified with -f (use -f - for STDIN)"
|
44
44
|
exit 1
|
45
45
|
end
|
46
46
|
# [options[:file], header_type, options[:tab]]
|
data/lib/csv2dokuwiki_tab.rb
CHANGED
@@ -23,14 +23,19 @@ module Csv2dokuwikiTab
|
|
23
23
|
|
24
24
|
class Converter
|
25
25
|
def initialize(file, header_type=1, sep=",")
|
26
|
-
@file = file
|
27
26
|
@header_type = header_type
|
28
27
|
@sep = sep
|
28
|
+
@io =
|
29
|
+
if file.nil? || file == "-"
|
30
|
+
$stdin
|
31
|
+
else
|
32
|
+
File.open(file, "r")
|
33
|
+
end
|
29
34
|
end
|
30
35
|
|
31
36
|
def convert
|
32
37
|
begin
|
33
|
-
CSV.
|
38
|
+
CSV.new(@io, col_sep: @sep).each_with_index do |row, idx|
|
34
39
|
next if row.all? { |x| x.nil? }
|
35
40
|
if idx == 0
|
36
41
|
print_header_row(row)
|
@@ -39,7 +44,7 @@ module Csv2dokuwikiTab
|
|
39
44
|
end
|
40
45
|
end
|
41
46
|
rescue Errno::ENOENT
|
42
|
-
warn "Error: File not found
|
47
|
+
warn "Error: File not found"
|
43
48
|
exit 1
|
44
49
|
rescue CSV::MalformedCSVError => e
|
45
50
|
warn "Error: Malformed CSV - #{e.message}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csv2dokuwiki_tab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shuji Shigenobu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-09-
|
11
|
+
date: 2025-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This gem provides a command-line tool to convert CSV files into DokuWiki
|
14
14
|
table format.
|
@@ -20,6 +20,7 @@ executables:
|
|
20
20
|
extensions: []
|
21
21
|
extra_rdoc_files: []
|
22
22
|
files:
|
23
|
+
- LICENSE
|
23
24
|
- README.md
|
24
25
|
- Rakefile
|
25
26
|
- examples/example.csv
|