houcluttex 1.0.0 → 1.0.1

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: 829d946b580113b2b827909a19c48cf232b6073d5967d670503b5d779826ed61
4
- data.tar.gz: 7b76686faba0bf7641673f9518afc0ee1aa49541bf524d15df216698221dd5f8
3
+ metadata.gz: 7c7d8c81d46c8d8a380f7a3cf3d1fa1d43478792fa2825c6556a68f50a44ad11
4
+ data.tar.gz: c8b68498ba79dc4c5af70f4e70347da2d0856acecd91bc5064156486bcff7b5b
5
5
  SHA512:
6
- metadata.gz: 4076b9d9a540042ceeb2a3393cb9adb0b53630644229fd5b6ab91196149cfc9ff9f664e14ce708de97db752690492665dda07c8b21a36e74c9ddc2f951cd3de6
7
- data.tar.gz: 98d5467b4273daf468eba8e8322fc7774cf2fa153742f3027f1ffeccc03945f892e7451eed376c0b5676af98d89ba4ec3cc8bce323af21117133bf76651e2110
6
+ metadata.gz: 3644ae35c0c01fc72e4f1dc3088eaa3f0eef243ff5a8040fa323d6c2a24a8bf46b7061e0e09d97be2bdeaa0d2fc0877a182028990708d78a67ac98e0daf5f46e
7
+ data.tar.gz: c195e7e359de0479f30813570601014918d3cf9a92446f111c96a5b24b95f04329e1e871f58c083eea1aafb362591df6a9a7bb537a3ee5b4f34b7eb567a8c63a
data/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## 使い方
10
10
 
11
- $ cluttex [OPTIONS] [--] INPUT.tex
11
+ $ houcluttex [OPTIONS] [--] INPUT.tex
12
12
 
13
13
  ### コンフィグ
14
14
 
@@ -20,8 +20,7 @@
20
20
 
21
21
  #### コンフィグファイル
22
22
 
23
- yaml 形式で指定します。`houcluttex.yml` をデフォルトとしますが、`houcluttex.yaml`、`houcluttexrc`、`.houcluttexrc` なども可能です。
24
- コマンドラインオプション `--config` でファイル名を指定できます。
23
+ yaml 形式で指定します。`houcluttex.yml` をデフォルトとしますが、`houcluttex.yaml`、`houcluttexrc`、`.houcluttexrc` なども可能です。コマンドラインオプション `--config` でファイル名を明示することもできます。
25
24
 
26
25
  yaml ファイルは Key-value の形式で ClutTeX のオプションを指定します。
27
26
 
@@ -59,11 +58,16 @@ ClutTeX と同様のコマンドラインオプションと、`config` オプシ
59
58
 
60
59
  #### 特別なオプション
61
60
 
62
- `input` オプションで指定したファイル名は、入力ファイルがコマンドラインで与えられなかった場合の入力ファイルとして利用します。
63
- このオプションはコマンドラインでは利用できません。
61
+ `input` オプションで指定したファイル名は、入力ファイルがコマンドラインで与えられなかった場合の入力ファイルとして利用します。このオプションは yaml でのみ利用可能です。
64
62
 
65
63
  `cluttex-path` オプションは ClutTeX のパスを指定します。デフォルトは `cluttex` です。
66
64
 
65
+ ## サンプル
66
+
67
+ sample ディレクトリにサンプルがあります。
68
+
69
+ magic ディレクトリでは `houcluttex test.tex`、yaml ディレクトリでは `houcluttex` を実行するとコンパイルできます。
70
+
67
71
  ## ライセンス
68
72
 
