texd 0.3.0 → 0.4.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: 8f90c7123f60872130f0a2c36a6a6fa44154d1e3956c140f45e07e6815761363
4
- data.tar.gz: a1c855d5a76517dae7eb2c5a2a9cc9be621236fa59018e62fbeeaa9b31ee0d49
3
+ metadata.gz: fde0921bb4b213505d16db41af06475dfb4915c0b1283e4e0ef74c956715bab5
4
+ data.tar.gz: 6bc1878f34088d9ad32a8ac9a9c81819f20293153ed11148b2da8d190e9a4afc
5
5
  SHA512:
6
- metadata.gz: ecc5d22800aea0f4b77e76c0c052106cb80bb47c3c3a478696c712957fbc178ac74c7014d3927ff09bd45c4472a167fc8ebd7bcbd9ff154f12c90f2724df319d
7
- data.tar.gz: 88dad14c7c7f95fbb53bb12bd9777de8033d8b8aceafe896efabcf8f0c33463ece25b90ef43e2e3108c617586007171c498a969fe7184763d73812cf35ed0cf4
6
+ metadata.gz: 3c6d63be3ffe9e11e9c0b98bc3466f07427014057291c8df551aa1ed49c3b5f4cf9e9e0583c96254fd7288193199598db6aabc17f92545e2de38f36004cbf6e0
7
+ data.tar.gz: 919b674fd137f097d241170a54ae2746b150a76edd52aa373974234336d6884f3bd8e2820834d58a11f6f0131f6d63fc07b43f76faf971a182604a044cde7f10
data/.rubocop.yml CHANGED
@@ -154,6 +154,10 @@ Metrics/BlockLength:
154
154
  - spec/**/*.rb
155
155
  - config/**/*.rb
156
156
 
157
+ Metrics/ClassLength:
158
+ Exclude:
159
+ - lib/texd/config.rb
160
+
157
161
  Metrics/ModuleLength:
158
162
  CountComments: false # count full line comments?
159
163
 
data/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
- ## [Unreleased]
1
+ ## Unreleased
2
2
 
3
- ## [0.1.0] - 2022-03-14
3
+ [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.4.0...master)
4
4
 
