texd 0.4.0 → 0.4.1

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: fde0921bb4b213505d16db41af06475dfb4915c0b1283e4e0ef74c956715bab5
4
- data.tar.gz: 6bc1878f34088d9ad32a8ac9a9c81819f20293153ed11148b2da8d190e9a4afc
3
+ metadata.gz: e81fb33476966032e12c55d7078c824f82e249ad5191bb499a6f0047e6748603
4
+ data.tar.gz: 41860606ab46c0006a33b740120c8441a8a29d2b48b577ef133a4acff8a5bd8a
5
5
  SHA512:
6
- metadata.gz: 3c6d63be3ffe9e11e9c0b98bc3466f07427014057291c8df551aa1ed49c3b5f4cf9e9e0583c96254fd7288193199598db6aabc17f92545e2de38f36004cbf6e0
7
- data.tar.gz: 919b674fd137f097d241170a54ae2746b150a76edd52aa373974234336d6884f3bd8e2820834d58a11f6f0131f6d63fc07b43f76faf971a182604a044cde7f10
6
+ metadata.gz: 352f6eca45f3e55b0e0df036d59f21f4d77dd7567a6c92853ae5766b6a6b3e2d751a9d9a68f4f353c95435caf6cdfed843f0774a4fd64d3fc0ba0ec33a90405d
7
+ data.tar.gz: 71f761e43adf6268567cd49285a8fe542887e4654499dc297fe7d26feb6882803474702704f6493ece465a339e8ba2283cfd4e0e114f6ed153b7e2c98f2c99b5
data/CHANGELOG.md CHANGED
@@ -1,10 +1,10 @@
1
1
  ## Unreleased
2
2
 
3
- [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.4.0...master)
3
+ [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.4.1...master)
4
4
 
5
- ## v0.4.0
5
+ ## v0.4.1 - 2022-06-16
6
6
 
7
- [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.3.2...v0.4.0)
7
+ [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.3.2...v0.4.1)
8
8
 
9
9
  **Changes**
10
10
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- texd (0.4.0)
4
+ texd (0.4.1)
5
5
  multipart-post (~> 2.0)
6
6
  rails (>= 6.0, < 8)
7
7
 
data/README.md CHANGED
@@ -21,7 +21,7 @@ Install the gem and add to the application's Gemfile by executing:
21
21
 
22
22
  ## Configuration
23
23
 
24
- Befor you can use texd, you need to tell it where your instance is located.
24
+ Before you can use texd, you need to tell it where your instance is located.
25
25
 
26
26
  By default, this gem reads the `TEXD_ENDPOINT` environment variable and falls
27
27
  back to `http://localhost:2201/render`, should it be empty.
@@ -38,15 +38,18 @@ end
38
38
 
39
39
  ```rb
40
40
  Texd.configure do |config|
41
- config.endpoint = ENV.fetch("TEXD_ENDPOINT", "http://localhost:2201/")
42
- config.open_timeout = ENV.fetch("TEXD_OPEN_TIMEOUT", 60)
43
- config.read_timeout = ENV.fetch("TEXD_READ_TIMEOUT", 180)
44
- config.write_timeout = ENV.fetch("TEXD_WRITE_TIMEOUT", 60)
45
- config.error_format = ENV.fetch("TEXD_ERRORS", "full")
46
- config.tex_engine = ENV["TEXD_ENGINE"]
47
- config.tex_image = ENV["TEXD_IMAGE"]
48
- config.helpers = []
49
- config.lookup_paths = [] # Rails.root.join("app/tex") is always inserted as first entry
41
+ config.endpoint = ENV.fetch("TEXD_ENDPOINT", "http://localhost:2201/")
42
+ config.open_timeout = ENV.fetch("TEXD_OPEN_TIMEOUT", 60)
43
+ config.read_timeout = ENV.fetch("TEXD_READ_TIMEOUT", 180)
44
+ config.write_timeout = ENV.fetch("TEXD_WRITE_TIMEOUT", 60)
45
+ config.error_format = ENV.fetch("TEXD_ERRORS", "full")
46
+ config.error_handler = ENV.fetch("TEXD_ERROR_HANDLER", "raise")
47
+ config.tex_engine = ENV["TEXD_ENGINE"]
48
+ config.tex_image = ENV["TEXD_IMAGE"]
49
+ config.helpers = []
50
+ config.lookup_paths = []
51
+ config.lookup_paths = [] # Rails.root.join("app/tex") is always prepended
52
+ config.ref_cache_size = 128
50
53
  end
51
54
  ```
52
55
 
@@ -174,6 +177,31 @@ All errors inherit from `Texd::Client::RenderError` and should have
174
177
  a `details` attribute (a Hash) containing the actual error returned
175
178
  from the server.
176
179
 
180
+ ## Global error reporting
181
+
182
+ texd can be configured with external error reporting, like Sentry.
183
+
184
+ This example sends the LaTeX compilation log and compiled main input `.tex`
185
+ file to Sentry:
186
+
187
+ ```ruby
188
+ Texd.configure do |config|
189
+ config.error_handler = ->(err, doc) {
190
+ Sentry.set_context "texd", {
191
+ details: err.details, # if config.error_format == "json"
192
+ logs: err.logs, # otherwise
193
+ }.compact
194
+ Sentry.capture_exception(err)
195
+
196
+ raise err # re-raise, so that your code can decide further actions
197
+ }
198
+ end
199
+ ```
200
+
201
+ `config.error_handler` must respond to `call`, and receives the error (an instance
202
+ of `Texd::Client::CompilationError`) and the document context (an instance of
203
+ `Texd::Document::Compilation`).
204
+
177
205
  ## Development
178
206
 
179
207
  After checking out the repo, run `bin/setup` to install dependencies. Then, run
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- texd (0.4.0)
4
+ texd (0.4.1)
5
5
  multipart-post (~> 2.0)
6
6
  rails (>= 6.0, < 8)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- texd (0.4.0)
4
+ texd (0.4.1)
5
5
  multipart-post (~> 2.0)
6
6
  rails (>= 6.0, < 8)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- texd (0.4.0)
4
+ texd (0.4.1)
5
5
  multipart-post (~> 2.0)
6
6
  rails (>= 6.0, < 8)
7
7
 
data/lib/texd/config.rb CHANGED
@@ -82,7 +82,7 @@ module Texd
82
82
  #
83
83
  # Supported values are described in ERROR_FORMATS.
84
84
  #
85
- # The default is "full" and can be overriden by the `TEXD_WRITE_TIMEOUT`
85
+ # The default is "full" and can be overriden by the `TEXD_ERRORS`
86
86
  # environment variable.
87
87
  attr_reader :error_format
88
88
 
data/lib/texd/document.rb CHANGED
@@ -40,6 +40,12 @@ module Texd
40
40
  def to_upload_ios(missing_refs: Set.new)
41
41
  attachments.to_upload_ios(missing_refs)
42
42
  end
43
+
44
+ # Convenience accessor for the main input file.
45
+ # @returns [String] main input file contents
46
+ def main_input_contents
47
+ attachments.items.fetch(main_input_name).contents
48
+ end
43
49
  end
44
50
  end
45
51
  end
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.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: texd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Menke
@@ -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.4.0/CHANGELOG.md
144
+ changelog_uri: https://github.com/digineo/texd-ruby/blob/v0.4.1/CHANGELOG.md
145
145
  post_install_message:
146
146
  rdoc_options: []
147
147
  require_paths: