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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f12825ac7bc96cc0bcde6d9d4b10cd303760873
4
- data.tar.gz: 832c989f6b175c6cc0ad3e45d489cbe547ecdb83
3
+ metadata.gz: 856713e709651faff382b211c10a74c5bfdf6311
4
+ data.tar.gz: 269827bd4822092ad06131da063d3bd6b0d40b2d
5
5
  SHA512:
6
- metadata.gz: 6b69ee41107db0eb159a9c1a7a412a64f8497c75e74402d9bd9acfe4b2d9b822f115359921ebabe8d889b05ec570a16b3ced06e130d77820b66947f8b0686c32
7
- data.tar.gz: dc5aafc5be83e8e305dee9b6d646647faf426607c98650bc51e07820d4ff3863d2b85c94b4d5631dd0c3557d9105ce43c52b84e2f5484ffd1758feda455db174
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.
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "latexml-ruby"
4
- spec.version = "0.0.1"
4
+ spec.version = "0.0.2"
5
5
 
6
6
  spec.authors = ["Deyan Ginev"]
7
7
  spec.email = ["deyan@authorea.com"]
@@ -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
- # status = response["status"]
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.1
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-29 00:00:00.000000000 Z
11
+ date: 2016-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: escape_utils