latexml-ruby 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -1
- data/latexml-ruby.gemspec +1 -1
- data/lib/latexml.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 856713e709651faff382b211c10a74c5bfdf6311
|
4
|
+
data.tar.gz: 269827bd4822092ad06131da063d3bd6b0d40b2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50e564db34b16ad8f7f3b11d4acf717d212b33f8473ddc287e260c32c545e0d33f1e6676bfa3e32c211f727b705180d054a3be5f53bb850039e1318b136e09a8
|
7
|
+
data.tar.gz: bcb31153c787cdfd63dfc05fce5198f86034cff05de7177b6c2c05f09b614a7fa7462e8b6d56b384a510cd105ef25b4231020d27be895dad7560ab39734827f2
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://secure.travis-ci.org/Authorea/latexml-ruby.png?branch=master)](https://travis-ci.org/Authorea/latexml-ruby)
|
4
4
|
[![license](http://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/authorea/LaTeXML-Ruby/master/LICENSE)
|
5
|
-
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/latexml-ruby.svg)](https://badge.fury.io/rb/latexml-ruby)
|
6
6
|
|
7
7
|
A Ruby wrapper for the [LaTeXML](http://dlmf.nist.gov/LaTeXML/) LaTeX to XML/HTML/ePub converter.
|
8
8
|
|
@@ -12,6 +12,8 @@ Includes support for daemonized conversion runs, for additional performance, via
|
|
12
12
|
|
13
13
|
You may be familiar with other LaTeX conversion tools such as Pandoc or tex4ht. LaTeXML attempts to be a complete TeX interpreter, and covers a vastly larger range of the TeX/LaTeX ecosystem than Pandoc. At the same time it allows for just-in-time binding of structural and semantic macros, which allows it to create higher quality HTML5 than tex4ht, and makes bridging the impedance mismatch between PDF and HTML an achievable goal.
|
14
14
|
|
15
|
+
We use LaTeXML extensively at Authorea (http://www.authorea.com) for enabling [Power latex editing](https://www.authorea.com/28015) for our authors.
|
16
|
+
|
15
17
|
## Installation
|
16
18
|
|
17
19
|
Add this line to your application's Gemfile:
|
@@ -28,20 +30,29 @@ Or install it yourself as:
|
|
28
30
|
|
29
31
|
$ gem install latexml-ruby
|
30
32
|
|
33
|
+
### Caveat
|
34
|
+
|
35
|
+
The current default setup of the wrapper options uses some advanced LaTeX packages, for which you also need a working LaTeX installation on the machine, as LaTeXML resorts to the native LaTeX definitions. It's usually best to install ```texlive```, or a similar comprehensive TeX distro. For a minimal setup set of options, see the [basic test setup](https://github.com/Authorea/latexml-ruby/blob/master/test/basics_test.rb#L5)
|
36
|
+
|
31
37
|
## Usage
|
32
38
|
|
33
39
|
A hello world conversion job looks like:
|
34
40
|
|
35
41
|
```ruby
|
42
|
+
require 'latexml'
|
43
|
+
|
36
44
|
@latexml = LaTeXML.new
|
37
45
|
|
38
46
|
response = @latexml.convert(literal: "hello world")
|
39
47
|
|
40
48
|
result = response[:result]
|
41
49
|
messages = response[:messages]
|
50
|
+
status_code = response[:status_code]
|
42
51
|
|
43
52
|
```
|
44
53
|
|
54
|
+
You can find more information on the LaTeXML message codes in [the official manual](http://dlmf.nist.gov/LaTeXML/manual/errorcodes/index.html).Status codes range from 0 (OK), 1 (warning), 2 (error) to 3 (fatal error).
|
55
|
+
|
45
56
|
## Contributing
|
46
57
|
|
47
58
|
Bug reports and pull requests are welcome on GitHub at https://github.com/Authorea/latexml-ruby.
|
data/latexml-ruby.gemspec
CHANGED
data/lib/latexml.rb
CHANGED
@@ -164,11 +164,13 @@ class LaTeXML
|
|
164
164
|
# email_content = "#{request.body}\n\nLog: #{log}"
|
165
165
|
# Resque.enqueue(NotificationsWorker, email_subject, email_content)
|
166
166
|
# end
|
167
|
+
|
167
168
|
# We can check for the error code if we want to: 0 is ok, 1 is warning, 2 is error and 3 is fatal error
|
168
|
-
|
169
|
+
status = response["status"]
|
170
|
+
status_code = response["status_code"] || 3 # when undefined, implied Fatal, it should always be returned
|
169
171
|
|
170
172
|
# Return the HTML content:
|
171
|
-
return {result: html, messages: parse_log(log)}
|
173
|
+
return {result: html, messages: parse_log(log), status: status, status_code: status_code}
|
172
174
|
end
|
173
175
|
|
174
176
|
# Parses a log string which follows the LaTeXML convention
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: latexml-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Deyan Ginev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: escape_utils
|