texd 0.1.0 → 0.2.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/Gemfile.lock +3 -3
- data/gemfiles/rails-6.0.lock +2 -2
- data/gemfiles/rails-6.1.lock +2 -2
- data/gemfiles/rails-7.0.lock +2 -2
- data/lib/texd/document.rb +3 -1
- data/lib/texd/helpers.rb +2 -2
- data/lib/texd/version.rb +1 -1
- data/lib/texd.rb +16 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 676222ee01af1a31facb86ee1a4416f4f5b3307e0c8e7de9b6ee7357b5e8a838
|
4
|
+
data.tar.gz: 153a30b56379209ba62ec860de87ae3fc6dd322b6828df73557bef90cb526bc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 210eab22723d4f043cad09601022fa577769a3235bbbac5984c538594d83015559b2f1d92d8f537cd230e301fc97425c75aca12a310d210f60ff85a05b3e0df8
|
7
|
+
data.tar.gz: 82c1ebfedabb268f92871ad707aa0b1d611440bb641a134a449e112eac76d24476e3ddcf25c788b6620b364650085e09a2e5ffad0a8fcc4592b04e953d2583c5
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
texd (0.
|
4
|
+
texd (0.2.0)
|
5
5
|
multipart-post (~> 2.0)
|
6
6
|
rails (>= 6.0, < 8)
|
7
7
|
|
@@ -81,7 +81,7 @@ GEM
|
|
81
81
|
activesupport (>= 3.0.0)
|
82
82
|
railties (>= 3.0.0)
|
83
83
|
thor (>= 0.14.6)
|
84
|
-
concurrent-ruby (1.1.
|
84
|
+
concurrent-ruby (1.1.10)
|
85
85
|
crass (1.0.6)
|
86
86
|
diff-lcs (1.5.0)
|
87
87
|
digest (3.1.0)
|
@@ -183,7 +183,7 @@ GEM
|
|
183
183
|
rspec-mocks (~> 3.10)
|
184
184
|
rspec-support (~> 3.10)
|
185
185
|
rspec-support (3.11.0)
|
186
|
-
rubocop (1.26.
|
186
|
+
rubocop (1.26.1)
|
187
187
|
parallel (~> 1.10)
|
188
188
|
parser (>= 3.1.0.0)
|
189
189
|
rainbow (>= 2.2.2, < 4.0)
|
data/gemfiles/rails-6.0.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
texd (0.
|
4
|
+
texd (0.2.0)
|
5
5
|
multipart-post (~> 2.0)
|
6
6
|
rails (>= 6.0, < 8)
|
7
7
|
|
@@ -70,7 +70,7 @@ GEM
|
|
70
70
|
activesupport (>= 3.0.0)
|
71
71
|
railties (>= 3.0.0)
|
72
72
|
thor (>= 0.14.6)
|
73
|
-
concurrent-ruby (1.1.
|
73
|
+
concurrent-ruby (1.1.10)
|
74
74
|
crass (1.0.6)
|
75
75
|
diff-lcs (1.5.0)
|
76
76
|
erubi (1.10.0)
|
data/gemfiles/rails-6.1.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
texd (0.
|
4
|
+
texd (0.2.0)
|
5
5
|
multipart-post (~> 2.0)
|
6
6
|
rails (>= 6.0, < 8)
|
7
7
|
|
@@ -74,7 +74,7 @@ GEM
|
|
74
74
|
activesupport (>= 3.0.0)
|
75
75
|
railties (>= 3.0.0)
|
76
76
|
thor (>= 0.14.6)
|
77
|
-
concurrent-ruby (1.1.
|
77
|
+
concurrent-ruby (1.1.10)
|
78
78
|
crass (1.0.6)
|
79
79
|
diff-lcs (1.5.0)
|
80
80
|
erubi (1.10.0)
|
data/gemfiles/rails-7.0.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
texd (0.
|
4
|
+
texd (0.2.0)
|
5
5
|
multipart-post (~> 2.0)
|
6
6
|
rails (>= 6.0, < 8)
|
7
7
|
|
@@ -80,7 +80,7 @@ GEM
|
|
80
80
|
activesupport (>= 3.0.0)
|
81
81
|
railties (>= 3.0.0)
|
82
82
|
thor (>= 0.14.6)
|
83
|
-
concurrent-ruby (1.1.
|
83
|
+
concurrent-ruby (1.1.10)
|
84
84
|
crass (1.0.6)
|
85
85
|
diff-lcs (1.5.0)
|
86
86
|
digest (3.1.0)
|
data/lib/texd/document.rb
CHANGED
@@ -22,7 +22,9 @@ module Texd
|
|
22
22
|
# forwards to ActionView::Renderer#render).
|
23
23
|
# @return [Compilation]
|
24
24
|
def compile(*args)
|
25
|
-
|
25
|
+
locals = args.last.delete(:locals) if args.last.is_a?(Hash)
|
26
|
+
helper_mod = ::Texd.helpers(attachments, locals)
|
27
|
+
|
26
28
|
tex_source = Class.new(ApplicationController) {
|
27
29
|
helper helper_mod
|
28
30
|
}.render(*args)
|
data/lib/texd/helpers.rb
CHANGED
@@ -28,8 +28,8 @@ module Texd
|
|
28
28
|
|
29
29
|
# Escapes the given text, making it safe for use in TeX documents.
|
30
30
|
def escape(text, line_break = "\\\\\\", typographic: true)
|
31
|
-
text = +text
|
32
|
-
text.
|
31
|
+
text = +text.to_s # text might be nil or a frozen string
|
32
|
+
text.tap do |str|
|
33
33
|
str.gsub!(ESCAPE_RE) do |m|
|
34
34
|
if Regexp.last_match(1)
|
35
35
|
"\\#{m}"
|
data/lib/texd/version.rb
CHANGED
data/lib/texd.rb
CHANGED
@@ -55,16 +55,26 @@ module Texd
|
|
55
55
|
@client
|
56
56
|
end
|
57
57
|
|
58
|
-
# Creates a helper module containing
|
59
|
-
# and (b) any other helper configured in Text.config.helpers.
|
58
|
+
# Creates a helper module containing:
|
60
59
|
#
|
61
|
-
#
|
60
|
+
# 1. the `texd_attach` and `texd_reference` helper,
|
61
|
+
# 2. locals passed in, transformed to helper methods, and
|
62
|
+
# 3. any other helper configured in Text.config.helpers.
|
62
63
|
#
|
63
64
|
# @api private
|
64
|
-
|
65
|
+
# @param [Texd::AttachmentList] attachments
|
66
|
+
# @param [Hash, nil] locals
|
67
|
+
# @return [Module] a new helper module
|
68
|
+
def helpers(attachments, locals) # rubocop:disable Metrics/AbcSize
|
69
|
+
locals ||= {}
|
70
|
+
|
65
71
|
Module.new do
|
66
72
|
include Texd::Helpers
|
67
73
|
|
74
|
+
Texd.config.helpers.each do |mod|
|
75
|
+
include mod
|
76
|
+
end
|
77
|
+
|
68
78
|
define_method :texd_attach do |path, rename: true, with_extension: true|
|
69
79
|
attachments.attach(path, rename).name(with_extension)
|
70
80
|
end
|
@@ -75,8 +85,8 @@ module Texd
|
|
75
85
|
|
76
86
|
alias_method :texd_references, :texd_reference
|
77
87
|
|
78
|
-
|
79
|
-
|
88
|
+
locals.each do |name, value|
|
89
|
+
define_method(name) { value }
|
80
90
|
end
|
81
91
|
end
|
82
92
|
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.
|
4
|
+
version: 0.2.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-
|
11
|
+
date: 2022-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multipart-post
|
@@ -140,7 +140,7 @@ metadata:
|
|
140
140
|
rubygems_mfa_required: 'true'
|
141
141
|
homepage_uri: https://github.com/digineo/texd-ruby
|
142
142
|
source_code_uri: https://github.com/digineo/texd-ruby
|
143
|
-
changelog_uri: https://github.com/digineo/texd-ruby/blob/v0.
|
143
|
+
changelog_uri: https://github.com/digineo/texd-ruby/blob/v0.2.0/CHANGELOG.md
|
144
144
|
post_install_message:
|
145
145
|
rdoc_options: []
|
146
146
|
require_paths:
|