RbST 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/RbST.gemspec +2 -2
- data/lib/rst2parts/rst2html.py +7 -4
- data/lib/rst2parts/rst2latex.py +7 -4
- data/lib/rst2parts/transform.py +8 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30396c228e2675195f9ec0af364131a27d2347c71b56c20512d4edaaf4f94f30
|
4
|
+
data.tar.gz: 83c578d4573da49ca62b57d70aa207b97813cbe6e0218fd6ccd5edba1db4a2c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2939d986df841b5b125d55476aa0dc7df55ee93a89a983c4b741acb9182a12b6ada463d589e5c3003549ca5cea69f4b066792781cd7862528ba2e640d07db0c4
|
7
|
+
data.tar.gz: 2de1916192a97a262e4160370a5c72e5a38e08ce9517fb4cf7835acaca6d4d941173686991374fad17debbd0bda25104965ac6a33edc49a4b3b02ea970a2bbb4
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# RbST
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/xwmx/rbst.svg?branch=master)](https://travis-ci.org/xwmx/rbst)
|
4
|
+
|
3
5
|
A Ruby gem for processing
|
4
6
|
[reStructuredText](https://en.wikipedia.org/wiki/ReStructuredText) via Python's
|
5
7
|
[Docutils](https://pypi.org/project/docutils/).
|
data/RbST.gemspec
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'RbST'
|
5
|
-
s.version = '0.6.
|
5
|
+
s.version = '0.6.5'
|
6
6
|
s.licenses = ['MIT']
|
7
7
|
s.summary = "A Ruby gem for processing reStructuredText via Python's Docutils."
|
8
8
|
s.description = "A Ruby gem for processing reStructuredText via Python's Docutils."
|
9
9
|
s.authors = ['William Melody']
|
10
10
|
s.email = 'hi@williammelody.com'
|
11
|
-
s.date = '2020-
|
11
|
+
s.date = '2020-04-16'
|
12
12
|
s.extra_rdoc_files = [
|
13
13
|
'LICENSE',
|
14
14
|
'README.md'
|
data/lib/rst2parts/rst2html.py
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
try:
|
4
4
|
import locale
|
5
|
-
|
5
|
+
|
6
|
+
locale.setlocale(locale.LC_ALL, "")
|
6
7
|
except:
|
7
8
|
pass
|
8
9
|
|
@@ -11,14 +12,16 @@ import sys
|
|
11
12
|
from transform import transform
|
12
13
|
from docutils.writers.html4css1 import Writer
|
13
14
|
|
15
|
+
|
14
16
|
def main():
|
15
|
-
return transform(writer=Writer(), part=
|
17
|
+
return transform(writer=Writer(), part="html_body")
|
18
|
+
|
16
19
|
|
17
|
-
if __name__ ==
|
20
|
+
if __name__ == "__main__":
|
18
21
|
# Python 2 wants an encoded string for unicode, while Python 3 views an
|
19
22
|
# encoded string as bytes and asks for a string. Solution via:
|
20
23
|
# http://stackoverflow.com/a/24104423
|
21
24
|
if sys.version_info[0] < 3:
|
22
|
-
UTF8Writer = codecs.getwriter(
|
25
|
+
UTF8Writer = codecs.getwriter("utf8")
|
23
26
|
sys.stdout = UTF8Writer(sys.stdout)
|
24
27
|
sys.stdout.write(main())
|
data/lib/rst2parts/rst2latex.py
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
try:
|
4
4
|
import locale
|
5
|
-
|
5
|
+
|
6
|
+
locale.setlocale(locale.LC_ALL, "")
|
6
7
|
except:
|
7
8
|
pass
|
8
9
|
|
@@ -11,14 +12,16 @@ import sys
|
|
11
12
|
from transform import transform
|
12
13
|
from docutils.writers.latex2e import Writer
|
13
14
|
|
15
|
+
|
14
16
|
def main():
|
15
|
-
return transform(writer=Writer(), part=
|
17
|
+
return transform(writer=Writer(), part="whole")
|
18
|
+
|
16
19
|
|
17
|
-
if __name__ ==
|
20
|
+
if __name__ == "__main__":
|
18
21
|
# Python 2 wants an encoded string for unicode, while Python 3 views an
|
19
22
|
# encoded string as bytes and asks for a string. Solution via:
|
20
23
|
# http://stackoverflow.com/a/24104423
|
21
24
|
if sys.version_info[0] < 3:
|
22
|
-
UTF8Writer = codecs.getwriter(
|
25
|
+
UTF8Writer = codecs.getwriter("utf8")
|
23
26
|
sys.stdout = UTF8Writer(sys.stdout)
|
24
27
|
sys.stdout.write(main())
|
data/lib/rst2parts/transform.py
CHANGED
@@ -4,6 +4,7 @@ from optparse import OptionParser
|
|
4
4
|
from docutils.frontend import OptionParser as DocutilsOptionParser
|
5
5
|
from docutils.parsers.rst import Parser
|
6
6
|
|
7
|
+
|
7
8
|
def transform(writer=None, part=None):
|
8
9
|
p = OptionParser(add_help_option=False)
|
9
10
|
|
@@ -12,29 +13,24 @@ def transform(writer=None, part=None):
|
|
12
13
|
for group in docutils_parser.option_groups:
|
13
14
|
p.add_option_group(group.title, None).add_options(group.option_list)
|
14
15
|
|
15
|
-
p.add_option(
|
16
|
+
p.add_option("--part", default=part)
|
16
17
|
|
17
18
|
opts, args = p.parse_args()
|
18
19
|
|
19
|
-
settings = dict(
|
20
|
-
|
21
|
-
|
22
|
-
}, **opts.__dict__)
|
20
|
+
settings = dict(
|
21
|
+
{"file_insertion_enabled": False, "raw_enabled": False,}, **opts.__dict__
|
22
|
+
)
|
23
23
|
|
24
24
|
if len(args) == 1:
|
25
25
|
try:
|
26
|
-
content = open(args[0],
|
26
|
+
content = open(args[0], "rb").read()
|
27
27
|
except IOError:
|
28
28
|
content = args[0]
|
29
29
|
else:
|
30
30
|
content = sys.stdin.read()
|
31
31
|
|
32
|
-
parts = publish_parts(
|
33
|
-
source=content,
|
34
|
-
settings_overrides=settings,
|
35
|
-
writer=writer,
|
36
|
-
)
|
32
|
+
parts = publish_parts(source=content, settings_overrides=settings, writer=writer,)
|
37
33
|
|
38
34
|
if opts.part in parts:
|
39
35
|
return parts[opts.part]
|
40
|
-
return u
|
36
|
+
return u""
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: RbST
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Melody
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|