5
- - Initial release
5
+ ## v0.4.0
6
+
7
+ [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.3.2...v0.4.0)
8
+
9
+ **Changes**
10
+
11
+ - add support for configurable error handling
12
+
13
+ ## v0.3.2 - 2022-03-28
14
+
15
+ [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.2.2...v0.3.2)
16
+
17
+ **Changes**
18
+
19
+ - add support for Texd reference store
20
+ - add support for Basic Auth credentials
21
+
22
+ ## v0.2.2 - 2022-03-22
23
+
24
+ [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.1.0...v0.2.2)
25
+
26
+ **Fixes**
27
+
28
+ - `escape` helper now handles nil values
29
+ - improve Ruby 3.x compatability
30
+
31
+ **Changes**
32
+
33
+ - state arguments for `Texd.render`/`Texd::Document.render` explicitly
34
+ (forbid no arbitrary arguments)
35
+ - refactor template locals
36
+
37
+ ## v0.1.0 - 2022-03-14
38
+
39
+ [Compare changes](https://github.com/digineo/texd-ruby/compare/4562035e...v0.1.0)
40
+
41
+ - First public release
data/Gemfile.lock CHANGED
@@ -1,74 +1,74 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- texd (0.3.0)
4
+ texd (0.4.0)
5
5
  multipart-post (~> 2.0)
6
6
  rails (>= 6.0, < 8)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (7.0.2.3)
12
- actionpack (= 7.0.2.3)
13
- activesupport (= 7.0.2.3)
11
+ actioncable (7.0.3)
12
+ actionpack (= 7.0.3)
13
+ activesupport (= 7.0.3)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailbox (7.0.2.3)
17
- actionpack (= 7.0.2.3)
18
- activejob (= 7.0.2.3)
19
- activerecord (= 7.0.2.3)
20
- activestorage (= 7.0.2.3)
21
- activesupport (= 7.0.2.3)
16
+ actionmailbox (7.0.3)
17
+ actionpack (= 7.0.3)
18
+ activejob (= 7.0.3)
19
+ activerecord (= 7.0.3)
20
+ activestorage (= 7.0.3)
21
+ activesupport (= 7.0.3)
22
22
  mail (>= 2.7.1)
23
23
  net-imap
24
24
  net-pop
25
25
  net-smtp
26
- actionmailer (7.0.2.3)
27
- actionpack (= 7.0.2.3)
28
- actionview (= 7.0.2.3)
29
- activejob (= 7.0.2.3)
30
- activesupport (= 7.0.2.3)
26
+ actionmailer (7.0.3)
27
+ actionpack (= 7.0.3)
28
+ actionview (= 7.0.3)
29
+ activejob (= 7.0.3)
30
+ activesupport (= 7.0.3)
31
31
  mail (~> 2.5, >= 2.5.4)
32
32
  net-imap
33
33
  net-pop
34
34
  net-smtp
35
35
  rails-dom-testing (~> 2.0)
36
- actionpack (7.0.2.3)
37
- actionview (= 7.0.2.3)
38
- activesupport (= 7.0.2.3)
36
+ actionpack (7.0.3)
37
+ actionview (= 7.0.3)
38
+ activesupport (= 7.0.3)
39
39
  rack (~> 2.0, >= 2.2.0)
40
40
  rack-test (>= 0.6.3)
41
41
  rails-dom-testing (~> 2.0)
42
42
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
43
- actiontext (7.0.2.3)
44
- actionpack (= 7.0.2.3)
45
- activerecord (= 7.0.2.3)
46
- activestorage (= 7.0.2.3)
47
- activesupport (= 7.0.2.3)
43
+ actiontext (7.0.3)
44
+ actionpack (= 7.0.3)
45
+ activerecord (= 7.0.3)
46
+ activestorage (= 7.0.3)
47
+ activesupport (= 7.0.3)
48
48
  globalid (>= 0.6.0)
49
49
  nokogiri (>= 1.8.5)
50
- actionview (7.0.2.3)
51
- activesupport (= 7.0.2.3)
50
+ actionview (7.0.3)
51
+ activesupport (= 7.0.3)
52
52
  builder (~> 3.1)
53
53
  erubi (~> 1.4)
54
54
  rails-dom-testing (~> 2.0)
55
55
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
56
- activejob (7.0.2.3)
57
- activesupport (= 7.0.2.3)
56
+ activejob (7.0.3)
57
+ activesupport (= 7.0.3)
58
58
  globalid (>= 0.3.6)
59
- activemodel (7.0.2.3)
60
- activesupport (= 7.0.2.3)
61
- activerecord (7.0.2.3)
62
- activemodel (= 7.0.2.3)
63
- activesupport (= 7.0.2.3)
64
- activestorage (7.0.2.3)
65
- actionpack (= 7.0.2.3)
66
- activejob (= 7.0.2.3)
67
- activerecord (= 7.0.2.3)
68
- activesupport (= 7.0.2.3)
59
+ activemodel (7.0.3)
60
+ activesupport (= 7.0.3)
61
+ activerecord (7.0.3)
62
+ activemodel (= 7.0.3)
63
+ activesupport (= 7.0.3)
64
+ activestorage (7.0.3)
65
+ actionpack (= 7.0.3)
66
+ activejob (= 7.0.3)
67
+ activerecord (= 7.0.3)
68
+ activesupport (= 7.0.3)
69
69
  marcel (~> 1.0)
70
70
  mini_mime (>= 1.1.0)
71
- activesupport (7.0.2.3)
71
+ activesupport (7.0.3)
72
72
  concurrent-ruby (~> 1.0, >= 1.0.2)
73
73
  i18n (>= 1.6, < 2)
74
74
  minitest (>= 5.1)
@@ -77,7 +77,7 @@ GEM
77
77
  builder (3.2.4)
78
78
  byebug (11.1.3)
79
79
  coderay (1.1.3)
80
- combustion (1.3.5)
80
+ combustion (1.3.7)
81
81
  activesupport (>= 3.0.0)
82
82
  railties (>= 3.0.0)
83
83
  thor (>= 0.14.6)
@@ -90,8 +90,7 @@ GEM
90
90
  activesupport (>= 5.0)
91
91
  i18n (1.10.0)
92
92
  concurrent-ruby (~> 1.0)
93
- io-wait (0.2.1)
94
- loofah (2.15.0)
93
+ loofah (2.18.0)
95
94
  crass (~> 1.0.2)
96
95
  nokogiri (>= 1.5.9)
97
96
  mail (2.7.1)
@@ -99,8 +98,9 @@ GEM
99
98
  marcel (1.0.2)
100
99
  method_source (1.0.0)
101
100
  mini_mime (1.1.2)
102
- minitest (5.15.0)
103
- multipart-post (2.1.1)
101
+ mini_portile2 (2.8.0)
102
+ minitest (5.16.0)
103
+ multipart-post (2.2.3)
104
104
  net-imap (0.2.3)
105
105
  digest
106
106
  net-protocol
@@ -109,18 +109,20 @@ GEM
109
109
  digest
110
110
  net-protocol
111
111
  timeout
112
- net-protocol (0.1.2)
113
- io-wait
112
+ net-protocol (0.1.3)
114
113
  timeout
115
114
  net-smtp (0.3.1)
116
115
  digest
117
116
  net-protocol
118
117
  timeout
119
118
  nio4r (2.5.8)
120
- nokogiri (1.13.3-x86_64-linux)
119
+ nokogiri (1.13.6)
120
+ mini_portile2 (~> 2.8.0)
121
121
  racc (~> 1.4)
122
- parallel (1.22.0)
123
- parser (3.1.1.0)
122
+ nokogiri (1.13.6-x86_64-linux)
123
+ racc (~> 1.4)
124
+ parallel (1.22.1)
125
+ parser (3.1.2.0)
124
126
  ast (~> 2.4.1)
125
127
  pry (0.13.1)
126
128
  coderay (~> 1.1)
@@ -129,38 +131,38 @@ GEM
129
131
  byebug (~> 11.0)
130
132
  pry (~> 0.13.0)
131
133
  racc (1.6.0)
132
- rack (2.2.3)
134
+ rack (2.2.3.1)
133
135
  rack-test (1.1.0)
134
136
  rack (>= 1.0, < 3)
135
- rails (7.0.2.3)
136
- actioncable (= 7.0.2.3)
137
- actionmailbox (= 7.0.2.3)
138
- actionmailer (= 7.0.2.3)
139
- actionpack (= 7.0.2.3)
140
- actiontext (= 7.0.2.3)
141
- actionview (= 7.0.2.3)
142
- activejob (= 7.0.2.3)
143
- activemodel (= 7.0.2.3)
144
- activerecord (= 7.0.2.3)
145
- activestorage (= 7.0.2.3)
146
- activesupport (= 7.0.2.3)
137
+ rails (7.0.3)
138
+ actioncable (= 7.0.3)
139
+ actionmailbox (= 7.0.3)
140
+ actionmailer (= 7.0.3)
141
+ actionpack (= 7.0.3)
142
+ actiontext (= 7.0.3)
143
+ actionview (= 7.0.3)
144
+ activejob (= 7.0.3)
145
+ activemodel (= 7.0.3)
146
+ activerecord (= 7.0.3)
147
+ activestorage (= 7.0.3)
148
+ activesupport (= 7.0.3)
147
149
  bundler (>= 1.15.0)
148
- railties (= 7.0.2.3)
150
+ railties (= 7.0.3)
149
151
  rails-dom-testing (2.0.3)
150
152
  activesupport (>= 4.2.0)
151
153
  nokogiri (>= 1.6)
152
- rails-html-sanitizer (1.4.2)
154
+ rails-html-sanitizer (1.4.3)
153
155
  loofah (~> 2.3)
154
- railties (7.0.2.3)
155
- actionpack (= 7.0.2.3)
156
- activesupport (= 7.0.2.3)
156
+ railties (7.0.3)
157
+ actionpack (= 7.0.3)
158
+ activesupport (= 7.0.3)
157
159
  method_source
158
160
  rake (>= 12.2)
159
161
  thor (~> 1.0)
160
162
  zeitwerk (~> 2.5)
161
163
  rainbow (3.1.1)
162
164
  rake (13.0.6)
163
- regexp_parser (2.2.1)
165
+ regexp_parser (2.5.0)
164
166
  rexml (3.2.5)
165
167
  rspec (3.11.0)
166
168
  rspec-core (~> 3.11.0)
@@ -171,10 +173,10 @@ GEM
171
173
  rspec-expectations (3.11.0)
172
174
  diff-lcs (>= 1.2.0, < 2.0)
173
175
  rspec-support (~> 3.11.0)
174
- rspec-mocks (3.11.0)
176
+ rspec-mocks (3.11.1)
175
177
  diff-lcs (>= 1.2.0, < 2.0)
176
178
  rspec-support (~> 3.11.0)
177
- rspec-rails (5.1.1)
179
+ rspec-rails (5.1.2)
178
180
  actionpack (>= 5.2)
179
181
  activesupport (>= 5.2)
180
182
  railties (>= 5.2)
@@ -183,29 +185,29 @@ GEM
183
185
  rspec-mocks (~> 3.10)
184
186
  rspec-support (~> 3.10)
185
187
  rspec-support (3.11.0)
186
- rubocop (1.26.1)
188
+ rubocop (1.30.1)
187
189
  parallel (~> 1.10)
188
190
  parser (>= 3.1.0.0)
189
191
  rainbow (>= 2.2.2, < 4.0)
190
192
  regexp_parser (>= 1.8, < 3.0)
191
- rexml
192
- rubocop-ast (>= 1.16.0, < 2.0)
193
+ rexml (>= 3.2.5, < 4.0)
194
+ rubocop-ast (>= 1.18.0, < 2.0)
193
195
  ruby-progressbar (~> 1.7)
194
196
  unicode-display_width (>= 1.4.0, < 3.0)
195
- rubocop-ast (1.16.0)
197
+ rubocop-ast (1.18.0)
196
198
  parser (>= 3.1.1.0)
197
- rubocop-rails (2.14.2)
199
+ rubocop-rails (2.15.0)
198
200
  activesupport (>= 4.2.0)
199
201
  rack (>= 1.1)
200
202
  rubocop (>= 1.7.0, < 2.0)
201
203
  rubocop-rake (0.6.0)
202
204
  rubocop (~> 1.0)
203
- rubocop-rspec (2.9.0)
205
+ rubocop-rspec (2.11.1)
204
206
  rubocop (~> 1.19)
205
207
  ruby-progressbar (1.11.0)
206
- strscan (3.0.1)
208
+ strscan (3.0.3)
207
209
  thor (1.2.1)
208
- timeout (0.2.0)
210
+ timeout (0.3.0)
209
211
  tzinfo (2.0.4)
210
212
  concurrent-ruby (~> 1.0)
211
213
  unicode-display_width (2.1.0)
@@ -213,11 +215,12 @@ GEM
213
215
  websocket-driver (0.7.5)
214
216
  websocket-extensions (>= 0.1.0)
215
217
  websocket-extensions (0.1.5)
216
- yard (0.9.27)
218
+ yard (0.9.28)
217
219
  webrick (~> 1.7.0)
218
- zeitwerk (2.5.4)
220
+ zeitwerk (2.6.0)
219
221
 
220
222
  PLATFORMS
223
+ ruby
221
224
  x86_64-linux
222
225
 
223
226
  DEPENDENCIES
data/Makefile CHANGED
@@ -44,11 +44,12 @@ docs:
44
44
 
45
45
  .PHONY: texd-docker
46
46
  texd-docker:
47
+ rm -rvf tmp/jobs tmp/refs
47
48
  mkdir -p tmp/jobs tmp/refs
48
49
  docker run --rm \
49
50
  --name texd-dev \
50
51
  -p 127.0.0.1:2201:2201 \
51
52
  -v $$(pwd)/tmp/jobs:/texd \
52
53
  -v $$(pwd)/tmp/refs:/refs \
53
- --user=$$(id -u):$$(id -g) \
54
- digineode/texd --reference-store dir:///refs
54
+ -u $$(id -u):$$(id -g) \
55
+ digineode/texd --reference-store dir:///refs --keep-jobs always
@@ -1,63 +1,63 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- texd (0.3.0)
4
+ texd (0.4.0)
5
5
  multipart-post (~> 2.0)
6
6
  rails (>= 6.0, < 8)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (6.0.4.7)
12
- actionpack (= 6.0.4.7)
11
+ actioncable (6.0.5)
12
+ actionpack (= 6.0.5)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailbox (6.0.4.7)
16
- actionpack (= 6.0.4.7)
17
- activejob (= 6.0.4.7)
18
- activerecord (= 6.0.4.7)
19
- activestorage (= 6.0.4.7)
20
- activesupport (= 6.0.4.7)
15
+ actionmailbox (6.0.5)
16
+ actionpack (= 6.0.5)
17
+ activejob (= 6.0.5)
18
+ activerecord (= 6.0.5)
19
+ activestorage (= 6.0.5)
20
+ activesupport (= 6.0.5)
21
21
  mail (>= 2.7.1)
22
- actionmailer (6.0.4.7)
23
- actionpack (= 6.0.4.7)
24
- actionview (= 6.0.4.7)
25
- activejob (= 6.0.4.7)
22
+ actionmailer (6.0.5)
23
+ actionpack (= 6.0.5)
24
+ actionview (= 6.0.5)
25
+ activejob (= 6.0.5)
26
26
  mail (~> 2.5, >= 2.5.4)
27
27
  rails-dom-testing (~> 2.0)
28
- actionpack (6.0.4.7)
29
- actionview (= 6.0.4.7)
30
- activesupport (= 6.0.4.7)
28
+ actionpack (6.0.5)
29
+ actionview (= 6.0.5)
30
+ activesupport (= 6.0.5)
31
31
  rack (~> 2.0, >= 2.0.8)
32
32
  rack-test (>= 0.6.3)
33
33
  rails-dom-testing (~> 2.0)
34
34
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
35
- actiontext (6.0.4.7)
36
- actionpack (= 6.0.4.7)
37
- activerecord (= 6.0.4.7)
38
- activestorage (= 6.0.4.7)
39
- activesupport (= 6.0.4.7)
35
+ actiontext (6.0.5)
36
+ actionpack (= 6.0.5)
37
+ activerecord (= 6.0.5)
38
+ activestorage (= 6.0.5)
39
+ activesupport (= 6.0.5)
40
40
  nokogiri (>= 1.8.5)
41
- actionview (6.0.4.7)
42
- activesupport (= 6.0.4.7)
41
+ actionview (6.0.5)
42
+ activesupport (= 6.0.5)
43
43
  builder (~> 3.1)
44
44
  erubi (~> 1.4)
45
45
  rails-dom-testing (~> 2.0)
46
46
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
47
- activejob (6.0.4.7)
48
- activesupport (= 6.0.4.7)
47
+ activejob (6.0.5)
48
+ activesupport (= 6.0.5)
49
49
  globalid (>= 0.3.6)
50
- activemodel (6.0.4.7)
51
- activesupport (= 6.0.4.7)
52
- activerecord (6.0.4.7)
53
- activemodel (= 6.0.4.7)
54
- activesupport (= 6.0.4.7)
55
- activestorage (6.0.4.7)
56
- actionpack (= 6.0.4.7)
57
- activejob (= 6.0.4.7)
58
- activerecord (= 6.0.4.7)
59
- marcel (~> 1.0.0)
60
- activesupport (6.0.4.7)
50
+ activemodel (6.0.5)
51
+ activesupport (= 6.0.5)
52
+ activerecord (6.0.5)
53
+ activemodel (= 6.0.5)
54
+ activesupport (= 6.0.5)
55
+ activestorage (6.0.5)
56
+ actionpack (= 6.0.5)
57
+ activejob (= 6.0.5)
58
+ activerecord (= 6.0.5)
59
+ marcel (~> 1.0)
60
+ activesupport (6.0.5)
61
61
  concurrent-ruby (~> 1.0, >= 1.0.2)
62
62
  i18n (>= 0.7, < 2)
63
63
  minitest (~> 5.1)
@@ -66,7 +66,7 @@ GEM
66
66
  builder (3.2.4)
67
67
  byebug (11.1.3)
68
68
  coderay (1.1.3)
69
- combustion (1.3.5)
69
+ combustion (1.3.7)
70
70
  activesupport (>= 3.0.0)
71
71
  railties (>= 3.0.0)
72
72
  thor (>= 0.14.6)
@@ -78,7 +78,7 @@ GEM
78
78
  activesupport (>= 5.0)
79
79
  i18n (1.10.0)
80
80
  concurrent-ruby (~> 1.0)
81
- loofah (2.15.0)
81
+ loofah (2.18.0)
82
82
  crass (~> 1.0.2)
83
83
  nokogiri (>= 1.5.9)
84
84
  mail (2.7.1)
@@ -86,10 +86,14 @@ GEM
86
86
  marcel (1.0.2)
87
87
  method_source (1.0.0)
88
88
  mini_mime (1.1.2)
89
- minitest (5.15.0)
90
- multipart-post (2.1.1)
89
+ mini_portile2 (2.8.0)
90
+ minitest (5.16.0)
91
+ multipart-post (2.2.3)
91
92
  nio4r (2.5.8)
92
- nokogiri (1.13.3-x86_64-linux)
93
+ nokogiri (1.13.6)
94
+ mini_portile2 (~> 2.8.0)
95
+ racc (~> 1.4)
96
+ nokogiri (1.13.6-x86_64-linux)
93
97
  racc (~> 1.4)
94
98
  pry (0.13.1)
95
99
  coderay (~> 1.1)
@@ -98,32 +102,32 @@ GEM
98
102
  byebug (~> 11.0)
99
103
  pry (~> 0.13.0)
100
104
  racc (1.6.0)
101
- rack (2.2.3)
105
+ rack (2.2.3.1)
102
106
  rack-test (1.1.0)
103
107
  rack (>= 1.0, < 3)
104
- rails (6.0.4.7)
105
- actioncable (= 6.0.4.7)
106
- actionmailbox (= 6.0.4.7)
107
- actionmailer (= 6.0.4.7)
108
- actionpack (= 6.0.4.7)
109
- actiontext (= 6.0.4.7)
110
- actionview (= 6.0.4.7)
111
- activejob (= 6.0.4.7)
112
- activemodel (= 6.0.4.7)
113
- activerecord (= 6.0.4.7)
114
- activestorage (= 6.0.4.7)
115
- activesupport (= 6.0.4.7)
108
+ rails (6.0.5)
109
+ actioncable (= 6.0.5)
110
+ actionmailbox (= 6.0.5)
111
+ actionmailer (= 6.0.5)
112
+ actionpack (= 6.0.5)
113
+ actiontext (= 6.0.5)
114
+ actionview (= 6.0.5)
115
+ activejob (= 6.0.5)
116
+ activemodel (= 6.0.5)
117
+ activerecord (= 6.0.5)
118
+ activestorage (= 6.0.5)
119
+ activesupport (= 6.0.5)
116
120
  bundler (>= 1.3.0)
117
- railties (= 6.0.4.7)
121
+ railties (= 6.0.5)
118
122
  sprockets-rails (>= 2.0.0)
119
123
  rails-dom-testing (2.0.3)
120
124
  activesupport (>= 4.2.0)
121
125
  nokogiri (>= 1.6)
122
- rails-html-sanitizer (1.4.2)
126
+ rails-html-sanitizer (1.4.3)
123
127
  loofah (~> 2.3)
124
- railties (6.0.4.7)
125
- actionpack (= 6.0.4.7)
126
- activesupport (= 6.0.4.7)
128
+ railties (6.0.5)
129
+ actionpack (= 6.0.5)
130
+ activesupport (= 6.0.5)
127
131
  method_source
128
132
  rake (>= 0.8.7)
129
133
  thor (>= 0.20.3, < 2.0)
@@ -137,10 +141,10 @@ GEM
137
141
  rspec-expectations (3.11.0)
138
142
  diff-lcs (>= 1.2.0, < 2.0)
139
143
  rspec-support (~> 3.11.0)
140
- rspec-mocks (3.11.0)
144
+ rspec-mocks (3.11.1)
141
145
  diff-lcs (>= 1.2.0, < 2.0)
142
146
  rspec-support (~> 3.11.0)
143
- rspec-rails (5.1.1)
147
+ rspec-rails (5.1.2)
144
148
  actionpack (>= 5.2)
145
149
  activesupport (>= 5.2)
146
150
  railties (>= 5.2)
@@ -163,9 +167,10 @@ GEM
163
167
  websocket-driver (0.7.5)
164
168
  websocket-extensions (>= 0.1.0)
165
169
  websocket-extensions (0.1.5)
166
- zeitwerk (2.5.4)
170
+ zeitwerk (2.6.0)
167
171
 
168
172
  PLATFORMS
173
+ ruby
169
174
  x86_64-linux
170
175
 
171
176
  DEPENDENCIES
@@ -1,67 +1,67 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- texd (0.3.0)
4
+ texd (0.4.0)
5
5
  multipart-post (~> 2.0)
6
6
  rails (>= 6.0, < 8)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (6.1.5)
12
- actionpack (= 6.1.5)
13
- activesupport (= 6.1.5)
11
+ actioncable (6.1.6)
12
+ actionpack (= 6.1.6)
13
+ activesupport (= 6.1.6)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailbox (6.1.5)
17
- actionpack (= 6.1.5)
18
- activejob (= 6.1.5)
19
- activerecord (= 6.1.5)
20
- activestorage (= 6.1.5)
21
- activesupport (= 6.1.5)
16
+ actionmailbox (6.1.6)
17
+ actionpack (= 6.1.6)
18
+ activejob (= 6.1.6)
19
+ activerecord (= 6.1.6)
20
+ activestorage (= 6.1.6)
21
+ activesupport (= 6.1.6)
22
22
  mail (>= 2.7.1)
23
- actionmailer (6.1.5)
24
- actionpack (= 6.1.5)
25
- actionview (= 6.1.5)
26
- activejob (= 6.1.5)
27
- activesupport (= 6.1.5)
23
+ actionmailer (6.1.6)
24
+ actionpack (= 6.1.6)
25
+ actionview (= 6.1.6)
26
+ activejob (= 6.1.6)
27
+ activesupport (= 6.1.6)
28
28
  mail (~> 2.5, >= 2.5.4)
29
29
  rails-dom-testing (~> 2.0)
30
- actionpack (6.1.5)
31
- actionview (= 6.1.5)
32
- activesupport (= 6.1.5)
30
+ actionpack (6.1.6)
31
+ actionview (= 6.1.6)
32
+ activesupport (= 6.1.6)
33
33
  rack (~> 2.0, >= 2.0.9)
34
34
  rack-test (>= 0.6.3)
35
35
  rails-dom-testing (~> 2.0)
36
36
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
- actiontext (6.1.5)
38
- actionpack (= 6.1.5)
39
- activerecord (= 6.1.5)
40
- activestorage (= 6.1.5)
41
- activesupport (= 6.1.5)
37
+ actiontext (6.1.6)
38
+ actionpack (= 6.1.6)
39
+ activerecord (= 6.1.6)
40
+ activestorage (= 6.1.6)
41
+ activesupport (= 6.1.6)
42
42
  nokogiri (>= 1.8.5)
43
- actionview (6.1.5)
44
- activesupport (= 6.1.5)
43
+ actionview (6.1.6)
44
+ activesupport (= 6.1.6)
45
45
  builder (~> 3.1)
46
46
  erubi (~> 1.4)
47
47
  rails-dom-testing (~> 2.0)
48
48
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
- activejob (6.1.5)
50
- activesupport (= 6.1.5)
49
+ activejob (6.1.6)
50
+ activesupport (= 6.1.6)
51
51
  globalid (>= 0.3.6)
52
- activemodel (6.1.5)
53
- activesupport (= 6.1.5)
54
- activerecord (6.1.5)
55
- activemodel (= 6.1.5)
56
- activesupport (= 6.1.5)
57
- activestorage (6.1.5)
58
- actionpack (= 6.1.5)
59
- activejob (= 6.1.5)
60
- activerecord (= 6.1.5)
61
- activesupport (= 6.1.5)
52
+ activemodel (6.1.6)
53
+ activesupport (= 6.1.6)
54
+ activerecord (6.1.6)
55
+ activemodel (= 6.1.6)
56
+ activesupport (= 6.1.6)
57
+ activestorage (6.1.6)
58
+ actionpack (= 6.1.6)
59
+ activejob (= 6.1.6)
60
+ activerecord (= 6.1.6)
61
+ activesupport (= 6.1.6)
62
62
  marcel (~> 1.0)
63
63
  mini_mime (>= 1.1.0)
64
- activesupport (6.1.5)
64
+ activesupport (6.1.6)
65
65
  concurrent-ruby (~> 1.0, >= 1.0.2)
66
66
  i18n (>= 1.6, < 2)
67
67
  minitest (>= 5.1)
@@ -70,7 +70,7 @@ GEM
70
70
  builder (3.2.4)
71
71
  byebug (11.1.3)
72
72
  coderay (1.1.3)
73
- combustion (1.3.5)
73
+ combustion (1.3.7)
74
74
  activesupport (>= 3.0.0)
75
75
  railties (>= 3.0.0)
76
76
  thor (>= 0.14.6)
@@ -82,7 +82,7 @@ GEM
82
82
  activesupport (>= 5.0)
83
83
  i18n (1.10.0)
84
84
  concurrent-ruby (~> 1.0)
85
- loofah (2.15.0)
85
+ loofah (2.18.0)
86
86
  crass (~> 1.0.2)
87
87
  nokogiri (>= 1.5.9)
88
88
  mail (2.7.1)
@@ -90,10 +90,14 @@ GEM
90
90
  marcel (1.0.2)
91
91
  method_source (1.0.0)
92
92
  mini_mime (1.1.2)
93
- minitest (5.15.0)
94
- multipart-post (2.1.1)
93
+ mini_portile2 (2.8.0)
94
+ minitest (5.16.0)
95
+ multipart-post (2.2.3)
95
96
  nio4r (2.5.8)
96
- nokogiri (1.13.3-x86_64-linux)
97
+ nokogiri (1.13.6)
98
+ mini_portile2 (~> 2.8.0)
99
+ racc (~> 1.4)
100
+ nokogiri (1.13.6-x86_64-linux)
97
101
  racc (~> 1.4)
98
102
  pry (0.13.1)
99
103
  coderay (~> 1.1)
@@ -102,32 +106,32 @@ GEM
102
106
  byebug (~> 11.0)
103
107
  pry (~> 0.13.0)
104
108
  racc (1.6.0)
105
- rack (2.2.3)
109
+ rack (2.2.3.1)
106
110
  rack-test (1.1.0)
107
111
  rack (>= 1.0, < 3)
108
- rails (6.1.5)
109
- actioncable (= 6.1.5)
110
- actionmailbox (= 6.1.5)
111
- actionmailer (= 6.1.5)
112
- actionpack (= 6.1.5)
113
- actiontext (= 6.1.5)
114
- actionview (= 6.1.5)
115
- activejob (= 6.1.5)
116
- activemodel (= 6.1.5)
117
- activerecord (= 6.1.5)
118
- activestorage (= 6.1.5)
119
- activesupport (= 6.1.5)
112
+ rails (6.1.6)
113
+ actioncable (= 6.1.6)
114
+ actionmailbox (= 6.1.6)
115
+ actionmailer (= 6.1.6)
116
+ actionpack (= 6.1.6)
117
+ actiontext (= 6.1.6)
118
+ actionview (= 6.1.6)
119
+ activejob (= 6.1.6)
120
+ activemodel (= 6.1.6)
121
+ activerecord (= 6.1.6)
122
+ activestorage (= 6.1.6)
123
+ activesupport (= 6.1.6)
120
124
  bundler (>= 1.15.0)
121
- railties (= 6.1.5)
125
+ railties (= 6.1.6)
122
126
  sprockets-rails (>= 2.0.0)
123
127
  rails-dom-testing (2.0.3)
124
128
  activesupport (>= 4.2.0)
125
129
  nokogiri (>= 1.6)
126
- rails-html-sanitizer (1.4.2)
130
+ rails-html-sanitizer (1.4.3)
127
131
  loofah (~> 2.3)
128
- railties (6.1.5)
129
- actionpack (= 6.1.5)
130
- activesupport (= 6.1.5)
132
+ railties (6.1.6)
133
+ actionpack (= 6.1.6)
134
+ activesupport (= 6.1.6)
131
135
  method_source
132
136
  rake (>= 12.2)
133
137
  thor (~> 1.0)
@@ -141,10 +145,10 @@ GEM
141
145
  rspec-expectations (3.11.0)
142
146
  diff-lcs (>= 1.2.0, < 2.0)
143
147
  rspec-support (~> 3.11.0)
144
- rspec-mocks (3.11.0)
148
+ rspec-mocks (3.11.1)
145
149
  diff-lcs (>= 1.2.0, < 2.0)
146
150
  rspec-support (~> 3.11.0)
147
- rspec-rails (5.1.1)
151
+ rspec-rails (5.1.2)
148
152
  actionpack (>= 5.2)
149
153
  activesupport (>= 5.2)
150
154
  railties (>= 5.2)
@@ -166,9 +170,10 @@ GEM
166
170
  websocket-driver (0.7.5)
167
171
  websocket-extensions (>= 0.1.0)
168
172
  websocket-extensions (0.1.5)
169
- zeitwerk (2.5.4)
173
+ zeitwerk (2.6.0)
170
174
 
171
175
  PLATFORMS
176
+ ruby
172
177
  x86_64-linux
173
178
 
174
179
  DEPENDENCIES
@@ -1,74 +1,74 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- texd (0.3.0)
4
+ texd (0.4.0)
5
5
  multipart-post (~> 2.0)
6
6
  rails (>= 6.0, < 8)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (7.0.2.3)
12
- actionpack (= 7.0.2.3)
13
- activesupport (= 7.0.2.3)
11
+ actioncable (7.0.3)
12
+ actionpack (= 7.0.3)
13
+ activesupport (= 7.0.3)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailbox (7.0.2.3)
17
- actionpack (= 7.0.2.3)
18
- activejob (= 7.0.2.3)
19
- activerecord (= 7.0.2.3)
20
- activestorage (= 7.0.2.3)
21
- activesupport (= 7.0.2.3)
16
+ actionmailbox (7.0.3)
17
+ actionpack (= 7.0.3)
18
+ activejob (= 7.0.3)
19
+ activerecord (= 7.0.3)
20
+ activestorage (= 7.0.3)
21
+ activesupport (= 7.0.3)
22
22
  mail (>= 2.7.1)
23
23
  net-imap
24
24
  net-pop
25
25
  net-smtp
26
- actionmailer (7.0.2.3)
27
- actionpack (= 7.0.2.3)
28
- actionview (= 7.0.2.3)
29
- activejob (= 7.0.2.3)
30
- activesupport (= 7.0.2.3)
26
+ actionmailer (7.0.3)
27
+ actionpack (= 7.0.3)
28
+ actionview (= 7.0.3)
29
+ activejob (= 7.0.3)
30
+ activesupport (= 7.0.3)
31
31
  mail (~> 2.5, >= 2.5.4)
32
32
  net-imap
33
33
  net-pop
34
34
  net-smtp
35
35
  rails-dom-testing (~> 2.0)
36
- actionpack (7.0.2.3)
37
- actionview (= 7.0.2.3)
38
- activesupport (= 7.0.2.3)
36
+ actionpack (7.0.3)
37
+ actionview (= 7.0.3)
38
+ activesupport (= 7.0.3)
39
39
  rack (~> 2.0, >= 2.2.0)
40
40
  rack-test (>= 0.6.3)
41
41
  rails-dom-testing (~> 2.0)
42
42
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
43
- actiontext (7.0.2.3)
44
- actionpack (= 7.0.2.3)
45
- activerecord (= 7.0.2.3)
46
- activestorage (= 7.0.2.3)
47
- activesupport (= 7.0.2.3)
43
+ actiontext (7.0.3)
44
+ actionpack (= 7.0.3)
45
+ activerecord (= 7.0.3)
46
+ activestorage (= 7.0.3)
47
+ activesupport (= 7.0.3)
48
48
  globalid (>= 0.6.0)
49
49
  nokogiri (>= 1.8.5)
50
- actionview (7.0.2.3)
51
- activesupport (= 7.0.2.3)
50
+ actionview (7.0.3)
51
+ activesupport (= 7.0.3)
52
52
  builder (~> 3.1)
53
53
  erubi (~> 1.4)
54
54
  rails-dom-testing (~> 2.0)
55
55
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
56
- activejob (7.0.2.3)
57
- activesupport (= 7.0.2.3)
56
+ activejob (7.0.3)
57
+ activesupport (= 7.0.3)
58
58
  globalid (>= 0.3.6)
59
- activemodel (7.0.2.3)
60
- activesupport (= 7.0.2.3)
61
- activerecord (7.0.2.3)
62
- activemodel (= 7.0.2.3)
63
- activesupport (= 7.0.2.3)
64
- activestorage (7.0.2.3)
65
- actionpack (= 7.0.2.3)
66
- activejob (= 7.0.2.3)
67
- activerecord (= 7.0.2.3)
68
- activesupport (= 7.0.2.3)
59
+ activemodel (7.0.3)
60
+ activesupport (= 7.0.3)
61
+ activerecord (7.0.3)
62
+ activemodel (= 7.0.3)
63
+ activesupport (= 7.0.3)
64
+ activestorage (7.0.3)
65
+ actionpack (= 7.0.3)
66
+ activejob (= 7.0.3)
67
+ activerecord (= 7.0.3)
68
+ activesupport (= 7.0.3)
69
69
  marcel (~> 1.0)
70
70
  mini_mime (>= 1.1.0)
71
- activesupport (7.0.2.3)
71
+ activesupport (7.0.3)
72
72
  concurrent-ruby (~> 1.0, >= 1.0.2)
73
73
  i18n (>= 1.6, < 2)
74
74
  minitest (>= 5.1)
@@ -76,7 +76,7 @@ GEM
76
76
  builder (3.2.4)
77
77
  byebug (11.1.3)
78
78
  coderay (1.1.3)
79
- combustion (1.3.5)
79
+ combustion (1.3.7)
80
80
  activesupport (>= 3.0.0)
81
81
  railties (>= 3.0.0)
82
82
  thor (>= 0.14.6)
@@ -89,8 +89,7 @@ GEM
89
89
  activesupport (>= 5.0)
90
90
  i18n (1.10.0)
91
91
  concurrent-ruby (~> 1.0)
92
- io-wait (0.2.1)
93
- loofah (2.15.0)
92
+ loofah (2.18.0)
94
93
  crass (~> 1.0.2)
95
94
  nokogiri (>= 1.5.9)
96
95
  mail (2.7.1)
@@ -98,8 +97,9 @@ GEM
98
97
  marcel (1.0.2)
99
98
  method_source (1.0.0)
100
99
  mini_mime (1.1.2)
101
- minitest (5.15.0)
102
- multipart-post (2.1.1)
100
+ mini_portile2 (2.8.0)
101
+ minitest (5.16.0)
102
+ multipart-post (2.2.3)
103
103
  net-imap (0.2.3)
104
104
  digest
105
105
  net-protocol
@@ -108,15 +108,17 @@ GEM
108
108
  digest
109
109
  net-protocol
110
110
  timeout
111
- net-protocol (0.1.2)
112
- io-wait
111
+ net-protocol (0.1.3)
113
112
  timeout
114
113
  net-smtp (0.3.1)
115
114
  digest
116
115
  net-protocol
117
116
  timeout
118
117
  nio4r (2.5.8)
119
- nokogiri (1.13.3-x86_64-linux)
118
+ nokogiri (1.13.6)
119
+ mini_portile2 (~> 2.8.0)
120
+ racc (~> 1.4)
121
+ nokogiri (1.13.6-x86_64-linux)
120
122
  racc (~> 1.4)
121
123
  pry (0.13.1)
122
124
  coderay (~> 1.1)
@@ -125,31 +127,31 @@ GEM
125
127
  byebug (~> 11.0)
126
128
  pry (~> 0.13.0)
127
129
  racc (1.6.0)
128
- rack (2.2.3)
130
+ rack (2.2.3.1)
129
131
  rack-test (1.1.0)
130
132
  rack (>= 1.0, < 3)
131
- rails (7.0.2.3)
132
- actioncable (= 7.0.2.3)
133
- actionmailbox (= 7.0.2.3)
134
- actionmailer (= 7.0.2.3)
135
- actionpack (= 7.0.2.3)
136
- actiontext (= 7.0.2.3)
137
- actionview (= 7.0.2.3)
138
- activejob (= 7.0.2.3)
139
- activemodel (= 7.0.2.3)
140
- activerecord (= 7.0.2.3)
141
- activestorage (= 7.0.2.3)
142
- activesupport (= 7.0.2.3)
133
+ rails (7.0.3)
134
+ actioncable (= 7.0.3)
135
+ actionmailbox (= 7.0.3)
136
+ actionmailer (= 7.0.3)
137
+ actionpack (= 7.0.3)
138
+ actiontext (= 7.0.3)
139
+ actionview (= 7.0.3)
140
+ activejob (= 7.0.3)
141
+ activemodel (= 7.0.3)
142
+ activerecord (= 7.0.3)
143
+ activestorage (= 7.0.3)
144
+ activesupport (= 7.0.3)
143
145
  bundler (>= 1.15.0)
144
- railties (= 7.0.2.3)
146
+ railties (= 7.0.3)
145
147
  rails-dom-testing (2.0.3)
146
148
  activesupport (>= 4.2.0)
147
149
  nokogiri (>= 1.6)
148
- rails-html-sanitizer (1.4.2)
150
+ rails-html-sanitizer (1.4.3)
149
151
  loofah (~> 2.3)
150
- railties (7.0.2.3)
151
- actionpack (= 7.0.2.3)
152
- activesupport (= 7.0.2.3)
152
+ railties (7.0.3)
153
+ actionpack (= 7.0.3)
154
+ activesupport (= 7.0.3)
153
155
  method_source
154
156
  rake (>= 12.2)
155
157
  thor (~> 1.0)
@@ -164,10 +166,10 @@ GEM
164
166
  rspec-expectations (3.11.0)
165
167
  diff-lcs (>= 1.2.0, < 2.0)
166
168
  rspec-support (~> 3.11.0)
167
- rspec-mocks (3.11.0)
169
+ rspec-mocks (3.11.1)
168
170
  diff-lcs (>= 1.2.0, < 2.0)
169
171
  rspec-support (~> 3.11.0)
170
- rspec-rails (5.1.1)
172
+ rspec-rails (5.1.2)
171
173
  actionpack (>= 5.2)
172
174
  activesupport (>= 5.2)
173
175
  railties (>= 5.2)
@@ -176,17 +178,18 @@ GEM
176
178
  rspec-mocks (~> 3.10)
177
179
  rspec-support (~> 3.10)
178
180
  rspec-support (3.11.0)
179
- strscan (3.0.1)
181
+ strscan (3.0.3)
180
182
  thor (1.2.1)
181
- timeout (0.2.0)
183
+ timeout (0.3.0)
182
184
  tzinfo (2.0.4)
183
185
  concurrent-ruby (~> 1.0)
184
186
  websocket-driver (0.7.5)
185
187
  websocket-extensions (>= 0.1.0)
186
188
  websocket-extensions (0.1.5)
187
- zeitwerk (2.5.4)
189
+ zeitwerk (2.6.0)
188
190
 
189
191
  PLATFORMS
192
+ ruby
190
193
  x86_64-linux
191
194
 
192
195
  DEPENDENCIES
data/lib/texd/client.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require "net/http"
4
4
  require "net/http/post/multipart"
5
5
  require "json"
6
+ require "pp"
6
7
 
7
8
  module Texd
8
9
  class Client
@@ -39,6 +40,20 @@ module Texd
39
40
  @logs = logs
40
41
  super(message, details: details)
41
42
  end
43
+
44
+ def write_to(io)
45
+ io << "Compilation failed: #{message}\n"
46
+ if details
47
+ io.print "Details: "
48
+ PP.pp(details, io)
49
+ end
50
+
51
+ if logs
52
+ io << "Logs:\n" << logs
53
+ else
54
+ io << "Logs: not available"
55
+ end
56
+ end
42
57
  end
43
58
 
44
59
  # Raised when the texd server encountered one or more unknown file
@@ -87,6 +102,7 @@ module Texd
87
102
 
88
103
  Net::HTTP.start uri.host, uri.port, **request_options(uri) do |http|
89
104
  req = yield(uri)
105
+ req.basic_auth(uri.user, uri.password) if uri.user || uri.password
90
106
  decode_response http.request(req)
91
107
  end
92
108
  end
@@ -108,7 +124,7 @@ module Texd
108
124
  end
109
125
 
110
126
  def decode_response(res)
111
- ct = res["Content-Type"]
127
+ ct = res["Content-Type"].to_s
112
128
  body = case ct.split(";").first
113
129
  when "application/json"
114
130
  JSON.parse(res.body)
data/lib/texd/config.rb CHANGED
@@ -27,8 +27,9 @@ module Texd
27
27
  read_timeout: ENV.fetch("TEXD_READ_TIMEOUT", 180),
28
28
  write_timeout: ENV.fetch("TEXD_WRITE_TIMEOUT", 60),
29
29
  error_format: ENV.fetch("TEXD_ERRORS", "full"),
30
- tex_engine: ENV["TEXD_ENGINE"],
31
- tex_image: ENV["TEXD_IMAGE"],
30
+ error_handler: ENV.fetch("TEXD_ERROR_HANDLER", "raise"),
31
+ tex_engine: ENV.fetch("TEXD_ENGINE", nil),
32
+ tex_image: ENV.fetch("TEXD_IMAGE", nil),
32
33
  helpers: Set.new,
33
34
  lookup_paths: [], # Rails.root.join("app/tex") is inserted in railtie.rb
34
35
  ref_cache_size: 128,
@@ -40,6 +41,13 @@ module Texd
40
41
  # Supported error formats.
41
42
  ERROR_FORMATS = %w[json full condensed].freeze
42
43
 
44
+ # Default error handlers. One might provide a custom proc, if desired.
45
+ ERROR_HANDLERS = {
46
+ "raise" => proc { |err, _doc| raise err },
47
+ "stderr" => proc { |err, _doc| err.write_to($stderr) },
48
+ "ignore" => proc { |_err, _doc| },
49
+ }.freeze
50
+
43
51
  # Supported TeX engines.
44
52
  TEX_ENGINES = %w[xelatex lualatex pdflatex].freeze
45
53
 
@@ -78,6 +86,22 @@ module Texd
78
86
  # environment variable.
79
87
  attr_reader :error_format
80
88
 
89
+ # This setting defines how to handle Texd::Client::CompilationError errors.
90
+ #
91
+ # Supported values are:
92
+ #
93
+ # - "raise", which will not process the error,
94
+ # - "stderr", which will print the error to stderr,
95
+ # - "ignore", which will silently discard,
96
+ # - a Proc instance, which will delegate the error handling to it.
97
+ #
98
+ # The setter will lookup "raise", "stderr", and "ignore" from ERROR_HANDLERS,
99
+ # so this attribute will always be of kind Proc.
100
+ #
101
+ # The default value is "raise" and can be overridden by the `TEXD_ERROR_HANDLER`
102
+ # environment variable.
103
+ attr_reader :error_handler
104
+
81
105
  # This is the selected TeX engine. Supported values are described in
82
106
  # TEX_ENGINES.
83
107
  #
@@ -163,12 +187,30 @@ module Texd
163
187
  val = val.to_s
164
188
 
165
189
  unless ERROR_FORMATS.include?(val)
166
- raise InvalidConfig.new(nil, got: val, expected: ERROR_FORMATS)
190
+ raise InvalidConfig.new(nil,
191
+ option: :error_format,
192
+ got: val,
193
+ expected: ERROR_FORMATS)
167
194
  end
168
195
 
169
196
  @error_format = val
170
197
  end
171
198
 
199
+ def error_handler=(val)
200
+ val ||= "raise"
201
+ val = ERROR_HANDLERS.fetch(val.to_s, nil) unless val.respond_to?(:call)
202
+
203
+ if val
204
+ @error_handler = val
205
+ return
206
+ end
207
+
208
+ raise InvalidConfig.new(nil,
209
+ option: :error_handler,
210
+ got: val,
211
+ expected: ERROR_HANDLERS.keys + ["a Proc instance"])
212
+ end
213
+
172
214
  def tex_engine=(val)
173
215
  unless val.nil?
174
216
  val = val.to_s
data/lib/texd/document.rb CHANGED
@@ -6,8 +6,8 @@ module Texd
6
6
  attr_reader :attachments
7
7
 
8
8
  # Shorthand for `new.compile`.
9
- def self.compile(template:, locals: {})
10
- new.compile(template: template, locals: locals)
9
+ def self.compile(**kwargs)
10
+ new.compile(**kwargs)
11
11
  end
12
12
 
13
13
  def initialize
@@ -22,12 +22,15 @@ module Texd
22
22
  # context.
23
23
  # @param [Hash, nil] locals will be made available as getter methods in
24
24
  # the template.
25
+ # @param [String, Boolean] layout to be used. String value name template
26
+ # files in `app/views/layouts`, `true` (default) uses the application
27
+ # layout, and `false` renders without a layout.
25
28
  # @return [Compilation]
26
- def compile(template:, locals: {})
29
+ def compile(template:, locals: {}, layout: true)
27
30
  helper_mod = ::Texd.helpers(attachments, locals)
28
31
  tex_source = Class.new(ApplicationController) {
29
32
  helper helper_mod
30
- }.render(template: template, format: :tex)
33
+ }.render(template: template, format: :tex, layout: layout)
31
34
 
