github-markup 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -3
- data/Gemfile +1 -1
- data/HISTORY.md +9 -0
- data/README.md +3 -3
- data/lib/github-markup.rb +1 -1
- data/lib/github/commands/rest2html +18 -1
- data/test/markup_test.rb +4 -5
- 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: 015436ffdbdabf0b573f786f948960ccae1e547c
|
4
|
+
data.tar.gz: e508fb427eb6e7ce276ab54478ff5a1f81bded7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67f22bcd3f185424ba4ad390b60c972a0167afc1e3bc22d5b0bd2978dd3e9825d5ed1711e9d31cb94dcac64003e9d11aa536a45282416ae6f0e6bde121230d79
|
7
|
+
data.tar.gz: 875c40738eef72db08c8307800e10cbb49fadcfee28cd90bd084736e761a8e3b182c4fdf501d69ec93050693e844a7a20a059a30ded40bedddc558831a1b7322
|
data/.travis.yml
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
3
|
- 2.0.0
|
4
|
-
- 2.1.
|
5
|
-
-
|
4
|
+
- 2.1.10
|
5
|
+
- 2.2.7
|
6
|
+
- 2.3.4
|
7
|
+
- 2.4.1
|
8
|
+
- jruby-9.1.9.0
|
6
9
|
jdk:
|
7
10
|
- oraclejdk8
|
8
11
|
notifications:
|
@@ -25,4 +28,4 @@ env:
|
|
25
28
|
- "JRUBY_OPTS=-Xcext.enabled=true"
|
26
29
|
matrix:
|
27
30
|
allow_failures:
|
28
|
-
- rvm: jruby-
|
31
|
+
- rvm: jruby-9.1.9.0
|
data/Gemfile
CHANGED
data/HISTORY.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## 1.6.1 - 2017-07-25
|
2
|
+
|
3
|
+
### Changed
|
4
|
+
|
5
|
+
* Added support for highlight directive in rST [#925](https://github.com/github/markup/pull/925)
|
6
|
+
* Fixes to documentation and code style [#1009](https://github.com/github/markup/pull/1009) [#1071](https://github.com/github/markup/pull/1071) [#1087](https://github.com/github/markup/pull/1087)
|
7
|
+
* Test against newer Ruby versions [#1086](https://github.com/github/markup/pull/1086)
|
8
|
+
* Upgrade to Asciidoctor 1.5.6.1 [#1088](https://github.com/github/markup/pull/1088)
|
9
|
+
|
1
10
|
## 1.6.0 - 2017-04-03
|
2
11
|
|
3
12
|
### Changed
|
data/README.md
CHANGED
@@ -25,7 +25,7 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a
|
|
25
25
|
* [.org](http://orgmode.org/) -- `gem install org-ruby`
|
26
26
|
* [.creole](http://wikicreole.org/) -- `gem install creole`
|
27
27
|
* [.mediawiki, .wiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth`
|
28
|
-
* [.rst](http://docutils.sourceforge.net/rst.html) -- `
|
28
|
+
* [.rst](http://docutils.sourceforge.net/rst.html) -- `pip install docutils`
|
29
29
|
* [.asciidoc, .adoc, .asc](http://asciidoc.org/) -- `gem install asciidoctor` (http://asciidoctor.org)
|
30
30
|
* [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::XHTML`
|
31
31
|
comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN.
|
@@ -46,7 +46,7 @@ Basic form:
|
|
46
46
|
```ruby
|
47
47
|
require 'github/markup'
|
48
48
|
|
49
|
-
GitHub::Markup.render('README.markdown',
|
49
|
+
GitHub::Markup.render('README.markdown', "* One\n* Two")
|
50
50
|
```
|
51
51
|
|
52
52
|
More realistic form:
|
@@ -62,7 +62,7 @@ And a convenience form:
|
|
62
62
|
```ruby
|
63
63
|
require 'github/markup'
|
64
64
|
|
65
|
-
GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN,
|
65
|
+
GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "* One\n* Two")
|
66
66
|
```
|
67
67
|
|
68
68
|
|
data/lib/github-markup.rb
CHANGED
@@ -49,7 +49,7 @@ import io
|
|
49
49
|
|
50
50
|
from docutils import nodes
|
51
51
|
from docutils.parsers.rst import directives, roles
|
52
|
-
from docutils.parsers.rst.directives.body import CodeBlock
|
52
|
+
from docutils.parsers.rst.directives.body import CodeBlock, Directive
|
53
53
|
from docutils.core import publish_parts
|
54
54
|
from docutils.writers.html4css1 import Writer, HTMLTranslator
|
55
55
|
from docutils.parsers.rst.states import Body
|
@@ -133,6 +133,18 @@ SETTINGS = {
|
|
133
133
|
'field_name_limit': 50,
|
134
134
|
}
|
135
135
|
|
136
|
+
default_highlight_language = None
|
137
|
+
|
138
|
+
class HighlightDirective(Directive):
|
139
|
+
required_arguments = 1
|
140
|
+
optional_arguments = 1
|
141
|
+
option_spec = {}
|
142
|
+
def run(self):
|
143
|
+
"""Track the default syntax highlighting language
|
144
|
+
"""
|
145
|
+
global default_highlight_language
|
146
|
+
default_highlight_language = self.arguments[0]
|
147
|
+
return []
|
136
148
|
|
137
149
|
class DoctestDirective(CodeBlock):
|
138
150
|
"""Render Sphinx 'doctest:: [group]' blocks as 'code:: python'
|
@@ -171,6 +183,8 @@ class GitHubHTMLTranslator(HTMLTranslator):
|
|
171
183
|
language = classes[1]
|
172
184
|
del classes[:]
|
173
185
|
self.body.append(self.starttag(node, 'pre', lang=language))
|
186
|
+
elif default_highlight_language is not None:
|
187
|
+
self.body.append(self.starttag(node, 'pre', lang=default_highlight_language))
|
174
188
|
else:
|
175
189
|
self.body.append(self.starttag(node, 'pre'))
|
176
190
|
|
@@ -248,6 +262,9 @@ def main():
|
|
248
262
|
# Render source code in Sphinx doctest blocks
|
249
263
|
directives.register_directive('doctest', DoctestDirective)
|
250
264
|
|
265
|
+
# Set default highlight language
|
266
|
+
directives.register_directive('highlight', HighlightDirective)
|
267
|
+
|
251
268
|
parts = publish_parts(text, writer=writer, settings_overrides=SETTINGS)
|
252
269
|
if 'html_body' in parts:
|
253
270
|
html = parts['html_body']
|
data/test/markup_test.rb
CHANGED
@@ -9,11 +9,10 @@ require 'nokogiri'
|
|
9
9
|
require 'nokogiri/diff'
|
10
10
|
|
11
11
|
def normalize_html(text)
|
12
|
-
text.strip
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
text
|
12
|
+
text.strip
|
13
|
+
.gsub(/\s\s+/,' ')
|
14
|
+
.gsub(/\p{Pi}|\p{Pf}|"/u,'"')
|
15
|
+
.gsub("\u2026",'...')
|
17
16
|
end
|
18
17
|
|
19
18
|
def assert_html_equal(expected, actual, msg = nil)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-markup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Wanstrath
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|