texrack 0.6.1 → 0.6.2
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/CHANGELOG.md +4 -0
- data/README.md +12 -1
- data/lib/texrack.rb +2 -1
- data/lib/texrack/endpoint.rb +7 -3
- data/lib/texrack/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bfd05831d8152524aaffa8c9010236ae1df91bb
|
4
|
+
data.tar.gz: 41f7804550ebcabcb899067ef2050447bb2178b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81f357de2ffe1d4e1e03f56013078a39c6373d41c060b9c5ccb8f4720dde78ded2e131ebe1c1c518be3c96c86528db4797a271756453c306531103fccd48c188
|
7
|
+
data.tar.gz: 6c229ac6abbc7c03e1ad5cbe986e64e852f5901cea05e4c3e0a2e2524ec1284b7a002a0cd4c963a4cadce35ecb8e6f37c84e4b44275ab443440c942bf8b51ce5
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -22,7 +22,8 @@ Texrack.config = {
|
|
22
22
|
pdflatex: "pdflatex",
|
23
23
|
convert: "convert",
|
24
24
|
logger: nil,
|
25
|
-
cache_dir: Dir.mktmpdir
|
25
|
+
cache_dir: Dir.mktmpdir,
|
26
|
+
allowed_domains: ['*.example.com']
|
26
27
|
}
|
27
28
|
```
|
28
29
|
|
@@ -54,6 +55,16 @@ If you are dealing with software incapable of proper status codes (looking at
|
|
54
55
|
you, Flash), you can pass `always_200=1` and it'll respond with 200 OK even
|
55
56
|
though we should really respond with a 5xx.
|
56
57
|
|
58
|
+
### Trim result image
|
59
|
+
Pass `trim=1` to tell ImageMagick to trim the result using [-trim](http://www.imagemagick.org/Usage/crop/#trim).
|
60
|
+
|
61
|
+
### crossdomain.xml
|
62
|
+
If TexRack is used from Flash, and hosted on a different domain, you might need a crossdomain.xml file.
|
63
|
+
Set `Texrack.config[:allowed_domains]` to an array of domains that should be allowed access.
|
64
|
+
|
65
|
+
Example:
|
66
|
+
`allowed_domains: ['*.example.com']`
|
67
|
+
|
57
68
|
### Caching
|
58
69
|
Generated images are cached by default, so we don't have to shell out to
|
59
70
|
pdflatex and imagemagick all the time. Configure `cache_dir` to store the
|
data/lib/texrack.rb
CHANGED
data/lib/texrack/endpoint.rb
CHANGED
@@ -21,9 +21,12 @@ module Texrack
|
|
21
21
|
render_png
|
22
22
|
end
|
23
23
|
|
24
|
-
|
25
|
-
|
24
|
+
get '/crossdomain.xml' do
|
25
|
+
content_type 'application/xml'
|
26
|
+
erb :crossdomain
|
27
|
+
end
|
26
28
|
|
29
|
+
def render_png
|
27
30
|
begin
|
28
31
|
output = Texrack::OutputFile.new(digest)
|
29
32
|
unless output.exists?
|
@@ -33,6 +36,7 @@ module Texrack
|
|
33
36
|
output.finish
|
34
37
|
end
|
35
38
|
|
39
|
+
set_headers
|
36
40
|
send_file output, disposition: :inline
|
37
41
|
rescue Texrack::LatexFailedError
|
38
42
|
send_static_error "latex-failed.png"
|
@@ -51,7 +55,7 @@ module Texrack
|
|
51
55
|
end
|
52
56
|
|
53
57
|
def send_static_error(filename)
|
54
|
-
headers['ETag'] =
|
58
|
+
headers['ETag'] = ''
|
55
59
|
send_file File.join(settings.public_folder, filename), {
|
56
60
|
disposition: :inline,
|
57
61
|
status: error_status
|
data/lib/texrack/version.rb
CHANGED