32
35
  main = attachments.main_input(tex_source)
33
36
  Compilation.new(main.name, attachments)
data/lib/texd/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Texd
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
data/lib/texd.rb CHANGED
@@ -105,7 +105,6 @@ module Texd
105
105
  # # Compilation failed and we might have a log in err.logs (only
106
106
  # # Texd.config.error_format is "full" or "condensed").
107
107
  # # Otherwise some details might be available in err.details.
108
- # # have a log in err.details
109
108
  # rescue Texd::Client::InputError => err
110
109
  # # something failed during input file processing. For details see
111
110
  # # err.details
@@ -119,12 +118,15 @@ module Texd
119
118
  # context.
120
119
  # @param [Hash, nil] locals will be made available as getter methods in
121
120
  # the template.
121
+ # @param [String, Boolean] layout to be used. String value name template
122
+ # files in `app/views/layouts`, `true` (default) uses the application
123
+ # layout, and `false` renders without a layout.
122
124
  # @raise [Texd::Client::ResponseError] on input and queue errors. Also on
123
125
  # compilation errors, if Texd.config.error_format is set to JSON.
124
126
  # @raise [Texd::Error] on other Texd related errors.
125
127
  # @return [String] the PDF object
126
- def render(template:, locals: {})
127
- doc = Document.compile(template: template, locals: locals)
128
+ def render(template:, locals: {}, layout: true)
129
+ doc = Document.compile(template: template, locals: locals, layout: layout)
128
130
 
129
131
  client.render doc.to_upload_ios,
130
132
  input: doc.main_input_name
@@ -132,5 +134,8 @@ module Texd
132
134
  # retry once with resolved references
133
135
  client.render doc.to_upload_ios(missing_refs: err.references),
134
136
  input: doc.main_input_name
137
+ rescue Client::CompilationError => err
138
+ config.error_handler.call(err, doc)
139
+ nil
135
140
  end
136
141
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: texd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Menke
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-24 00:00:00.000000000 Z
11
+ date: 2022-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multipart-post
@@ -141,7 +141,7 @@ metadata:
141
141
  rubygems_mfa_required: 'true'
142
142
  homepage_uri: https://github.com/digineo/texd-ruby
143
143
  source_code_uri: https://github.com/digineo/texd-ruby
144
- changelog_uri: https://github.com/digineo/texd-ruby/blob/v0.3.0/CHANGELOG.md
144
+ changelog_uri: https://github.com/digineo/texd-ruby/blob/v0.4.0/CHANGELOG.md
145
145
  post_install_message:
146
146
  rdoc_options: []
147
147
  require_paths: