github-markup 1.6.0 → 1.6.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a84a52be34f80606a5f1242e796a1b46c385fb87
4
- data.tar.gz: d36d6d7c3e3148bbdc0cb5bceea4fef4a953fe74
3
+ metadata.gz: 015436ffdbdabf0b573f786f948960ccae1e547c
4
+ data.tar.gz: e508fb427eb6e7ce276ab54478ff5a1f81bded7b
5
5
  SHA512:
6
- metadata.gz: b555eb0a0b7b5483894380a3c25c22747e0e1cc582f3e7161b9f7eca0070047aaae84d91c328a9751e0bf27696a9c9abca0e4fb1d8c102cd2e9838c516cf3885
7
- data.tar.gz: cc7e932e048021775673258daac64a8406f0d48fdb3951b9ab35578c51f6eb07c14ed367303f2a0c119b21e8114ab8872e15b301d75f330a8b02ecfab2a622b3
6
+ metadata.gz: 67f22bcd3f185424ba4ad390b60c972a0167afc1e3bc22d5b0bd2978dd3e9825d5ed1711e9d31cb94dcac64003e9d11aa536a45282416ae6f0e6bde121230d79
7
+ data.tar.gz: 875c40738eef72db08c8307800e10cbb49fadcfee28cd90bd084736e761a8e3b182c4fdf501d69ec93050693e844a7a20a059a30ded40bedddc558831a1b7322
@@ -1,8 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.0.0
4
- - 2.1.1
5
- - jruby-19mode
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-19mode
31
+ - rvm: jruby-9.1.9.0
data/Gemfile CHANGED
@@ -10,5 +10,5 @@ gem "rdoc", "~>3.6"
10
10
  gem "org-ruby", "= 0.9.9"
11
11
  gem "creole", "~>0.3.6"
12
12
  gem "wikicloth", "=0.8.3"
13
- gem "asciidoctor", "= 1.5.5"
13
+ gem "asciidoctor", "= 1.5.6.1"
14
14
  gem "rake"
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) -- `python3 -m pip install sphinx`
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', '* One\n* Two')
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, '* One\n* Two')
65
+ GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "* One\n* Two")
66
66
  ```
67
67
 
68
68
 
@@ -1,6 +1,6 @@
1
1
  module GitHub
2
2
  module Markup
3
- VERSION = '1.6.0'
3
+ VERSION = '1.6.1'
4
4
  Version = VERSION
5
5
  end
6
6
  end
@@ -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']
@@ -9,11 +9,10 @@ require 'nokogiri'
9
9
  require 'nokogiri/diff'
10
10
 
11
11
  def normalize_html(text)
12
- text.strip!
13
- text.gsub!(/\s\s+/,' ')
14
- text.gsub!(/\p{Pi}|\p{Pf}|"/u,'"')
15
- text.gsub!("\u2026",'...')
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.0
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-04-03 00:00:00.000000000 Z
11
+ date: 2017-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake