github-markup 1.2.1 → 1.3.0

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: e844da72208ec935e4020028fc0aa073e0059816
4
- data.tar.gz: 6e91e20d6ba14cf0edb8b5ac71b5afcf9475a100
3
+ metadata.gz: a3d520df18a45654c76a61891d06e3ba0c5b48ac
4
+ data.tar.gz: 512eba6bdd38192bd3694c7bb48d3542d47282e1
5
5
  SHA512:
6
- metadata.gz: c00e888d1a7171e1b4a9f7039b819365712a0018fe548ffdd563568c5c3ea9beb847961b55044f5c720887e61a611a8971e0a65112cd0dc6591fe342c26288a7
7
- data.tar.gz: 2553686d3e18239fd21b5aee12ccb0d73efb159ebaea9770a78e325b37e6dd7a4ad3213bc8289f36bb11cdf1125e15f2f4d4dbf132ac8fb217937204b09f3bc7
6
+ metadata.gz: e95bf5760cf1242f6866b77c0fa349ba0b6b186d69fab0aaed5d1ff3b5aba46321dc9fe60077de0470aab1cecb846e903903447dd3ed534802294d9b4fc1997b
7
+ data.tar.gz: c16b23d2650c72334a1c7b5f3302956cf8011dd263daa4034b07af9baaca2628137f31294173ba63c34ef938cf45260dbaa530ae1d13b3d8e02088adc35e28e9
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.pyc
2
+ pkg/
3
+ .bundle
4
+ Gemfile.lock
5
+ vendor/
data/.kick ADDED
@@ -0,0 +1,26 @@
1
+ # take control of the growl notifications
2
+ module GrowlHacks
3
+ def growl(type, subject, body, *args, &block)
4
+ case type
5
+ when Kicker::GROWL_NOTIFICATIONS[:succeeded]
6
+ puts subject = "Success"
7
+ body = body.split("\n").last
8
+ when Kicker::GROWL_NOTIFICATIONS[:failed]
9
+ subject = "Failure"
10
+ puts body
11
+ body = body.split("\n").last
12
+ else
13
+ return nil
14
+ end
15
+ super(type, subject, body, *args, &block)
16
+ end
17
+ end
18
+
19
+ Kicker.send :extend, GrowlHacks
20
+
21
+ # no logging
22
+ Kicker::Utils.module_eval do
23
+ def log(message)
24
+ nil
25
+ end
26
+ end
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ before_install: sudo pip install docutils
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.1
6
+ notifications:
7
+ disabled: true
8
+ bundler_args: --without development
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,81 @@
1
+ # Contributing
2
+
3
+ Want to contribute? Great!
4
+
5
+ 1. Fork it.
6
+ 2. Create a branch (`git checkout -b my_markup`)
7
+ 3. Commit your changes (`git commit -am "Added Snarkdown"`)
8
+ 4. Push to the branch (`git push origin my_markup`)
9
+ 5. Open a [Pull Request][1]
10
+ 6. Enjoy a refreshing Diet Coke and wait
11
+
12
+
13
+ There are two ways to add markups.
14
+
15
+ ### Commands
16
+
17
+ If your markup is in a language other than Ruby, drop a translator
18
+ script in `lib/github/commands` which accepts input on STDIN and
19
+ returns HTML on STDOUT. See [rest2html][r2h] for an example.
20
+
21
+ Once your script is in place, edit `lib/github/markups.rb` and tell
22
+ GitHub Markup about it. Again we look to [rest2html][r2hc] for
23
+ guidance:
24
+
25
+ command(:rest2html, /re?st(.txt)?/)
26
+
27
+ Here we're telling GitHub Markup of the existence of a `rest2html`
28
+ command which should be used for any file ending in `rest`,
29
+ `rst`, `rest.txt` or `rst.txt`. Any regular expression will do.
30
+
31
+ Finally add your [tests](#testing).
32
+
33
+ ### Classes
34
+
35
+ If your markup can be translated using a Ruby library, that's
36
+ great. Check out `lib/github/markups.rb` for some
37
+ examples. Let's look at Markdown:
38
+
39
+ markup(:markdown, /md|mkdn?|markdown/) do |content|
40
+ Markdown.new(content).to_html
41
+ end
42
+
43
+ We give the `markup` method three bits of information: the name of the
44
+ file to `require`, a regular expression for extensions to match, and a
45
+ block to run with unformatted markup which should return HTML.
46
+
47
+ If you need to monkeypatch a RubyGem or something, check out the
48
+ included RDoc example.
49
+
50
+ Finally add your [tests](#testing).
51
+
52
+ ### Testing
53
+
54
+ To run the tests:
55
+
56
+ $ rake
57
+
58
+ When adding support for a new markup library, create a `README.extension` in `test/markups` along with a `README.extension.html`. As you may imagine, the `README.extension` should be your known input and the
59
+ `README.extension.html` should be the desired output.
60
+
61
+ Now run the tests: `rake`
62
+
63
+ If nothing complains, congratulations!
64
+
65
+ ## Releasing a new version
66
+
67
+ If you are the current maintainer of this gem:
68
+
69
+ 0. Bump the version number in `lib/github-markup.rb`, adhering to [Semantic Versioning](http://semver.org/)
70
+ 0. Update `HISTORY.md`
71
+ 0. Test the latest version on GitHub
72
+ 0. Build the new version with `rake build`
73
+ 0. Copy `pkg/github-markup*.gem` to `vendor/cache` in your local checkout of GitHub
74
+ 0. Update the version for `github-markup` in the `Gemfile`
75
+ 0. Run `bundle update --local github-markup`
76
+ 0. Run any relevant tests and test it manually from the browser.
77
+ 0. Push the new gem release with `rake release`. If you don't have permission to release to rubygems.org, contact one of the existing owners (`gem owners github-markup`) and ask them to add you.
78
+
79
+ [1]: http://github.com/github/markup/pulls
80
+ [r2h]: lib/github/commands/rest2html
81
+ [r2hc]: lib/github/markups.rb#L51
data/Gemfile CHANGED
@@ -5,6 +5,6 @@ gem "RedCloth"
5
5
  gem "rdoc", "~>3.6"
6
6
  gem "org-ruby", "= 0.9.1.gh"
7
7
  gem "creole", "~>0.3.6"
8
- gem "wikicloth", "=0.6.0"
8
+ gem "wikicloth", "=0.8.1"
9
9
  gem "asciidoctor", "= 0.1.4"
10
10
  gem "rake"
data/HISTORY.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 1.3.0 (2014-09-11)
2
+
3
+ * Extend the field limit for tables to 50 characters for RST [#306](https://github.com/github/markup/pull/306)
4
+ * Add `.mkdn` as a supported markdown extension [#308](https://github.com/github/markup/pull/308)
5
+ * Upgrade wikicloth to 0.8.1 [#317](https://github.com/github/markup/pull/317)
6
+ * Force encoding of posix-spawn output [#338](https://github.com/github/markup/pull/338)
7
+ * Add `.rmd` as a supported markdown extension [#343](https://github.com/github/markup/pull/343)
8
+
9
+ [Full changelog](https://github.com/github/markup/compare/v1.2.1...v1.3.0)
10
+
1
11
  ## 1.2.1 (2014-04-23)
2
12
 
3
13
  * Disable RST warnings [#290](https://github.com/github/markup/pull/290)
data/README.md CHANGED
@@ -2,7 +2,7 @@ GitHub Markup
2
2
  =============
3
3
 
4
4
  We use this library on GitHub when rendering your README or any other
5
- rich text file.
5
+ rich text file. The generated HTML is then run through filters in the [html-pipeline](https://github.com/jch/html-pipeline) to perform things like [sanitization](#html-sanitization) and [syntax highlighting](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/syntax_highlight_filter.rb).
6
6
 
7
7
  Markups
8
8
  -------
@@ -10,101 +10,22 @@ Markups
10
10
  The following markups are supported. The dependencies listed are required if
11
11
  you wish to run the library. You can also run `script/bootstrap` to fetch them all.
12
12
 
13
- * [.markdown, .mdown, .md](http://daringfireball.net/projects/markdown/) -- `gem install redcarpet` (https://github.com/vmg/redcarpet)
13
+ * [.markdown, .mdown, .mkdn, .md](http://daringfireball.net/projects/markdown/) -- `gem install redcarpet` (https://github.com/vmg/redcarpet)
14
14
  * [.textile](http://www.textism.com/tools/textile/) -- `gem install RedCloth`
15
15
  * [.rdoc](http://rdoc.sourceforge.net/) -- `gem install rdoc -v 3.6.1`
16
16
  * [.org](http://orgmode.org/) -- `gem install org-ruby`
17
17
  * [.creole](http://wikicreole.org/) -- `gem install creole`
18
- * [.mediawiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth`
18
+ * [.mediawiki, .wiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth`
19
19
  * [.rst](http://docutils.sourceforge.net/rst.html) -- `easy_install docutils`
20
20
  * [.asciidoc, .adoc, .asc](http://asciidoc.org/) -- `gem install asciidoctor` (http://asciidoctor.org)
21
21
  * [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::HTML`
22
22
  comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN.
23
23
 
24
- HTML sanitization
25
- -----------------
26
-
27
- HTML rendered by the various markup language processors gets passed through an [HTML sanitization filter](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/sanitization_filter.rb) for security reasons. HTML elements not in the whitelist are removed. HTML attributes not in the whitelist are removed from the preserved elements.
28
-
29
- The following HTML elements, organized by category, are whitelisted:
30
-
31
- * Headings: h1, h2, h3, h4, h5, h6, h7, h8
32
- * Prose: p, div, blockquote
33
- * Preformatted: pre
34
- * Inline: b, i, strong, em, tt, code, ins, del, sup, sub, kbd, samp, q, var
35
- * Lists: ol, ul, li, dl, dt, dd
36
- * Tables: table, thead, tbody, tfoot, tr, td, th
37
- * Breaks: br, hr
38
- * Ruby (East Asian): ruby, rt, rp
39
-
40
- The following attributes, organized by element, are whitelisted:
41
-
42
- * a: href (http://, https://, mailto://, github-windows:// and github-mac:// URI schemes and relative paths only)
43
- * img: src (http:// and https::// URI schemes and relative paths only)
44
- * div: itemscope, itemtype
45
- * all: abbr, accept, accept-charset, accesskey, action, align, alt, axis, border, cellpadding, cellspacing, char, charoff, charset, checked, cite, clear, cols, colspan, color, compact, coords, datetime, dir, disabled, enctype, for, frame, headers, height, hreflang, hspace, ismap, label, lang, longdesc, maxlength, media, method, multiple, name, nohref, noshade, nowrap, prompt, readonly, rel, rev, rows, rowspan, rules, scope, selected, shape, size, span, start, summary, tabindex, target, title, type, usemap, valign, value, vspace, width, itemprop
46
-
47
- Note that the id attribute is *not* whitelisted.
48
-
49
- Contributing
50
- ------------
51
-
52
- Want to contribute? Great! There are two ways to add markups.
53
-
54
-
55
- ### Commands
56
-
57
- If your markup is in a language other than Ruby, drop a translator
58
- script in `lib/github/commands` which accepts input on STDIN and
59
- returns HTML on STDOUT. See [rest2html][r2h] for an example.
60
-
61
- Once your script is in place, edit `lib/github/markups.rb` and tell
62
- GitHub Markup about it. Again we look to [rest2html][r2hc] for
63
- guidance:
64
-
65
- command(:rest2html, /re?st(.txt)?/)
66
-
67
- Here we're telling GitHub Markup of the existence of a `rest2html`
68
- command which should be used for any file ending in `rest`,
69
- `rst`, `rest.txt` or `rst.txt`. Any regular expression will do.
70
-
71
- Finally add your tests. Create a `README.extension` in `test/markups`
72
- along with a `README.extension.html`. As you may imagine, the
73
- `README.extension` should be your known input and the
74
- `README.extension.html` should be the desired output.
75
-
76
- Now run the tests: `rake`
77
-
78
- If nothing complains, congratulations!
79
-
80
-
81
- ### Classes
82
-
83
- If your markup can be translated using a Ruby library, that's
84
- great. Check out `lib/github/markups.rb` for some
85
- examples. Let's look at Markdown:
86
-
87
- markup(:markdown, /md|mkdn?|markdown/) do |content|
88
- Markdown.new(content).to_html
89
- end
90
-
91
- We give the `markup` method three bits of information: the name of the
92
- file to `require`, a regular expression for extensions to match, and a
93
- block to run with unformatted markup which should return HTML.
94
-
95
- If you need to monkeypatch a RubyGem or something, check out the
96
- included RDoc example.
97
-
98
- Tests should be added in the same manner as described under the
99
- `Commands` section.
100
-
101
-
102
24
  Installation
103
25
  -----------
104
26
 
105
27
  gem install github-markup
106
28
 
107
-
108
29
  Usage
109
30
  -----
110
31
 
@@ -116,29 +37,36 @@ Or, more realistically:
116
37
  require 'github/markup'
117
38
  GitHub::Markup.render(file, File.read(file))
118
39
 
40
+ Contributing
41
+ ------------
119
42
 
120
- Testing
121
- -------
122
-
123
- To run the tests:
43
+ See [Contributing](CONTRIBUTING.md)
124
44
 
125
- $ rake
45
+ HTML sanitization
46
+ -----------------
126
47
 
127
- To add tests see the `Commands` section earlier in this
128
- README.
48
+ HTML rendered by the various markup language processors gets passed through an [HTML sanitization filter](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/sanitization_filter.rb) for security reasons. HTML elements not in the whitelist are removed. HTML attributes not in the whitelist are removed from the preserved elements.
129
49
 
50
+ The following HTML elements, organized by category, are whitelisted:
130
51
 
131
- Contributing
132
- ------------
52
+ |Type | Elements
53
+ |------|----------
54
+ |Headings | `h1`, `h2`, `h3`, `h4`, `h5`, `h6`, `h7`, `h8`
55
+ |Prose | `p`, `div`, `blockquote`
56
+ |Formatted | `pre`
57
+ | Inline | `b`, `i`, `strong`, `em`, `tt`, `code`, `ins`, `del`, `sup`, `sub`, `kbd`, `samp`, `q`, `var`
58
+ | Lists | `ol`, `ul`, `li`, `dl`, `dt`, `dd`
59
+ | Tables | `table`, `thead`, `tbody`, `tfoot`, `tr`, `td`, `th`
60
+ | Breaks | `br`, `hr`
61
+ | Ruby (East Asian) | `ruby`, `rt`, `rp`
133
62
 
134
- 1. Fork it.
135
- 2. Create a branch (`git checkout -b my_markup`)
136
- 3. Commit your changes (`git commit -am "Added Snarkdown"`)
137
- 4. Push to the branch (`git push origin my_markup`)
138
- 5. Open a [Pull Request][1]
139
- 6. Enjoy a refreshing Diet Coke and wait
63
+ The following attributes, organized by element, are whitelisted:
140
64
 
65
+ |Element | Attributes
66
+ |------|----------
67
+ | `a` | `href` (`http://`, `https://`, `mailto://`, `github-windows://`, and `github-mac://` URI schemes and relative paths only)
68
+ | `img` | `src` (`http://` and `https://` URI schemes and relative paths only)
69
+ | `div` | `itemscope`, `itemtype`
70
+ | All | `abbr`, `accept`, `accept-charset`, `accesskey`, `action`, `align`, `alt`, `axis`, `border`, `cellpadding`, `cellspacing`, `char`, `charoff`, `charset`, `checked`, `cite`, `clear`, `cols`, `colspan`, `color`, `compact`, `coords`, `datetime`, `dir`, `disabled`, `enctype`, `for`, `frame`, `headers`, `height`, `hreflang`, `hspace`, `ismap`, `label`, `lang`, `longdesc`, `maxlength`, `media`, `method`, `multiple`, `name`, `nohref`, `noshade`, `nowrap`, `prompt`, `readonly`, `rel`, `rev`, `rows`, `rowspan`, `rules`, `scope`, `selected`, `shape`, `size`, `span`, `start`, `summary`, `tabindex`, `target`, `title`, `type`, `usemap`, `valign`, `value`, `vspace`, `width`, `itemprop`
141
71
 
142
- [r2h]: lib/github/commands/rest2html
143
- [r2hc]: lib/github/markups.rb#L51
144
- [1]: http://github.com/github/markup/pulls
72
+ Note that the `id` attribute is *not* whitelisted.
data/Rakefile CHANGED
@@ -1,49 +1,6 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'date'
1
+ #!/usr/bin/env rake
4
2
 
5
- #############################################################################
6
- #
7
- # Helper functions
8
- #
9
- #############################################################################
10
-
11
- def name
12
- @name ||= Dir['*.gemspec'].first.split('.').first
13
- end
14
-
15
- def version
16
- line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
17
- line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
18
- end
19
-
20
- def date
21
- Date.today.to_s
22
- end
23
-
24
- def rubyforge_project
25
- name
26
- end
27
-
28
- def gemspec_file
29
- "#{name}.gemspec"
30
- end
31
-
32
- def gem_file
33
- "#{name}-#{version}.gem"
34
- end
35
-
36
- def replace_header(head, header_name)
37
- head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
38
- end
39
-
40
- #############################################################################
41
- #
42
- # Standard tasks
43
- #
44
- #############################################################################
45
-
46
- task :default => :test
3
+ require "bundler/gem_tasks"
47
4
 
48
5
  require 'rake/testtask'
49
6
  Rake::TestTask.new(:test) do |test|
@@ -54,80 +11,7 @@ end
54
11
 
55
12
  desc "Open an irb session preloaded with this library"
56
13
  task :console do
57
- sh "irb -rubygems -r ./lib/#{name}.rb"
58
- end
59
-
60
- #############################################################################
61
- #
62
- # Custom tasks (add your own tasks here)
63
- #
64
- #############################################################################
65
-
66
- desc "Kick it"
67
- task :kick do
68
- exec "kicker -e rake test lib"
69
- end
70
-
71
- #############################################################################
72
- #
73
- # Packaging tasks
74
- #
75
- #############################################################################
76
-
77
- desc "Create tag v#{version} and build and push #{gem_file} to Rubygems"
78
- task :release => :build do
79
- unless `git branch` =~ /^\* master$/
80
- puts "You must be on the master branch to release!"
81
- exit!
82
- end
83
- sh "git commit --allow-empty -a -m 'Release #{version}'"
84
- sh "git tag v#{version}"
85
- sh "git push origin master"
86
- sh "git push origin v#{version}"
87
- sh "gem push pkg/#{name}-#{version}.gem"
88
- end
89
-
90
- desc "Build #{gem_file} into the pkg directory"
91
- task :build => :gemspec do
92
- sh "mkdir -p pkg"
93
- sh "gem build #{gemspec_file}"
94
- sh "mv #{gem_file} pkg"
95
- end
96
-
97
- desc "Generate #{gemspec_file}"
98
- task :gemspec => :validate do
99
- # read spec file and split out manifest section
100
- spec = File.read(gemspec_file)
101
- head, manifest, tail = spec.split(" # = MANIFEST =\n")
102
-
103
- # replace name version and date
104
- replace_header(head, :name)
105
- replace_header(head, :version)
106
- replace_header(head, :date)
107
- #comment this out if your rubyforge_project has a different name
108
- replace_header(head, :rubyforge_project)
109
-
110
- # determine file list from git ls-files
111
- files = `git ls-files`.
112
- split("\n").
113
- sort.
114
- reject { |file| file =~ /^\./ }.
115
- reject { |file| file =~ /^(rdoc|pkg)/ }.
116
- map { |file| " #{file}" }.
117
- join("\n")
118
-
119
- # piece file back together and write
120
- manifest = " s.files = %w[\n#{files}\n ]\n"
121
- spec = [head, manifest, tail].join(" # = MANIFEST =\n")
122
- File.open(gemspec_file, 'w') { |io| io.write(spec) }
123
- puts "Updated #{gemspec_file}"
124
- end
125
-
126
- desc "Validate #{gemspec_file}"
127
- task :validate do
128
- unless Dir['VERSION*'].empty?
129
- puts "A `VERSION` file at root level violates Gem best practices."
130
- exit!
131
- end
14
+ sh "irb -I lib -r bundler/setup -r github/markup"
132
15
  end
133
16
 
17
+ task :default => :test
@@ -1,113 +1,20 @@
1
1
  require File.expand_path("../lib/github-markup", __FILE__)
2
2
 
3
- ## This is the rakegem gemspec template. Make sure you read and understand
4
- ## all of the comments. Some sections require modification, and others can
5
- ## be deleted if you don't need them. Once you understand the contents of
6
- ## this file, feel free to delete any comments that begin with two hash marks.
7
- ## You can find comprehensive Gem::Specification documentation, at
8
- ## http://docs.rubygems.org/read/chapter/20
9
3
  Gem::Specification.new do |s|
10
- s.specification_version = 2 if s.respond_to? :specification_version=
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.rubygems_version = '1.3.5'
13
-
14
- ## Leave these as is they will be modified for you by the rake gemspec task.
15
- ## If your rubyforge_project name is different, then edit it and comment out
16
- ## the sub! line in the Rakefile
17
- s.name = 'github-markup'
18
- s.version = GitHub::Markup::VERSION
19
- s.date = '2014-04-23'
20
- s.executables = ['github-markup']
21
-
22
- ## Make sure your summary is short. The description may be as long
23
- ## as you like.
24
- s.summary = "The code GitHub uses to render README.markup"
25
- s.description = <<desc
26
- This gem is used by GitHub to render any fancy markup such as
27
- Markdown, Textile, Org-Mode, etc. Fork it and add your own!
28
- desc
29
-
30
- ## List the primary authors. If there are a bunch of authors, it's probably
31
- ## better to set the email to an email list or something. If you don't have
32
- ## a custom homepage, consider using your GitHub URL or the like.
33
- s.authors = ["Chris Wanstrath"]
34
- s.email = 'chris@ozmm.org'
35
- s.homepage = 'https://github.com/github/markup'
36
-
37
- ## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
38
- ## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
4
+ s.name = "github-markup"
5
+ s.version = GitHub::Markup::VERSION
6
+ s.summary = "The code GitHub uses to render README.markup"
7
+ s.description = "This gem is used by GitHub to render any fancy markup such " +
8
+ "as Markdown, Textile, Org-Mode, etc. Fork it and add your own!"
9
+ s.authors = ["Chris Wanstrath"]
10
+ s.email = "chris@ozmm.org"
11
+ s.homepage = "https://github.com/github/markup"
12
+ s.license = "MIT"
13
+
14
+ s.files = `git ls-files`.split($\)
15
+ s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
39
17
  s.require_paths = %w[lib]
40
18
 
41
- ## Specify any RDoc options here. You'll want to add your README and
42
- ## LICENSE files to the extra_rdoc_files list.
43
- s.rdoc_options = ["--charset=UTF-8"]
44
- s.extra_rdoc_files = %w[README.md LICENSE]
45
-
46
- ## List your runtime dependencies here. Runtime dependencies are those
47
- ## that are needed for an end user to actually USE your code.
48
- #s.add_dependency('simple_uuid', "~> 0.1.2")
49
-
50
- ## List your development dependencies here. Development dependencies are
51
- ## those that are only needed during development
52
- #s.add_development_dependency("test-unit", "~> 2.3.0")
53
-
54
- ## Leave this section as-is. It will be automatically generated from the
55
- ## contents of your Git repository via the gemspec task. DO NOT REMOVE
56
- ## THE MANIFEST COMMENTS, they are used as delimiters by the task.
57
- # = MANIFEST =
58
- s.files = %w[
59
- Gemfile
60
- HISTORY.md
61
- LICENSE
62
- README.md
63
- Rakefile
64
- bin/github-markup
65
- github-markup.gemspec
66
- lib/github-markup.rb
67
- lib/github/commands/foo.rst
68
- lib/github/commands/rest2html
69
- lib/github/markup.rb
70
- lib/github/markup/command_implementation.rb
71
- lib/github/markup/gem_implementation.rb
72
- lib/github/markup/implementation.rb
73
- lib/github/markup/markdown.rb
74
- lib/github/markup/rdoc.rb
75
- lib/github/markups.rb
76
- script/bootstrap
77
- script/cibuild
78
- test/markup_test.rb
79
- test/markups/README.asciidoc
80
- test/markups/README.asciidoc.html
81
- test/markups/README.creole
82
- test/markups/README.creole.html
83
- test/markups/README.litcoffee
84
- test/markups/README.litcoffee.html
85
- test/markups/README.markdown
86
- test/markups/README.markdown.html
87
- test/markups/README.mediawiki
88
- test/markups/README.mediawiki.html
89
- test/markups/README.noformat
90
- test/markups/README.noformat.html
91
- test/markups/README.org
92
- test/markups/README.org.html
93
- test/markups/README.pod
94
- test/markups/README.pod.html
95
- test/markups/README.rdoc
96
- test/markups/README.rdoc.html
97
- test/markups/README.rst
98
- test/markups/README.rst.html
99
- test/markups/README.rst.txt
100
- test/markups/README.rst.txt.html
101
- test/markups/README.textile
102
- test/markups/README.textile.html
103
- test/markups/README.txt
104
- test/markups/README.txt.html
105
- ]
106
- # = MANIFEST =
107
-
108
- ## Test files will be grabbed from the file list. Make sure the path glob
109
- ## matches what you actually use.
110
- s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
111
-
112
- s.add_dependency 'posix-spawn', '~> 0.3.8'
19
+ s.add_dependency "posix-spawn", "~> 0.3.8"
113
20
  end
data/lib/github-markup.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module GitHub
2
2
  module Markup
3
- VERSION = '1.2.1'
3
+ VERSION = '1.3.0'
4
4
  Version = VERSION
5
5
  end
6
6
  end
@@ -57,7 +57,8 @@ SETTINGS = {
57
57
  'initial_header_level': 2,
58
58
  'report_level': 5,
59
59
  'syntax_highlight' : 'none',
60
- 'math_output' : 'latex'
60
+ 'math_output' : 'latex',
61
+ 'field_name_limit': 50,
61
62
  }
62
63
 
63
64
  class GitHubHTMLTranslator(HTMLTranslator):
@@ -35,7 +35,7 @@ module GitHub
35
35
  def execute(command, target)
36
36
  spawn = POSIX::Spawn::Child.new(*command, :input => target)
37
37
  if spawn.status.success?
38
- spawn.out.gsub("\r", '')
38
+ spawn.out.gsub("\r", '').force_encoding(target.encoding)
39
39
  else
40
40
  raise CommandError.new(spawn.err.strip)
41
41
  end
@@ -25,7 +25,7 @@ module GitHub
25
25
  }
26
26
 
27
27
  def initialize
28
- super(/md|mkdn?|mdwn|mdown|markdown|litcoffee/)
28
+ super(/md|rmd|mkdn?|mdwn|mdown|markdown|litcoffee/i)
29
29
  end
30
30
 
31
31
  def load
@@ -1,4 +1,5 @@
1
1
  require "github/markup/markdown"
2
+ require "shellwords"
2
3
 
3
4
  markups << GitHub::Markup::Markdown.new
4
5
 
@@ -29,7 +30,7 @@ markup(:asciidoctor, /adoc|asc(iidoc)?/) do |content|
29
30
  Asciidoctor.render(content, :safe => :secure, :attributes => %w(showtitle idprefix idseparator=- env=github env-github source-highlighter=html-pipeline))
30
31
  end
31
32
 
32
- command("python2 -S #{File.dirname(__FILE__)}/commands/rest2html", /re?st(\.txt)?/)
33
+ command("python2 -S #{Shellwords.escape(File.dirname(__FILE__))}/commands/rest2html", /re?st(\.txt)?/)
33
34
 
34
35
  # pod2html is nice enough to generate a full-on HTML document for us,
35
36
  # so we return the favor by ripping out the good parts.
data/test/markup_test.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # encoding: UTF-8
2
+
1
3
  $LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib"
2
4
 
3
5
  require 'github/markup'
@@ -35,6 +37,8 @@ message
35
37
  def test_knows_what_it_can_and_cannot_render
36
38
  assert_equal false, GitHub::Markup.can_render?('README.html')
37
39
  assert_equal true, GitHub::Markup.can_render?('README.markdown')
40
+ assert_equal true, GitHub::Markup.can_render?('README.rmd')
41
+ assert_equal true, GitHub::Markup.can_render?('README.Rmd')
38
42
  assert_equal false, GitHub::Markup.can_render?('README.cmd')
39
43
  assert_equal true, GitHub::Markup.can_render?('README.litcoffee')
40
44
  end
@@ -50,4 +54,9 @@ message
50
54
  fail "an exception was expected but was not raised"
51
55
  end
52
56
  end
57
+
58
+ def test_preserve_markup
59
+ content = "Noël"
60
+ assert_equal content.encoding.name, GitHub::Markup.render('Foo.rst', content).encoding.name
61
+ end
53
62
  end
@@ -21,4 +21,7 @@ For projects requiring multiple scripting languages, JSR223 is a good fit. Thoug
21
21
  The full [http://jruby-embed.kenai.com/docs/ API documentation] has all the gory details. It's worth talking about a couple of the finer points here.
22
22
 
23
23
  = Previous Embedding JRuby Page=
24
- We recommend using Embed Core; however, if you're maintaining code that uses the old API, you can find its documentation on the [[JavaIntegration|legacy embedding]] page.
24
+ We recommend using Embed Core; however, if you're maintaining code that uses the old API, you can find its documentation on the [[JavaIntegration|legacy embedding]]<ref>This link goes nowhere.</ref> page.
25
+
26
+ = References =
27
+ <references/>
@@ -1,35 +1,41 @@
1
- <p>
2
- <a href="javascript:void(0)">&raquo; JRuby Project Wiki Home Page</a>
3
1
 
2
+ <p><a href="Home">&raquo; JRuby Project Wiki Home Page</a>
4
3
  <h1>Embedding JRuby</h1>
5
-
6
4
  Using Java from Ruby is JRuby's best-known feature---but you can also go in the other direction, and use Ruby from Java. There are several different ways to do this. You can execute entire Ruby scripts, call individual Ruby methods, or even implement a Java interface in Ruby (thus allowing you to treat Ruby objects like Java ones). We refer to all these techniques generically as "embedding." This section will explain how to embed JRuby in your Java project.
5
+ </p>
6
+ <p><table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Table of Contents</h2></div><ul></li><li><a href="#Red_Bridge_JRuby_Embed">Red Bridge (JRuby Embed)</a><ul><li><a href="#Features_of_Red_Bridge">Features of Red Bridge</a></li></ul><li><a href="#Previous_Embedding_JRuby_Page">Previous Embedding JRuby Page</a></li><li><a href="#References">References</a></li></ul></td></tr></table>
7
+ </p>
8
+
9
+ <h1><a name="Red_Bridge_JRuby_Embed"></a><span class="mw-headline" id="Red_Bridge_JRuby_Embed">Red Bridge (JRuby Embed)</span></h1>
7
10
 
8
- </p><p>
9
- <table id="toc" class="toc" summary="Contents"><tr><td><div style="font-weight:bold">Table of Contents</div><ul></ul></td></tr></table>
10
11
 
11
- </p><p>
12
- <h1> <span id="Red_Bridge_JRuby_Embed" class="mw-headline">Red Bridge (JRuby Embed)</span></h1>
13
12
 
14
- JRuby has long had a private embedding API, which was closely tied to the runtime's internals and therefore changed frequently as JRuby evolved. Since version 1.4, however, we have also provided a more stable public API, known as Red Bridge or JRuby Embed. Existing Java programs written to the <a href="javascript:void(0)">legacy API</a> should still work, but we strongly recommend Red Bridge for all new projects.
13
+ <p>JRuby has long had a private embedding API, which was closely tied to the runtime's internals and therefore changed frequently as JRuby evolved. Since version 1.4, however, we have also provided a more stable public API, known as Red Bridge or JRuby Embed. Existing Java programs written to the <a href="DirectJRubyEmbedding">legacy API</a> should still work, but we strongly recommend Red Bridge for all new projects.
14
+ </p>
15
+
16
+ <h2><a name="Features_of_Red_Bridge"></a><span class="mw-headline" id="Features_of_Red_Bridge">Features of Red Bridge</span></h2>
17
+
15
18
 
16
- </p><p>
17
- <h2> <span id="Features_of_Red_Bridge" class="mw-headline">Features of Red Bridge</span></h2>Red Bridge consists of two layers: Embed Core on the bottom, and implementations of <a href="http://www.jcp.org/en/jsr/detail?id=223">JSR223</a> and <a href="http://jakarta.apache.org/bsf/">BSF</a> on top. Embed Core is JRuby-specific, and can take advantage of much of JRuby's power. JSR223 and BSF are more general interfaces that provide a common ground across scripting languages.
19
+ <p>Red Bridge consists of two layers: Embed Core on the bottom, and implementations of <a href="http://www.jcp.org/en/jsr/detail?id=223" target="_blank">JSR223</a> and <a href="http://jakarta.apache.org/bsf/" target="_blank">BSF</a> on top. Embed Core is JRuby-specific, and can take advantage of much of JRuby's power. JSR223 and BSF are more general interfaces that provide a common ground across scripting languages.
20
+ </p>
21
+ <p>Which API should you use? For projects where Ruby is the only scripting language involved, we recommend Embed Core for the following reasons:
22
+ </p>
18
23
 
19
- </p><p>
20
- Which API should you use? For projects where Ruby is the only scripting language involved, we recommend Embed Core for the following reasons:
21
24
 
22
- </p><p>
23
- <ol><li> With Embed Core, you can create several Ruby environments in one JVM, and configure them individually (via <code>org.jruby.RubyInstanceConfig</code>. With the other APIs, configuration options can only be set globally, via the <code>System</code> properties.
24
25
 
25
- </li><li> Embed Core offers several shortcuts, such as loading scripts from a <code>java.io.InputStream</code>, or returning Java-friendly objects from Ruby code. These allow you to skip a lot of boilerplate.
26
+ <p><ol><li>With Embed Core, you can create several Ruby environments in one JVM, and configure them individually (via <code>org.jruby.RubyInstanceConfig</code>. With the other APIs, configuration options can only be set globally, via the <code>System</code> properties.</li><li>Embed Core offers several shortcuts, such as loading scripts from a <code>java.io.InputStream</code>, or returning Java-friendly objects from Ruby code. These allow you to skip a lot of boilerplate.</li></ol>
27
+ For projects requiring multiple scripting languages, JSR223 is a good fit. Though the API is language-independent, JRuby's implementation of it allows you to set some Ruby-specific options. In particular, you can control the threading model of the scripting engine, the lifetime of local variables, compilation mode, and how line numbers are displayed.
28
+ </p>
29
+ <p>The full <a href="http://jruby-embed.kenai.com/docs/" target="_blank">API documentation</a> has all the gory details. It's worth talking about a couple of the finer points here.
30
+ </p>
26
31
 
27
- </p><p>
28
- </li></ol> For projects requiring multiple scripting languages, JSR223 is a good fit. Though the API is language-independent, JRuby's implementation of it allows you to set some Ruby-specific options. In particular, you can control the threading model of the scripting engine, the lifetime of local variables, compilation mode, and how line numbers are displayed.
32
+ <h1><a name="Previous_Embedding_JRuby_Page"></a><span class="mw-headline" id="Previous_Embedding_JRuby_Page">Previous Embedding JRuby Page</span></h1>
29
33
 
30
- </p><p>
31
- The full <a href="http://jruby-embed.kenai.com/docs/">API documentation</a> has all the gory details. It's worth talking about a couple of the finer points here.
32
34
 
33
- </p><p>
34
- <h1> <span id="Previous_Embedding_JRuby_Page" class="mw-headline">Previous Embedding JRuby Page</span></h1>We recommend using Embed Core; however, if you're maintaining code that uses the old API, you can find its documentation on the <a href="javascript:void(0)">legacy embedding</a> page.
35
+ <p>We recommend using Embed Core; however, if you're maintaining code that uses the old API, you can find its documentation on the <a href="JavaIntegration">legacy embedding</a><sup class="reference" id="cite_ref-1-0">[<a href="#cite_note-1">1</a>]</sup> page.
35
36
  </p>
37
+
38
+ <h1><a name="References"></a><span class="mw-headline" id="References">References</span></h1>
39
+
40
+
41
+ <p><ol><li id="cite_note-1"><b><a href="#cite_ref-1-0">^</a> </b> This link goes nowhere.</li></ol></p>
@@ -0,0 +1,3 @@
1
+ # Title
2
+ * One
3
+ * Two
@@ -0,0 +1,6 @@
1
+ <h1>Title</h1>
2
+
3
+ <ul>
4
+ <li>One</li>
5
+ <li>Two</li>
6
+ </ul>
@@ -46,3 +46,12 @@ Source https://github.com/tony/pullv
46
46
 
47
47
  .. image:: https://scan.coverity.com/projects/621/badge.svg
48
48
  :alt: Coverity Scan Build Status
49
+
50
+ Field list
51
+ ----------
52
+
53
+ :123456789 123456789 123456789 123456789 123456789 1: Uh-oh! This name is too long!
54
+ :123456789 123456789 123456789 123456789 1234567890: this is a long name,
55
+ but no problem!
56
+ :123456789 12345: this is not so long, but long enough for the default!
57
+ :123456789 1234: this should work even with the default :)
@@ -5,6 +5,7 @@
5
5
  <p class="topic-title first">Table of Contents</p>
6
6
  <ul class="simple">
7
7
  <li><a class="reference internal" href="#header-2" id="id1">Header 2</a></li>
8
+ <li><a class="reference internal" href="#field-list" id="id2">Field list</a></li>
8
9
  </ul>
9
10
  </div>
10
11
  <h2><a class="toc-backref" href="#id1">Header 2</a></h2>
@@ -40,3 +41,21 @@
40
41
  <a class="reference external image-reference" href="https://scan.coverity.com/projects/621"><img alt="Coverity Scan Build Status" src="https://scan.coverity.com/projects/621/badge.svg">
41
42
  </a>
42
43
  <img alt="Coverity Scan Build Status" src="https://scan.coverity.com/projects/621/badge.svg">
44
+ <h2><a class="toc-backref" href="#id2">Field list</a></h2>
45
+ <table class="docutils field-list" frame="void" rules="none">
46
+ <col class="field-name" />
47
+ <col class="field-body" />
48
+ <tbody valign="top">
49
+ <tr class="field"><th class="field-name" colspan="2">123456789 123456789 123456789 123456789 123456789 1:</th></tr>
50
+ <tr class="field"><td>&nbsp;</td><td class="field-body">Uh-oh! This name is too long!</td>
51
+ </tr>
52
+ <tr class="field"><th class="field-name">123456789 123456789 123456789 123456789 1234567890:</th><td class="field-body">this is a long name,
53
+ but no problem!</td>
54
+ </tr>
55
+ <tr class="field"><th class="field-name">123456789 12345:</th><td class="field-body">this is not so long, but long enough for the default!</td>
56
+ </tr>
57
+ <tr class="field"><th class="field-name">123456789 1234:</th><td class="field-body">this should work even with the default :)</td>
58
+ </tr>
59
+ </tbody>
60
+ </table>
61
+
metadata CHANGED
@@ -1,40 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-markup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wanstrath
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-23 00:00:00.000000000 Z
11
+ date: 2014-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: posix-spawn
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.3.8
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.3.8
27
- description: |2
28
- This gem is used by GitHub to render any fancy markup such as
29
- Markdown, Textile, Org-Mode, etc. Fork it and add your own!
27
+ description: This gem is used by GitHub to render any fancy markup such as Markdown,
28
+ Textile, Org-Mode, etc. Fork it and add your own!
30
29
  email: chris@ozmm.org
31
30
  executables:
32
31
  - github-markup
33
32
  extensions: []
34
- extra_rdoc_files:
35
- - README.md
36
- - LICENSE
33
+ extra_rdoc_files: []
37
34
  files:
35
+ - ".gitignore"
36
+ - ".kick"
37
+ - ".travis.yml"
38
+ - CONTRIBUTING.md
38
39
  - Gemfile
39
40
  - HISTORY.md
40
41
  - LICENSE
@@ -73,6 +74,8 @@ files:
73
74
  - test/markups/README.pod.html
74
75
  - test/markups/README.rdoc
75
76
  - test/markups/README.rdoc.html
77
+ - test/markups/README.rmd
78
+ - test/markups/README.rmd.html
76
79
  - test/markups/README.rst
77
80
  - test/markups/README.rst.html
78
81
  - test/markups/README.rst.txt
@@ -82,28 +85,56 @@ files:
82
85
  - test/markups/README.txt
83
86
  - test/markups/README.txt.html
84
87
  homepage: https://github.com/github/markup
85
- licenses: []
88
+ licenses:
89
+ - MIT
86
90
  metadata: {}
87
91
  post_install_message:
88
- rdoc_options:
89
- - --charset=UTF-8
92
+ rdoc_options: []
90
93
  require_paths:
91
94
  - lib
92
95
  required_ruby_version: !ruby/object:Gem::Requirement
93
96
  requirements:
94
- - - '>='
97
+ - - ">="
95
98
  - !ruby/object:Gem::Version
96
99
  version: '0'
97
100
  required_rubygems_version: !ruby/object:Gem::Requirement
98
101
  requirements:
99
- - - '>='
102
+ - - ">="
100
103
  - !ruby/object:Gem::Version
101
104
  version: '0'
102
105
  requirements: []
103
106
  rubyforge_project:
104
- rubygems_version: 2.0.3
107
+ rubygems_version: 2.2.2
105
108
  signing_key:
106
- specification_version: 2
109
+ specification_version: 4
107
110
  summary: The code GitHub uses to render README.markup
108
- test_files: []
109
- has_rdoc:
111
+ test_files:
112
+ - test/markup_test.rb
113
+ - test/markups/README.asciidoc
114
+ - test/markups/README.asciidoc.html
115
+ - test/markups/README.creole
116
+ - test/markups/README.creole.html
117
+ - test/markups/README.litcoffee
118
+ - test/markups/README.litcoffee.html
119
+ - test/markups/README.markdown
120
+ - test/markups/README.markdown.html
121
+ - test/markups/README.mediawiki
122
+ - test/markups/README.mediawiki.html
123
+ - test/markups/README.noformat
124
+ - test/markups/README.noformat.html
125
+ - test/markups/README.org
126
+ - test/markups/README.org.html
127
+ - test/markups/README.pod
128
+ - test/markups/README.pod.html
129
+ - test/markups/README.rdoc
130
+ - test/markups/README.rdoc.html
131
+ - test/markups/README.rmd
132
+ - test/markups/README.rmd.html
133
+ - test/markups/README.rst
134
+ - test/markups/README.rst.html
135
+ - test/markups/README.rst.txt
136
+ - test/markups/README.rst.txt.html
137
+ - test/markups/README.textile
138
+ - test/markups/README.textile.html
139
+ - test/markups/README.txt
140
+ - test/markups/README.txt.html