69
73
  この gem は [MIT License](https://opensource.org/licenses/MIT) のもとで利用できます。
data/exe/houcluttex CHANGED
@@ -14,41 +14,7 @@ def convert_bool(str)
14
14
  end
15
15
  end
16
16
 
17
- config = {
18
- 'cluttex-path' => nil,
19
- 'input' => nil,
20
-
21
- 'engine' => nil,
22
- 'output' => nil,
23
- 'fresh' => false,
24
- 'max-iterations' => 3,
25
- 'change-directory' => false,
26
- 'watch' => false,
27
- 'color' => 'auto',
28
- 'includeonly' => nil,
29
- 'make-depends' => nil,
30
- 'tex-option' => [],
31
- 'dvipdfmx-option' => [],
32
- 'verbose' => false,
33
-
34
- 'makeindex' => nil,
35
- 'bibtex' => nil,
36
- 'biber' => nil,
37
- 'makeglossaries' => nil,
38
-
39
- 'shell-escape' => true,
40
- 'shell-restricted' => false,
41
- 'synctex' => nil,
42
- 'file-line-error' => true,
43
- 'halt-on-error' => true,
44
- 'interaction' => 'nonstopmode',
45
- 'jobname' => nil,
46
- 'fmt' => nil,
47
- 'output-directory' => nil,
48
- 'output-format' => 'pdf'
49
- }
50
-
51
- config_file = ['houcluttex.yml', 'houcluttex.yaml', 'houcluttex_config.yml', 'houcluttex_config.yaml', 'houcluttexrc', '.houcluttexrc'].find{|e| File.exist?(e)}
17
+ config_file = %w[houcluttex.yml houcluttex.yaml houcluttex_config.yml houcluttex_config.yaml houcluttexrc .houcluttexrc].find{|e| File.exist?(e)}
52
18
 
53
19
  # parse command-line options
54
20
 
@@ -70,27 +36,38 @@ until argv.empty?
70
36
  config_by_args[m[1][3..-1]] = false
71
37
  when 'tex-options', 'dvipdfmx-options'
72
38
  config_by_args[m[1][0..-2]] ||= []
73
- config_by_args[m[1][0..-2]] += Shellwords.split(m[3] || argv.shift)
39
+ config_by_args[m[1][0..-2]] += (m[3] || argv.shift).shellsplit
74
40
  when 'tex-option', 'dvipdfmx-option'
75
41
  config_by_args[m[1]] ||= []
76
42
  config_by_args[m[1]] << (m[3] || argv.shift)
43
+ when 'includeonly', 'package-support'
44
+ config_by_args[m[1]] = (m[3] || argv.shift).split(',')
77
45
  when 'input'
78
46
  raise 'cannot use `--input` option in command-line'
79
47
  when 'config'
80
48
  config_file = m[3] || argv.shift
81
- else
49
+ when 'cluttex-path', 'engine', 'output', 'max-iterations', 'color', 'make-depends', 'engine-executable', 'makeindex', 'bibtex', 'biber', 'makeglossaries', 'synctex', 'interaction', 'jobname', 'fmt', 'output-directory', 'output-format'
82
50
  config_by_args[m[1]] = m[3] || argv.shift
51
+ else
52
+ warn "option `--#{m[1]}` is ignored"
83
53
  end
84
54
  elsif arg.start_with?('-')
85
- case arg
86
- when '-e'
55
+ a = arg[1..-1]
56
+ case a
57
+ when 'e'
87
58
  config_by_args['engine'] = argv.shift
88
- when '-o'
59
+ when 'o'
89
60
  config_by_args['output'] = argv.shift
90
- when '-V'
61
+ when 'V'
91
62
  config_by_args['verbose'] = true
63
+ when 'shell-escape', 'shell-restricted', 'file-line-error', 'halt-on-error'
64
+ config_by_args[a] = true
65
+ when 'no-shell-escape', 'no-file-line-error', 'no-halt-on-error'
66
+ config_by_args[a[3..-1]] = false
67
+ when 'synctex', 'interaction', 'jobname', 'fmt', 'output-directory', 'output-format'
68
+ config_by_args[a] = argv.shift
92
69
  else
93
- warn "option `#{arg}` is ignored"
70
+ warn "option `-#{arg}` is ignored"
94
71
  end
95
72
  else
96
73
  remain_args << arg
@@ -98,12 +75,12 @@ until argv.empty?
98
75
  end
99
76
 
100
77
  # load yaml
101
- config.merge!(YAML.load_file(config_file)) if config_file
78
+ config = config_file ? YAML.load_file(config_file) : {}
102
79
 
103
80
  # decide input file
104
81
  raise 'multiple input files' if remain_args.size >= 2
105
- config['input'] = remain_args.first unless remain_args.empty?
106
- raise 'no input file' if config['input'].nil?
82
+ config['input'] = remain_args[0] unless remain_args.empty?
83
+ raise 'no input file' unless config['input']
107
84
 
108
85
  # parse magic comments
109
86
 
@@ -165,19 +142,20 @@ end
165
142
  cmd_args = []
166
143
 
167
144
  config.each do |k, v|
145
+ next if v.nil?
168
146
  case k
169
147
  when 'cluttex-path', 'input'
170
- # ignore
148
+ nil
171
149
  when 'tex-option', 'dvipdfmx-option'
172
- v.each{|e| cmd_args << "--#{k}=#{e}"}
173
- when 'includeonly'
174
- cmd_args << (v.is_a?(Array) ? "--#{k}=#{v.join(',')}" : "--#{k}=#{v}") if v
150
+ v.each{|e| cmd_args << "--#{k}=#{e}"} unless v.empty?
151
+ when 'includeonly', 'package-support'
152
+ cmd_args << (v.is_a?(Array) ? "--#{k}=#{v.join(',')}" : "--#{k}=#{v}") unless v.empty?
175
153
  when 'fresh', 'watch', 'verbose', 'shell-restricted'
176
154
  cmd_args << "--#{k}" if v
177
155
  when 'change-directory', 'shell-escape', 'file-line-error', 'halt-on-error'
178
156
  cmd_args << (v ? "--#{k}" : "--no-#{k}")
179
157
  else
180
- cmd_args << "--#{k}=#{v}" unless v.nil?
158
+ cmd_args << "--#{k}=#{v}"
181
159
  end
182
160
  end
183
161
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Houcluttex
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
data/lib/houcluttex.rb CHANGED
@@ -1,6 +1 @@
1
- require "houcluttex/version"
2
-
3
- module Houcluttex
4
- class Error < StandardError; end
5
- # Your code goes here...
6
- end
1
+ require 'houcluttex/version'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: houcluttex
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ishotihadus
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-25 00:00:00.000000000 Z
11
+ date: 2019-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  requirements: []
84
- rubygems_version: 3.0.1
84
+ rubygems_version: 3.0.3
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: configurable cluttex wrapper