github-markup 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'github-markup'
16
- s.version = '0.7.2'
17
- s.date = '2012-04-05'
16
+ s.version = '0.7.3'
17
+ s.date = '2012-07-17'
18
18
  s.executables = ['github-markup']
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -1,6 +1,6 @@
1
1
  module GitHub
2
2
  module Markup
3
- VERSION = '0.7.1'
3
+ VERSION = '0.7.3'
4
4
  Version = VERSION
5
5
  end
6
6
  end
@@ -17,7 +17,7 @@ import sys
17
17
  import codecs
18
18
 
19
19
  from docutils.core import publish_parts
20
- from docutils.writers.html4css1 import Writer
20
+ from docutils.writers.html4css1 import Writer, HTMLTranslator
21
21
 
22
22
  SETTINGS = {
23
23
  'cloak_email_addresses': True,
@@ -26,8 +26,20 @@ SETTINGS = {
26
26
  'strip_comments': True,
27
27
  'doctitle_xform': False,
28
28
  'report_level': 5,
29
+ 'syntax_highlight' : 'none',
30
+ 'math_output' : 'latex'
29
31
  }
30
32
 
33
+ class GitHubHTMLTranslator(HTMLTranslator):
34
+ def visit_literal_block(self, node):
35
+ classes = node.attributes['classes']
36
+ if len(classes) >= 2 and classes[0] == 'code':
37
+ language = classes[1]
38
+ del classes[:]
39
+ self.body.append(self.starttag(node, 'pre', lang=language))
40
+ else:
41
+ super(self, node)
42
+
31
43
  def main():
32
44
  """
33
45
  Parses the given ReST file or the redirected string input and returns the
@@ -43,7 +55,10 @@ def main():
43
55
  except IndexError: # no filename given
44
56
  text = sys.stdin.read()
45
57
 
46
- parts = publish_parts(text, writer=Writer(), settings_overrides=SETTINGS)
58
+ writer = Writer()
59
+ writer.translator_class = GitHubHTMLTranslator
60
+
61
+ parts = publish_parts(text, writer=writer, settings_overrides=SETTINGS)
47
62
  if 'html_body' in parts:
48
63
  html = parts['html_body']
49
64
  return html.encode('utf-8')
metadata CHANGED
@@ -1,33 +1,27 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: github-markup
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 7
8
- - 2
9
- version: 0.7.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.3
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Chris Wanstrath
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2012-04-05 00:00:00 -07:00
12
+ date: 2012-07-17 00:00:00.000000000 -07:00
18
13
  default_executable:
19
14
  dependencies: []
20
-
21
- description: " This gem is used by GitHub to render any fancy markup such as\n Markdown, Textile, Org-Mode, etc. Fork it and add your own!\n"
15
+ description: ! " This gem is used by GitHub to render any fancy markup such as\n
16
+ \ Markdown, Textile, Org-Mode, etc. Fork it and add your own!\n"
22
17
  email: chris@ozmm.org
23
- executables:
18
+ executables:
24
19
  - github-markup
25
20
  extensions: []
26
-
27
- extra_rdoc_files:
21
+ extra_rdoc_files:
28
22
  - README.md
29
23
  - LICENSE
30
- files:
24
+ files:
31
25
  - Gemfile
32
26
  - HISTORY.md
33
27
  - LICENSE
@@ -70,32 +64,27 @@ files:
70
64
  has_rdoc: true
71
65
  homepage: https://github.com/github/markup
72
66
  licenses: []
73
-
74
67
  post_install_message:
75
- rdoc_options:
68
+ rdoc_options:
76
69
  - --charset=UTF-8
77
- require_paths:
70
+ require_paths:
78
71
  - lib
79
- required_ruby_version: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- segments:
84
- - 0
85
- version: "0"
86
- required_rubygems_version: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- segments:
91
- - 0
92
- version: "0"
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
93
84
  requirements: []
94
-
95
85
  rubyforge_project:
96
- rubygems_version: 1.3.6
86
+ rubygems_version: 1.3.9.5
97
87
  signing_key:
98
88
  specification_version: 2
99
89
  summary: The code GitHub uses to render README.markup
100
90
  test_files: []
101
-