From 320e6e081efcf27c087888de6d9e6eec6cf0e801 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Mon, 17 Dec 2012 23:32:30 +0100 Subject: [PATCH 001/416] Say hi to the doctor --- Gemfile | 1 + github-markup.gemspec | 8 +- lib/github-markup.rb | 2 +- lib/github/commands/asciidoc2html | 119 -------------- lib/github/commands/asciidocapi.py | 240 ----------------------------- lib/github/markups.rb | 6 +- 6 files changed, 10 insertions(+), 366 deletions(-) delete mode 100755 lib/github/commands/asciidoc2html delete mode 100644 lib/github/commands/asciidocapi.py diff --git a/Gemfile b/Gemfile index 98ec4dd0..5c043a2b 100644 --- a/Gemfile +++ b/Gemfile @@ -6,4 +6,5 @@ gem "org-ruby", ">= 0.7.0" gem "creole", "~>0.3.6" gem "wikicloth", "=0.6.0" gem "literati", "= 0.0.3" +gem "asciidoctor", ">= 0.0.5" gem "rake" diff --git a/github-markup.gemspec b/github-markup.gemspec index c2e5ee33..86e9bb53 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -13,8 +13,8 @@ Gem::Specification.new do |s| ## If your rubyforge_project name is different, then edit it and comment out ## the sub! line in the Rakefile s.name = 'github-markup' - s.version = '0.7.4' - s.date = '2012-07-19' + s.version = '0.7.5' + s.date = '2012-12-17' s.executables = ['github-markup'] ## Make sure your summary is short. The description may be as long @@ -62,8 +62,6 @@ desc bin/github-markup github-markup.gemspec lib/github-markup.rb - lib/github/commands/asciidoc2html - lib/github/commands/asciidocapi.py lib/github/commands/rest2html lib/github/markup.rb lib/github/markup/rdoc.rb @@ -73,6 +71,8 @@ desc test/markups/README.asciidoc.html test/markups/README.creole test/markups/README.creole.html + test/markups/README.lhs + test/markups/README.lhs.html test/markups/README.markdown test/markups/README.markdown.html test/markups/README.mediawiki diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 01a52898..7fe0cfe2 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '0.7.4' + VERSION = '0.7.5' Version = VERSION end end diff --git a/lib/github/commands/asciidoc2html b/lib/github/commands/asciidoc2html deleted file mode 100755 index 7a29d472..00000000 --- a/lib/github/commands/asciidoc2html +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env python - -"""A small wrapper file for parsing AsciiDoc files at Github.""" - -__author__ = "Devin Weaver" -__copyright__ = "Copyright (C) 2009 Devin Weaver" -__license__ = "Public Domain" -__version__ = "0.1" - -""" -github_asciidoc.py ------------------- - -This is a wrapper file for parsing AsciiDoc files at github. It wraps the -current AsciiDoc API. - -AsciiDoc specifications suggest using the file extension of `.txt` however this -causes conflict because there is no way to determine if a text file is an -AsciiDoc or not without pre-processing the file. This gives us two simple -options: - -1. **Parse all text files**. We could have all files ending in `.txt` or - ``README.txt`` be parsed through AsciiDoc. It will print pretty text fine - even if it isn't formatted as such. However this could be *not what the user - expects*. -2. **Pick a unique extension**. We could pick a unique extension (i.e. - `.asciidoc`) to prevent clashing. Although not directly suggested by the - author of AsciiDoc there is no standard or practice to the contrary. - -Option two is recommended by myself. - -Requirements -~~~~~~~~~~~~ - -The AsciiDoc API comes in two parts. The first is the system installation of -AsciiDoc which has a simple install_. The second part is the API script. You -can either copy this to the current directory or the application's lib folder. -There is more information on the `API page`_ - -The `re` package is imported here for the purpose to accomplish E-Mail address -cloaking. AsciiDoc does not offer it's own cloaking algorithm like docutils -does. So I made a simple one here to do the same. **If the expense of regex's -is too high it can be easily commented out.** - -.. tip:: - AsciiDoc by default runs in *safe mode* which means it will not include - external files that are **not** in the same directory as the `infile`. - However since we use a StringIO through the API it should be based on the - current working directory. - -.. _install: http://www.methods.co.nz/asciidoc/userguide.html -.. _API page: http://www.methods.co.nz/asciidoc/asciidocapi.html -""" - -try: - import locale - locale.setlocale(locale.LC_ALL, '') -except: - pass - -import sys -import cStringIO # faster then StringIO -from asciidocapi import AsciiDocAPI -from asciidocapi import AsciiDocError -import re # only needed to simulate cloak_email_addresses - -def main(): - """ - Parses the given AsciiDoc file or the redirected string input and returns - the HTML body. - - Usage: asciidoc2html < README.rst - asciidoc2html README.rst - """ - try: - text = open(sys.argv[1], 'r').read() - except IOError: # given filename could not be found - return '' - except IndexError: # no filename given - text = sys.stdin.read() - - infile = cStringIO.StringIO(text) - outfile = cStringIO.StringIO() - asciidoc = AsciiDocAPI() - asciidoc.options('-s') - - try: - asciidoc.execute(infile, outfile, 'xhtml11') - except AsciiDocError, strerror: - str = "%s" % (strerror) - str = str.replace("&", "&") # Must be done first - str = str.replace("<", "%lt;") - str = str.replace(">", "%gt;") - outfile.write ("
AsciiDoc ERROR: %s
" % (str)) - - """ - Cloak email addresses - - AsciiDoc API does not have a `cloak_email_addresses` option. We can do the - same with a set of regex but that can be expensive. Keep section commented - to disable. So ``abc@mail.example.com`` becomes: - - ----------- - - abc@mail.example.org - ----------- - """ - def mangleEmail(matches): - email1 = "%s%40%s" % (matches.group(1), matches.group(2)) - email1 = email1.replace(".", ".") - email2 = "%s@%s" % (matches.group(1), matches.group(2)) - email2 = email2.replace(".", ".") - return "%s" % (email1, email2) - - return re.sub(r'([^@]+)@([^@]+)', mangleEmail, outfile.getvalue()) - #return outfile.getvalue() - -if __name__ == '__main__': - print main() diff --git a/lib/github/commands/asciidocapi.py b/lib/github/commands/asciidocapi.py deleted file mode 100644 index 783f808d..00000000 --- a/lib/github/commands/asciidocapi.py +++ /dev/null @@ -1,240 +0,0 @@ -#!/usr/bin/env python -""" -asciidocapi - AsciiDoc API wrapper class. - -The AsciiDocAPI class provides an API for executing asciidoc. Minimal example -compiles `mydoc.txt` to `mydoc.html`: - - import asciidocapi - asciidoc = asciidocapi.AsciiDocAPI() - asciidoc.execute('mydoc.txt') - -- Full documentation in asciidocapi.txt. -- See the doctests below for more examples. - -Doctests: - -1. Check execution: - - >>> import StringIO - >>> infile = StringIO.StringIO('Hello *{author}*') - >>> outfile = StringIO.StringIO() - >>> asciidoc = AsciiDocAPI() - >>> asciidoc.options('--no-header-footer') - >>> asciidoc.attributes['author'] = 'Joe Bloggs' - >>> asciidoc.execute(infile, outfile, backend='html4') - >>> print outfile.getvalue() -

Hello Joe Bloggs

- - >>> asciidoc.attributes['author'] = 'Bill Smith' - >>> infile = StringIO.StringIO('Hello _{author}_') - >>> outfile = StringIO.StringIO() - >>> asciidoc.execute(infile, outfile, backend='docbook') - >>> print outfile.getvalue() - Hello Bill Smith - -2. Check error handling: - - >>> import StringIO - >>> asciidoc = AsciiDocAPI() - >>> infile = StringIO.StringIO('---------') - >>> outfile = StringIO.StringIO() - >>> asciidoc.execute(infile, outfile) - Traceback (most recent call last): - File "", line 1, in - File "asciidocapi.py", line 189, in execute - raise AsciiDocError(self.messages[-1]) - AsciiDocError: ERROR: : line 1: [blockdef-listing] missing closing delimiter - - -Copyright (C) 2009 Stuart Rackham. Free use of this software is granted -under the terms of the GNU General Public License (GPL). - -""" - -import sys,os,re - -API_VERSION = '0.1.1' -MIN_ASCIIDOC_VERSION = '8.4.1' # Minimum acceptable AsciiDoc version. - - -def find_in_path(fname, path=None): - """ - Find file fname in paths. Return None if not found. - """ - if path is None: - path = os.environ.get('PATH', '') - for dir in path.split(os.pathsep): - fpath = os.path.join(dir, fname) - if os.path.isfile(fpath): - return fpath - else: - return None - - -class AsciiDocError(Exception): - pass - - -class Options(object): - """ - Stores asciidoc(1) command options. - """ - def __init__(self, values=[]): - self.values = values[:] - def __call__(self, name, value=None): - """Shortcut for append method.""" - self.append(name, value) - def append(self, name, value=None): - if type(value) in (int,float): - value = str(value) - self.values.append((name,value)) - - -class Version(object): - """ - Parse and compare AsciiDoc version numbers. Instance attributes: - - string: String version number '.[.][suffix]'. - major: Integer major version number. - minor: Integer minor version number. - micro: Integer micro version number. - suffix: Suffix (begins with non-numeric character) is ignored when - comparing. - - Doctest examples: - - >>> Version('8.2.5') < Version('8.3 beta 1') - True - >>> Version('8.3.0') == Version('8.3. beta 1') - True - >>> Version('8.2.0') < Version('8.20') - True - >>> Version('8.20').major - 8 - >>> Version('8.20').minor - 20 - >>> Version('8.20').micro - 0 - >>> Version('8.20').suffix - '' - >>> Version('8.20 beta 1').suffix - 'beta 1' - - """ - def __init__(self, version): - self.string = version - reo = re.match(r'^(\d+)\.(\d+)(\.(\d+))?\s*(.*?)\s*$', self.string) - if not reo: - raise ValueError('invalid version number: %s' % self.string) - groups = reo.groups() - self.major = int(groups[0]) - self.minor = int(groups[1]) - self.micro = int(groups[3] or '0') - self.suffix = groups[4] or '' - def __cmp__(self, other): - result = cmp(self.major, other.major) - if result == 0: - result = cmp(self.minor, other.minor) - if result == 0: - result = cmp(self.micro, other.micro) - return result - - -class AsciiDocAPI(object): - """ - AsciiDoc API class. - """ - def __init__(self, asciidoc_py=None): - """ - Locate and import asciidoc.py. - Initialize instance attributes. - """ - self.options = Options() - self.attributes = {} - self.messages = [] - # Search for the asciidoc command file. - # Try ASCIIDOC_PY environment variable first. - cmd = os.environ.get('ASCIIDOC_PY') - if cmd: - if not os.path.isfile(cmd): - raise AsciiDocError('missing ASCIIDOC_PY file: %s' % cmd) - elif asciidoc_py: - # Next try path specified by caller. - cmd = asciidoc_py - if not os.path.isfile(cmd): - raise AsciiDocError('missing file: %s' % cmd) - else: - # Try shell search paths. - for fname in ['asciidoc.py','asciidoc.pyc','asciidoc']: - cmd = find_in_path(fname) - if cmd: break - else: - # Finally try current working directory. - for cmd in ['asciidoc.py','asciidoc.pyc','asciidoc']: - if os.path.isfile(cmd): break - else: - raise AsciiDocError('failed to locate asciidoc.py[c]') - cmd = os.path.realpath(cmd) - if os.path.splitext(cmd)[1] not in ['.py','.pyc']: - raise AsciiDocError('invalid Python module name: %s' % cmd) - sys.path.insert(0, os.path.dirname(cmd)) - try: - try: - import asciidoc - except ImportError: - raise AsciiDocError('failed to import asciidoc') - finally: - del sys.path[0] - if Version(asciidoc.VERSION) < Version(MIN_ASCIIDOC_VERSION): - raise AsciiDocError( - 'asciidocapi %s requires asciidoc %s or better' - % (API_VERSION, MIN_ASCIIDOC_VERSION)) - self.asciidoc = asciidoc - self.cmd = cmd - - def execute(self, infile, outfile=None, backend=None): - """ - Compile infile to outfile using backend format. - infile can outfile can be file path strings or file like objects. - """ - self.messages = [] - opts = Options(self.options.values) - if outfile is not None: - opts('--out-file', outfile) - if backend is not None: - opts('--backend', backend) - for k,v in self.attributes.items(): - if v == '' or k[-1] in '!@': - s = k - elif v is None: # A None value undefines the attribute. - s = k + '!' - else: - s = '%s=%s' % (k,v) - opts('--attribute', s) - args = [infile] - sys.path.insert(0, os.path.dirname(self.cmd)) - try: - # The AsciiDoc command was designed to process source text then - # exit, there are globals and statics in asciidoc.py that have - # to be reinitialized before each run -- hence the reload. - reload(self.asciidoc) - finally: - del sys.path[0] - try: - try: - self.asciidoc.execute(self.cmd, opts.values, args) - finally: - self.messages = self.asciidoc.messages[:] - except SystemExit, e: - if e.code: - raise AsciiDocError(self.messages[-1]) - - -if __name__ == "__main__": - """ - Run module doctests. - """ - import doctest - options = doctest.NORMALIZE_WHITESPACE + doctest.ELLIPSIS - doctest.testmod(optionflags=options) diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 4b6bfe6c..098f6172 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -44,9 +44,11 @@ Literati.render(content) end -command(:rest2html, /re?st(\.txt)?/) +markup(:asciidoctor, /asc|adoc|asciidoc/) do |content| + Asciidoctor::Document.new(content).render +end -command('asciidoc -s --backend=xhtml11 -o - -', /asc|adoc|asciidoc/) +command(:rest2html, /re?st(\.txt)?/) # pod2html is nice enough to generate a full-on HTML document for us, # so we return the favor by ripping out the good parts. From 24eae2087f18e1e34b389d4e9858369993a0b0ab Mon Sep 17 00:00:00 2001 From: Sam Whited Date: Thu, 27 Dec 2012 10:46:02 -0500 Subject: [PATCH 002/416] Remove copyright in public domain rest2html I'm no lawyer, but if the license is "Public Domain" (not really a license) I'm reasonably sure that equals no-copyright in most countries. Not a huge deal, but worth fixing. --- lib/github/commands/rest2html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 4d1d522c..015f6be9 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -3,7 +3,7 @@ """A small wrapper file for parsing ReST files at GitHub.""" __author__ = "Jannis Leidel" -__copyright__ = "Copyright (C) 2008 Jannis Leidel" +__copyright__ = "Public Domain" __license__ = "Public Domain" __version__ = "0.1" From 8154dca5f42425fe389ed7027c5569ae91e377ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicent=20Mart=C3=AD?= Date: Mon, 21 Jan 2013 17:32:32 -0800 Subject: [PATCH 003/416] Bump Asciidoctor with security fixes --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 5c043a2b..943a84b6 100644 --- a/Gemfile +++ b/Gemfile @@ -6,5 +6,5 @@ gem "org-ruby", ">= 0.7.0" gem "creole", "~>0.3.6" gem "wikicloth", "=0.6.0" gem "literati", "= 0.0.3" -gem "asciidoctor", ">= 0.0.5" +gem "asciidoctor", ">= 0.0.9" gem "rake" From e6a819659e7c53b881632f896cee758da9508468 Mon Sep 17 00:00:00 2001 From: Yossef Mendelssohn Date: Sat, 2 Feb 2013 02:37:48 -0800 Subject: [PATCH 004/416] make rest2html links in README relative Also update line number to point to rest2html command use. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7087065d..7b4a4c8f 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,6 @@ Contributing 6. Enjoy a refreshing Diet Coke and wait -[r2h]: http://github.com/github/markup/tree/master/lib/github/commands/rest2html -[r2hc]: http://github.com/github/markup/tree/master/lib/github/markups.rb#L13 +[r2h]: lib/github/commands/rest2html +[r2hc]: lib/github/markups.rb#L51 [1]: http://github.com/github/markup/pulls From bfd4687f4b7ee187780414778a8f3ac985fc246d Mon Sep 17 00:00:00 2001 From: Coby Chapple Date: Fri, 5 Apr 2013 13:24:00 +0100 Subject: [PATCH 005/416] add tests for rendering .litcoffee as markdown --- test/markup_test.rb | 1 + test/markups/README.litcoffee | 59 ++++++++++++++++++++++++++++++ test/markups/README.litcoffee.html | 57 +++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 test/markups/README.litcoffee create mode 100644 test/markups/README.litcoffee.html diff --git a/test/markup_test.rb b/test/markup_test.rb index 87208a9e..336fc171 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -36,6 +36,7 @@ def test_knows_what_it_can_and_cannot_render assert_equal false, GitHub::Markup.can_render?('README.html') assert_equal true, GitHub::Markup.can_render?('README.markdown') assert_equal false, GitHub::Markup.can_render?('README.cmd') + assert_equal true, GitHub::Markup.can_render?('README.litcoffee') end def test_fails_gracefully_on_missing_commands diff --git a/test/markups/README.litcoffee b/test/markups/README.litcoffee new file mode 100644 index 00000000..3946763a --- /dev/null +++ b/test/markups/README.litcoffee @@ -0,0 +1,59 @@ +Literate CoffeeScript Test +-------------------------- + +> Taken from https://github.com/jashkenas/coffee-script/blob/master/test/literate.litcoffee + +comment comment + + test "basic literate CoffeeScript parsing", -> + ok yes + +now with a... + + test "broken up indentation", -> + +... broken up ... + + do -> + +... nested block. + + ok yes + +Code must be separated from text by a blank line. + + test "code blocks must be preceded by a blank line", -> + +The next line is part of the text and will not be executed. + fail() + + ok yes + +Code in `backticks is not parsed` and... + + test "comments in indented blocks work", -> + do -> + do -> + # Regular comment. + + ### + Block comment. + ### + + ok yes + +Regular [Markdown](http://example.com/markdown) features, like links +and unordered lists, are fine: + + * I + + * Am + + * A + + * List + +Tabs work too: + + test "tabbed code", -> + ok yes diff --git a/test/markups/README.litcoffee.html b/test/markups/README.litcoffee.html new file mode 100644 index 00000000..b5c63608 --- /dev/null +++ b/test/markups/README.litcoffee.html @@ -0,0 +1,57 @@ +

Literate CoffeeScript Test

+ +
+

Taken from https://github.com/jashkenas/coffee-script/blob/master/test/literate.litcoffee

+
+ +

comment comment

+ +
test "basic literate CoffeeScript parsing", ->
+  ok yes
+ +

now with a…

+ +
test "broken up indentation", ->
+ +

… broken up …

+ +
  do ->
+ +

… nested block.

+ +
    ok yes
+ +

Code must be separated from text by a blank line.

+ +
test "code blocks must be preceded by a blank line", ->
+ +

The next line is part of the text and will not be executed. fail()

+ +
  ok yes
+ +

Code in backticks is not parsed and…

+ +
test "comments in indented blocks work", ->
+  do ->
+    do ->
+      # Regular comment.
+
+      ###
+        Block comment.
+      ###
+
+      ok yes
+ +

Regular Markdown features, like links and unordered lists, are fine:

+ +

* I

+ +

* Am

+ +

* A

+ +

* List

+ +

Tabs work too:

+ +

test “tabbed code”, -> ok yes

From 425f4aa10e53461773a715b4e6681421cd415dfe Mon Sep 17 00:00:00 2001 From: Coby Chapple Date: Fri, 5 Apr 2013 13:24:27 +0100 Subject: [PATCH 006/416] add .litcoffee to the list of Markdown file extensions --- lib/github/markups.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 098f6172..71103ba2 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -1,17 +1,17 @@ -MD_FILES = /md|mkdn?|mdwn|mdown|markdown/ +MD_FILES = /md|mkdn?|mdwn|mdown|markdown|litcoffee/ if markup('github/markdown', MD_FILES) do |content| GitHub::Markdown.render(content) end elsif markup(:redcarpet, MD_FILES) do |content| RedcarpetCompat.new(content).to_html - end + end elsif markup(:rdiscount, MD_FILES) do |content| RDiscount.new(content).to_html - end + end elsif markup(:maruku, MD_FILES) do |content| Maruku.new(content).to_html - end + end elsif markup(:kramdown, MD_FILES) do |content| Kramdown::Document.new(content).to_html end From 0930507e9c30958cdfe36458343c50e13ebf5a66 Mon Sep 17 00:00:00 2001 From: Coby Chapple Date: Fri, 7 Jun 2013 11:43:40 +0100 Subject: [PATCH 007/416] alter test markup/rendered-html files to match better --- test/markups/README.litcoffee | 4 +-- test/markups/README.litcoffee.html | 53 +++++++++++++++++------------- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/test/markups/README.litcoffee b/test/markups/README.litcoffee index 3946763a..ab626cd4 100644 --- a/test/markups/README.litcoffee +++ b/test/markups/README.litcoffee @@ -42,8 +42,8 @@ Code in `backticks is not parsed` and... ok yes -Regular [Markdown](http://example.com/markdown) features, like links -and unordered lists, are fine: +Regular [Markdown](http://example.com/markdown) features, +like links and unordered lists, are fine: * I diff --git a/test/markups/README.litcoffee.html b/test/markups/README.litcoffee.html index b5c63608..e33f2349 100644 --- a/test/markups/README.litcoffee.html +++ b/test/markups/README.litcoffee.html @@ -1,4 +1,4 @@ -

Literate CoffeeScript Test

+

Literate CoffeeScript Test

Taken from https://github.com/jashkenas/coffee-script/blob/master/test/literate.litcoffee

@@ -7,29 +7,36 @@

Literate CoffeeScript Test

comment comment

test "basic literate CoffeeScript parsing", ->
-  ok yes
+ ok yes + -

now with a…

+

now with a...

-
test "broken up indentation", ->
+
test "broken up indentation", ->
+
-

… broken up …

+

... broken up ...

-
  do ->
+
  do ->
+
-

… nested block.

+

... nested block.

-
    ok yes
+
    ok yes
+

Code must be separated from text by a blank line.

-
test "code blocks must be preceded by a blank line", ->
+
test "code blocks must be preceded by a blank line", ->
+
-

The next line is part of the text and will not be executed. fail()

+

The next line is part of the text and will not be executed. + fail()

-
  ok yes
+
  ok yes
+
-

Code in backticks is not parsed and…

+

Code in backticks is not parsed and...

test "comments in indented blocks work", ->
   do ->
@@ -40,18 +47,20 @@ 

Literate CoffeeScript Test

Block comment. ### - ok yes
+ ok yes + -

Regular Markdown features, like links and unordered lists, are fine:

+

Regular Markdown features, +like links and unordered lists, are fine:

-

* I

- -

* Am

- -

* A

- -

* List

+
    +
  • I

  • +
  • Am

  • +
  • A

  • +
  • List

  • +

Tabs work too:

-

test “tabbed code”, -> ok yes

+

test "tabbed code", -> + ok yes

From 8d23ebff1799052509d3bd190a20cf03440078da Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Mon, 29 Jul 2013 13:13:18 -0400 Subject: [PATCH 008/416] Note other extensions for AsciiDoc https://github.com/github/markup/blob/master/lib/github/markups.rb claims to support `markup(:asciidoctor, /asc|adoc|asciidoc/)` so note those extensions here. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7087065d..89a55a46 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ you wish to run the library. * [.creole](http://wikicreole.org/) -- `gem install creole` * [.mediawiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth` * [.rst](http://docutils.sourceforge.net/rst.html) -- `easy_install docutils` -* [.asciidoc](http://www.methods.co.nz/asciidoc/) -- `brew install asciidoc` +* [.asciidoc, .adoc, .asc](http://www.methods.co.nz/asciidoc/) -- `brew install asciidoc` * [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::HTML` comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN. From b0edf6dcba7bdc624ff4f4d92e84f56e740c2255 Mon Sep 17 00:00:00 2001 From: Rimero Solutions Date: Sat, 10 Aug 2013 16:14:35 -0400 Subject: [PATCH 009/416] Resolve #189 by upgrading org-ruby dependency. --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 943a84b6..6a46990f 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "http://rubygems.org" gem "redcarpet" gem "RedCloth" gem "rdoc", "~>3.6" -gem "org-ruby", ">= 0.7.0" +gem "org-ruby", ">= 0.8.1" gem "creole", "~>0.3.6" gem "wikicloth", "=0.6.0" gem "literati", "= 0.0.3" From 6c3ce3beef951796fe906541f99359f7d73363c5 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 10 Sep 2013 22:26:56 -0700 Subject: [PATCH 010/416] rstrip results to avoid errors dealing with newlines at the end of a file --- test/markup_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/markup_test.rb b/test/markup_test.rb index 87208a9e..82b46141 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -12,8 +12,8 @@ class MarkupTest < Test::Unit::TestCase source = File.read(readme) expected_file = "#{readme}.html" - expected = File.read(expected_file) - actual = GitHub::Markup.render(readme, File.read(readme)) + expected = File.read(expected_file).rstrip + actual = GitHub::Markup.render(readme, File.read(readme)).rstrip if source != expected assert(source != actual, "#{markup} did not render anything") From b017e7f792b732f5e0fa1e311ffcde5eed289742 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 10 Sep 2013 22:27:45 -0700 Subject: [PATCH 011/416] Fix failing tests All of these deal with attributes moving around in the files. --- lib/github/markup.rb | 2 + test/markups/README.asciidoc.html | 14 +-- test/markups/README.lhs.html | 2 +- test/markups/README.mediawiki.html | 8 +- test/markups/README.org.html | 185 +++++++++++++---------------- 5 files changed, 95 insertions(+), 116 deletions(-) diff --git a/lib/github/markup.rb b/lib/github/markup.rb index d8638c21..1cabe915 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -88,6 +88,8 @@ def execute(command, target) out.gsub("\r", '') rescue Errno::EPIPE "" + rescue Errno::ENOENT + "" end # Define markups diff --git a/test/markups/README.asciidoc.html b/test/markups/README.asciidoc.html index 19951735..447343cb 100644 --- a/test/markups/README.asciidoc.html +++ b/test/markups/README.asciidoc.html @@ -1,12 +1,10 @@ -
    +
    +
    • -

      -One -

      +

      One

    • -

      -Two -

      +

      Two

    • -
    +
+
diff --git a/test/markups/README.lhs.html b/test/markups/README.lhs.html index a2dbea79..b099d366 100644 --- a/test/markups/README.lhs.html +++ b/test/markups/README.lhs.html @@ -2,7 +2,7 @@

Markdown

Except with more magic added.

-
isPrefixOf              :: (Eq a) => [a] -> [a] -> Bool
+
isPrefixOf              :: (Eq a) => [a] -> [a] -> Bool
 isPrefixOf [] _         =  True
 isPrefixOf _  []        =  False
 isPrefixOf (x:xs) (y:ys)=  x == y && isPrefixOf xs ys
diff --git a/test/markups/README.mediawiki.html b/test/markups/README.mediawiki.html
index 5e6454b9..e8400592 100644
--- a/test/markups/README.mediawiki.html
+++ b/test/markups/README.mediawiki.html
@@ -9,12 +9,12 @@ 

Embedding JRuby

Table of Contents

    -

    Red Bridge (JRuby Embed)

    +

    Red Bridge (JRuby Embed)

    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 legacy API should still work, but we strongly recommend Red Bridge for all new projects.

    -

    Features of Red Bridge

    Red Bridge consists of two layers: Embed Core on the bottom, and implementations of JSR223 and BSF 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. +

    Features of Red Bridge

    Red Bridge consists of two layers: Embed Core on the bottom, and implementations of JSR223 and BSF 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.

    Which API should you use? For projects where Ruby is the only scripting language involved, we recommend Embed Core for the following reasons: @@ -31,5 +31,5 @@

    Features of Red Bridg The full API documentation has all the gory details. It's worth talking about a couple of the finer points here.

    -

    Previous Embedding JRuby Page

    We recommend using Embed Core; however, if you're maintaining code that uses the old API, you can find its documentation on the legacy embedding page. -

    \ No newline at end of file +

    Previous Embedding JRuby Page

    We recommend using Embed Core; however, if you're maintaining code that uses the old API, you can find its documentation on the legacy embedding page. +

    diff --git a/test/markups/README.org.html b/test/markups/README.org.html index 2438fe74..2d1708b2 100644 --- a/test/markups/README.org.html +++ b/test/markups/README.org.html @@ -4,133 +4,112 @@ Location:http://github.com/bdewey/org-ruby Version:0.5.1 -

    1 Description

    -

    Helpful Ruby routines for parsing orgmode files. The most significant thing this library does today is convert orgmode files to textile. Currently, you cannot do much to customize the conversion. The supplied textile conversion is optimized for extracting “content” from the orgfile as opposed to “metadata.”

    -

    2 History

    -

    2.1 2009-12-30: Version 0.5.1

    +

    1 Description

    +

    Helpful Ruby routines for parsing orgmode files. The most + significant thing this library does today is convert orgmode files + to textile. Currently, you cannot do much to customize the + conversion. The supplied textile conversion is optimized for + extracting “content” from the orgfile as opposed to “metadata.”

    +

    2 History

    +

    2.1 2009-12-30: Version 0.5.1

      -
    • Minor enhancement: Recognize lines starting with “:” as examples. -
    • -
    • Minor enhancement: Recognize #+BEGIN_SRC as source blocks -
    • -
    • Minor enhancement: Add “src” and “example” classes to <pre> blocks. -
    • +
    • Minor enhancement: Recognize lines starting with “:” as examples.
    • +
    • Minor enhancement: Recognize #+BEGIN_SRC as source blocks
    • +
    • Minor enhancement: Add “src” and “example” classes to <pre> blocks.
    -

    2.2 2009-12-30: Version 0.5.0

    +

    2.2 2009-12-30: Version 0.5.0

      -
    • Parse (but not necessarily use) in-buffer settings. The following in-buffer settings are used: -
        -
      • Understand the #+TITLE: directive. -
      • -
      • Exporting todo keywords (option todo:t) -
      • -
      • Numbering headlines (option num:t) -
      • -
      • Skipping text before the first headline (option skip:t) -
      • -
      • Skipping tables (option |:nil) -
      • -
      • Custom todo keywords -
      • -
      • EXPORT_SELECT_TAGS and EXPORT_EXLUDE_TAGS for controlling parts of the tree to export -
      • -
      -
    • -
    • Rewrite “file:(blah).org” links to “http:(blah).html” links. This makes the inter-links to other org-mode files work. -
    • -
    • Uses <th> tags inside table rows that precede table separators. -
    • +
    • Parse (but not necessarily use) in-buffer settings. The following + in-buffer settings are used: +
        +
      • Understand the #+TITLE: directive.
      • +
      • Exporting todo keywords (option todo:t)
      • +
      • Numbering headlines (option num:t)
      • +
      • Skipping text before the first headline (option skip:t)
      • +
      • Skipping tables (option |:nil)
      • +
      • Custom todo keywords
      • +
      • EXPORT_SELECT_TAGS and EXPORT_EXLUDE_TAGS for controlling parts of + the tree to export
      • +
      +
    • +
    • Rewrite “file:(blah).org” links to “http:(blah).html” links. This + makes the inter-links to other org-mode files work.
    • +
    • Uses <th> tags inside table rows that precede table separators.
    • Bugfixes: -
        -
      • Headings now have HTML escaped. -
      • -
      +
        +
      • Headings now have HTML escaped.
      • +
    -

    2.3 2009-12-29: Version 0.4.2

    +

    2.3 2009-12-29: Version 0.4.2

      -
    • Got rid of the extraneous newline at the start of code blocks. -
    • -
    • Everything now shows up in code blocks, even org-mode metadata. -
    • +
    • Got rid of the extraneous newline at the start of code blocks.
    • +
    • Everything now shows up in code blocks, even org-mode metadata.
    • Fixed bugs: -
        -
      • Regressed smart double quotes with HTML escaping. Added a test case and fixed the regression. -
      • -
      +
        +
      • Regressed smart double quotes with HTML escaping. Added a test + case and fixed the regression.
      • +
    -

    2.4 2009-12-29: Version 0.4.1

    +

    2.4 2009-12-29: Version 0.4.1

      -
    • HTML is now escaped by default -
    • -
    • org-mode comments will show up in a code block. -
    • +
    • HTML is now escaped by default
    • +
    • org-mode comments will show up in a code block.
    -

    2.5 2009-12-29: Version 0.4

    +

    2.5 2009-12-29: Version 0.4

      -
    • The first thing output in HTML gets the class “title” -
    • -
    • HTML output is now indented -
    • +
    • The first thing output in HTML gets the class “title”
    • +
    • HTML output is now indented
    • Proper support for multi-paragraph list items. -

      See? This paragraph is part of the last bullet.

      +

      See? This paragraph is part of the last bullet.

    • Fixed bugs: -
        -
      • “rake spec” wouldn’t work on Linux. Needed “require ‘rubygems’”. -
      • -
      +
        +
      • “rake spec” wouldn’t work on Linux. Needed “require ‘rubygems’”.
      • +
    -

    2.6 2009-12-27: Version 0.3

    +

    2.6 2009-12-27: Version 0.3

      -
    • Uses rubypants to get better typography (smart quotes, elipses, etc…). -
    • +
    • Uses rubypants to get better typography (smart quotes, elipses, etc…).
    • Fixed bugs: -
        -
      • Tables and lists did not get properly closed at the end of file -
      • -
      • You couldn’t do inline formatting inside table cells -
      • -
      • Characters in PRE blocks were not HTML escaped. -
      • -
      +
        +
      • Tables and lists did not get properly closed at the end of file
      • +
      • You couldn’t do inline formatting inside table cells
      • +
      • Characters in PRE blocks were not HTML escaped.
      • +
    -

    2.7 2009-12-26: Version 0.2

    +

    2.7 2009-12-26: Version 0.2

      -
    • Added to_html output on the parser. -
    • -
    • Added support for the full range of inline markup: bold, italic, code, verbatim, underline, strikethrough. -
    • -
    • Lots of refactoring to make the code more maintainable. -
    • +
    • Added to_html output on the parser.
    • +
    • Added support for the full range of inline markup: bold, + italic, code, verbatim, underline, strikethrough.
    • +
    • Lots of refactoring to make the code more maintainable.
    -

    2.8 2009-12-23: Version 0.1

    +

    2.8 2009-12-23: Version 0.1

    • Added support for block code, like this: -
      -     def flush!
      -     @logger.debug "FLUSH ==========> #{@output_type}"
      -     if (@output_type == :blank) then
      -       @output << "\n"
      -     elsif (@buffer.length > 0) then
      -       if @cancel_modifier then
      -         @output << "p. " if @output_type == :paragraph
      -         @cancel_modifier = false
      -       end
      -       @output << @paragraph_modifier if (@paragraph_modifier and not sticky_modifier?)
      -       @output << @buffer.textile_substitution << "\n"
      -     end
      -     @buffer = ""
      -   end
      -  
      -
    • -
        -
      • Major code cleanup: Created the OutputBuffer class that greatly simplified a lot of the messiness of textile conversion. -
      • -
      • Added support for line breaks within list items. -
      • -
      +
      +  def flush!
      +  @logger.debug "FLUSH ==========> #{@output_type}"
      +  if (@output_type == :blank) then
      +    @output << "\n"
      +  elsif (@buffer.length > 0) then
      +    if @cancel_modifier then
      +      @output << "p. " if @output_type == :paragraph
      +      @cancel_modifier = false
      +    end
      +    @output << @paragraph_modifier if (@paragraph_modifier and not sticky_modifier?)
      +    @output << @buffer.textile_substitution << "\n"
      +  end
      +  @buffer = ""
      +end
      +    
      + +
    • Major code cleanup: Created the OutputBuffer class that + greatly simplified a lot of the messiness of textile + conversion.
    • +
    • Added support for line breaks within list items.
    From 9bd0bd30bc61d81e43a2fa26974d07228810ad02 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 10 Sep 2013 22:27:57 -0700 Subject: [PATCH 012/416] Add script/bootstrap to get all the required libs --- README.md | 2 +- script/bootstrap | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100755 script/bootstrap diff --git a/README.md b/README.md index 7087065d..768491ba 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Markups ------- The following markups are supported. The dependencies listed are required if -you wish to run the library. +you wish to run the library. You can also run `script/bootstrap` to fetch them all. * [.markdown, .mdown, .md](http://daringfireball.net/projects/markdown/) -- `gem install redcarpet` (https://github.com/vmg/redcarpet) * [.textile](http://www.textism.com/tools/textile/) -- `gem install RedCloth` diff --git a/script/bootstrap b/script/bootstrap new file mode 100755 index 00000000..f9f93d43 --- /dev/null +++ b/script/bootstrap @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e + +cd $(dirname "$0")/.. + +bundle install +easy_install docutils +brew install asciidoc From bfd0bbf98d09e4cb7cb10be08347fb322a614327 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 10 Sep 2013 22:34:05 -0700 Subject: [PATCH 013/416] Add cibuild script --- script/cibuild | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 script/cibuild diff --git a/script/cibuild b/script/cibuild new file mode 100755 index 00000000..a73079e1 --- /dev/null +++ b/script/cibuild @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +# bootstrap gem environment changes +echo "Bootstrapping gem environment ..." + +script/bootstrap --local + +rake From 1a4bd64d54b210963cb78911a62630370cc155e0 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 10 Sep 2013 22:40:26 -0700 Subject: [PATCH 014/416] More cibuild updates --- .travis.yml | 7 +++++++ script/cibuild | 10 ++++++++++ 2 files changed, 17 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..d188749d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +before_install: sudo apt-get install easy_install docutils +rvm: + - 1.9.3 + - 2.0.0 +notifications: + disabled: true +bundler_args: --without development \ No newline at end of file diff --git a/script/cibuild b/script/cibuild index a73079e1..33251773 100755 --- a/script/cibuild +++ b/script/cibuild @@ -2,6 +2,16 @@ set -e +# GC customizations +export RUBY_GC_MALLOC_LIMIT=79000000 +export RUBY_HEAP_MIN_SLOTS=800000 +export RUBY_HEAP_FREE_MIN=100000 +export RUBY_HEAP_SLOTS_INCREMENT=400000 +export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 + +export PATH="/usr/share/rbenv/shims:$PATH" +export RBENV_VERSION="1.9.3" + # bootstrap gem environment changes echo "Bootstrapping gem environment ..." From f45d2901207b43bc868035bfbb4f41c4d0c1607e Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Wed, 11 Sep 2013 21:16:36 -0700 Subject: [PATCH 015/416] Properly run easy_install for travis --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d188749d..849ebc64 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ -before_install: sudo apt-get install easy_install docutils +before_install: easy_install docutils rvm: - 1.9.3 - 2.0.0 notifications: disabled: true -bundler_args: --without development \ No newline at end of file +bundler_args: --without development From 82de9f37ae19d115cfc779949b22a88614bdfc60 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Wed, 11 Sep 2013 21:18:22 -0700 Subject: [PATCH 016/416] Use pip for Travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 849ebc64..8d70dc0c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -before_install: easy_install docutils +before_install: sudo pip install docutils rvm: - 1.9.3 - 2.0.0 From 3e48ce096ff373fedc82d4eaf200a78a7569e15b Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Wed, 11 Sep 2013 21:46:14 -0700 Subject: [PATCH 017/416] Add vendor to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 80c4bf78..b803332a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ bin .bundle Gemfile.lock +vendor/ \ No newline at end of file From 407264c45a5c1b823a87e9e9bc82a740a080dfea Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Wed, 11 Sep 2013 21:48:31 -0700 Subject: [PATCH 018/416] Fix LHS test file --- test/markups/README.lhs.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/markups/README.lhs.html b/test/markups/README.lhs.html index b099d366..eb2a30a1 100644 --- a/test/markups/README.lhs.html +++ b/test/markups/README.lhs.html @@ -2,7 +2,7 @@

    Markdown

    Except with more magic added.

    -
    isPrefixOf              :: (Eq a) => [a] -> [a] -> Bool
    +
    isPrefixOf              :: (Eq a) => [a] -> [a] -> Bool
     isPrefixOf [] _         =  True
     isPrefixOf _  []        =  False
     isPrefixOf (x:xs) (y:ys)=  x == y && isPrefixOf xs ys
    
    From 2b1a41eef50c05d65093a6692f1ffe3a047e400c Mon Sep 17 00:00:00 2001
    From: Garen Torikian 
    Date: Wed, 11 Sep 2013 21:54:30 -0700
    Subject: [PATCH 019/416] :lipstick:
    
    ---
     lib/github/markup.rb | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/lib/github/markup.rb b/lib/github/markup.rb
    index 1cabe915..7e3f816b 100644
    --- a/lib/github/markup.rb
    +++ b/lib/github/markup.rb
    @@ -89,7 +89,7 @@ def execute(command, target)
         rescue Errno::EPIPE
           ""
         rescue Errno::ENOENT
    -        ""
    +      ""
         end
     
         # Define markups
    
    From d764df94fc8e71227c3e8ff6458968ca134ef7ff Mon Sep 17 00:00:00 2001
    From: Garen Torikian 
    Date: Wed, 11 Sep 2013 22:08:51 -0700
    Subject: [PATCH 020/416] Convert > to >
    
    ---
     test/markups/README.litcoffee.html | 16 ++++++++--------
     1 file changed, 8 insertions(+), 8 deletions(-)
    
    diff --git a/test/markups/README.litcoffee.html b/test/markups/README.litcoffee.html
    index e33f2349..69255d21 100644
    --- a/test/markups/README.litcoffee.html
    +++ b/test/markups/README.litcoffee.html
    @@ -6,18 +6,18 @@ 

    Literate CoffeeScript Test

    comment comment

    -
    test "basic literate CoffeeScript parsing", ->
    +
    test "basic literate CoffeeScript parsing", ->
       ok yes
     

    now with a...

    -
    test "broken up indentation", ->
    +
    test "broken up indentation", ->
     

    ... broken up ...

    -
      do ->
    +
      do ->
     

    ... nested block.

    @@ -27,7 +27,7 @@

    Literate CoffeeScript Test

    Code must be separated from text by a blank line.

    -
    test "code blocks must be preceded by a blank line", ->
    +
    test "code blocks must be preceded by a blank line", ->
     

    The next line is part of the text and will not be executed. @@ -38,9 +38,9 @@

    Literate CoffeeScript Test

    Code in backticks is not parsed and...

    -
    test "comments in indented blocks work", ->
    -  do ->
    -    do ->
    +
    test "comments in indented blocks work", ->
    +  do ->
    +    do ->
           # Regular comment.
     
           ###
    @@ -62,5 +62,5 @@ 

    Literate CoffeeScript Test

    Tabs work too:

    -

    test "tabbed code", -> +

    test "tabbed code", -> ok yes

    From 14031f4166ebc5c57d09b766a1fa26eba2fdb6f1 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 12 Sep 2013 11:27:58 -0700 Subject: [PATCH 021/416] Release 0.7.6 --- github-markup.gemspec | 8 ++++++-- lib/github-markup.rb | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index 86e9bb53..71e8eb28 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -13,8 +13,8 @@ Gem::Specification.new do |s| ## If your rubyforge_project name is different, then edit it and comment out ## the sub! line in the Rakefile s.name = 'github-markup' - s.version = '0.7.5' - s.date = '2012-12-17' + s.version = '0.7.6' + s.date = '2013-09-12' s.executables = ['github-markup'] ## Make sure your summary is short. The description may be as long @@ -66,6 +66,8 @@ desc lib/github/markup.rb lib/github/markup/rdoc.rb lib/github/markups.rb + script/bootstrap + script/cibuild test/markup_test.rb test/markups/README.asciidoc test/markups/README.asciidoc.html @@ -73,6 +75,8 @@ desc test/markups/README.creole.html test/markups/README.lhs test/markups/README.lhs.html + test/markups/README.litcoffee + test/markups/README.litcoffee.html test/markups/README.markdown test/markups/README.markdown.html test/markups/README.mediawiki diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 7fe0cfe2..896d7eea 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '0.7.5' + VERSION = '0.7.6' Version = VERSION end end From a29021ce53f830b32b20dff962e726499e0b5516 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 12 Sep 2013 11:28:20 -0700 Subject: [PATCH 022/416] Release 0.7.6 From 1d189e7da7f82750bc2b9d8b326a50b9dff21925 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 12 Sep 2013 11:29:22 -0700 Subject: [PATCH 023/416] Release 0.7.6 From cbbaeda7ed1cd2a4f9f59598ebefaa3c8568494e Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Mon, 23 Sep 2013 18:20:15 -0700 Subject: [PATCH 024/416] Bump up to 0.7.7 --- .gitignore | 1 + github-markup.gemspec | 6 ++++-- lib/github-markup.rb | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index b803332a..e3746243 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.pyc +pkg/ bin .bundle Gemfile.lock diff --git a/github-markup.gemspec b/github-markup.gemspec index 71e8eb28..2957dc40 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -1,3 +1,5 @@ +require File.expand_path("../lib/github-markup", __FILE__) + ## This is the rakegem gemspec template. Make sure you read and understand ## all of the comments. Some sections require modification, and others can ## be deleted if you don't need them. Once you understand the contents of @@ -13,8 +15,8 @@ Gem::Specification.new do |s| ## If your rubyforge_project name is different, then edit it and comment out ## the sub! line in the Rakefile s.name = 'github-markup' - s.version = '0.7.6' - s.date = '2013-09-12' + s.version = GitHub::Markup::VERSION + s.date = '2013-09-23' s.executables = ['github-markup'] ## Make sure your summary is short. The description may be as long diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 896d7eea..1a3570c2 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '0.7.6' + VERSION = '0.7.7' Version = VERSION end end From 529204749d41be4892b28deab8d2125e5ea35c55 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Thu, 26 Sep 2013 17:09:00 -0600 Subject: [PATCH 025/416] resolves #200 upgrade to Asciidoctor 0.1.4 - upgrade asciidoctor gem to 0.1.4 - update install instructions for AsciiDoc - configure Asciidoctor to output correct
     tags for code listings
    - set the showtitle attribute so document title is displayed
    - set section idprefix & idseparator to be consistent w/ other renderers
    - set env-github to allow conditional content when rendering on GitHub
    - add tests for admonition (no icon) and source listing
    - fix test
    ---
     Gemfile                           |  2 +-
     README.md                         |  2 +-
     lib/github/markups.rb             |  4 ++--
     script/bootstrap                  |  1 -
     test/markups/README.asciidoc      | 12 ++++++++++++
     test/markups/README.asciidoc.html | 29 +++++++++++++++++++++++++++++
     6 files changed, 45 insertions(+), 5 deletions(-)
    
    diff --git a/Gemfile b/Gemfile
    index 943a84b6..ed45c35a 100644
    --- a/Gemfile
    +++ b/Gemfile
    @@ -6,5 +6,5 @@ gem "org-ruby", ">= 0.7.0"
     gem "creole", "~>0.3.6"
     gem "wikicloth", "=0.6.0"
     gem "literati", "= 0.0.3"
    -gem "asciidoctor", ">= 0.0.9"
    +gem "asciidoctor", "= 0.1.4"
     gem "rake"
    diff --git a/README.md b/README.md
    index 7afa93ed..39f386d2 100644
    --- a/README.md
    +++ b/README.md
    @@ -17,7 +17,7 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a
     * [.creole](http://wikicreole.org/) -- `gem install creole`
     * [.mediawiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth`
     * [.rst](http://docutils.sourceforge.net/rst.html) -- `easy_install docutils`
    -* [.asciidoc, .adoc, .asc](http://www.methods.co.nz/asciidoc/) -- `brew install asciidoc`
    +* [.asciidoc, .adoc, .asc](http://asciidoc.org/) -- `gem install asciidoctor` (http://asciidoctor.org)
     * [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::HTML`
       comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN.
     
    diff --git a/lib/github/markups.rb b/lib/github/markups.rb
    index 71103ba2..3567144d 100644
    --- a/lib/github/markups.rb
    +++ b/lib/github/markups.rb
    @@ -44,8 +44,8 @@
       Literati.render(content)
     end
     
    -markup(:asciidoctor, /asc|adoc|asciidoc/) do |content|
    -  Asciidoctor::Document.new(content).render
    +markup(:asciidoctor, /adoc|asc(iidoc)?/) do |content|
    +  Asciidoctor.render(content, :safe => :secure, :attributes => %w(showtitle idprefix idseparator=- env=github env-github source-highlighter=html-pipeline))
     end
     
     command(:rest2html, /re?st(\.txt)?/)
    diff --git a/script/bootstrap b/script/bootstrap
    index f9f93d43..8092d517 100755
    --- a/script/bootstrap
    +++ b/script/bootstrap
    @@ -6,4 +6,3 @@ cd $(dirname "$0")/..
     
     bundle install
     easy_install docutils
    -brew install asciidoc
    diff --git a/test/markups/README.asciidoc b/test/markups/README.asciidoc
    index b36565cc..6a0462cb 100644
    --- a/test/markups/README.asciidoc
    +++ b/test/markups/README.asciidoc
    @@ -1,2 +1,14 @@
    += Document Title
    +
    +== First Section
    +
     * One
     * Two
    +
    +== Second Section
    +
    +NOTE: Here is some source code.
    +
    +```ruby
    +puts "Hello, World!"
    +```
    diff --git a/test/markups/README.asciidoc.html b/test/markups/README.asciidoc.html
    index 447343cb..0692ac1d 100644
    --- a/test/markups/README.asciidoc.html
    +++ b/test/markups/README.asciidoc.html
    @@ -1,3 +1,7 @@
    +

    Document Title

    +
    +

    First Section

    +
    • @@ -8,3 +12,28 @@
    +
    +
    +
    +

    Second Section

    +
    +
    + + + + + +
    +
    Note
    +
    +Here is some source code. +
    +
    +
    +
    +
    puts "Hello, World!"
    +
    +
    +
    +
    + From 6536a74ef095f4d6880fa91e9e61c7d510b23ddc Mon Sep 17 00:00:00 2001 From: Tyler Chung Date: Sat, 28 Sep 2013 14:06:14 +0800 Subject: [PATCH 026/416] remove rst table border --- lib/github/commands/rest2html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 4d1d522c..daf6004f 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -40,6 +40,14 @@ class GitHubHTMLTranslator(HTMLTranslator): else: self.body.append(self.starttag(node, 'pre')) + def visit_table(self, node): + classes = ' '.join(['docutils', self.settings.table_style]).strip() + self.body.append( + self.starttag(node, 'table', CLASS=classes)) + + def depart_table(self, node): + self.body.append('\n') + def main(): """ Parses the given ReST file or the redirected string input and returns the From f38a51da6fdbc0cff8f0fde0a9037faac4605ce4 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Mon, 30 Sep 2013 00:35:49 -0700 Subject: [PATCH 027/416] Add tests for RST --- test/markups/README.rst | 8 ++++++++ test/markups/README.rst.html | 24 +++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/test/markups/README.rst b/test/markups/README.rst index 0dd8a812..d420def0 100644 --- a/test/markups/README.rst +++ b/test/markups/README.rst @@ -11,3 +11,11 @@ Header 2 2. More ``code``, hooray 3. Somé UTF-8° + +============== ========================================================== +Travis http://travis-ci.org/tony/pullv +Docs http://pullv.rtfd.org +API http://pullv.readthedocs.org/en/latest/api.html +Issues https://github.com/tony/pullv/issues +Source https://github.com/tony/pullv +============== ========================================================== diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index 266c0702..b117e888 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -9,7 +9,29 @@

    Header 2

  • More code, hooray
  • Somé UTF-8°
  • + ++++ + + + + + + + + + + + + + + + + + +
    Travishttp://travis-ci.org/tony/pullv
    Docshttp://pullv.rtfd.org
    APIhttp://pullv.readthedocs.org/en/latest/api.html
    Issueshttps://github.com/tony/pullv/issues
    Sourcehttps://github.com/tony/pullv
    - From 4bef720e5bb10afe26958ba50a9b4f805c597e14 Mon Sep 17 00:00:00 2001 From: Charlie Somerville Date: Wed, 4 Dec 2013 10:09:20 +1100 Subject: [PATCH 028/416] tell ruby what the filename of markups.rb is --- lib/github/markup.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/github/markup.rb b/lib/github/markup.rb index 7e3f816b..b36f68c6 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -93,6 +93,7 @@ def execute(command, target) end # Define markups - instance_eval File.read(File.dirname(__FILE__) + '/markups.rb') + markups_rb = File.dirname(__FILE__) + '/markups.rb' + instance_eval File.read(markups_rb), markups_rb end end From d565a88a743c2624351ce4cd1f027d2bb1cd76ed Mon Sep 17 00:00:00 2001 From: Charlie Somerville Date: Wed, 4 Dec 2013 10:09:33 +1100 Subject: [PATCH 029/416] defer loading of markups gems until they're first used --- lib/github/markup.rb | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/github/markup.rb b/lib/github/markup.rb index b36f68c6..f586c0e3 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -8,6 +8,14 @@ module GitHub module Markup extend self @@markups = {} + @@deferred_markups = [] + + def preload! + @@deferred_markups.each do |loader| + loader.call + end + @@deferred_markups = [] + end def render(filename, content = nil) content ||= File.read(filename) @@ -20,8 +28,16 @@ def render(filename, content = nil) end def markup(file, pattern, &block) - require file.to_s - add_markup(pattern, &block) + loader = proc do + require file.to_s + add_markup(pattern, &block) + end + @@deferred_markups << loader + add_markup pattern do |*args| + @@deferred_markups.delete(loader) + loader.call + block.call(*args) + end true rescue LoadError false From 9f38d4156f389f31b1741b85e3296191616ec23d Mon Sep 17 00:00:00 2001 From: Charlie Somerville Date: Wed, 4 Dec 2013 10:24:16 +1100 Subject: [PATCH 030/416] add :eager option to markup --- lib/github/markup.rb | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/lib/github/markup.rb b/lib/github/markup.rb index f586c0e3..c69accc7 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -27,20 +27,28 @@ def render(filename, content = nil) end end - def markup(file, pattern, &block) + def markup(file, pattern, opts = {}, &block) loader = proc do - require file.to_s - add_markup(pattern, &block) + begin + require file.to_s + add_markup(pattern, &block) + true + rescue LoadError + false + end end - @@deferred_markups << loader - add_markup pattern do |*args| - @@deferred_markups.delete(loader) + + if opts[:eager] loader.call - block.call(*args) + else + @@deferred_markups << loader + add_markup pattern do |*args| + @@deferred_markups.delete(loader) + loader.call + block.call(*args) + end + true end - true - rescue LoadError - false end def command(command, regexp, &block) From c5f848e82768648571f6e2c45ef18cd121c794f8 Mon Sep 17 00:00:00 2001 From: Charlie Somerville Date: Wed, 4 Dec 2013 10:24:27 +1100 Subject: [PATCH 031/416] eager load markdown implementations for fallback --- lib/github/markups.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 71103ba2..9217e68a 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -1,21 +1,21 @@ MD_FILES = /md|mkdn?|mdwn|mdown|markdown|litcoffee/ -if markup('github/markdown', MD_FILES) do |content| +if markup('github/markdown', MD_FILES, eager: true) do |content| GitHub::Markdown.render(content) end -elsif markup(:redcarpet, MD_FILES) do |content| +elsif markup(:redcarpet, MD_FILES, eager: true) do |content| RedcarpetCompat.new(content).to_html end -elsif markup(:rdiscount, MD_FILES) do |content| +elsif markup(:rdiscount, MD_FILES, eager: true) do |content| RDiscount.new(content).to_html end -elsif markup(:maruku, MD_FILES) do |content| +elsif markup(:maruku, MD_FILES, eager: true) do |content| Maruku.new(content).to_html end -elsif markup(:kramdown, MD_FILES) do |content| +elsif markup(:kramdown, MD_FILES, eager: true) do |content| Kramdown::Document.new(content).to_html end -elsif markup(:bluecloth, MD_FILES) do |content| +elsif markup(:bluecloth, MD_FILES, eager: true) do |content| BlueCloth.new(content).to_html end end From 91950b83bbc9990613bec5370f53ddddaad644f6 Mon Sep 17 00:00:00 2001 From: Charlie Somerville Date: Wed, 4 Dec 2013 11:19:42 +1100 Subject: [PATCH 032/416] refactor command/gem details into implementation classes --- lib/github/markup.rb | 96 +++------------------ lib/github/markup/command_implementation.rb | 52 +++++++++++ lib/github/markup/gem_implementation.rb | 26 ++++++ lib/github/markup/implementation.rb | 23 +++++ 4 files changed, 112 insertions(+), 85 deletions(-) create mode 100644 lib/github/markup/command_implementation.rb create mode 100644 lib/github/markup/gem_implementation.rb create mode 100644 lib/github/markup/implementation.rb diff --git a/lib/github/markup.rb b/lib/github/markup.rb index c69accc7..a204d0e7 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -1,83 +1,35 @@ -begin - require 'open3_detach' -rescue LoadError - require 'open3' -end +require "github/markup/command_implementation" +require "github/markup/gem_implementation" module GitHub module Markup extend self - @@markups = {} - @@deferred_markups = [] + @@markups = [] def preload! - @@deferred_markups.each do |loader| - loader.call - end - @@deferred_markups = [] + # TODO end def render(filename, content = nil) content ||= File.read(filename) - if proc = renderer(filename) - proc[content] + if impl = renderer(filename) + impl.render(content) else content end end def markup(file, pattern, opts = {}, &block) - loader = proc do - begin - require file.to_s - add_markup(pattern, &block) - true - rescue LoadError - false - end - end - - if opts[:eager] - loader.call - else - @@deferred_markups << loader - add_markup pattern do |*args| - @@deferred_markups.delete(loader) - loader.call - block.call(*args) - end - true - end + @@markups << GemImplementation.new(pattern, file, &block) end def command(command, regexp, &block) - command = command.to_s - if File.exists?(file = File.dirname(__FILE__) + "/commands/#{command}") command = file end - add_markup(regexp) do |content| - rendered = execute(command, content) - rendered = rendered.to_s.empty? ? content : rendered - - if block && block.arity == 2 - # If the block takes two arguments, pass new content and old - # content. - block.call(rendered, content) - elsif block - # One argument is just the new content. - block.call(rendered) - else - # No block? No problem! - rendered - end - end - end - - def add_markup(regexp, &block) - @@markups[regexp] = block + @@markups << CommandImplementation.new(regexp, command, &block) end def can_render?(filename) @@ -85,35 +37,9 @@ def can_render?(filename) end def renderer(filename) - @@markups.each do |key, value| - if Regexp.compile("\\.(#{key})$") =~ filename - return value - end - end - nil - end - - def renderer_name(filename) - @@markups.each do |key, value| - if Regexp.compile("\\.(#{key})$") =~ filename - return key - end - end - nil - end - - def execute(command, target) - out = '' - Open3.popen3(command) do |stdin, stdout, _| - stdin.puts target - stdin.close - out = stdout.read - end - out.gsub("\r", '') - rescue Errno::EPIPE - "" - rescue Errno::ENOENT - "" + @@markups.find { |impl| + impl.match?(filename) + } end # Define markups diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb new file mode 100644 index 00000000..9c531f0d --- /dev/null +++ b/lib/github/markup/command_implementation.rb @@ -0,0 +1,52 @@ +begin + require "open3_detach" +rescue LoadError + require "open3" +end + +require "github/markup/implementation" + +module GitHub + module Markup + class CommandImplementation < Implementation + attr_reader :command, :block + + def initialize(regexp, command, &block) + super regexp + @command = command.to_s + @block = block + end + + def render(content) + rendered = execute(command, content) + rendered = rendered.to_s.empty? ? content : rendered + call_block(rendered, content) + end + + private + def call_block(rendered, content) + if block && block.arity == 2 + block.call(rendered, content) + elsif block + block.call(rendered) + else + rendered + end + end + + def execute(command, target) + out = '' + Open3.popen3(command) do |stdin, stdout, _| + stdin.puts target + stdin.close + out = stdout.read + end + out.gsub("\r", '') + rescue Errno::EPIPE + "" + rescue Errno::ENOENT + "" + end + end + end +end diff --git a/lib/github/markup/gem_implementation.rb b/lib/github/markup/gem_implementation.rb new file mode 100644 index 00000000..a9f80b75 --- /dev/null +++ b/lib/github/markup/gem_implementation.rb @@ -0,0 +1,26 @@ +require "github/markup/implementation" + +module GitHub + module Markup + class GemImplementation < Implementation + attr_reader :gem_name, :renderer + + def initialize(regexp, gem_name, &renderer) + super regexp + @gem_name = gem_name.to_s + @renderer = renderer + end + + def load + return if @loaded + require gem_name + @loaded = true + end + + def render(content) + load + renderer.call(content) + end + end + end +end diff --git a/lib/github/markup/implementation.rb b/lib/github/markup/implementation.rb new file mode 100644 index 00000000..16f73bc4 --- /dev/null +++ b/lib/github/markup/implementation.rb @@ -0,0 +1,23 @@ +module GitHub + module Markup + class Implementation + attr_reader :regexp + + def initialize(regexp) + @regexp = regexp + end + + def load + # no-op by default + end + + def render(content) + raise NotImplementedError, "subclasses of GitHub::Markup::Implementation must define #render" + end + + def match?(filename) + Regexp.compile("\\.(#{regexp})$") =~ filename + end + end + end +end From d65bb7ee9be795ae607d0d666e34fd4b33be0926 Mon Sep 17 00:00:00 2001 From: Charlie Somerville Date: Wed, 4 Dec 2013 11:25:39 +1100 Subject: [PATCH 033/416] add special cased markdown implementation --- lib/github/markup/markdown.rb | 56 +++++++++++++++++++++++++++++++++++ lib/github/markups.rb | 22 ++------------ 2 files changed, 58 insertions(+), 20 deletions(-) create mode 100644 lib/github/markup/markdown.rb diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb new file mode 100644 index 00000000..f4ef99dc --- /dev/null +++ b/lib/github/markup/markdown.rb @@ -0,0 +1,56 @@ +require "github/markup/implementation" + +module GitHub + module Markup + class Markdown < Implementation + MARKDOWN_GEMS = { + "github/markdown" => proc { |content| + GitHub::Markdown.render(content) + }, + "redcarpet" => proc { |content| + RedcarpetCompat.new(content).to_html + }, + "rdiscount" => proc { |content| + RDiscount.new(content).to_html + }, + "maruku" => proc { |content| + Maruku.new(content).to_html + }, + "kramdown" => proc { |content| + Kramdown::Document.new(content).to_html + }, + "bluecloth" => proc { |content| + BlueCloth.new(content).to_html + }, + } + + def initialize + super(/md|mkdn?|mdwn|mdown|markdown|litcoffee/) + end + + def load + return if @renderer + MARKDOWN_GEMS.each do |gem_name, renderer| + if try_require(gem_name) + @renderer = renderer + return + end + end + raise LoadError, "no suitable markdown gem found" + end + + def render(content) + load + @renderer.call(content) + end + + private + def try_require(file) + require file + true + rescue LoadError + false + end + end + end +end diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 9217e68a..c06af64a 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -1,24 +1,6 @@ -MD_FILES = /md|mkdn?|mdwn|mdown|markdown|litcoffee/ +require "github/markup/markdown" -if markup('github/markdown', MD_FILES, eager: true) do |content| - GitHub::Markdown.render(content) - end -elsif markup(:redcarpet, MD_FILES, eager: true) do |content| - RedcarpetCompat.new(content).to_html - end -elsif markup(:rdiscount, MD_FILES, eager: true) do |content| - RDiscount.new(content).to_html - end -elsif markup(:maruku, MD_FILES, eager: true) do |content| - Maruku.new(content).to_html - end -elsif markup(:kramdown, MD_FILES, eager: true) do |content| - Kramdown::Document.new(content).to_html - end -elsif markup(:bluecloth, MD_FILES, eager: true) do |content| - BlueCloth.new(content).to_html - end -end +@@markups << GitHub::Markup::Markdown.new markup(:redcloth, /textile/) do |content| RedCloth.new(content).to_html From f6f0e0b580edd0bdefc1232775be59ffaa2e3f8d Mon Sep 17 00:00:00 2001 From: Charlie Somerville Date: Wed, 4 Dec 2013 11:26:55 +1100 Subject: [PATCH 034/416] fix GitHub::Markup.preload! --- lib/github/markup.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/github/markup.rb b/lib/github/markup.rb index a204d0e7..abdb788d 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -7,7 +7,9 @@ module Markup @@markups = [] def preload! - # TODO + @@markups.each do |markup| + markup.load + end end def render(filename, content = nil) From 606dfa12397db75c61a4c7f971c91c49380af011 Mon Sep 17 00:00:00 2001 From: Charlie Somerville Date: Wed, 4 Dec 2013 11:31:13 +1100 Subject: [PATCH 035/416] cache file extension regexp instead of recompiling it every time --- lib/github/markup/implementation.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/github/markup/implementation.rb b/lib/github/markup/implementation.rb index 16f73bc4..463a39d4 100644 --- a/lib/github/markup/implementation.rb +++ b/lib/github/markup/implementation.rb @@ -16,7 +16,12 @@ def render(content) end def match?(filename) - Regexp.compile("\\.(#{regexp})$") =~ filename + file_ext_regexp =~ filename + end + + private + def file_ext_regexp + @file_ext_regexp ||= /\.(#{regexp})\z/ end end end From 819fa6024eaf2e5fe4854c81cf1d5834a793f113 Mon Sep 17 00:00:00 2001 From: Charlie Somerville Date: Wed, 4 Dec 2013 12:01:13 +1100 Subject: [PATCH 036/416] add a markups accessor method for @@markups --- lib/github/markup.rb | 12 ++++++++---- lib/github/markups.rb | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/github/markup.rb b/lib/github/markup.rb index abdb788d..4e3bf917 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -6,8 +6,12 @@ module Markup extend self @@markups = [] + def markups + @@markups + end + def preload! - @@markups.each do |markup| + markups.each do |markup| markup.load end end @@ -23,7 +27,7 @@ def render(filename, content = nil) end def markup(file, pattern, opts = {}, &block) - @@markups << GemImplementation.new(pattern, file, &block) + markups << GemImplementation.new(pattern, file, &block) end def command(command, regexp, &block) @@ -31,7 +35,7 @@ def command(command, regexp, &block) command = file end - @@markups << CommandImplementation.new(regexp, command, &block) + markups << CommandImplementation.new(regexp, command, &block) end def can_render?(filename) @@ -39,7 +43,7 @@ def can_render?(filename) end def renderer(filename) - @@markups.find { |impl| + markups.find { |impl| impl.match?(filename) } end diff --git a/lib/github/markups.rb b/lib/github/markups.rb index c06af64a..29498257 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -1,6 +1,6 @@ require "github/markup/markdown" -@@markups << GitHub::Markup::Markdown.new +markups << GitHub::Markup::Markdown.new markup(:redcloth, /textile/) do |content| RedCloth.new(content).to_html From b183c895c6495de2ab89dec7ff6b0bc7d8a82eb7 Mon Sep 17 00:00:00 2001 From: Charlie Somerville Date: Wed, 4 Dec 2013 14:07:48 +1100 Subject: [PATCH 037/416] bump version to 1.0.0 --- lib/github-markup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 1a3570c2..f3e9d3ec 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '0.7.7' + VERSION = '1.0.0' Version = VERSION end end From b7cabb1c81ea30035dd63a508a67a949c1846f4c Mon Sep 17 00:00:00 2001 From: Charlie Somerville Date: Wed, 4 Dec 2013 14:08:38 +1100 Subject: [PATCH 038/416] Release 1.0.0 --- github-markup.gemspec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index 2957dc40..cece0358 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| ## the sub! line in the Rakefile s.name = 'github-markup' s.version = GitHub::Markup::VERSION - s.date = '2013-09-23' + s.date = '2013-12-04' s.executables = ['github-markup'] ## Make sure your summary is short. The description may be as long @@ -66,6 +66,10 @@ desc lib/github-markup.rb lib/github/commands/rest2html lib/github/markup.rb + lib/github/markup/command_implementation.rb + lib/github/markup/gem_implementation.rb + lib/github/markup/implementation.rb + lib/github/markup/markdown.rb lib/github/markup/rdoc.rb lib/github/markups.rb script/bootstrap From acecae3dfa70229620e471e57193aabef3a2c15d Mon Sep 17 00:00:00 2001 From: masarakki Date: Sun, 15 Dec 2013 05:15:20 +0900 Subject: [PATCH 039/416] add initilize options for rdoc-4.0.x --- lib/github/markup/rdoc.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/github/markup/rdoc.rb b/lib/github/markup/rdoc.rb index 8332e402..5bf14639 100644 --- a/lib/github/markup/rdoc.rb +++ b/lib/github/markup/rdoc.rb @@ -9,7 +9,11 @@ def initialize(content) end def to_html - h = ::RDoc::Markup::ToHtml.new + if ::RDoc::VERSION.to_i >= 4 + h = ::RDoc::Markup::ToHtml.new(::RDoc::Options.new) + else + h = ::RDoc::Markup::ToHtml.new + end h.convert(@content) end end From 42f82b5d55683cee1a0b2fc45eb7119c8391c723 Mon Sep 17 00:00:00 2001 From: Ken Dreyer Date: Mon, 30 Dec 2013 09:33:24 -0700 Subject: [PATCH 040/416] require newer asciidoc in order to match test data Asciidoc versions prior to 0.1.4 would write HTML output with a couple of extra newline characters, and this would cause the tests to fail. Ensure that we're using the very latest version of Asciidoc to avoid this. 1) Failure: MarkupTest#test_asciidoc [/builddir/build/BUILD/github-markup-1.0.0/usr/share/ge ms/gems/github-markup-1.0.0/test/markup_test.rb:28]: README.asciidoc.html's contents don't match command output: --- - 2013-12-30 09:20:16.824751950 -0700 +++ test/markups/README.asciidoc.html 2013-12-30 09:20:15.464500241 -0700 @@ -1,5 +1,4 @@
    -
    • One

      @@ -8,4 +7,4 @@

      Two

    -
    \ No newline at end of file + --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 943a84b6..7406ca65 100644 --- a/Gemfile +++ b/Gemfile @@ -6,5 +6,5 @@ gem "org-ruby", ">= 0.7.0" gem "creole", "~>0.3.6" gem "wikicloth", "=0.6.0" gem "literati", "= 0.0.3" -gem "asciidoctor", ">= 0.0.9" +gem "asciidoctor", ">= 0.1.4" gem "rake" From 439663239642361ce02b939767b3cc20c8765f3d Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Tue, 21 Jan 2014 21:17:14 -0800 Subject: [PATCH 041/416] Update docs and bootstrap for asciidoc --- README.md | 2 +- script/bootstrap | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 7afa93ed..fcdfb197 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a * [.creole](http://wikicreole.org/) -- `gem install creole` * [.mediawiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth` * [.rst](http://docutils.sourceforge.net/rst.html) -- `easy_install docutils` -* [.asciidoc, .adoc, .asc](http://www.methods.co.nz/asciidoc/) -- `brew install asciidoc` +* [.asciidoc, .adoc, .asc](http://www.methods.co.nz/asciidoc/) -- `gem install asciidoctor` * [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::HTML` comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN. diff --git a/script/bootstrap b/script/bootstrap index f9f93d43..8092d517 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -6,4 +6,3 @@ cd $(dirname "$0")/.. bundle install easy_install docutils -brew install asciidoc From f1e2cd841a14c1e3e96519c79eb3ceb72eafc7d5 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Wed, 22 Jan 2014 12:08:49 +0100 Subject: [PATCH 042/416] Use CC0 as the license for rst2html. This should clarify the kerfuffle merged in #177 and is in spirit of what I intended when I wrote the file in 2008. See the CC0 FAQ for more details: http://creativecommons.org/about/cc0 I used the git log to mention the people who contributed to the file since then. Fixes #205. --- lib/github/commands/rest2html | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index ce696b06..66ebf42c 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -1,10 +1,29 @@ #!/usr/bin/env python +""" +rest2html - A small wrapper file for parsing ReST files at GitHub. -"""A small wrapper file for parsing ReST files at GitHub.""" +Written in 2008 by Jannis Leidel + +Brandon Keepers +Bryan Veloso +Chris Wanstrath +Dave Abrahams +Gasper Zejn +Michael Jones +Sam Whited +Tyler Chung +Vicent Marti + +To the extent possible under law, the author(s) have dedicated all copyright +and related and neighboring rights to this software to the public domain +worldwide. This software is distributed without any warranty. + +You should have received a copy of the CC0 Public Domain Dedication along with +this software. If not, see . +""" __author__ = "Jannis Leidel" -__copyright__ = "Public Domain" -__license__ = "Public Domain" +__license__ = "CC0" __version__ = "0.1" try: From 8ddb6701992637638801195df62bcc14b935ee6a Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Tue, 28 Jan 2014 17:10:01 -0700 Subject: [PATCH 043/416] document the HTML sanitization whitelist --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 39f386d2..5def29b6 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,30 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a * [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::HTML` comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN. +HTML sanitization +----------------- + +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. + +The following HTML elements, organized by category, are whitelisted: + +* Headings: h1, h2, h3, h4, h5, h6, h7, h8 +* Prose: p, div, blockquote +* Preformatted: pre +* Inline: b, i, strong, em, tt, code, ins, del, sup, sub, kbd, samp, q, var +* Lists: ol, ul, li, dl, dt, dd +* Tables: table, thead, tbody, tfoot, tr, td, th +* Breaks: br, hr +* Ruby (East Asian): ruby, rt, rp + +The following attributes, organized by element, are whitelisted: + +* a: href (http://, https://, mailto://, github-windows:// and github-mac:// URI schemes and relative paths only) +* img: src (http:// and https::// URI schemes and relative paths only) +* div: itemscope, itemtype +* 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 + +Note that the id attribute is *not* whitelisted. Contributing ------------ From c5b7c116e2043a6fcab032f6df52ab19dd60fba8 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Tue, 28 Jan 2014 18:34:20 -0800 Subject: [PATCH 044/416] Bump version number --- github-markup.gemspec | 2 +- lib/github-markup.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index cece0358..6eddf8fe 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| ## the sub! line in the Rakefile s.name = 'github-markup' s.version = GitHub::Markup::VERSION - s.date = '2013-12-04' + s.date = '2014-01-28' s.executables = ['github-markup'] ## Make sure your summary is short. The description may be as long diff --git a/lib/github-markup.rb b/lib/github-markup.rb index f3e9d3ec..7324a34c 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.0.0' + VERSION = '1.0.1' Version = VERSION end end From ddf63f42cd88bea029414e8e4505f7030ec81e52 Mon Sep 17 00:00:00 2001 From: Waldemar Quevedo Date: Sat, 8 Feb 2014 17:18:39 +0900 Subject: [PATCH 045/416] Update to org-ruby 0.9.0 --- Gemfile | 2 +- lib/github/markups.rb | 2 +- test/markups/README.org | 22 +++++++++++++++++++--- test/markups/README.org.html | 35 +++++++++++++++++++++++++---------- 4 files changed, 46 insertions(+), 15 deletions(-) diff --git a/Gemfile b/Gemfile index d573ef30..a08970e7 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "http://rubygems.org" gem "redcarpet" gem "RedCloth" gem "rdoc", "~>3.6" -gem "org-ruby", ">= 0.8.1" +gem "org-ruby", ">= 0.9.0" gem "creole", "~>0.3.6" gem "wikicloth", "=0.6.0" gem "literati", "= 0.0.3" diff --git a/lib/github/markups.rb b/lib/github/markups.rb index cb771f1c..4f680533 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -11,7 +11,7 @@ end markup('org-ruby', /org/) do |content| - Orgmode::Parser.new(content).to_html + Orgmode::Parser.new(content, :allow_include_files => false).to_html end markup(:creole, /creole/) do |content| diff --git a/test/markups/README.org b/test/markups/README.org index a6ab34d7..c479b047 100644 --- a/test/markups/README.org +++ b/test/markups/README.org @@ -11,8 +11,8 @@ #+STARTUP: showall | Status: | Under Development | - | Location: | [[http://github.com/bdewey/org-ruby]] | - | Version: | 0.5.1 | + | Location: | [[http://github.com/wallyqs/org-ruby]] | + | Version: | 0.9.0 | * Description @@ -22,9 +22,25 @@ conversion. The supplied textile conversion is optimized for extracting "content" from the orgfile as opposed to "metadata." - * History +** 2014-02-08: Version 0.9.0 + + - Let's make sure =#+INCLUDE:= is not supported + +#+INCLUDE: "./README.txt" src text + + - And confirm that syntax highlight is supported + +#+begin_src ruby +module GitHub + module Markup + VERSION = 'test' + Version = VERSION + end +end +#+end_src + ** 2009-12-30: Version 0.5.1 - Minor enhancement: Recognize lines starting with ":" as examples. diff --git a/test/markups/README.org.html b/test/markups/README.org.html index 2d1708b2..84abc77a 100644 --- a/test/markups/README.org.html +++ b/test/markups/README.org.html @@ -1,8 +1,8 @@

    org-ruby

    - - + +
    Status:Under Development
    Location:http://github.com/bdewey/org-ruby
    Version:0.5.1
    Location:http://github.com/wallyqs/org-ruby
    Version:0.9.0

    1 Description

    Helpful Ruby routines for parsing orgmode files. The most @@ -11,13 +11,28 @@

    1 Description

    conversion. The supplied textile conversion is optimized for extracting “content” from the orgfile as opposed to “metadata.”

    2 History

    -

    2.1 2009-12-30: Version 0.5.1

    +

    2.1 2014-02-08: Version 0.9.0

    +
      +
    • Let’s make sure #+INCLUDE: is not supported
    • +
    +
      +
    • And confirm that syntax highlight is supported
    • +
    +
    +module GitHub
    +  module Markup
    +    VERSION = 'test'
    +    Version = VERSION
    +  end
    +end
    +
    +

    2.2 2009-12-30: Version 0.5.1

    • Minor enhancement: Recognize lines starting with “:” as examples.
    • Minor enhancement: Recognize #+BEGIN_SRC as source blocks
    • Minor enhancement: Add “src” and “example” classes to <pre> blocks.
    -

    2.2 2009-12-30: Version 0.5.0

    +

    2.3 2009-12-30: Version 0.5.0

    • Parse (but not necessarily use) in-buffer settings. The following in-buffer settings are used: @@ -41,7 +56,7 @@

      2.2 2009-12-30: Version

    -

    2.3 2009-12-29: Version 0.4.2

    +

    2.4 2009-12-29: Version 0.4.2

    • Got rid of the extraneous newline at the start of code blocks.
    • Everything now shows up in code blocks, even org-mode metadata.
    • @@ -52,12 +67,12 @@

      2.3 2009-12-29: Version

    -

    2.4 2009-12-29: Version 0.4.1

    +

    2.5 2009-12-29: Version 0.4.1

    • HTML is now escaped by default
    • org-mode comments will show up in a code block.
    -

    2.5 2009-12-29: Version 0.4

    +

    2.6 2009-12-29: Version 0.4

    • The first thing output in HTML gets the class “title”
    • HTML output is now indented
    • @@ -70,7 +85,7 @@

      2.5 2009-12-29: Version

    -

    2.6 2009-12-27: Version 0.3

    +

    2.7 2009-12-27: Version 0.3

    • Uses rubypants to get better typography (smart quotes, elipses, etc…).
    • Fixed bugs: @@ -81,14 +96,14 @@

      2.6 2009-12-27: Version

    -

    2.7 2009-12-26: Version 0.2

    +

    2.8 2009-12-26: Version 0.2

    • Added to_html output on the parser.
    • Added support for the full range of inline markup: bold, italic, code, verbatim, underline, strikethrough.
    • Lots of refactoring to make the code more maintainable.
    -

    2.8 2009-12-23: Version 0.1

    +

    2.9 2009-12-23: Version 0.1

    • Added support for block code, like this:
      
      From 1c8c4eff33be03d18816e8cf86668935046b68c0 Mon Sep 17 00:00:00 2001
      From: "David E. Wheeler" 
      Date: Tue, 24 Sep 2013 09:37:31 -0700
      Subject: [PATCH 046/416] Switch to Pod::Simple::XHTML. There are a few reasons
       for this:
      
      * It's HTML output is *much* cleaner.
      * You can tell it not to emit headers and footers directly.
      
      The only downside is that you need a fairly recent version of Pod::Simple for
      it to be there and really solid. I recommend 3.12 or higher, and at least
      3.11.
      ---
       README.md             |  2 +-
       lib/github/markups.rb | 12 ++----------
       2 files changed, 3 insertions(+), 11 deletions(-)
      
      diff --git a/README.md b/README.md
      index 5def29b6..39e23c98 100644
      --- a/README.md
      +++ b/README.md
      @@ -18,7 +18,7 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a
       * [.mediawiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth`
       * [.rst](http://docutils.sourceforge.net/rst.html) -- `easy_install docutils`
       * [.asciidoc, .adoc, .asc](http://asciidoc.org/) -- `gem install asciidoctor` (http://asciidoctor.org)
      -* [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::HTML`
      +* [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::XHTML`
         comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN.
       
       HTML sanitization
      diff --git a/lib/github/markups.rb b/lib/github/markups.rb
      index cb771f1c..ac2c6454 100644
      --- a/lib/github/markups.rb
      +++ b/lib/github/markups.rb
      @@ -32,13 +32,5 @@
       
       command(:rest2html, /re?st(\.txt)?/)
       
      -# pod2html is nice enough to generate a full-on HTML document for us,
      -# so we return the favor by ripping out the good parts.
      -#
      -# Any block passed to `command` will be handed the command's STDOUT for
      -# post processing.
      -command("/usr/bin/env perl -MPod::Simple::HTML -e Pod::Simple::HTML::go", /pod/) do |rendered|
      -  if rendered =~ /\s*(.+)\s*/mi
      -    $1
      -  end
      -end
      +command("/usr/bin/env perldoc -MPod::Simple::XHTML -w html_header: -w html_footer:", /pod/)
      +
      
      From da384a69f71673df6116299e575bd1f0231082b2 Mon Sep 17 00:00:00 2001
      From: "David E. Wheeler" 
      Date: Tue, 21 Jan 2014 21:52:43 -0800
      Subject: [PATCH 047/416] Update Pod test.
      
      ---
       test/markups/README.pod.html | 104 +++++++++++------------------------
       1 file changed, 33 insertions(+), 71 deletions(-)
      
      diff --git a/test/markups/README.pod.html b/test/markups/README.pod.html
      index 8bc00b37..9f0f9194 100644
      --- a/test/markups/README.pod.html
      +++ b/test/markups/README.pod.html
      @@ -1,106 +1,68 @@
      -
      +

      Matrixy

      -

      Matrixy

      +

      INTRODUCTION

      -

      INTRODUCTION

      +

      This is a port of the MATLAB/Octave programming language to Parrot. See the ROADMAP file for more information on the status of this project, and what else needs to be done.

      -

      This is a port of the MATLAB/Octave programming language to Parrot. -See the ROADMAP file for more information on the status of this project, -and what else needs to be done.

      - -

      ABOUT

      +

      ABOUT

      Primary goals are:

      -
      +
        +

        =item* Create a working compiler that understands the majority of the MATLAB/Octave programming language.

        -
      -

      IMPLEMENTATION

      +
    + +

    IMPLEMENTATION

    This project is broken into three primary components:

    -
    -

    =item* The first is the parser, -located in the src/parser/ directory. -The parser proper is composed of three source files, -grammar.pg which is a Perl6Grammar file, -and actions.pm which is the associated actions file written in NQP, -and grammar-oper.pm which is the operator precidence parser. -In addition, -several helper functions used by the parser are located in src/internals.

    - -

    =item* The second component is the library of builtin functions in the src/builtins/ directory. -These functions are, -currently, -written primarily in PIR. -Function names prefixed with an underscore are "private" functions for use with the parser. -Other functions should have names which are the same as names for regular MATLAB or Octave functions, -since they will be available to the HLL. -These are also separated into different namespaces depending on visibility and utility.

    - -

    =item* A number of library functions are written in M, -or mostly M with some inline PIR code in toolbox/.

    -
    - -

    DEPENDENCIES

    +
      + +

      =item* The first is the parser, located in the src/parser/ directory. The parser proper is composed of three source files, grammar.pg which is a Perl6Grammar file, and actions.pm which is the associated actions file written in NQP, and grammar-oper.pm which is the operator precidence parser. In addition, several helper functions used by the parser are located in src/internals.

      + +

      =item* The second component is the library of builtin functions in the src/builtins/ directory. These functions are, currently, written primarily in PIR. Function names prefixed with an underscore are "private" functions for use with the parser. Other functions should have names which are the same as names for regular MATLAB or Octave functions, since they will be available to the HLL. These are also separated into different namespaces depending on visibility and utility.

      + +

      =item* A number of library functions are written in M, or mostly M with some inline PIR code in toolbox/.

      + +
    + +

    DEPENDENCIES

    Matrixy depends on these dependencies:

    -

    Parrot

    +

    Parrot

    -

    To get a proper version of Parrot to build Matrixy, -you will need to check out and build Parrot from source:

    +

    To get a proper version of Parrot to build Matrixy, you will need to check out and build Parrot from source:

    -
        svn co http://svn.parrot.org/parrot/trunk parrot
    +
        svn co http://svn.parrot.org/parrot/trunk parrot
         cd parrot
         perl Configure.pl
    -    make && make test && make install-dev
    + make && make test && make install-dev
    -

    Parrot-Linear-Algebra

    +

    Parrot-Linear-Algebra

    The linear algebra package for Parrot is available separately and provides functionality required by Matrixy. This includes matrix data types and matrix manipulation libraries

    -

    BUILDING

    +

    BUILDING

    Once all dependencies are in place, you can build Matrixy using this sequence of commands:

    -
        perl Configure.pl
    -    nmake test
    +
        perl Configure.pl
    +    nmake test
    -

    TODO

    +

    TODO

    -
        * Parser
    +
        * Parser
         * Standard Builtins
    -    * Test against Octave Test Suite.
    + * Test against Octave Test Suite.
    -

    BUGS

    +

    BUGS

    Lots!

    -

    CONTACT

    +

    CONTACT

    If you need to contact the Matrixy team, go to the project home page at:

    From 933cf783393f65eb486852f21663fb0e06134ac1 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Tue, 21 Jan 2014 21:57:32 -0800 Subject: [PATCH 048/416] Fix Pod list items. --- test/markups/README.pod | 8 ++++---- test/markups/README.pod.html | 12 ++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/test/markups/README.pod b/test/markups/README.pod index f7b5aac5..f6ad2c48 100644 --- a/test/markups/README.pod +++ b/test/markups/README.pod @@ -12,7 +12,7 @@ Primary goals are: =over 4 -=item* Create a working compiler that understands the majority of the +=item * Create a working compiler that understands the majority of the MATLAB/Octave programming language. =back @@ -23,14 +23,14 @@ This project is broken into three primary components: =over 4 -=item* The first is the parser, located in the C directory. The +=item * The first is the parser, located in the C directory. The parser proper is composed of three source files, F which is a Perl6Grammar file, and F which is the associated actions file written in NQP, and F which is the operator precidence parser. In addition, several helper functions used by the parser are located in C. -=item* The second component is the library of builtin functions in the +=item * The second component is the library of builtin functions in the C directory. These functions are, currently, written primarily in PIR. Function names prefixed with an underscore are "private" functions for use with the parser. Other functions should have names which are the same as names @@ -38,7 +38,7 @@ for regular MATLAB or Octave functions, since they will be available to the HLL. These are also separated into different namespaces depending on visibility and utility. -=item* A number of library functions are written in M, or mostly M with some +=item * A number of library functions are written in M, or mostly M with some inline PIR code in C. =back diff --git a/test/markups/README.pod.html b/test/markups/README.pod.html index 9f0f9194..e5c73eee 100644 --- a/test/markups/README.pod.html +++ b/test/markups/README.pod.html @@ -10,8 +10,9 @@

    ABOUT

      -

      =item* Create a working compiler that understands the majority of the MATLAB/Octave programming language.

      +
    • Create a working compiler that understands the majority of the MATLAB/Octave programming language.

      +

    IMPLEMENTATION

    @@ -20,12 +21,15 @@

    IMPLEMENTATION

      -

      =item* The first is the parser, located in the src/parser/ directory. The parser proper is composed of three source files, grammar.pg which is a Perl6Grammar file, and actions.pm which is the associated actions file written in NQP, and grammar-oper.pm which is the operator precidence parser. In addition, several helper functions used by the parser are located in src/internals.

      +
    • The first is the parser, located in the src/parser/ directory. The parser proper is composed of three source files, grammar.pg which is a Perl6Grammar file, and actions.pm which is the associated actions file written in NQP, and grammar-oper.pm which is the operator precidence parser. In addition, several helper functions used by the parser are located in src/internals.

      -

      =item* The second component is the library of builtin functions in the src/builtins/ directory. These functions are, currently, written primarily in PIR. Function names prefixed with an underscore are "private" functions for use with the parser. Other functions should have names which are the same as names for regular MATLAB or Octave functions, since they will be available to the HLL. These are also separated into different namespaces depending on visibility and utility.

      +
    • +
    • The second component is the library of builtin functions in the src/builtins/ directory. These functions are, currently, written primarily in PIR. Function names prefixed with an underscore are "private" functions for use with the parser. Other functions should have names which are the same as names for regular MATLAB or Octave functions, since they will be available to the HLL. These are also separated into different namespaces depending on visibility and utility.

      -

      =item* A number of library functions are written in M, or mostly M with some inline PIR code in toolbox/.

      +
    • +
    • A number of library functions are written in M, or mostly M with some inline PIR code in toolbox/.

      +

    DEPENDENCIES

    From 7f7913e601bc9baea5e8fa93bf498646e7379b58 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Thu, 23 Jan 2014 20:27:58 -0800 Subject: [PATCH 049/416] Try installing Pod::Simple::XHTML before testing. --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8d70dc0c..e98ea5af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ -before_install: sudo pip install docutils +before_install: + - sudo pip install docutils + - sudo cpanm --installdeps --notest Pod::Simple rvm: - 1.9.3 - 2.0.0 From 874f2795900aa14290f13b2c7a1a9e831b18f0db Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Thu, 23 Jan 2014 20:40:45 -0800 Subject: [PATCH 050/416] Install cpanm. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e98ea5af..3ff24e31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ before_install: - - sudo pip install docutils + - sudo pip install docutils cpanminus - sudo cpanm --installdeps --notest Pod::Simple rvm: - 1.9.3 From e79260d0deac3483c726e07d5cfbd38fed845c15 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Thu, 23 Jan 2014 20:46:32 -0800 Subject: [PATCH 051/416] Cannot find the cpanm .deb, so install from source. I'm sure there is one, since Perl builds use it, but I don't know what it's called. This will do for now. --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3ff24e31..75a4fb1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ before_install: - - sudo pip install docutils cpanminus + - sudo pip install docutils + - curl -L http://cpanmin.us | perl - --sudo App::cpanminus - sudo cpanm --installdeps --notest Pod::Simple rvm: - 1.9.3 From e209388a56063fae808b2a9caf8280f2abde882f Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Thu, 23 Jan 2014 20:50:44 -0800 Subject: [PATCH 052/416] Try installing perl-doc. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 75a4fb1c..a9a0cbeb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ before_install: - sudo pip install docutils + - sudo apt-get install perl-doc - curl -L http://cpanmin.us | perl - --sudo App::cpanminus - sudo cpanm --installdeps --notest Pod::Simple rvm: From f506b135a9f2ff8593a1055c84e33bd706d0ade9 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Fri, 24 Jan 2014 14:19:16 -0800 Subject: [PATCH 053/416] Try runing perldoc in before_install. To see what the errors are. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index a9a0cbeb..99be22a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ before_install: - sudo apt-get install perl-doc - curl -L http://cpanmin.us | perl - --sudo App::cpanminus - sudo cpanm --installdeps --notest Pod::Simple + - /usr/bin/env perldoc -MPod::Simple::XHTML -w html_header: -w html_footer: test/markups/README.pod rvm: - 1.9.3 - 2.0.0 From 090cedffec130a20f2b104080d1ee8e0d565fe40 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Fri, 24 Jan 2014 15:34:53 -0800 Subject: [PATCH 054/416] Quote string. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 99be22a4..cbaa2ca4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ before_install: - sudo apt-get install perl-doc - curl -L http://cpanmin.us | perl - --sudo App::cpanminus - sudo cpanm --installdeps --notest Pod::Simple - - /usr/bin/env perldoc -MPod::Simple::XHTML -w html_header: -w html_footer: test/markups/README.pod + - "/usr/bin/env perldoc -MPod::Simple::XHTML -w html_header: -w html_footer: test/markups/README.pod" rvm: - 1.9.3 - 2.0.0 From 236b992a068bc7ca0a9d4fa111b7b5c3247ffeba Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Fri, 24 Jan 2014 15:39:54 -0800 Subject: [PATCH 055/416] No pager. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cbaa2ca4..00b83f91 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ before_install: - sudo apt-get install perl-doc - curl -L http://cpanmin.us | perl - --sudo App::cpanminus - sudo cpanm --installdeps --notest Pod::Simple - - "/usr/bin/env perldoc -MPod::Simple::XHTML -w html_header: -w html_footer: test/markups/README.pod" + - "/usr/bin/env perldoc -MPod::Simple::XHTML -w html_header: -w html_footer: -T test/markups/README.pod" rvm: - 1.9.3 - 2.0.0 From 2eb3c2dd015c9614416ea606486e3954289b8c46 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Fri, 24 Jan 2014 15:43:10 -0800 Subject: [PATCH 056/416] Maybe need to explicitly send the command to STDOUT? --- .travis.yml | 1 - lib/github/markups.rb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 00b83f91..a9a0cbeb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ before_install: - sudo apt-get install perl-doc - curl -L http://cpanmin.us | perl - --sudo App::cpanminus - sudo cpanm --installdeps --notest Pod::Simple - - "/usr/bin/env perldoc -MPod::Simple::XHTML -w html_header: -w html_footer: -T test/markups/README.pod" rvm: - 1.9.3 - 2.0.0 diff --git a/lib/github/markups.rb b/lib/github/markups.rb index ac2c6454..6de42d0b 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -32,5 +32,5 @@ command(:rest2html, /re?st(\.txt)?/) -command("/usr/bin/env perldoc -MPod::Simple::XHTML -w html_header: -w html_footer:", /pod/) +command("/usr/bin/env perldoc -MPod::Simple::XHTML -w html_header: -w html_footer: -T", /pod/) From e0ff850342811817da3a60def45f5bbe61bd3143 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Tue, 4 Feb 2014 11:19:24 -0800 Subject: [PATCH 057/416] Disable exception handling. --- lib/github/markup/command_implementation.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index 9c531f0d..42ccd022 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -42,10 +42,10 @@ def execute(command, target) out = stdout.read end out.gsub("\r", '') - rescue Errno::EPIPE - "" - rescue Errno::ENOENT - "" + # rescue Errno::EPIPE + # "" + # rescue Errno::ENOENT + # "" end end end From 510f4d61d98a46a5ca418bdeab8e9779f4253017 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Wed, 5 Feb 2014 13:52:39 -0800 Subject: [PATCH 058/416] Whitespace change, try to get Travis to go. --- lib/github/markup/command_implementation.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index 42ccd022..96c97471 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -6,6 +6,7 @@ require "github/markup/implementation" + module GitHub module Markup class CommandImplementation < Implementation From 16dbe0cff5cafc1e7dca66d83e27364ec690fe0d Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Thu, 6 Feb 2014 17:08:57 -0800 Subject: [PATCH 059/416] Add pod2html. By putting it all into a Perl script, we can more easily control things, including being able to add code to sent the indentation for verbatim blocks to the indentation of the first line. --- lib/github/commands/pod2html | 14 ++++++++++++++ lib/github/markup/command_implementation.rb | 8 ++++---- lib/github/markups.rb | 2 +- test/markups/README.pod.html | 18 +++++++++--------- 4 files changed, 28 insertions(+), 14 deletions(-) create mode 100755 lib/github/commands/pod2html diff --git a/lib/github/commands/pod2html b/lib/github/commands/pod2html new file mode 100755 index 00000000..b9539468 --- /dev/null +++ b/lib/github/commands/pod2html @@ -0,0 +1,14 @@ +#!/usr/bin/env perl -w + +use strict; +use Pod::Simple::XHTML 3.11; + +my $p = Pod::Simple::XHTML->new; +$p->html_header(''); +$p->html_footer(''); +$p->strip_verbatim_indent(sub { + my $lines = shift; + (my $indent = $lines->[0]) =~ s/\S.*//; + return $indent; +}); +$p->parse_from_file(shift); diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index 96c97471..a1eed93a 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -43,10 +43,10 @@ def execute(command, target) out = stdout.read end out.gsub("\r", '') - # rescue Errno::EPIPE - # "" - # rescue Errno::ENOENT - # "" + rescue Errno::EPIPE + "" + rescue Errno::ENOENT + "" end end end diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 6de42d0b..3f694225 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -32,5 +32,5 @@ command(:rest2html, /re?st(\.txt)?/) -command("/usr/bin/env perldoc -MPod::Simple::XHTML -w html_header: -w html_footer: -T", /pod/) +command(:pod2html, /pod/) diff --git a/test/markups/README.pod.html b/test/markups/README.pod.html index e5c73eee..4c49ef20 100644 --- a/test/markups/README.pod.html +++ b/test/markups/README.pod.html @@ -40,10 +40,10 @@

    Parrot

    To get a proper version of Parrot to build Matrixy, you will need to check out and build Parrot from source:

    -
        svn co http://svn.parrot.org/parrot/trunk parrot
    -    cd parrot
    -    perl Configure.pl
    -    make && make test && make install-dev
    +
    svn co http://svn.parrot.org/parrot/trunk parrot
    +cd parrot
    +perl Configure.pl
    +make && make test && make install-dev

    Parrot-Linear-Algebra

    @@ -53,14 +53,14 @@

    BUILDING

    Once all dependencies are in place, you can build Matrixy using this sequence of commands:

    -
        perl Configure.pl
    -    nmake test
    +
    perl Configure.pl
    +nmake test

    TODO

    -
        * Parser
    -    * Standard Builtins
    -    * Test against Octave Test Suite.
    +
    * Parser
    +* Standard Builtins
    +* Test against Octave Test Suite.

    BUGS

    From 3a5159d148430e878329b6d3a3a15a0f7756eaea Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Mon, 10 Feb 2014 14:30:04 -0800 Subject: [PATCH 060/416] Remove installation of stuff. The perl-doc package failed to install with a 404. But maybe it will not be needed now. --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index a9a0cbeb..48d5cfb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,5 @@ before_install: - sudo pip install docutils - - sudo apt-get install perl-doc - - curl -L http://cpanmin.us | perl - --sudo App::cpanminus - - sudo cpanm --installdeps --notest Pod::Simple rvm: - 1.9.3 - 2.0.0 From 60a6fc884acc74cc25a30e9c6d0e41f5e471e55f Mon Sep 17 00:00:00 2001 From: Waldemar Quevedo Date: Thu, 13 Feb 2014 21:44:06 +0900 Subject: [PATCH 061/416] Use org-ruby 0.9.1 instead --- Gemfile | 2 +- test/markups/README.org.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index a08970e7..5749a338 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "http://rubygems.org" gem "redcarpet" gem "RedCloth" gem "rdoc", "~>3.6" -gem "org-ruby", ">= 0.9.0" +gem "org-ruby", ">= 0.9.1" gem "creole", "~>0.3.6" gem "wikicloth", "=0.6.0" gem "literati", "= 0.0.3" diff --git a/test/markups/README.org.html b/test/markups/README.org.html index 84abc77a..30ea31cf 100644 --- a/test/markups/README.org.html +++ b/test/markups/README.org.html @@ -21,7 +21,7 @@

    2.1 2014-02-08: Version
     module GitHub
       module Markup
    -    VERSION = 'test'
    +    VERSION = 'test'
         Version = VERSION
       end
     end
    
    From 0dcf0f504625e66bca47620e1c8e6fc06f940f05 Mon Sep 17 00:00:00 2001
    From: Garen Torikian 
    Date: Thu, 13 Feb 2014 16:29:55 -0800
    Subject: [PATCH 062/416] Do not add superfluous div tags to the document, or
     sections
    
    ---
     lib/github/commands/rest2html | 16 ++++++++++++++++
     1 file changed, 16 insertions(+)
    
    diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html
    index 66ebf42c..f6f8b6e2 100755
    --- a/lib/github/commands/rest2html
    +++ b/lib/github/commands/rest2html
    @@ -8,6 +8,7 @@ Brandon Keepers 
     Bryan Veloso 
     Chris Wanstrath 
     Dave Abrahams 
    +Garen Torikian 
     Gasper Zejn 
     Michael Jones 
     Sam Whited 
    @@ -50,6 +51,21 @@ SETTINGS = {
     }
     
     class GitHubHTMLTranslator(HTMLTranslator):
    +    # removes the 
    tag wrapped around docs + # see also: http://bit.ly/1exfq2h (warning! sourceforge link.) + def depart_document(self, node): + HTMLTranslator.depart_document(self, node) + self.html_body.pop(0) + self.html_body.pop() + + # technique for visiting sections, without generating additional divs + # see also: http://bit.ly/NHtyRx + def visit_section(self, node): + self.section_level += 1 + + def depart_section(self, node): + self.section_level -= 1 + def visit_literal_block(self, node): classes = node.attributes['classes'] if len(classes) >= 2 and classes[0] == 'code': From 70e6d5a64581a95b33bfe5a1d3e9a95a9034cc93 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 13 Feb 2014 16:30:14 -0800 Subject: [PATCH 063/416] Fix RST tests to remove superfluous divs --- test/markups/README.rst.html | 6 ------ test/markups/README.rst.txt.html | 7 ------- 2 files changed, 13 deletions(-) diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index b117e888..5bb052bb 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -1,8 +1,5 @@ -
    -

    Header 1

    Example text.

    -

    Header 2

    1. Blah blah code blah
    2. @@ -32,6 +29,3 @@

      Header 2

      -
    -
    -
    diff --git a/test/markups/README.rst.txt.html b/test/markups/README.rst.txt.html index 8e26e4f0..e60a5403 100644 --- a/test/markups/README.rst.txt.html +++ b/test/markups/README.rst.txt.html @@ -1,14 +1,7 @@ -
    -

    Header 1

    Example text.

    -

    Header 2

    1. Blah blah code blah
    2. More code, hooray
    -
    -
    -
    - From e54ca4ada29bb12cef069023150b58f283465145 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 14 Feb 2014 15:52:09 -0800 Subject: [PATCH 064/416] Prepare release v1.0.2 --- lib/github-markup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 7324a34c..7833199f 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.0.1' + VERSION = '1.0.2' Version = VERSION end end From 079e651a61c7f6b2d24e70293ba6bd683fbb5374 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 14 Feb 2014 15:52:15 -0800 Subject: [PATCH 065/416] Release 1.0.2 --- github-markup.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index 6eddf8fe..47c61ccd 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| ## the sub! line in the Rakefile s.name = 'github-markup' s.version = GitHub::Markup::VERSION - s.date = '2014-01-28' + s.date = '2014-02-14' s.executables = ['github-markup'] ## Make sure your summary is short. The description may be as long From 026d50f34f37512e25c819966043af0ef9239a06 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Tue, 18 Feb 2014 20:13:23 +0100 Subject: [PATCH 066/416] Use `posix-spawn` for builtin commands --- Gemfile | 1 + lib/github/markup/command_implementation.rb | 9 ++------- lib/github/markups.rb | 4 ++-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index d573ef30..5fa81d34 100644 --- a/Gemfile +++ b/Gemfile @@ -8,3 +8,4 @@ gem "wikicloth", "=0.6.0" gem "literati", "= 0.0.3" gem "asciidoctor", "= 0.1.4" gem "rake" +gem "posix-spawn" diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index 9c531f0d..cbb4621a 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -1,9 +1,4 @@ -begin - require "open3_detach" -rescue LoadError - require "open3" -end - +require "posix-spawn" require "github/markup/implementation" module GitHub @@ -36,7 +31,7 @@ def call_block(rendered, content) def execute(command, target) out = '' - Open3.popen3(command) do |stdin, stdout, _| + POSIX::Spawn.popen4(command) do |_, stdin, stdout, _| stdin.puts target stdin.close out = stdout.read diff --git a/lib/github/markups.rb b/lib/github/markups.rb index cb771f1c..7b1a02a8 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -30,14 +30,14 @@ Asciidoctor.render(content, :safe => :secure, :attributes => %w(showtitle idprefix idseparator=- env=github env-github source-highlighter=html-pipeline)) end -command(:rest2html, /re?st(\.txt)?/) +command('rest2html', /re?st(\.txt)?/) # pod2html is nice enough to generate a full-on HTML document for us, # so we return the favor by ripping out the good parts. # # Any block passed to `command` will be handed the command's STDOUT for # post processing. -command("/usr/bin/env perl -MPod::Simple::HTML -e Pod::Simple::HTML::go", /pod/) do |rendered| +command(['/usr/bin/env', 'perl', '-MPod::Simple::HTML', '-e', 'Pod::Simple::HTML::go'], /pod/) do |rendered| if rendered =~ /\s*(.+)\s*/mi $1 end From 8b2499b13e6095095a613cbcb2e26b831584d08c Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Tue, 18 Feb 2014 20:56:35 +0100 Subject: [PATCH 067/416] POSIX::Spawn.popen4 doesn't have block syntax --- lib/github/markup/command_implementation.rb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index cbb4621a..c8051696 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -30,12 +30,17 @@ def call_block(rendered, content) end def execute(command, target) - out = '' - POSIX::Spawn.popen4(command) do |_, stdin, stdout, _| - stdin.puts target - stdin.close - out = stdout.read - end + pid, stdin, stdout, stderr = POSIX::Spawn.popen4(*command) + + stdin.puts target + stdin.close + + Process.waitpid pid + + out = stdout.read + stdout.close + stderr.close + out.gsub("\r", '') rescue Errno::EPIPE "" From f9be7946906c3de2a0aed7834ff5da20b58947ea Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Tue, 18 Feb 2014 22:03:35 +0100 Subject: [PATCH 068/416] Use POSIX::Spawn::Child --- lib/github/markup/command_implementation.rb | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index c8051696..22c68637 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -30,18 +30,8 @@ def call_block(rendered, content) end def execute(command, target) - pid, stdin, stdout, stderr = POSIX::Spawn.popen4(*command) - - stdin.puts target - stdin.close - - Process.waitpid pid - - out = stdout.read - stdout.close - stderr.close - - out.gsub("\r", '') + spawn = POSIX::Spawn::Child.new(*command, :input => target) + spawn.out.gsub("\r", '') rescue Errno::EPIPE "" rescue Errno::ENOENT From 57ae6e4291ffe40eb97f44d2b7bdcaa235d534e1 Mon Sep 17 00:00:00 2001 From: Shinya Okano Date: Wed, 26 Feb 2014 01:24:10 +0900 Subject: [PATCH 069/416] Correct some tests --- test/markup_test.rb | 2 +- test/markups/README.lhs.html | 2 +- test/markups/README.litcoffee.html | 16 ++++++++-------- test/markups/README.rst.html | 2 +- test/markups/README.rst.txt | 8 ++++++++ test/markups/README.rst.txt.html | 24 ++++++++++++++++++++++++ 6 files changed, 43 insertions(+), 11 deletions(-) diff --git a/test/markup_test.rb b/test/markup_test.rb index 6f062c39..742b5747 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -13,7 +13,7 @@ class MarkupTest < Test::Unit::TestCase expected_file = "#{readme}.html" expected = File.read(expected_file).rstrip - actual = GitHub::Markup.render(readme, File.read(readme)).rstrip + actual = GitHub::Markup.render(readme, File.read(readme)).rstrip.force_encoding("utf-8") if source != expected assert(source != actual, "#{markup} did not render anything") diff --git a/test/markups/README.lhs.html b/test/markups/README.lhs.html index eb2a30a1..a2dbea79 100644 --- a/test/markups/README.lhs.html +++ b/test/markups/README.lhs.html @@ -2,7 +2,7 @@

    Markdown

    Except with more magic added.

    -
    isPrefixOf              :: (Eq a) => [a] -> [a] -> Bool
    +
    isPrefixOf              :: (Eq a) => [a] -> [a] -> Bool
     isPrefixOf [] _         =  True
     isPrefixOf _  []        =  False
     isPrefixOf (x:xs) (y:ys)=  x == y && isPrefixOf xs ys
    diff --git a/test/markups/README.litcoffee.html b/test/markups/README.litcoffee.html
    index 69255d21..e33f2349 100644
    --- a/test/markups/README.litcoffee.html
    +++ b/test/markups/README.litcoffee.html
    @@ -6,18 +6,18 @@ 

    Literate CoffeeScript Test

    comment comment

    -
    test "basic literate CoffeeScript parsing", ->
    +
    test "basic literate CoffeeScript parsing", ->
       ok yes
     

    now with a...

    -
    test "broken up indentation", ->
    +
    test "broken up indentation", ->
     

    ... broken up ...

    -
      do ->
    +
      do ->
     

    ... nested block.

    @@ -27,7 +27,7 @@

    Literate CoffeeScript Test

    Code must be separated from text by a blank line.

    -
    test "code blocks must be preceded by a blank line", ->
    +
    test "code blocks must be preceded by a blank line", ->
     

    The next line is part of the text and will not be executed. @@ -38,9 +38,9 @@

    Literate CoffeeScript Test

    Code in backticks is not parsed and...

    -
    test "comments in indented blocks work", ->
    -  do ->
    -    do ->
    +
    test "comments in indented blocks work", ->
    +  do ->
    +    do ->
           # Regular comment.
     
           ###
    @@ -62,5 +62,5 @@ 

    Literate CoffeeScript Test

    Tabs work too:

    -

    test "tabbed code", -> +

    test "tabbed code", -> ok yes

    diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index 5bb052bb..477abaa2 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -28,4 +28,4 @@

    Header 2

    https://github.com/tony/pullv - + \ No newline at end of file diff --git a/test/markups/README.rst.txt b/test/markups/README.rst.txt index add90768..d420def0 100644 --- a/test/markups/README.rst.txt +++ b/test/markups/README.rst.txt @@ -10,4 +10,12 @@ Header 2 2. More ``code``, hooray +3. Somé UTF-8° +============== ========================================================== +Travis http://travis-ci.org/tony/pullv +Docs http://pullv.rtfd.org +API http://pullv.readthedocs.org/en/latest/api.html +Issues https://github.com/tony/pullv/issues +Source https://github.com/tony/pullv +============== ========================================================== diff --git a/test/markups/README.rst.txt.html b/test/markups/README.rst.txt.html index e60a5403..477abaa2 100644 --- a/test/markups/README.rst.txt.html +++ b/test/markups/README.rst.txt.html @@ -4,4 +4,28 @@

    Header 2

    1. Blah blah code blah
    2. More code, hooray
    3. +
    4. Somé UTF-8°
    + ++++ + + + + + + + + + + + + + + + + + +
    Travishttp://travis-ci.org/tony/pullv
    Docshttp://pullv.rtfd.org
    APIhttp://pullv.readthedocs.org/en/latest/api.html
    Issueshttps://github.com/tony/pullv/issues
    Sourcehttps://github.com/tony/pullv
    \ No newline at end of file From 35ad339ae6098547d91687ea67ed374665482a21 Mon Sep 17 00:00:00 2001 From: Shinya Okano Date: Wed, 26 Feb 2014 01:50:06 +0900 Subject: [PATCH 070/416] Fix pod command --- lib/github/markups.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 7b1a02a8..d94bd4ec 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -37,7 +37,7 @@ # # Any block passed to `command` will be handed the command's STDOUT for # post processing. -command(['/usr/bin/env', 'perl', '-MPod::Simple::HTML', '-e', 'Pod::Simple::HTML::go'], /pod/) do |rendered| +command('/usr/bin/env perl -MPod::Simple::HTML -e Pod::Simple::HTML::go', /pod/) do |rendered| if rendered =~ /\s*(.+)\s*/mi $1 end From c422187fb92f10a648ce47588c966f798e1f43fe Mon Sep 17 00:00:00 2001 From: Shinya Okano Date: Wed, 26 Feb 2014 01:57:38 +0900 Subject: [PATCH 071/416] Add test target ruby-2.1.1 for travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 8d70dc0c..efbff2ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ before_install: sudo pip install docutils rvm: - 1.9.3 - 2.0.0 + - 2.1.1 notifications: disabled: true bundler_args: --without development From 6b8f96a54757cd30ada432ec028ef4948ecd5dfe Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 25 Feb 2014 12:30:25 -0800 Subject: [PATCH 072/416] Release 1.0.3 --- lib/github-markup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 7833199f..b5bf48b9 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.0.2' + VERSION = '1.0.3' Version = VERSION end end From 0e7470a37a81fad84655cd29aee20de0c9a3d803 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 25 Feb 2014 12:30:31 -0800 Subject: [PATCH 073/416] Release 1.0.3 --- github-markup.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index 47c61ccd..71df6044 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| ## the sub! line in the Rakefile s.name = 'github-markup' s.version = GitHub::Markup::VERSION - s.date = '2014-02-14' + s.date = '2014-02-25' s.executables = ['github-markup'] ## Make sure your summary is short. The description may be as long From 2672c008236200bf614abbf7815144946c90ca7e Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Tue, 4 Mar 2014 13:18:25 -0500 Subject: [PATCH 074/416] Declare dependency on posix-spawn --- Gemfile | 1 - github-markup.gemspec | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 5fa81d34..d573ef30 100644 --- a/Gemfile +++ b/Gemfile @@ -8,4 +8,3 @@ gem "wikicloth", "=0.6.0" gem "literati", "= 0.0.3" gem "asciidoctor", "= 0.1.4" gem "rake" -gem "posix-spawn" diff --git a/github-markup.gemspec b/github-markup.gemspec index 71df6044..2b7622ab 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -109,5 +109,6 @@ desc ## Test files will be grabbed from the file list. Make sure the path glob ## matches what you actually use. s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ } -end + s.add_dependency 'posix-spawn', '~> 0.3.8' +end From f2953c62b7338840376a32e9b45a8ea926dfff98 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Wed, 5 Mar 2014 10:23:44 -0500 Subject: [PATCH 075/416] add gemspec to the Gemfile --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index d573ef30..2132c473 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,5 @@ source "http://rubygems.org" +gemspec gem "redcarpet" gem "RedCloth" gem "rdoc", "~>3.6" From 73d5ebde9639f0e34025c8335c41569699fc61fe Mon Sep 17 00:00:00 2001 From: Miles Gould Date: Fri, 7 Mar 2014 10:35:42 +0000 Subject: [PATCH 076/416] Remove rendering of literate Haskell. This was breaking display of a lot of code files: see #196. --- Gemfile | 1 - lib/github/markups.rb | 4 ---- test/markups/README.lhs | 10 ---------- test/markups/README.lhs.html | 11 ----------- 4 files changed, 26 deletions(-) delete mode 100644 test/markups/README.lhs delete mode 100644 test/markups/README.lhs.html diff --git a/Gemfile b/Gemfile index 5fa81d34..eb306dcd 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,6 @@ gem "rdoc", "~>3.6" gem "org-ruby", ">= 0.8.1" gem "creole", "~>0.3.6" gem "wikicloth", "=0.6.0" -gem "literati", "= 0.0.3" gem "asciidoctor", "= 0.1.4" gem "rake" gem "posix-spawn" diff --git a/lib/github/markups.rb b/lib/github/markups.rb index d94bd4ec..6fbe09e6 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -22,10 +22,6 @@ WikiCloth::WikiCloth.new(:data => content).to_html(:noedit => true) end -markup(:literati, /lhs/) do |content| - Literati.render(content) -end - markup(:asciidoctor, /adoc|asc(iidoc)?/) do |content| Asciidoctor.render(content, :safe => :secure, :attributes => %w(showtitle idprefix idseparator=- env=github env-github source-highlighter=html-pipeline)) end diff --git a/test/markups/README.lhs b/test/markups/README.lhs deleted file mode 100644 index e0b4467f..00000000 --- a/test/markups/README.lhs +++ /dev/null @@ -1,10 +0,0 @@ -# Markdown - -Except with more magic added. - -> isPrefixOf :: (Eq a) => [a] -> [a] -> Bool -> isPrefixOf [] _ = True -> isPrefixOf _ [] = False -> isPrefixOf (x:xs) (y:ys)= x == y && isPrefixOf xs ys - -And Haskell. A lot of Haskell. diff --git a/test/markups/README.lhs.html b/test/markups/README.lhs.html deleted file mode 100644 index a2dbea79..00000000 --- a/test/markups/README.lhs.html +++ /dev/null @@ -1,11 +0,0 @@ -

    Markdown

    - -

    Except with more magic added.

    - -
    isPrefixOf              :: (Eq a) => [a] -> [a] -> Bool
    -isPrefixOf [] _         =  True
    -isPrefixOf _  []        =  False
    -isPrefixOf (x:xs) (y:ys)=  x == y && isPrefixOf xs ys
    -
    - -

    And Haskell. A lot of Haskell.

    From 78ee2f09fd3f18a4cf4bab5eb45a1bcd176adbb3 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 7 Mar 2014 11:24:37 -0500 Subject: [PATCH 077/416] raise error if the command exits non-zero --- lib/github/markup/command_implementation.rb | 8 +++++++- test/markup_test.rb | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index 22c68637..a655e6d4 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -3,6 +3,8 @@ module GitHub module Markup + CommandError = Class.new(Exception) + class CommandImplementation < Implementation attr_reader :command, :block @@ -31,7 +33,11 @@ def call_block(rendered, content) def execute(command, target) spawn = POSIX::Spawn::Child.new(*command, :input => target) - spawn.out.gsub("\r", '') + if spawn.status.success? + spawn.out.gsub("\r", '') + else + raise CommandError.new(spawn.err) + end rescue Errno::EPIPE "" rescue Errno::ENOENT diff --git a/test/markup_test.rb b/test/markup_test.rb index 742b5747..289b15b0 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -54,4 +54,12 @@ def test_fails_gracefully_on_missing_env_commands actual = GitHub::Markup.render('README.tf', text) assert_equal text, actual end + + def test_raises_error_if_command_exits_non_zero + GitHub::Markup.command('echo "failure message" && false', /fail/) + assert GitHub::Markup.can_render?('README.fail') + assert_raises GitHub::Markup::CommandError, "failure message" do + GitHub::Markup.render('README.fail', "stop swallowing errors") + end + end end From 016a9ea08dc877bb5beb35861af48e176512eec7 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 7 Mar 2014 11:38:51 -0500 Subject: [PATCH 078/416] Test for failure message --- lib/github/markup/command_implementation.rb | 2 +- test/markup_test.rb | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index a655e6d4..9cd4dc04 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -36,7 +36,7 @@ def execute(command, target) if spawn.status.success? spawn.out.gsub("\r", '') else - raise CommandError.new(spawn.err) + raise CommandError.new(spawn.err.strip) end rescue Errno::EPIPE "" diff --git a/test/markup_test.rb b/test/markup_test.rb index 289b15b0..8d65d063 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -56,10 +56,14 @@ def test_fails_gracefully_on_missing_env_commands end def test_raises_error_if_command_exits_non_zero - GitHub::Markup.command('echo "failure message" && false', /fail/) + GitHub::Markup.command('echo "failure message">&2 && false', /fail/) assert GitHub::Markup.can_render?('README.fail') - assert_raises GitHub::Markup::CommandError, "failure message" do + begin GitHub::Markup.render('README.fail', "stop swallowing errors") + rescue GitHub::Markup::CommandError => e + assert_equal "failure message", e.message + else + fail "an exception was expected but was not raised" end end end From 8b1b254fd775beca0a6278a28a46c87593e20372 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 7 Mar 2014 11:42:28 -0500 Subject: [PATCH 079/416] Do not silently fail on missing commands --- test/markup_test.rb | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/test/markup_test.rb b/test/markup_test.rb index 8d65d063..b9070b1a 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -39,22 +39,6 @@ def test_knows_what_it_can_and_cannot_render assert_equal true, GitHub::Markup.can_render?('README.litcoffee') end - def test_fails_gracefully_on_missing_commands - GitHub::Markup.command(:i_made_it_up, /mde/) - text = 'hi there' - assert GitHub::Markup.can_render?('README.mde') - actual = GitHub::Markup.render('README.mde', text) - assert_equal text, actual - end - - def test_fails_gracefully_on_missing_env_commands - GitHub::Markup.command('/usr/bin/env totally_fake', /tf/) - text = 'hey mang' - assert GitHub::Markup.can_render?('README.tf') - actual = GitHub::Markup.render('README.tf', text) - assert_equal text, actual - end - def test_raises_error_if_command_exits_non_zero GitHub::Markup.command('echo "failure message">&2 && false', /fail/) assert GitHub::Markup.can_render?('README.fail') From 98ff4ee7a9f29d7e3636a44c56a14a062dd4066e Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 7 Mar 2014 11:45:24 -0500 Subject: [PATCH 080/416] Don't rescue Errno exceptions --- lib/github/markup/command_implementation.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index 9cd4dc04..d3bbafd9 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -38,10 +38,6 @@ def execute(command, target) else raise CommandError.new(spawn.err.strip) end - rescue Errno::EPIPE - "" - rescue Errno::ENOENT - "" end end end From 81d82e2218498375adf1be40e9f1c87455ac1ea7 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 7 Mar 2014 11:52:21 -0500 Subject: [PATCH 081/416] Extend RuntimeError, use class syntax --- lib/github/markup/command_implementation.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index d3bbafd9..2c244407 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -3,7 +3,8 @@ module GitHub module Markup - CommandError = Class.new(Exception) + class CommandError < RuntimeError + end class CommandImplementation < Implementation attr_reader :command, :block From 9dacfaae2be9b3c08d5c4fc8d1635f2be25d65bf Mon Sep 17 00:00:00 2001 From: flying-sheep Date: Sat, 8 Mar 2014 09:57:43 +0100 Subject: [PATCH 082/416] circumvent docutils bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …by switching python 2’s default encoding --- lib/github/commands/rest2html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index f6f8b6e2..98e7e7e7 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 -S """ rest2html - A small wrapper file for parsing ReST files at GitHub. @@ -27,13 +27,19 @@ __author__ = "Jannis Leidel" __license__ = "CC0" __version__ = "0.1" +import sys + +#fix docutils failing with unicode parameters to CSV-Tabl +#TODO: remove -S switch and the following 2 lines after switching system to python 3. +sys.setdefaultencoding('utf-8') +import site + try: import locale locale.setlocale(locale.LC_ALL, '') except: pass -import sys import codecs from docutils.core import publish_parts From fa63b369cdd1146e2669ec42d1d2dbb0c0d42515 Mon Sep 17 00:00:00 2001 From: flying-sheep Date: Sat, 8 Mar 2014 15:57:51 +0100 Subject: [PATCH 083/416] fixed call not relying on the (invalid) shebang --- lib/github/markups.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 6fbe09e6..7f527a34 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -26,7 +26,7 @@ Asciidoctor.render(content, :safe => :secure, :attributes => %w(showtitle idprefix idseparator=- env=github env-github source-highlighter=html-pipeline)) end -command('rest2html', /re?st(\.txt)?/) +command('python2 -S rest2html', /re?st(\.txt)?/) # pod2html is nice enough to generate a full-on HTML document for us, # so we return the favor by ripping out the good parts. From c3522812955164c6a5e49327e201f437054628b4 Mon Sep 17 00:00:00 2001 From: flying-sheep Date: Sat, 8 Mar 2014 16:10:48 +0100 Subject: [PATCH 084/416] =?UTF-8?q?use=20full=20path=20for=20new=20command?= =?UTF-8?q?=20(not=20pretty=E2=80=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/github/markups.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 7f527a34..4362d51c 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -26,7 +26,7 @@ Asciidoctor.render(content, :safe => :secure, :attributes => %w(showtitle idprefix idseparator=- env=github env-github source-highlighter=html-pipeline)) end -command('python2 -S rest2html', /re?st(\.txt)?/) +command("python2 -S #{File.dirname(__FILE__)}/commands/rest2html", /re?st(\.txt)?/) # pod2html is nice enough to generate a full-on HTML document for us, # so we return the favor by ripping out the good parts. From 5bbd165a48fbf082f0f23c5f108f47a82bcb3428 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 7 Mar 2014 17:05:12 -0500 Subject: [PATCH 085/416] Prepare 1.1.0 release --- HISTORY.md | 5 +++++ github-markup.gemspec | 4 +--- lib/github-markup.rb | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 2877ebe0..1f2d91a9 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,8 @@ +## 1.1.0 (2014-03-10) + +* Raise GitHub::Markup::CommandError if external command exits with a non-zero status. +* Remove support for literate Haskell (see #266) + ## 0.5.1 (2010-09-30) * Support relative path links in rdoc diff --git a/github-markup.gemspec b/github-markup.gemspec index 71df6044..840c6b55 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| ## the sub! line in the Rakefile s.name = 'github-markup' s.version = GitHub::Markup::VERSION - s.date = '2014-02-25' + s.date = '2014-03-10' s.executables = ['github-markup'] ## Make sure your summary is short. The description may be as long @@ -79,8 +79,6 @@ desc test/markups/README.asciidoc.html test/markups/README.creole test/markups/README.creole.html - test/markups/README.lhs - test/markups/README.lhs.html test/markups/README.litcoffee test/markups/README.litcoffee.html test/markups/README.markdown diff --git a/lib/github-markup.rb b/lib/github-markup.rb index b5bf48b9..ab85cca7 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.0.3' + VERSION = '1.1.0' Version = VERSION end end From 3d8d5abc554088c71a0698fd6807751877a438df Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Mon, 10 Mar 2014 13:54:22 -0400 Subject: [PATCH 086/416] Release 1.1.0 From 98ce306457f9a190b4b1fc74067df0f6799add3b Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 14 Mar 2014 15:10:20 -0400 Subject: [PATCH 087/416] Add test case to demonstrate UTF-8 bug --- lib/github/commands/rest2html | 2 +- test/markups/README.rst | 14 ++++++++++++++ test/markups/README.rst.html | 22 +++++++++++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 98e7e7e7..c54153aa 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -51,7 +51,7 @@ SETTINGS = { 'raw_enabled': False, 'strip_comments': True, 'doctitle_xform': False, - 'report_level': 5, + 'report_level': 3, 'syntax_highlight' : 'none', 'math_output' : 'latex' } diff --git a/test/markups/README.rst b/test/markups/README.rst index d420def0..e207534a 100644 --- a/test/markups/README.rst +++ b/test/markups/README.rst @@ -12,6 +12,20 @@ Header 2 3. Somé UTF-8° +The UTF-8 quote character in this table used to cause python to go boom. Now docutils just displays an error inline so the user can fix it. Upgrading to Python 3 will fix this. + +.. csv-table:: Things that are Awesome (on a scale of 1-11) + :quote: ” + + Thing,Awesomeness + Icecream, 7 + Honey Badgers, 10.5 + Nickelback, -2 + Iron Man, 10 + Iron Man 2, 3 + Tabular Data, 5 + Made up ratings, 11 + ============== ========================================================== Travis http://travis-ci.org/tony/pullv Docs http://pullv.rtfd.org diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index 477abaa2..562a8e89 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -6,6 +6,26 @@

    Header 2

  • More code, hooray
  • Somé UTF-8°
  • +

    The UTF-8 quote character in this table used to cause python to go boom. Now docutils just displays an error inline so the user can fix it. Upgrading to Python 3 will fix this.

    +
    +

    System Message: ERROR/3 (<string>, line 17)

    +

    Error with CSV data in "csv-table" directive: +"quotechar" must be an 1-character string

    +
    +.. csv-table:: Things that are Awesome (on a scale of 1-11)
    +        :quote: ”
    +
    +        Thing,Awesomeness
    +        Icecream, 7
    +        Honey Badgers, 10.5
    +        Nickelback, -2
    +        Iron Man, 10
    +        Iron Man 2, 3
    +        Tabular Data, 5
    +        Made up ratings, 11
    +
    +
    +
    @@ -28,4 +48,4 @@

    Header 2

    -
    https://github.com/tony/pullv
    \ No newline at end of file + From 6cbdd88833bbb9adfc654fe535fab509696eaf35 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 14 Mar 2014 15:13:24 -0400 Subject: [PATCH 088/416] Clean up comment --- lib/github/commands/rest2html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index c54153aa..eff55aa3 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -29,8 +29,8 @@ __version__ = "0.1" import sys -#fix docutils failing with unicode parameters to CSV-Tabl -#TODO: remove -S switch and the following 2 lines after switching system to python 3. +# This fixes docutils failing with unicode parameters to CSV-Table. The -S +# switch and the following 2 lines can be removed after upgrading to python 3. sys.setdefaultencoding('utf-8') import site From 123fd7382510f14bee51fd19821ef2dae9a9de6b Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Thu, 3 Apr 2014 14:19:27 -0400 Subject: [PATCH 089/416] Prepare 1.1.1 release --- HISTORY.md | 5 +++++ github-markup.gemspec | 2 +- lib/github-markup.rb | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 1f2d91a9..9cbf1284 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,8 @@ +## 1.1.1 (2014-04-03) + +* Upgrade to org-ruby 0.9.1 +* Set default encoding to UTF-8 for Python 2 + ## 1.1.0 (2014-03-10) * Raise GitHub::Markup::CommandError if external command exits with a non-zero status. diff --git a/github-markup.gemspec b/github-markup.gemspec index a59d7d36..b10f20d0 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| ## the sub! line in the Rakefile s.name = 'github-markup' s.version = GitHub::Markup::VERSION - s.date = '2014-03-10' + s.date = '2014-04-03' s.executables = ['github-markup'] ## Make sure your summary is short. The description may be as long diff --git a/lib/github-markup.rb b/lib/github-markup.rb index ab85cca7..c9e6cd2a 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.1.0' + VERSION = '1.1.1' Version = VERSION end end From 8834f9a23e17f7371276f7b99418b7acdd720a50 Mon Sep 17 00:00:00 2001 From: Waldemar Quevedo Date: Fri, 4 Apr 2014 06:31:03 +0900 Subject: [PATCH 090/416] Lock to org-ruby version 0.9.1 --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index d27ae2e5..c26d2d70 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ gemspec gem "redcarpet" gem "RedCloth" gem "rdoc", "~>3.6" -gem "org-ruby", ">= 0.9.1" +gem "org-ruby", "= 0.9.1" gem "creole", "~>0.3.6" gem "wikicloth", "=0.6.0" gem "asciidoctor", "= 0.1.4" From 329fe3978f126c1a5e7898f9cc68f30bef50ea30 Mon Sep 17 00:00:00 2001 From: Waldemar Quevedo Date: Thu, 10 Apr 2014 04:06:52 +0900 Subject: [PATCH 091/416] Set Org Ruby gem version to 0.9.1.gh to support syntax highlighting in Github --- Gemfile | 2 +- lib/github/markups.rb | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index c26d2d70..a35eac1c 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ gemspec gem "redcarpet" gem "RedCloth" gem "rdoc", "~>3.6" -gem "org-ruby", "= 0.9.1" +gem "org-ruby", "= 0.9.1.gh" gem "creole", "~>0.3.6" gem "wikicloth", "=0.6.0" gem "asciidoctor", "= 0.1.4" diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 5c0303a5..286d76b6 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -11,7 +11,10 @@ end markup('org-ruby', /org/) do |content| - Orgmode::Parser.new(content, :allow_include_files => false).to_html + Orgmode::Parser.new(content, { + :allow_include_files => false, + :skip_syntax_highlight => true + }).to_html end markup(:creole, /creole/) do |content| From ba710cbeccd4176be23bf61414f4a3fa1d5b3f27 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Thu, 10 Apr 2014 14:14:31 -0400 Subject: [PATCH 092/416] Release 1.1.1 --- github-markup.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index b10f20d0..0f1bd87d 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| ## the sub! line in the Rakefile s.name = 'github-markup' s.version = GitHub::Markup::VERSION - s.date = '2014-04-03' + s.date = '2014-04-10' s.executables = ['github-markup'] ## Make sure your summary is short. The description may be as long From db01d18c27d1e81548b748cd4527b3e891986219 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Sat, 12 Apr 2014 12:16:56 -0700 Subject: [PATCH 093/416] Swap SVG `object` tags with `image` tags --- lib/github/commands/rest2html | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index eff55aa3..47ced6ec 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -28,6 +28,7 @@ __license__ = "CC0" __version__ = "0.1" import sys +import os # This fixes docutils failing with unicode parameters to CSV-Table. The -S # switch and the following 2 lines can be removed after upgrading to python 3. @@ -89,6 +90,27 @@ class GitHubHTMLTranslator(HTMLTranslator): def depart_table(self, node): self.body.append('\n') + def depart_image(self, node): + uri = node['uri'] + ext = os.path.splitext(uri)[1].lower() + # we need to swap RST's obj with img tags + # see http://git.io/5me3dA + if ext == ".svg": + # preserve essential attributes + atts = {} + atts['src'] = node['uri'] + atts['alt'] = node.get('alt', uri) + if 'width' in node: + atts['width'] = node['width'] + if 'height' in node: + atts['height'] = node['height'] + + # toss off obj tag + self.body.pop() + # add on img with attributes + self.body.append(self.starttag(node, 'img', **atts)) + self.body.append(self.context.pop()) + def main(): """ Parses the given ReST file or the redirected string input and returns the From f2f9917e1f50e8ee3188e6bdee2aea240a9b73f3 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Sat, 12 Apr 2014 12:17:09 -0700 Subject: [PATCH 094/416] Add tests for swapping `object` tags with `image` tags --- test/markups/README.rst | 8 ++++++++ test/markups/README.rst.html | 3 +++ 2 files changed, 11 insertions(+) diff --git a/test/markups/README.rst b/test/markups/README.rst index e207534a..fd8ad722 100644 --- a/test/markups/README.rst +++ b/test/markups/README.rst @@ -33,3 +33,11 @@ API http://pullv.readthedocs.org/en/latest/api.html Issues https://github.com/tony/pullv/issues Source https://github.com/tony/pullv ============== ========================================================== + + +.. image:: https://scan.coverity.com/projects/621/badge.svg + :target: https://scan.coverity.com/projects/621 + :alt: Coverity Scan Build Status + +.. image:: https://scan.coverity.com/projects/621/badge.svg + :alt: Coverity Scan Build Status diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index 562a8e89..77990de5 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -49,3 +49,6 @@

    Header 2

    +Coverity Scan Build Status + +Coverity Scan Build Status From 7a9da183776cb85b19a56c86cbef1204649acc9b Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Sat, 12 Apr 2014 15:12:08 -0700 Subject: [PATCH 095/416] Just pass along every attribute to the `ing` (except empty values) --- lib/github/commands/foo.rst | 7 +++++++ lib/github/commands/rest2html | 21 +++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 lib/github/commands/foo.rst diff --git a/lib/github/commands/foo.rst b/lib/github/commands/foo.rst new file mode 100644 index 00000000..e0950998 --- /dev/null +++ b/lib/github/commands/foo.rst @@ -0,0 +1,7 @@ + +.. image:: https://scan.coverity.com/projects/621/badge.svg + :target: https://scan.coverity.com/projects/621 + :alt: Coverity Scan Build Status + +.. image:: https://scan.coverity.com/projects/621/badge.svg + :alt: Coverity Scan Build Status diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 47ced6ec..4df0ace6 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -93,21 +93,22 @@ class GitHubHTMLTranslator(HTMLTranslator): def depart_image(self, node): uri = node['uri'] ext = os.path.splitext(uri)[1].lower() - # we need to swap RST's obj with img tags + # we need to swap RST's use of `object` with `img` tags # see http://git.io/5me3dA if ext == ".svg": # preserve essential attributes atts = {} - atts['src'] = node['uri'] - atts['alt'] = node.get('alt', uri) - if 'width' in node: - atts['width'] = node['width'] - if 'height' in node: - atts['height'] = node['height'] - - # toss off obj tag + for attribute, value in node.attributes.items(): + # we have no time for empty values + if value: + if attribute == "uri": + atts['src'] = value + else: + atts[attribute] = value + + # toss off `object` tag self.body.pop() - # add on img with attributes + # add on `img` with attributes self.body.append(self.starttag(node, 'img', **atts)) self.body.append(self.context.pop()) From 6f78cec499218c20c640ccba34550d5d08b0e8dc Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 15 Apr 2014 22:31:07 -0700 Subject: [PATCH 096/416] Release 1.1.2 --- lib/github-markup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index c9e6cd2a..1f9e9e76 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.1.1' + VERSION = '1.1.2' Version = VERSION end end From 1d3063cbdcf0030627db274054330c91618063c9 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 15 Apr 2014 22:31:35 -0700 Subject: [PATCH 097/416] Release 1.1.2 --- github-markup.gemspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index 0f1bd87d..867ca993 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| ## the sub! line in the Rakefile s.name = 'github-markup' s.version = GitHub::Markup::VERSION - s.date = '2014-04-10' + s.date = '2014-04-15' s.executables = ['github-markup'] ## Make sure your summary is short. The description may be as long @@ -64,6 +64,7 @@ desc bin/github-markup github-markup.gemspec lib/github-markup.rb + lib/github/commands/foo.rst lib/github/commands/rest2html lib/github/markup.rb lib/github/markup/command_implementation.rb From 28e31d19b6e65028c0f3c2dcc93f244b7db8baab Mon Sep 17 00:00:00 2001 From: Daniel Farina Date: Sat, 5 Apr 2014 08:46:26 -0700 Subject: [PATCH 098/416] Make rest2html program run more easily As interpreted by a Python 2.7 interpreter on a GNU system. This shebang form is unusual (env python2 -S), nor is relying on whitespace between shebang entries considered portable, de-facto nor de-jure. In addition, reloading sys seems to be necessary to allow for setdefaultencoding. That's apparently to prevent people from using that symbol, but as it was working before somehow, just fix it. --- lib/github/commands/rest2html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 4df0ace6..ad9c58a9 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 -S +#!/usr/bin/env python """ rest2html - A small wrapper file for parsing ReST files at GitHub. @@ -32,6 +32,7 @@ import os # This fixes docutils failing with unicode parameters to CSV-Table. The -S # switch and the following 2 lines can be removed after upgrading to python 3. +reload(sys) sys.setdefaultencoding('utf-8') import site From 8f706f75d5668fa1b50137d0dd6f4f2797237ff2 Mon Sep 17 00:00:00 2001 From: Daniel Farina Date: Sat, 5 Apr 2014 09:07:23 -0700 Subject: [PATCH 099/416] Interpret titles and subtitles in rst This hopes to make subtitles usable without changing the markup and table-of-contents generation of documents much at all. Previously, titles and subtitles[0] would introduce a lot of nesting in a generated table of contents. Enable both doctitle_xform and sectsubtitle_xform to remove those. However, merely enabling those will cause the existing top-level, non-title HTML header sizes to be promoted to

    , since titles and subtitles are not considered "sections", changing how the HTML output looks a rather lot. That's not how some sampled rsts (without subtitles) on work today: the title is biggest at

    , and all other sections are

    or below. So set the initial_header_level to "2", so that the largest text sections can have is

    , tied in size for the subtitle. [0]: http://docutils.sourceforge.net/docs/user/rst/quickstart.html#document-title-subtitle --- lib/github/commands/rest2html | 4 +++- test/markups/README.rst | 5 +++++ test/markups/README.rst.html | 13 ++++++++++--- test/markups/README.rst.txt.html | 2 +- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index ad9c58a9..f53442dd 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -52,7 +52,9 @@ SETTINGS = { 'file_insertion_enabled': False, 'raw_enabled': False, 'strip_comments': True, - 'doctitle_xform': False, + 'doctitle_xform': True, + 'sectsubtitle_xform': True, + 'initial_header_level': 2, 'report_level': 3, 'syntax_highlight' : 'none', 'math_output' : 'latex' diff --git a/test/markups/README.rst b/test/markups/README.rst index fd8ad722..9074b23f 100644 --- a/test/markups/README.rst +++ b/test/markups/README.rst @@ -1,8 +1,13 @@ Header 1 ======== +-------- +Subtitle +-------- Example text. +.. contents:: Table of Contents + Header 2 -------- diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index 77990de5..bd242190 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -1,6 +1,13 @@ -

    Header 1

    +

    Header 1

    +

    Subtitle

    Example text.

    -

    Header 2

    +
    +

    Table of Contents

    + +
    +

    Header 2

    1. Blah blah code blah
    2. More code, hooray
    3. @@ -8,7 +15,7 @@

      Header 2

    The UTF-8 quote character in this table used to cause python to go boom. Now docutils just displays an error inline so the user can fix it. Upgrading to Python 3 will fix this.

    -

    System Message: ERROR/3 (<string>, line 17)

    +

    System Message: ERROR/3 (<string>, line 22)

    Error with CSV data in "csv-table" directive: "quotechar" must be an 1-character string

    diff --git a/test/markups/README.rst.txt.html b/test/markups/README.rst.txt.html
    index 477abaa2..d46c426f 100644
    --- a/test/markups/README.rst.txt.html
    +++ b/test/markups/README.rst.txt.html
    @@ -1,4 +1,4 @@
    -

    Header 1

    +

    Header 1

    Example text.

    Header 2

      From 23860f4a8dec563f0f82f29cff18bd4b8083d6e3 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 17 Apr 2014 00:54:00 -0700 Subject: [PATCH 100/416] Bump to github-markup@1.2.0 --- lib/github-markup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 1f9e9e76..0fad0611 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.1.2' + VERSION = '1.2.0' Version = VERSION end end From 689a3fe619d0b56af9dcdb91a8b602c534e0f1cb Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 17 Apr 2014 00:54:26 -0700 Subject: [PATCH 101/416] Release 1.2.0 --- github-markup.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index 867ca993..4c3eb88a 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| ## the sub! line in the Rakefile s.name = 'github-markup' s.version = GitHub::Markup::VERSION - s.date = '2014-04-15' + s.date = '2014-04-17' s.executables = ['github-markup'] ## Make sure your summary is short. The description may be as long From 9a58d65c1344438165cf69d792872236a14ea209 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Wed, 23 Apr 2014 07:48:01 -0400 Subject: [PATCH 102/416] Disable RST warnings --- lib/github/commands/rest2html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index f53442dd..c0084915 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -55,7 +55,7 @@ SETTINGS = { 'doctitle_xform': True, 'sectsubtitle_xform': True, 'initial_header_level': 2, - 'report_level': 3, + 'report_level': 5, 'syntax_highlight' : 'none', 'math_output' : 'latex' } From 144f6343c04b43b9ffabd582f7ec32a025bb912d Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Wed, 23 Apr 2014 07:58:12 -0400 Subject: [PATCH 103/416] update RST example --- test/markups/README.rst | 2 +- test/markups/README.rst.html | 21 +-------------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/test/markups/README.rst b/test/markups/README.rst index 9074b23f..6db8bbb9 100644 --- a/test/markups/README.rst +++ b/test/markups/README.rst @@ -17,7 +17,7 @@ Header 2 3. Somé UTF-8° -The UTF-8 quote character in this table used to cause python to go boom. Now docutils just displays an error inline so the user can fix it. Upgrading to Python 3 will fix this. +The UTF-8 quote character in this table used to cause python to go boom. Now docutils just silently ignores it. .. csv-table:: Things that are Awesome (on a scale of 1-11) :quote: ” diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index bd242190..bf81fb07 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -13,26 +13,7 @@

      Header 2

    1. More code, hooray
    2. Somé UTF-8°
    -

    The UTF-8 quote character in this table used to cause python to go boom. Now docutils just displays an error inline so the user can fix it. Upgrading to Python 3 will fix this.

    -
    -

    System Message: ERROR/3 (<string>, line 22)

    -

    Error with CSV data in "csv-table" directive: -"quotechar" must be an 1-character string

    -
    -.. csv-table:: Things that are Awesome (on a scale of 1-11)
    -        :quote: ”
    -
    -        Thing,Awesomeness
    -        Icecream, 7
    -        Honey Badgers, 10.5
    -        Nickelback, -2
    -        Iron Man, 10
    -        Iron Man 2, 3
    -        Tabular Data, 5
    -        Made up ratings, 11
    -
    -
    -
    +

    The UTF-8 quote character in this table used to cause python to go boom. Now docutils just silently ignores it.

    From cb91a5068435b242e3e9d2598d6f07ddee30c510 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Wed, 23 Apr 2014 09:20:08 -0400 Subject: [PATCH 104/416] use bundler's rake tasks for releasing --- Rakefile | 124 ++---------------------------------------- github-markup.gemspec | 121 +++++------------------------------------ 2 files changed, 18 insertions(+), 227 deletions(-) diff --git a/Rakefile b/Rakefile index 928bc9a8..5a7b12e6 100644 --- a/Rakefile +++ b/Rakefile @@ -1,49 +1,6 @@ -require 'rubygems' -require 'rake' -require 'date' +#!/usr/bin/env rake -############################################################################# -# -# Helper functions -# -############################################################################# - -def name - @name ||= Dir['*.gemspec'].first.split('.').first -end - -def version - line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/] - line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1] -end - -def date - Date.today.to_s -end - -def rubyforge_project - name -end - -def gemspec_file - "#{name}.gemspec" -end - -def gem_file - "#{name}-#{version}.gem" -end - -def replace_header(head, header_name) - head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"} -end - -############################################################################# -# -# Standard tasks -# -############################################################################# - -task :default => :test +require "bundler/gem_tasks" require 'rake/testtask' Rake::TestTask.new(:test) do |test| @@ -54,80 +11,7 @@ end desc "Open an irb session preloaded with this library" task :console do - sh "irb -rubygems -r ./lib/#{name}.rb" -end - -############################################################################# -# -# Custom tasks (add your own tasks here) -# -############################################################################# - -desc "Kick it" -task :kick do - exec "kicker -e rake test lib" -end - -############################################################################# -# -# Packaging tasks -# -############################################################################# - -desc "Create tag v#{version} and build and push #{gem_file} to Rubygems" -task :release => :build do - unless `git branch` =~ /^\* master$/ - puts "You must be on the master branch to release!" - exit! - end - sh "git commit --allow-empty -a -m 'Release #{version}'" - sh "git tag v#{version}" - sh "git push origin master" - sh "git push origin v#{version}" - sh "gem push pkg/#{name}-#{version}.gem" -end - -desc "Build #{gem_file} into the pkg directory" -task :build => :gemspec do - sh "mkdir -p pkg" - sh "gem build #{gemspec_file}" - sh "mv #{gem_file} pkg" -end - -desc "Generate #{gemspec_file}" -task :gemspec => :validate do - # read spec file and split out manifest section - spec = File.read(gemspec_file) - head, manifest, tail = spec.split(" # = MANIFEST =\n") - - # replace name version and date - replace_header(head, :name) - replace_header(head, :version) - replace_header(head, :date) - #comment this out if your rubyforge_project has a different name - replace_header(head, :rubyforge_project) - - # determine file list from git ls-files - files = `git ls-files`. - split("\n"). - sort. - reject { |file| file =~ /^\./ }. - reject { |file| file =~ /^(rdoc|pkg)/ }. - map { |file| " #{file}" }. - join("\n") - - # piece file back together and write - manifest = " s.files = %w[\n#{files}\n ]\n" - spec = [head, manifest, tail].join(" # = MANIFEST =\n") - File.open(gemspec_file, 'w') { |io| io.write(spec) } - puts "Updated #{gemspec_file}" -end - -desc "Validate #{gemspec_file}" -task :validate do - unless Dir['VERSION*'].empty? - puts "A `VERSION` file at root level violates Gem best practices." - exit! - end + sh "irb -I lib -r bundler/setup -r github/markup" end +task :default => :test diff --git a/github-markup.gemspec b/github-markup.gemspec index 4c3eb88a..38604aee 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -1,113 +1,20 @@ require File.expand_path("../lib/github-markup", __FILE__) -## This is the rakegem gemspec template. Make sure you read and understand -## all of the comments. Some sections require modification, and others can -## be deleted if you don't need them. Once you understand the contents of -## this file, feel free to delete any comments that begin with two hash marks. -## You can find comprehensive Gem::Specification documentation, at -## http://docs.rubygems.org/read/chapter/20 Gem::Specification.new do |s| - s.specification_version = 2 if s.respond_to? :specification_version= - s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= - s.rubygems_version = '1.3.5' - - ## Leave these as is they will be modified for you by the rake gemspec task. - ## If your rubyforge_project name is different, then edit it and comment out - ## the sub! line in the Rakefile - s.name = 'github-markup' - s.version = GitHub::Markup::VERSION - s.date = '2014-04-17' - s.executables = ['github-markup'] - - ## Make sure your summary is short. The description may be as long - ## as you like. - s.summary = "The code GitHub uses to render README.markup" - s.description = < 0.1.2") - - ## List your development dependencies here. Development dependencies are - ## those that are only needed during development - #s.add_development_dependency("test-unit", "~> 2.3.0") - - ## Leave this section as-is. It will be automatically generated from the - ## contents of your Git repository via the gemspec task. DO NOT REMOVE - ## THE MANIFEST COMMENTS, they are used as delimiters by the task. - # = MANIFEST = - s.files = %w[ - Gemfile - HISTORY.md - LICENSE - README.md - Rakefile - bin/github-markup - github-markup.gemspec - lib/github-markup.rb - lib/github/commands/foo.rst - lib/github/commands/rest2html - lib/github/markup.rb - lib/github/markup/command_implementation.rb - lib/github/markup/gem_implementation.rb - lib/github/markup/implementation.rb - lib/github/markup/markdown.rb - lib/github/markup/rdoc.rb - lib/github/markups.rb - script/bootstrap - script/cibuild - test/markup_test.rb - test/markups/README.asciidoc - test/markups/README.asciidoc.html - test/markups/README.creole - test/markups/README.creole.html - test/markups/README.litcoffee - test/markups/README.litcoffee.html - test/markups/README.markdown - test/markups/README.markdown.html - test/markups/README.mediawiki - test/markups/README.mediawiki.html - test/markups/README.noformat - test/markups/README.noformat.html - test/markups/README.org - test/markups/README.org.html - test/markups/README.pod - test/markups/README.pod.html - test/markups/README.rdoc - test/markups/README.rdoc.html - test/markups/README.rst - test/markups/README.rst.html - test/markups/README.rst.txt - test/markups/README.rst.txt.html - test/markups/README.textile - test/markups/README.textile.html - test/markups/README.txt - test/markups/README.txt.html - ] - # = MANIFEST = - - ## Test files will be grabbed from the file list. Make sure the path glob - ## matches what you actually use. - s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ } - - s.add_dependency 'posix-spawn', '~> 0.3.8' + s.add_dependency "posix-spawn", "~> 0.3.8" end From da24f16cdb2c25ae3a70a650e81acb756d0c3833 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Wed, 23 Apr 2014 09:43:57 -0400 Subject: [PATCH 105/416] Move contributing docs to CONTRIBUTING.md --- CONTRIBUTING.md | 65 ++++++++++++++++++++++++++++++++++++++++++++ README.md | 71 +------------------------------------------------ 2 files changed, 66 insertions(+), 70 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..de8fc939 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,65 @@ +# Contributing + +Want to contribute? Great! + +1. Fork it. +2. Create a branch (`git checkout -b my_markup`) +3. Commit your changes (`git commit -am "Added Snarkdown"`) +4. Push to the branch (`git push origin my_markup`) +5. Open a [Pull Request][1] +6. Enjoy a refreshing Diet Coke and wait + + +There are two ways to add markups. + +### Commands + +If your markup is in a language other than Ruby, drop a translator +script in `lib/github/commands` which accepts input on STDIN and +returns HTML on STDOUT. See [rest2html][r2h] for an example. + +Once your script is in place, edit `lib/github/markups.rb` and tell +GitHub Markup about it. Again we look to [rest2html][r2hc] for +guidance: + + command(:rest2html, /re?st(.txt)?/) + +Here we're telling GitHub Markup of the existence of a `rest2html` +command which should be used for any file ending in `rest`, +`rst`, `rest.txt` or `rst.txt`. Any regular expression will do. + +Finally add your [tests](#testing). + +### Classes + +If your markup can be translated using a Ruby library, that's +great. Check out `lib/github/markups.rb` for some +examples. Let's look at Markdown: + + markup(:markdown, /md|mkdn?|markdown/) do |content| + Markdown.new(content).to_html + end + +We give the `markup` method three bits of information: the name of the +file to `require`, a regular expression for extensions to match, and a +block to run with unformatted markup which should return HTML. + +If you need to monkeypatch a RubyGem or something, check out the +included RDoc example. + +Finally add your [tests](#testing). + +### Testing + +To run the tests: + + $ rake + +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 +`README.extension.html` should be the desired output. + +Now run the tests: `rake` + +If nothing complains, congratulations! + +[1]: http://github.com/github/markup/pulls diff --git a/README.md b/README.md index 5def29b6..0016f53a 100644 --- a/README.md +++ b/README.md @@ -46,58 +46,6 @@ The following attributes, organized by element, are whitelisted: Note that the id attribute is *not* whitelisted. -Contributing ------------- - -Want to contribute? Great! There are two ways to add markups. - - -### Commands - -If your markup is in a language other than Ruby, drop a translator -script in `lib/github/commands` which accepts input on STDIN and -returns HTML on STDOUT. See [rest2html][r2h] for an example. - -Once your script is in place, edit `lib/github/markups.rb` and tell -GitHub Markup about it. Again we look to [rest2html][r2hc] for -guidance: - - command(:rest2html, /re?st(.txt)?/) - -Here we're telling GitHub Markup of the existence of a `rest2html` -command which should be used for any file ending in `rest`, -`rst`, `rest.txt` or `rst.txt`. Any regular expression will do. - -Finally add your tests. 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 -`README.extension.html` should be the desired output. - -Now run the tests: `rake` - -If nothing complains, congratulations! - - -### Classes - -If your markup can be translated using a Ruby library, that's -great. Check out `lib/github/markups.rb` for some -examples. Let's look at Markdown: - - markup(:markdown, /md|mkdn?|markdown/) do |content| - Markdown.new(content).to_html - end - -We give the `markup` method three bits of information: the name of the -file to `require`, a regular expression for extensions to match, and a -block to run with unformatted markup which should return HTML. - -If you need to monkeypatch a RubyGem or something, check out the -included RDoc example. - -Tests should be added in the same manner as described under the -`Commands` section. - Installation ----------- @@ -117,28 +65,11 @@ Or, more realistically: GitHub::Markup.render(file, File.read(file)) -Testing -------- - -To run the tests: - - $ rake - -To add tests see the `Commands` section earlier in this -README. - - Contributing ------------ -1. Fork it. -2. Create a branch (`git checkout -b my_markup`) -3. Commit your changes (`git commit -am "Added Snarkdown"`) -4. Push to the branch (`git push origin my_markup`) -5. Open a [Pull Request][1] -6. Enjoy a refreshing Diet Coke and wait +See [Contributing](CONTRIBUTING.md) [r2h]: lib/github/commands/rest2html [r2hc]: lib/github/markups.rb#L51 -[1]: http://github.com/github/markup/pulls From 5fd0b77eb09593153201a8a6171128fd52c27861 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Wed, 23 Apr 2014 09:44:09 -0400 Subject: [PATCH 106/416] Add docs for releasing a new version --- CONTRIBUTING.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index de8fc939..a77dce9a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,4 +62,18 @@ Now run the tests: `rake` If nothing complains, congratulations! +## Releasing a new version + +If you are the current maintainer of this gem: + +0. Bump the version number in `lib/github-markup.rb`, adhering to [Semantic Versioning](http://semver.org/) +0. Update `HISTORY.md` +0. Test the latest version on GitHub + 0. Build the new version with `rake build` + 0. Copy `pkg/github-markup*.gem` to `vendor/cache` in your local checkout of GitHub + 0. Update the version for `github-markup` in the `Gemfile` + 0. run `script/bootstrap` + 0. Run any relevant tests and test it manually from the browser. +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. + [1]: http://github.com/github/markup/pulls From dede9e8432244df336c730f76a601a505029991c Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Wed, 23 Apr 2014 09:45:54 -0400 Subject: [PATCH 107/416] Move link references into contributing --- CONTRIBUTING.md | 2 ++ README.md | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a77dce9a..c6d22727 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -77,3 +77,5 @@ If you are the current maintainer of this gem: 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. [1]: http://github.com/github/markup/pulls +[r2h]: lib/github/commands/rest2html +[r2hc]: lib/github/markups.rb#L51 diff --git a/README.md b/README.md index 0016f53a..6fce3302 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,3 @@ Contributing ------------ See [Contributing](CONTRIBUTING.md) - - -[r2h]: lib/github/commands/rest2html -[r2hc]: lib/github/markups.rb#L51 From df9ee4c20fd54c9ed3433a9caffa14542c4210fa Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Wed, 23 Apr 2014 09:51:15 -0400 Subject: [PATCH 108/416] installation and usage before sanitization --- README.md | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 6fce3302..0cda2682 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,22 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a * [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::HTML` comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN. +Installation +----------- + + gem install github-markup + +Usage +----- + + require 'github/markup' + GitHub::Markup.render('README.markdown', "* One\n* Two") + +Or, more realistically: + + require 'github/markup' + GitHub::Markup.render(file, File.read(file)) + HTML sanitization ----------------- @@ -46,25 +62,6 @@ The following attributes, organized by element, are whitelisted: Note that the id attribute is *not* whitelisted. - -Installation ------------ - - gem install github-markup - - -Usage ------ - - require 'github/markup' - GitHub::Markup.render('README.markdown', "* One\n* Two") - -Or, more realistically: - - require 'github/markup' - GitHub::Markup.render(file, File.read(file)) - - Contributing ------------ From 5c9d3b3b14128af5e0a431f0a7465e557bdbac48 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Wed, 23 Apr 2014 10:10:17 -0400 Subject: [PATCH 109/416] bin is not ignored --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e3746243..a08b381b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ *.pyc pkg/ -bin .bundle Gemfile.lock -vendor/ \ No newline at end of file +vendor/ From 25a8b9cce4c4227bf0831a519c51dfd776547c5d Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Wed, 23 Apr 2014 10:12:24 -0400 Subject: [PATCH 110/416] Fix docs for testing in GitHub --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c6d22727..57ba6e97 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -72,7 +72,7 @@ If you are the current maintainer of this gem: 0. Build the new version with `rake build` 0. Copy `pkg/github-markup*.gem` to `vendor/cache` in your local checkout of GitHub 0. Update the version for `github-markup` in the `Gemfile` - 0. run `script/bootstrap` + 0. Run `bundle update --local github-markup` 0. Run any relevant tests and test it manually from the browser. 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. From 0e4fe41ead97f84a4e6252755e537c0773f9564d Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Wed, 23 Apr 2014 09:54:40 -0400 Subject: [PATCH 111/416] Release 1.2.1 --- HISTORY.md | 6 ++++++ lib/github-markup.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 9cbf1284..5e91187e 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,9 @@ +## 1.2.1 (2014-04-23) + +* Disable RST warnings [#290](https://github.com/github/markup/pull/290) + +[Full changelog](https://github.com/github/markup/compare/v1.2.0...v1.2.1) + ## 1.1.1 (2014-04-03) * Upgrade to org-ruby 0.9.1 diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 0fad0611..c0fc6679 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.2.0' + VERSION = '1.2.1' Version = VERSION end end From ab584614d0dd72ae4986faa4af6b7a6241047be7 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Wed, 23 Apr 2014 10:14:53 -0400 Subject: [PATCH 112/416] Release 1.2.1 --- github-markup.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index 4c3eb88a..40c794d5 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| ## the sub! line in the Rakefile s.name = 'github-markup' s.version = GitHub::Markup::VERSION - s.date = '2014-04-17' + s.date = '2014-04-23' s.executables = ['github-markup'] ## Make sure your summary is short. The description may be as long From 5762d015ac355201e4952f652c14d3da226dcc76 Mon Sep 17 00:00:00 2001 From: Martin Monperrus Date: Fri, 2 May 2014 21:00:33 +0200 Subject: [PATCH 113/416] States that .wiki files are rendered using Mediawiki syntax --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0cda2682..b20a7f98 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a * [.rdoc](http://rdoc.sourceforge.net/) -- `gem install rdoc -v 3.6.1` * [.org](http://orgmode.org/) -- `gem install org-ruby` * [.creole](http://wikicreole.org/) -- `gem install creole` -* [.mediawiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth` +* [.mediawiki, .wiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth` * [.rst](http://docutils.sourceforge.net/rst.html) -- `easy_install docutils` * [.asciidoc, .adoc, .asc](http://asciidoc.org/) -- `gem install asciidoctor` (http://asciidoctor.org) * [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::HTML` From ab9c1e8ac144dea9a0831667c54914f372cf3fc2 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Tue, 27 May 2014 16:37:15 +0200 Subject: [PATCH 114/416] rst2html: Extend the field_name_limit to 50 Field lists are rendered weirdly in reST if the field name is longer that 14 characters. In this case the table cell where the field name is gets a colspan=2. For example this: ```rest :123456789012345: too long, colspan=2 :12345678901234: OK ``` Gets translated to: ```html
    123456789012345:
     too long, colspan=2
    12345678901234:OK
    ``` Increasing this default value of 14 to something more reasonable, like 50, seems sensible. Even when this is just another arbitrary value, since GitHub have a fixed total width, it seems sensible to not make it much more longer, since if the field name is too long it will look weird anyway. --- lib/github/commands/rest2html | 3 ++- test/markups/README.rst | 9 +++++++++ test/markups/README.rst.html | 19 +++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index c0084915..c8c8b521 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -57,7 +57,8 @@ SETTINGS = { 'initial_header_level': 2, 'report_level': 5, 'syntax_highlight' : 'none', - 'math_output' : 'latex' + 'math_output' : 'latex', + 'field_name_limit': 50, } class GitHubHTMLTranslator(HTMLTranslator): diff --git a/test/markups/README.rst b/test/markups/README.rst index 6db8bbb9..efd1685b 100644 --- a/test/markups/README.rst +++ b/test/markups/README.rst @@ -46,3 +46,12 @@ Source https://github.com/tony/pullv .. image:: https://scan.coverity.com/projects/621/badge.svg :alt: Coverity Scan Build Status + +Field list +---------- + +:123456789 123456789 123456789 123456789 123456789 1: Uh-oh! This name is too long! +:123456789 123456789 123456789 123456789 1234567890: this is a long name, + but no problem! +:123456789 12345: this is not so long, but long enough for the default! +:123456789 1234: this should work even with the default :) diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index bf81fb07..4186694d 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -5,6 +5,7 @@

    Subtitle

    Table of Contents

    Header 2

    @@ -40,3 +41,21 @@

    Header 2

    Coverity Scan Build Status Coverity Scan Build Status +

    Field list

    + +++ + + + + + + + + + + +
    123456789 123456789 123456789 123456789 123456789 1:
     Uh-oh! This name is too long!
    123456789 123456789 123456789 123456789 1234567890:this is a long name, +but no problem!
    123456789 12345:this is not so long, but long enough for the default!
    123456789 1234:this should work even with the default :)
    + From 1ed7e156c67949ad273b817bc195b6aa057c352f Mon Sep 17 00:00:00 2001 From: felixphew Date: Sat, 31 May 2014 07:31:33 +1000 Subject: [PATCH 115/416] Added .mkdn as a Markdown extension I have already submitted a corresponding change to Linguist (see #1215) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b20a7f98..4c0aac04 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Markups The following markups are supported. The dependencies listed are required if you wish to run the library. You can also run `script/bootstrap` to fetch them all. -* [.markdown, .mdown, .md](http://daringfireball.net/projects/markdown/) -- `gem install redcarpet` (https://github.com/vmg/redcarpet) +* [.markdown, .mdown, .mkdn, .md](http://daringfireball.net/projects/markdown/) -- `gem install redcarpet` (https://github.com/vmg/redcarpet) * [.textile](http://www.textism.com/tools/textile/) -- `gem install RedCloth` * [.rdoc](http://rdoc.sourceforge.net/) -- `gem install rdoc -v 3.6.1` * [.org](http://orgmode.org/) -- `gem install org-ruby` From 83923253df150329d35b5f5bbec47e0c75165ddc Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 6 Jun 2014 12:24:24 -0400 Subject: [PATCH 116/416] link to html-pipeline in the docs --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4c0aac04..58eb47f5 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ GitHub Markup ============= We use this library on GitHub when rendering your README or any other -rich text file. +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 [santization](#html-sanitization) and [syntax highlighting](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/syntax_highlight_filter.rb). Markups ------- From 62ab8ac092d26cdb70b9b65f0a796b9c47e182fe Mon Sep 17 00:00:00 2001 From: george2 Date: Mon, 9 Jun 2014 10:49:30 -0600 Subject: [PATCH 117/416] Fixed typo in README.md. Just a 1-character typo fix. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 58eb47f5..1f5b145f 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ The following HTML elements, organized by category, are whitelisted: The following attributes, organized by element, are whitelisted: * a: href (http://, https://, mailto://, github-windows:// and github-mac:// URI schemes and relative paths only) -* img: src (http:// and https::// URI schemes and relative paths only) +* img: src (http:// and https:// URI schemes and relative paths only) * div: itemscope, itemtype * 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 From bf2b3a119c7d5a1ba6cd4e1bd1bacf8826313381 Mon Sep 17 00:00:00 2001 From: Yusuke Matsubara Date: Wed, 11 Jun 2014 21:58:01 +0900 Subject: [PATCH 118/416] Update WikiCloth to 0.8.1 and support footnotes --- Gemfile | 2 +- test/markups/README.mediawiki | 5 +++- test/markups/README.mediawiki.html | 48 +++++++++++++++++------------- 3 files changed, 32 insertions(+), 23 deletions(-) diff --git a/Gemfile b/Gemfile index a35eac1c..84233326 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,6 @@ gem "RedCloth" gem "rdoc", "~>3.6" gem "org-ruby", "= 0.9.1.gh" gem "creole", "~>0.3.6" -gem "wikicloth", "=0.6.0" +gem "wikicloth", "=0.8.1" gem "asciidoctor", "= 0.1.4" gem "rake" diff --git a/test/markups/README.mediawiki b/test/markups/README.mediawiki index f7c394cd..36c3ef6b 100644 --- a/test/markups/README.mediawiki +++ b/test/markups/README.mediawiki @@ -21,4 +21,7 @@ For projects requiring multiple scripting languages, JSR223 is a good fit. Thoug 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. = Previous Embedding JRuby Page= -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. \ No newline at end of file +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]]This link goes nowhere. page. + += References = + diff --git a/test/markups/README.mediawiki.html b/test/markups/README.mediawiki.html index e8400592..a84d3d7b 100644 --- a/test/markups/README.mediawiki.html +++ b/test/markups/README.mediawiki.html @@ -1,35 +1,41 @@ -

    -» JRuby Project Wiki Home Page +

    » JRuby Project Wiki Home Page

    Embedding JRuby

    - 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. +

    +

    Table of Contents

    +

    + +

    Red Bridge (JRuby Embed)

    -

    -
    Table of Contents
      -

      -

      Red Bridge (JRuby Embed)

      -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 legacy API should still work, but we strongly recommend Red Bridge for all new projects. +

      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 legacy API should still work, but we strongly recommend Red Bridge for all new projects. +

      + +

      Features of Red Bridge

      + -

      -

      Features of Red Bridge

      Red Bridge consists of two layers: Embed Core on the bottom, and implementations of JSR223 and BSF 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. +

      Red Bridge consists of two layers: Embed Core on the bottom, and implementations of JSR223 and BSF 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. +

      +

      Which API should you use? For projects where Ruby is the only scripting language involved, we recommend Embed Core for the following reasons: +

      -

      -Which API should you use? For projects where Ruby is the only scripting language involved, we recommend Embed Core for the following reasons: -

      -

      1. With Embed Core, you can create several Ruby environments in one JVM, and configure them individually (via org.jruby.RubyInstanceConfig. With the other APIs, configuration options can only be set globally, via the System properties. -
      2. Embed Core offers several shortcuts, such as loading scripts from a java.io.InputStream, or returning Java-friendly objects from Ruby code. These allow you to skip a lot of boilerplate. +

        1. With Embed Core, you can create several Ruby environments in one JVM, and configure them individually (via org.jruby.RubyInstanceConfig. With the other APIs, configuration options can only be set globally, via the System properties.
        2. Embed Core offers several shortcuts, such as loading scripts from a java.io.InputStream, or returning Java-friendly objects from Ruby code. These allow you to skip a lot of boilerplate.
        +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. +

        +

        The full API documentation has all the gory details. It's worth talking about a couple of the finer points here. +

        -

        -

      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. +

      Previous Embedding JRuby Page

      -

      -The full API documentation has all the gory details. It's worth talking about a couple of the finer points here. -

      -

      Previous Embedding JRuby Page

      We recommend using Embed Core; however, if you're maintaining code that uses the old API, you can find its documentation on the legacy embedding page. +

      We recommend using Embed Core; however, if you're maintaining code that uses the old API, you can find its documentation on the legacy embedding[1] page.

      + +

      References

      + + +

      1. ^ This link goes nowhere.

      \ No newline at end of file From bc1a936c5936f9918a655ce7bd2d4073fb7afb1b Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Wed, 11 Jun 2014 14:51:11 -0400 Subject: [PATCH 119/416] bump version and update history --- HISTORY.md | 6 ++++++ lib/github-markup.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 5e91187e..01ea4831 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,9 @@ +## 1.3.0 (unreleased) + +* Upgrade wikicloth to 0.8.1 [#317](https://github.com/github/markup/pull/317) + +[Full changelog](https://github.com/github/markup/compare/v1.2.1...v1.3.0) + ## 1.2.1 (2014-04-23) * Disable RST warnings [#290](https://github.com/github/markup/pull/290) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index c0fc6679..18124c91 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.2.1' + VERSION = '1.3.0' Version = VERSION end end From 8c7ade076546af6b398d44d145b3b1111483f5c7 Mon Sep 17 00:00:00 2001 From: Neven Sajko Date: Sun, 15 Jun 2014 19:58:36 +0200 Subject: [PATCH 120/416] Fix a spelling mistake Add an 'i' to "santization". --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1f5b145f..92974f49 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ GitHub Markup ============= We use this library on GitHub when rendering your README or any other -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 [santization](#html-sanitization) and [syntax highlighting](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/syntax_highlight_filter.rb). +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). Markups ------- From 8892c83d1c70ce7e1306360355737f124817d199 Mon Sep 17 00:00:00 2001 From: Waldemar Quevedo Date: Sun, 22 Jun 2014 01:57:03 +0900 Subject: [PATCH 121/416] Lock version of Org Ruby to 0.9.7 --- Gemfile | 2 +- test/markups/README.org.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index a35eac1c..897d60e7 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ gemspec gem "redcarpet" gem "RedCloth" gem "rdoc", "~>3.6" -gem "org-ruby", "= 0.9.1.gh" +gem "org-ruby", "= 0.9.7" gem "creole", "~>0.3.6" gem "wikicloth", "=0.6.0" gem "asciidoctor", "= 0.1.4" diff --git a/test/markups/README.org.html b/test/markups/README.org.html index 30ea31cf..0326e393 100644 --- a/test/markups/README.org.html +++ b/test/markups/README.org.html @@ -1,4 +1,4 @@ -

      org-ruby

      +

      org-ruby

      From c02c304e14b4b02fc00f73618e5255586f903a35 Mon Sep 17 00:00:00 2001 From: Robert Schilling Date: Wed, 30 Jul 2014 18:19:57 +0200 Subject: [PATCH 122/416] Force encoding of posix_spawn output --- lib/github/markup/command_implementation.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index 2c244407..170e9b0a 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -35,7 +35,7 @@ def call_block(rendered, content) def execute(command, target) spawn = POSIX::Spawn::Child.new(*command, :input => target) if spawn.status.success? - spawn.out.gsub("\r", '') + spawn.out.gsub("\r", '').force_encoding(target.encoding) else raise CommandError.new(spawn.err.strip) end From a18341278261f703ee506d428fb69b1064b2c301 Mon Sep 17 00:00:00 2001 From: Robert Schilling Date: Thu, 31 Jul 2014 22:19:41 +0200 Subject: [PATCH 123/416] Force encoding of posix_spawn output --- test/markup_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/markup_test.rb b/test/markup_test.rb index b9070b1a..3269e0d6 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -1,3 +1,5 @@ +# encoding: UTF-8 + $LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib" require 'github/markup' @@ -50,4 +52,9 @@ def test_raises_error_if_command_exits_non_zero fail "an exception was expected but was not raised" end end + + def test_preserve_markup + content = "Noël" + assert_equal content.encoding.name, GitHub::Markup.render('Foo.rst', content).encoding.name + end end From 7012598d8ea284ac34f8c28120598be3e7fbd2d7 Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Thu, 7 Aug 2014 16:32:17 +0200 Subject: [PATCH 124/416] Render RMarkdown (.rmd) as Markdown --- lib/github/markup/markdown.rb | 2 +- test/markup_test.rb | 1 + test/markups/README.rmd | 3 +++ test/markups/README.rmd.html | 6 ++++++ 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 test/markups/README.rmd create mode 100644 test/markups/README.rmd.html diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index f4ef99dc..07f7ff87 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -25,7 +25,7 @@ class Markdown < Implementation } def initialize - super(/md|mkdn?|mdwn|mdown|markdown|litcoffee/) + super(/md|rmd|mkdn?|mdwn|mdown|markdown|litcoffee/) end def load diff --git a/test/markup_test.rb b/test/markup_test.rb index b9070b1a..cc7f74bf 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -35,6 +35,7 @@ class MarkupTest < Test::Unit::TestCase def test_knows_what_it_can_and_cannot_render assert_equal false, GitHub::Markup.can_render?('README.html') assert_equal true, GitHub::Markup.can_render?('README.markdown') + assert_equal true, GitHub::Markup.can_render?('README.rmd') assert_equal false, GitHub::Markup.can_render?('README.cmd') assert_equal true, GitHub::Markup.can_render?('README.litcoffee') end diff --git a/test/markups/README.rmd b/test/markups/README.rmd new file mode 100644 index 00000000..f9f5f702 --- /dev/null +++ b/test/markups/README.rmd @@ -0,0 +1,3 @@ +# Title +* One +* Two diff --git a/test/markups/README.rmd.html b/test/markups/README.rmd.html new file mode 100644 index 00000000..e712d1c7 --- /dev/null +++ b/test/markups/README.rmd.html @@ -0,0 +1,6 @@ +

      Title

      + +
        +
      • One
      • +
      • Two
      • +
      From cc2d3fb6654c685a89c2bfb73279c745b10ade11 Mon Sep 17 00:00:00 2001 From: Waldemar Quevedo Date: Sat, 16 Aug 2014 09:30:58 +0900 Subject: [PATCH 125/416] Update Org Ruby versoin to 0.9.8 --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 897d60e7..b79a2552 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ gemspec gem "redcarpet" gem "RedCloth" gem "rdoc", "~>3.6" -gem "org-ruby", "= 0.9.7" +gem "org-ruby", "= 0.9.8" gem "creole", "~>0.3.6" gem "wikicloth", "=0.6.0" gem "asciidoctor", "= 0.1.4" From 14fc76bc9e09f49b499a2a9d617df760d754221d Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 21 Aug 2014 14:27:27 -0700 Subject: [PATCH 126/416] Organize the README's whitelisted elements a bit better --- README.md | 216 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 197 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 92974f49..15cd968a 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,11 @@ Or, more realistically: require 'github/markup' GitHub::Markup.render(file, File.read(file)) +Contributing +------------ + +See [Contributing](CONTRIBUTING.md) + HTML sanitization ----------------- @@ -44,25 +49,198 @@ HTML rendered by the various markup language processors gets passed through an [ The following HTML elements, organized by category, are whitelisted: -* Headings: h1, h2, h3, h4, h5, h6, h7, h8 -* Prose: p, div, blockquote -* Preformatted: pre -* Inline: b, i, strong, em, tt, code, ins, del, sup, sub, kbd, samp, q, var -* Lists: ol, ul, li, dl, dt, dd -* Tables: table, thead, tbody, tfoot, tr, td, th -* Breaks: br, hr -* Ruby (East Asian): ruby, rt, rp +
      +
      Headings
      +
      +
        +
      • h1
      • +
      • h2
      • +
      • h3
      • +
      • h4
      • +
      • h5
      • +
      • h6
      • +
      • h7
      • +
      • h8
      • +
      +
      + +
      Prose
      +
      +
        +
      • p
      • +
      • div
      • +
      • blockquote
      • +
      +
      + +
      Formatted
      +
      +
        +
      • pre
      • +
      +
      + +
      Inline
      +
      +
        +
      • b
      • +
      • i
      • +
      • strong
      • +
      • em
      • +
      • tt
      • +
      • code
      • +
      • ins
      • +
      • del
      • +
      • sup
      • +
      • sub
      • +
      • kbd
      • +
      • samp
      • +
      • q
      • +
      • var
      • +
      +
      + +
      Lists
      +
      +
        +
      • ol
      • +
      • ul
      • +
      • li
      • +
      • dl
      • +
      • dt
      • +
      • dd
      • +
      +
      + +
      Tables
      +
      +
        +
      • table
      • +
      • thead
      • +
      • tbody
      • +
      • tfoot
      • +
      • tr
      • +
      • td
      • +
      • th
      • +
      +
      + +
      Breaks
      +
      +
        +
      • br
      • +
      • hr
      • +
      +
      + +
      Ruby (East Asian)
      +
      +
        +
      • ruby
      • +
      • rt
      • +
      • rp
      • +
      +
      +
      The following attributes, organized by element, are whitelisted: -* a: href (http://, https://, mailto://, github-windows:// and github-mac:// URI schemes and relative paths only) -* img: src (http:// and https:// URI schemes and relative paths only) -* div: itemscope, itemtype -* 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 - -Note that the id attribute is *not* whitelisted. - -Contributing ------------- - -See [Contributing](CONTRIBUTING.md) +
      +
      a
      +
      +
        +
      • href (http://, https://, mailto://, github-windows://, and github-mac:// URI schemes and relative paths only)
      • +
      +
      + +
      img
      +
      +
        +
      • src (http:// and https:// URI schemes and relative paths only)
      • +
      +
      + +
      div
      +
      +
        +
      • itemscope
      • +
      • itemtype
      • +
      +
      + +
      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
      • +
      +
      +
      + +Note that the `id` attribute is *not* whitelisted. From 65ef71bd15e1721c30d58bb50e906f8ffd25dc1d Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 21 Aug 2014 14:31:58 -0700 Subject: [PATCH 127/416] Tables are cooler --- README.md | 206 +++++------------------------------------------------- 1 file changed, 16 insertions(+), 190 deletions(-) diff --git a/README.md b/README.md index 15cd968a..25399944 100644 --- a/README.md +++ b/README.md @@ -49,198 +49,24 @@ HTML rendered by the various markup language processors gets passed through an [ The following HTML elements, organized by category, are whitelisted: -
      -
      Headings
      -
      -
        -
      • h1
      • -
      • h2
      • -
      • h3
      • -
      • h4
      • -
      • h5
      • -
      • h6
      • -
      • h7
      • -
      • h8
      • -
      -
      - -
      Prose
      -
      -
        -
      • p
      • -
      • div
      • -
      • blockquote
      • -
      -
      - -
      Formatted
      -
      -
        -
      • pre
      • -
      -
      - -
      Inline
      -
      -
        -
      • b
      • -
      • i
      • -
      • strong
      • -
      • em
      • -
      • tt
      • -
      • code
      • -
      • ins
      • -
      • del
      • -
      • sup
      • -
      • sub
      • -
      • kbd
      • -
      • samp
      • -
      • q
      • -
      • var
      • -
      -
      - -
      Lists
      -
      -
        -
      • ol
      • -
      • ul
      • -
      • li
      • -
      • dl
      • -
      • dt
      • -
      • dd
      • -
      -
      - -
      Tables
      -
      -
        -
      • table
      • -
      • thead
      • -
      • tbody
      • -
      • tfoot
      • -
      • tr
      • -
      • td
      • -
      • th
      • -
      -
      - -
      Breaks
      -
      -
        -
      • br
      • -
      • hr
      • -
      -
      - -
      Ruby (East Asian)
      -
      -
        -
      • ruby
      • -
      • rt
      • -
      • rp
      • -
      -
      -
      +|Type | Elements +|------|---------- +|Headings | `h1`, `h2`, `h3`, `h4`, `h5`, `h6`, `h7`, `h8` +|Prose | `p`, `div`, `blockquote` +|Formatted | `pre` +| Inline | `b`, `i`, `strong`, `em`, `tt`, `code`, `ins`, `del`, `sup`, `sub`, `kbd`, `samp`, `q`, `var` +| Lists | `ol`, `ul`, `li`, `dl`, `dt`, `dd` +| Tables | `table`, `thead`, `tbody`, `tfoot`, `tr`, `td`, `th` +| Breaks | `br`, `hr +| Ruby (East Asian) | `ruby`, `rt`, `rp` The following attributes, organized by element, are whitelisted: -
      -
      a
      -
      -
        -
      • href (http://, https://, mailto://, github-windows://, and github-mac:// URI schemes and relative paths only)
      • -
      -
      - -
      img
      -
      -
        -
      • src (http:// and https:// URI schemes and relative paths only)
      • -
      -
      - -
      div
      -
      -
        -
      • itemscope
      • -
      • itemtype
      • -
      -
      - -
      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
      • -
      -
      -
      +|Element | Attributes +|------|---------- +| `a` | `href` (`http://`, `https://`, `mailto://`, `github-windows://`, and `github-mac://` URI schemes and relative paths only) +| `img` | `src` (`http://` and `https://` URI schemes and relative paths only) +| `div` | `itemscope`, `itemtype` +| 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` Note that the `id` attribute is *not* whitelisted. From c1d67e6e1721044eb92eab4438b1a87a9e035103 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 21 Aug 2014 15:12:49 -0700 Subject: [PATCH 128/416] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 25399944..d6d0c8b1 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ The following HTML elements, organized by category, are whitelisted: | Inline | `b`, `i`, `strong`, `em`, `tt`, `code`, `ins`, `del`, `sup`, `sub`, `kbd`, `samp`, `q`, `var` | Lists | `ol`, `ul`, `li`, `dl`, `dt`, `dd` | Tables | `table`, `thead`, `tbody`, `tfoot`, `tr`, `td`, `th` -| Breaks | `br`, `hr +| Breaks | `br`, `hr` | Ruby (East Asian) | `ruby`, `rt`, `rp` The following attributes, organized by element, are whitelisted: From 3749f8361e3d676f93a692506294f4c984e15f3d Mon Sep 17 00:00:00 2001 From: Waldemar Quevedo Date: Sat, 30 Aug 2014 00:17:24 +0900 Subject: [PATCH 129/416] Change to use 0.9.9 which includes comments regex bugfix --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index b79a2552..4f6a06f6 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ gemspec gem "redcarpet" gem "RedCloth" gem "rdoc", "~>3.6" -gem "org-ruby", "= 0.9.8" +gem "org-ruby", "= 0.9.9" gem "creole", "~>0.3.6" gem "wikicloth", "=0.6.0" gem "asciidoctor", "= 0.1.4" From 1e7d83fd1e605db9f0d975482c2891a19bfeaf6b Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Thu, 4 Sep 2014 22:52:20 +0200 Subject: [PATCH 130/416] Escape the filepath to rest2html so paths containing spaces will be passed to CommandImplementation#execute correctly. --- lib/github/markups.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 286d76b6..eb562909 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -1,4 +1,5 @@ require "github/markup/markdown" +require "shellwords" markups << GitHub::Markup::Markdown.new @@ -29,7 +30,7 @@ Asciidoctor.render(content, :safe => :secure, :attributes => %w(showtitle idprefix idseparator=- env=github env-github source-highlighter=html-pipeline)) end -command("python2 -S #{File.dirname(__FILE__)}/commands/rest2html", /re?st(\.txt)?/) +command("python2 -S #{Shellwords.escape(File.dirname(__FILE__))}/commands/rest2html", /re?st(\.txt)?/) # pod2html is nice enough to generate a full-on HTML document for us, # so we return the favor by ripping out the good parts. From b057de29dc990d77fc84828f8952b8b0593775e2 Mon Sep 17 00:00:00 2001 From: Bart Kamphorst Date: Thu, 28 Aug 2014 23:16:19 +0200 Subject: [PATCH 131/416] Makes github/markup compatible with JRuby. --- Gemfile | 4 +- github-markup.gemspec | 2 +- lib/github/markup/command_implementation.rb | 42 +++++++++++++++++---- 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index a35eac1c..6c7a9ab6 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,8 @@ source "http://rubygems.org" gemspec -gem "redcarpet" + +gem "redcarpet", :platforms => :ruby +gem "kramdown", :platforms => :jruby gem "RedCloth" gem "rdoc", "~>3.6" gem "org-ruby", "= 0.9.1.gh" diff --git a/github-markup.gemspec b/github-markup.gemspec index 38604aee..18392cb2 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,5 +16,5 @@ Gem::Specification.new do |s| s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = %w[lib] - s.add_dependency "posix-spawn", "~> 0.3.8" + s.add_dependency "posix-spawn", "~> 0.3.8" unless RUBY_PLATFORM == 'java' end diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index 2c244407..f62c790e 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -1,4 +1,9 @@ -require "posix-spawn" +if RUBY_PLATFORM == 'java' + require "open3" +else + require "posix-spawn" +end + require "github/markup/implementation" module GitHub @@ -31,15 +36,36 @@ def call_block(rendered, content) rendered end end - - def execute(command, target) - spawn = POSIX::Spawn::Child.new(*command, :input => target) - if spawn.status.success? - spawn.out.gsub("\r", '') - else - raise CommandError.new(spawn.err.strip) + + if RUBY_PLATFORM == 'java' + def execute(command, target) + output = Open3.popen3(*command) do |stdin, stdout, stderr, wait_thr| + stdin.puts target + stdin.close + if wait_thr.value.success? + stdout.readlines + else + raise CommandError.new(stderr.readlines.join('').strip) + end + end + sanitize(output.join('')) + end + else + def execute(command, target) + spawn = POSIX::Spawn::Child.new(*command, :input => target) + if spawn.status.success? + sanitize(spawn.out) + else + raise CommandError.new(spawn.err.strip) + end + end end + + def sanitize(input) + input.gsub("\r", '') + end + end end end From 4bd71615650b5aba709f701a8ef3553fdb8ddded Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Tue, 9 Sep 2014 00:19:50 +0200 Subject: [PATCH 132/416] Implement assert_html_equal. --- test/markup_test.rb | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/test/markup_test.rb b/test/markup_test.rb index b9070b1a..7fab6a37 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -2,6 +2,34 @@ require 'github/markup' require 'test/unit' +require 'nokogiri' +require 'nokogiri/diff' + +def normalize_html(text) + text.strip! + text.gsub!(/\s\s+/,' ') + text.gsub!(/\p{Pi}|\p{Pf}|&quot;/u,'"') + text.gsub!("\u2026",'...') + text +end + +def assert_html_equal(expected, actual, msg = nil) + assert_block(msg) do + expected_doc = Nokogiri::HTML(expected) {|config| config.noblanks} + actual_doc = Nokogiri::HTML(actual) {|config| config.noblanks} + + expected_doc.search('//text()').each {|node| node.content = normalize_html node.content} + actual_doc.search('//text()').each {|node| node.content = normalize_html node.content} + + expected_doc.diff(actual_doc) do |change, node| + if change != ' ' && !node.blank? then + if change == "+" + break unless node.to_html =~ /id="*"/ + end + end + end + end +end class MarkupTest < Test::Unit::TestCase Dir['test/markups/README.*'].each do |readme| @@ -25,9 +53,8 @@ class MarkupTest < Test::Unit::TestCase f.read end - assert expected == actual, < Date: Tue, 9 Sep 2014 00:24:46 +0200 Subject: [PATCH 133/416] Add nokogiri and nokogiri-diff to gemspec --- github-markup.gemspec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/github-markup.gemspec b/github-markup.gemspec index 18392cb2..e544fc3f 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -17,4 +17,6 @@ Gem::Specification.new do |s| s.require_paths = %w[lib] s.add_dependency "posix-spawn", "~> 0.3.8" unless RUBY_PLATFORM == 'java' + s.add_development_dependency 'nokogiri', '~> 1.6.1' + s.add_development_dependency 'nokogiri-diff', '~> 0.2.0' end From e6b5dd157722a0e59b6ab22e3e15522c1cecf84c Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Tue, 9 Sep 2014 00:29:00 +0200 Subject: [PATCH 134/416] Trying to test jruby on travis. --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index efbff2ca..5b54647f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,8 @@ rvm: - 1.9.3 - 2.0.0 - 2.1.1 +jdk: + - oraclejdk7 + - openjdk7 notifications: disabled: true -bundler_args: --without development From 3dc4915df9099aafc9500bd17fc4a3190b71b466 Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Tue, 9 Sep 2014 00:42:01 +0200 Subject: [PATCH 135/416] Restore descriptive error message for test failures --- test/markup_test.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/markup_test.rb b/test/markup_test.rb index 7fab6a37..a76e0632 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -54,7 +54,8 @@ class MarkupTest < Test::Unit::TestCase end assert_html_equal expected, actual, < Date: Tue, 9 Sep 2014 11:14:15 +0200 Subject: [PATCH 136/416] Add jruby to travis. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 5b54647f..b05c680a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ rvm: - 1.9.3 - 2.0.0 - 2.1.1 + - jruby-19mode jdk: - oraclejdk7 - openjdk7 From 940d9425b8c3a9e2bcf6488c5bbcf12c2d79466d Mon Sep 17 00:00:00 2001 From: Bart Kamphorst Date: Tue, 9 Sep 2014 11:15:33 +0200 Subject: [PATCH 137/416] Skip test_raises_error_if_command_exits_non_zero on JRuby until https://github.com/jruby/jruby/issues/1947 is resolved. --- test/markup_test.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/markup_test.rb b/test/markup_test.rb index a76e0632..4d344ea1 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -68,6 +68,7 @@ def test_knows_what_it_can_and_cannot_render end def test_raises_error_if_command_exits_non_zero + skip("Skipping this test on JRuby until https://github.com/jruby/jruby/issues/1947 is fixed.") if RUBY_PLATFORM == 'java' GitHub::Markup.command('echo "failure message">&2 && false', /fail/) assert GitHub::Markup.can_render?('README.fail') begin From e1ea5782ebf09bb187e30cde04a0a1f09c4149ff Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Tue, 9 Sep 2014 15:49:55 +0200 Subject: [PATCH 138/416] Refactor changes to be ignored in diff. Fix bug that incorrectly ignored '-' changes. --- test/markup_test.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/markup_test.rb b/test/markup_test.rb index 4d344ea1..812e4903 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -21,11 +21,10 @@ def assert_html_equal(expected, actual, msg = nil) expected_doc.search('//text()').each {|node| node.content = normalize_html node.content} actual_doc.search('//text()').each {|node| node.content = normalize_html node.content} + ignore_changes = {"+" => Regexp.union(/^\s*id=".*"\s*$/), "-" => nil} expected_doc.diff(actual_doc) do |change, node| if change != ' ' && !node.blank? then - if change == "+" - break unless node.to_html =~ /id="*"/ - end + break unless node.to_html =~ ignore_changes[change] end end end From 26309c3117cacc01463fc68060da3452d839a5c5 Mon Sep 17 00:00:00 2001 From: Bart Kamphorst Date: Tue, 9 Sep 2014 16:44:53 +0200 Subject: [PATCH 139/416] Wrap shell command in a script as a workaround for https://github.com/jruby/jruby/issues/1947. --- test/fixtures/fail.sh | 3 +++ test/markup_test.rb | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100755 test/fixtures/fail.sh diff --git a/test/fixtures/fail.sh b/test/fixtures/fail.sh new file mode 100755 index 00000000..d6ec62b6 --- /dev/null +++ b/test/fixtures/fail.sh @@ -0,0 +1,3 @@ +#/usr/bin/env bash + +echo "failure message">&2 && false diff --git a/test/markup_test.rb b/test/markup_test.rb index 812e4903..4e86a766 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -67,8 +67,7 @@ def test_knows_what_it_can_and_cannot_render end def test_raises_error_if_command_exits_non_zero - skip("Skipping this test on JRuby until https://github.com/jruby/jruby/issues/1947 is fixed.") if RUBY_PLATFORM == 'java' - GitHub::Markup.command('echo "failure message">&2 && false', /fail/) + GitHub::Markup.command('test/fixtures/fail.sh', /fail/) assert GitHub::Markup.can_render?('README.fail') begin GitHub::Markup.render('README.fail', "stop swallowing errors") From 84b4912a5ba2bbf9cf357189ab26ba1965ef93c0 Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Wed, 10 Sep 2014 00:22:08 +0200 Subject: [PATCH 140/416] Fix shebang in fail.sh --- test/fixtures/fail.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/fail.sh b/test/fixtures/fail.sh index d6ec62b6..e89de54f 100755 --- a/test/fixtures/fail.sh +++ b/test/fixtures/fail.sh @@ -1,3 +1,3 @@ -#/usr/bin/env bash +#!/usr/bin/env bash echo "failure message">&2 && false From bde4a7b244ac6b82b2bfd7429e6d5ed798d913f0 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Thu, 11 Sep 2014 16:03:31 -0400 Subject: [PATCH 141/416] Perform case-insensitive test for file extensions --- lib/github/markup/implementation.rb | 2 +- test/markup_test.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/github/markup/implementation.rb b/lib/github/markup/implementation.rb index 463a39d4..9962d182 100644 --- a/lib/github/markup/implementation.rb +++ b/lib/github/markup/implementation.rb @@ -21,7 +21,7 @@ def match?(filename) private def file_ext_regexp - @file_ext_regexp ||= /\.(#{regexp})\z/ + @file_ext_regexp ||= /\.(#{regexp})\z/i end end end diff --git a/test/markup_test.rb b/test/markup_test.rb index cc7f74bf..7a1f459f 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -36,6 +36,7 @@ def test_knows_what_it_can_and_cannot_render assert_equal false, GitHub::Markup.can_render?('README.html') assert_equal true, GitHub::Markup.can_render?('README.markdown') assert_equal true, GitHub::Markup.can_render?('README.rmd') + assert_equal true, GitHub::Markup.can_render?('README.Rmd') assert_equal false, GitHub::Markup.can_render?('README.cmd') assert_equal true, GitHub::Markup.can_render?('README.litcoffee') end From d41a9e1fe65225e727f03ed68aa4849ef4b97816 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Thu, 11 Sep 2014 16:49:21 -0400 Subject: [PATCH 142/416] Case-insensitive on just markdown --- lib/github/markup/implementation.rb | 2 +- lib/github/markup/markdown.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/github/markup/implementation.rb b/lib/github/markup/implementation.rb index 9962d182..463a39d4 100644 --- a/lib/github/markup/implementation.rb +++ b/lib/github/markup/implementation.rb @@ -21,7 +21,7 @@ def match?(filename) private def file_ext_regexp - @file_ext_regexp ||= /\.(#{regexp})\z/i + @file_ext_regexp ||= /\.(#{regexp})\z/ end end end diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index 07f7ff87..8ad9722f 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -25,7 +25,7 @@ class Markdown < Implementation } def initialize - super(/md|rmd|mkdn?|mdwn|mdown|markdown|litcoffee/) + super(/md|rmd|mkdn?|mdwn|mdown|markdown|litcoffee/i) end def load From 27e20f0ef190fbc59d4b176b1ce317faa5a3ea31 Mon Sep 17 00:00:00 2001 From: Bart Kamphorst Date: Thu, 11 Sep 2014 23:23:20 +0200 Subject: [PATCH 143/416] Added exclude matrix to .travis.yml in order to prevent every regular ruby being tested twice. --- .travis.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.travis.yml b/.travis.yml index b05c680a..71eb9cb9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,23 @@ rvm: - 2.0.0 - 2.1.1 - jruby-19mode + - jruby-head jdk: - oraclejdk7 - openjdk7 +matrix: + exclude: + - rvm: 1.9.3 + jdk: oraclejdk7 + - rvm: 1.9.3 + jdk: openjdk7 + - rvm: 2.0.0 + jdk: oraclejdk7 + - rvm: 2.0.0 + jdk: openjdk7 + - rvm: 2.1.1 + jdk: oraclejdk7 + - rvm: 2.1.1 + jdk: openjdk7 notifications: disabled: true From 505356f14d64ae3fc0a2073751d2c4c8a7d4fede Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Thu, 11 Sep 2014 17:22:45 -0400 Subject: [PATCH 144/416] Update Changelog for 1.3.0 --- HISTORY.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 01ea4831..0cfdac48 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,6 +1,10 @@ -## 1.3.0 (unreleased) +## 1.3.0 (2014-09-11) +* Extend the field limit for tables to 50 characters for RST [#306](https://github.com/github/markup/pull/306) +* Add `.mkdn` as a supported markdown extension [#308](https://github.com/github/markup/pull/308) * Upgrade wikicloth to 0.8.1 [#317](https://github.com/github/markup/pull/317) +* Force encoding of posix-spawn output [#338](https://github.com/github/markup/pull/338) +* Add `.rmd` as a supported markdown extension [#343](https://github.com/github/markup/pull/343) [Full changelog](https://github.com/github/markup/compare/v1.2.1...v1.3.0) From 3d2e100f129c9ed3288a99f763e7b7157f85cef4 Mon Sep 17 00:00:00 2001 From: Bart Kamphorst Date: Sat, 13 Sep 2014 14:32:49 +0200 Subject: [PATCH 145/416] Test both jdk7 and jdk8 (with just oraclejdk). --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 71eb9cb9..6ff89be7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,20 +7,20 @@ rvm: - jruby-head jdk: - oraclejdk7 - - openjdk7 + - oraclejdk8 matrix: exclude: - rvm: 1.9.3 jdk: oraclejdk7 - rvm: 1.9.3 - jdk: openjdk7 + jdk: oraclejdk8 - rvm: 2.0.0 jdk: oraclejdk7 - rvm: 2.0.0 - jdk: openjdk7 + jdk: oraclejdk8 - rvm: 2.1.1 jdk: oraclejdk7 - rvm: 2.1.1 - jdk: openjdk7 + jdk: oraclejdk8 notifications: disabled: true From 5652cef6dc7fbb4f21cc5cea2677f445e14625f4 Mon Sep 17 00:00:00 2001 From: Bart Kamphorst Date: Sun, 14 Sep 2014 16:03:32 +0200 Subject: [PATCH 146/416] Install platform-specific dependencies in ext/mkrf_conf.rb. --- .travis.yml | 1 + Rakefile | 2 +- ext/mkrf_conf.rb | 15 +++++++++++++++ github-markup.gemspec | 3 ++- 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 ext/mkrf_conf.rb diff --git a/.travis.yml b/.travis.yml index 6ff89be7..cdbff3e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ before_install: sudo pip install docutils +script: bundle exec rake test rvm: - 1.9.3 - 2.0.0 diff --git a/Rakefile b/Rakefile index 5a7b12e6..a436eba6 100644 --- a/Rakefile +++ b/Rakefile @@ -14,4 +14,4 @@ task :console do sh "irb -I lib -r bundler/setup -r github/markup" end -task :default => :test +task :default \ No newline at end of file diff --git a/ext/mkrf_conf.rb b/ext/mkrf_conf.rb new file mode 100644 index 00000000..6b69b6ce --- /dev/null +++ b/ext/mkrf_conf.rb @@ -0,0 +1,15 @@ +require 'rubygems' +require 'rubygems/command.rb' +require 'rubygems/dependency_installer.rb' +begin + Gem::Command.build_args = ARGV + rescue NoMethodError +end +installer = Gem::DependencyInstaller.new +begin + unless RUBY_PLATFORM == 'java' + installer.install "posix-spawn", "~> 0.3.8" + end +rescue + exit(1) +end diff --git a/github-markup.gemspec b/github-markup.gemspec index e544fc3f..01d6263e 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -15,8 +15,9 @@ Gem::Specification.new do |s| s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) } s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = %w[lib] + s.extensions = "ext/mkrf_conf.rb" - s.add_dependency "posix-spawn", "~> 0.3.8" unless RUBY_PLATFORM == 'java' + # See ext/mkrf_conf.rb for platform-specific dependencies s.add_development_dependency 'nokogiri', '~> 1.6.1' s.add_development_dependency 'nokogiri-diff', '~> 0.2.0' end From b7a6adfbad126a43d3f74a8d53767956e6ce883a Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Sun, 14 Sep 2014 22:51:20 +0200 Subject: [PATCH 147/416] Document change in the way tests are run --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 57ba6e97..e5867fa1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,12 +53,12 @@ Finally add your [tests](#testing). To run the tests: - $ rake + $ rake test 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 `README.extension.html` should be the desired output. -Now run the tests: `rake` +Now run the tests: `rake test` If nothing complains, congratulations! From 4f1d5748a54f38a39514831ea7999eb748af3da5 Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Sun, 14 Sep 2014 23:07:29 +0200 Subject: [PATCH 148/416] Fix travis and do not require org-ruby on jruby --- .travis.yml | 6 ------ Gemfile | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index cdbff3e4..373f1603 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,15 +13,9 @@ matrix: exclude: - rvm: 1.9.3 jdk: oraclejdk7 - - rvm: 1.9.3 - jdk: oraclejdk8 - rvm: 2.0.0 jdk: oraclejdk7 - - rvm: 2.0.0 - jdk: oraclejdk8 - rvm: 2.1.1 jdk: oraclejdk7 - - rvm: 2.1.1 - jdk: oraclejdk8 notifications: disabled: true diff --git a/Gemfile b/Gemfile index fb7b8dac..050ec38c 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ gem "redcarpet", :platforms => :ruby gem "kramdown", :platforms => :jruby gem "RedCloth" gem "rdoc", "~>3.6" -gem "org-ruby", "= 0.9.1.gh" +gem "org-ruby", "= 0.9.1.gh", :platforms => :ruby gem "creole", "~>0.3.6" gem "wikicloth", "=0.8.1" gem "asciidoctor", "= 0.1.4" From 63faf67c996939ad57ced169719f324bc20d3cbd Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Sun, 14 Sep 2014 23:12:38 +0200 Subject: [PATCH 149/416] disable mediawiki on jruby, add org-ruby --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 050ec38c..5e42bad2 100644 --- a/Gemfile +++ b/Gemfile @@ -5,8 +5,8 @@ gem "redcarpet", :platforms => :ruby gem "kramdown", :platforms => :jruby gem "RedCloth" gem "rdoc", "~>3.6" -gem "org-ruby", "= 0.9.1.gh", :platforms => :ruby +gem "org-ruby", "= 0.9.1.gh" gem "creole", "~>0.3.6" -gem "wikicloth", "=0.8.1" +gem "wikicloth", "=0.8.1", :platforms => :ruby gem "asciidoctor", "= 0.1.4" gem "rake" From 92aa5e5dff6d012bc5359de396a39b9933397a95 Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Mon, 15 Sep 2014 00:25:41 +0200 Subject: [PATCH 150/416] Gemfile: other wikicloth on jruby, posix-spawn on ruby. --- Gemfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 5e42bad2..218754e1 100644 --- a/Gemfile +++ b/Gemfile @@ -1,12 +1,13 @@ source "http://rubygems.org" gemspec +gem "posix-spawn", :platforms => :ruby gem "redcarpet", :platforms => :ruby gem "kramdown", :platforms => :jruby gem "RedCloth" gem "rdoc", "~>3.6" gem "org-ruby", "= 0.9.1.gh" gem "creole", "~>0.3.6" -gem "wikicloth", "=0.8.1", :platforms => :ruby +gem "wikicloth", RUBY_PLATFORM == "java" ? "=0.8.0" : "=0.8.1" gem "asciidoctor", "= 0.1.4" gem "rake" From 1748e5f828b24c5d4590b07411f29fb1feccd3ec Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Mon, 15 Sep 2014 00:26:02 +0200 Subject: [PATCH 151/416] Fix bug in CommandImplementation#sanitize due to incorrect merging. --- lib/github/markup/command_implementation.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index e85c7149..7e44fd6c 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -48,21 +48,21 @@ def execute(command, target) raise CommandError.new(stderr.readlines.join('').strip) end end - sanitize(output.join('')) + sanitize(output.join(''), target.encoding) end else def execute(command, target) spawn = POSIX::Spawn::Child.new(*command, :input => target) if spawn.status.success? - sanitize(spawn.out) + sanitize(spawn.out, target.encoding) else raise CommandError.new(spawn.err.strip) end end end - def sanitize(input) - input.gsub("\r", '').force_encoding(target.encoding) + def sanitize(input, encoding) + input.gsub("\r", '').force_encoding(encoding) end end From 3ec9eafef282fe303d6600784f37b9329ec1f2e5 Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Mon, 15 Sep 2014 19:01:52 +0200 Subject: [PATCH 152/416] Disable mediawiki on jruby --- Gemfile | 2 +- test/markup_test.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 218754e1..09589c1f 100644 --- a/Gemfile +++ b/Gemfile @@ -8,6 +8,6 @@ gem "RedCloth" gem "rdoc", "~>3.6" gem "org-ruby", "= 0.9.1.gh" gem "creole", "~>0.3.6" -gem "wikicloth", RUBY_PLATFORM == "java" ? "=0.8.0" : "=0.8.1" +gem "wikicloth", :platforms => :ruby gem "asciidoctor", "= 0.1.4" gem "rake" diff --git a/test/markup_test.rb b/test/markup_test.rb index ca470fee..a98706b1 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -38,8 +38,9 @@ class MarkupTest < Test::Unit::TestCase markup = readme.split('/').last.gsub(/^README\./, '') define_method "test_#{markup}" do - source = File.read(readme) + skip "Skipping MediaWiki test because wikicloth is currently not compatible with JRuby." if markup == "mediawiki" && RUBY_PLATFORM == "java" + source = File.read(readme) expected_file = "#{readme}.html" expected = File.read(expected_file).rstrip actual = GitHub::Markup.render(readme, File.read(readme)).rstrip.force_encoding("utf-8") From c3a04237cae36293614af0c530b08ec757825510 Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Mon, 15 Sep 2014 19:49:07 +0200 Subject: [PATCH 153/416] Do not test against jruby-head (unstable) --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 373f1603..41081436 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ rvm: - 2.0.0 - 2.1.1 - jruby-19mode - - jruby-head jdk: - oraclejdk7 - oraclejdk8 From b1e4fb6ee6125ed5365b6d3b3204953907cbb51c Mon Sep 17 00:00:00 2001 From: Stephen Caraher Date: Fri, 19 Sep 2014 01:43:03 +1000 Subject: [PATCH 154/416] use not for rst inline literals --- lib/github/commands/rest2html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index c8c8b521..ca9f26ff 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -86,6 +86,14 @@ class GitHubHTMLTranslator(HTMLTranslator): else: self.body.append(self.starttag(node, 'pre')) + # always wrap two-backtick rst inline literals in , not + # this also avoids the generation of superfluous tags + def visit_literal(self, node): + self.body.append(self.starttag(node, 'code', suffix='')) + + def depart_literal(self, node): + self.body.append('') + def visit_table(self, node): classes = ' '.join(['docutils', self.settings.table_style]).strip() self.body.append( From bd75dc1f873291b0da2fb2b2b6f8f94f4bbc6e51 Mon Sep 17 00:00:00 2001 From: Stephen Caraher Date: Fri, 19 Sep 2014 03:24:06 +1000 Subject: [PATCH 155/416] updated rst html tests to expect not --- test/markups/README.rst.html | 4 ++-- test/markups/README.rst.txt.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index 4186694d..09c2bf32 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -10,8 +10,8 @@

      Subtitle

      Header 2

        -
      1. Blah blah code blah
      2. -
      3. More code, hooray
      4. +
      5. Blah blah code blah
      6. +
      7. More code, hooray
      8. Somé UTF-8°

      The UTF-8 quote character in this table used to cause python to go boom. Now docutils just silently ignores it.

      diff --git a/test/markups/README.rst.txt.html b/test/markups/README.rst.txt.html index d46c426f..c8e8b33d 100644 --- a/test/markups/README.rst.txt.html +++ b/test/markups/README.rst.txt.html @@ -2,8 +2,8 @@

      Header 1

      Example text.

      Header 2

        -
      1. Blah blah code blah
      2. -
      3. More code, hooray
      4. +
      5. Blah blah code blah
      6. +
      7. More code, hooray
      8. Somé UTF-8°
      Status:Under Development
      Location:http://github.com/wallyqs/org-ruby
      From 9e5907663c80f15328c495c0937bf69199078f7c Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Mon, 29 Sep 2014 11:55:51 -0400 Subject: [PATCH 156/416] Refactor rdoc impelementation --- lib/github/markup/rdoc.rb | 11 ++++++----- lib/github/markups.rb | 5 ++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/github/markup/rdoc.rb b/lib/github/markup/rdoc.rb index 5bf14639..dcbdf32c 100644 --- a/lib/github/markup/rdoc.rb +++ b/lib/github/markup/rdoc.rb @@ -1,20 +1,21 @@ +require "github/markup/implementation" require "rdoc" require "rdoc/markup/to_html" module GitHub module Markup - class RDoc - def initialize(content) - @content = content + class RDoc < Implementation + def initialize + super /rdoc/ end - def to_html + def render(content) if ::RDoc::VERSION.to_i >= 4 h = ::RDoc::Markup::ToHtml.new(::RDoc::Options.new) else h = ::RDoc::Markup::ToHtml.new end - h.convert(@content) + h.convert(content) end end end diff --git a/lib/github/markups.rb b/lib/github/markups.rb index eb562909..1915b662 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -1,4 +1,5 @@ require "github/markup/markdown" +require "github/markup/rdoc" require "shellwords" markups << GitHub::Markup::Markdown.new @@ -7,9 +8,7 @@ RedCloth.new(content).to_html end -markup('github/markup/rdoc', /rdoc/) do |content| - GitHub::Markup::RDoc.new(content).to_html -end +markups << GitHub::Markup::RDoc.new markup('org-ruby', /org/) do |content| Orgmode::Parser.new(content, { From 7a06537713a8a6e56192f2f2c8a082319b7b99d5 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Mon, 29 Sep 2014 11:56:27 -0400 Subject: [PATCH 157/416] add #name to all markup implementations --- lib/github/markup.rb | 4 ++-- lib/github/markup/command_implementation.rb | 5 +++-- lib/github/markup/gem_implementation.rb | 4 ++++ lib/github/markup/markdown.rb | 4 ++++ lib/github/markup/rdoc.rb | 4 ++++ lib/github/markups.rb | 12 ++++++++---- test/markup_test.rb | 14 +++++++++++++- 7 files changed, 38 insertions(+), 9 deletions(-) diff --git a/lib/github/markup.rb b/lib/github/markup.rb index 4e3bf917..88d8a45e 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -30,12 +30,12 @@ def markup(file, pattern, opts = {}, &block) markups << GemImplementation.new(pattern, file, &block) end - def command(command, regexp, &block) + def command(command, regexp, name, &block) if File.exists?(file = File.dirname(__FILE__) + "/commands/#{command}") command = file end - markups << CommandImplementation.new(regexp, command, &block) + markups << CommandImplementation.new(regexp, command, name, &block) end def can_render?(filename) diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index 170e9b0a..1115535f 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -7,12 +7,13 @@ class CommandError < RuntimeError end class CommandImplementation < Implementation - attr_reader :command, :block + attr_reader :command, :block, :name - def initialize(regexp, command, &block) + def initialize(regexp, command, name, &block) super regexp @command = command.to_s @block = block + @name = name end def render(content) diff --git a/lib/github/markup/gem_implementation.rb b/lib/github/markup/gem_implementation.rb index a9f80b75..270f5a88 100644 --- a/lib/github/markup/gem_implementation.rb +++ b/lib/github/markup/gem_implementation.rb @@ -21,6 +21,10 @@ def render(content) load renderer.call(content) end + + def name + gem_name + end end end end diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index 8ad9722f..c3b51bfb 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -44,6 +44,10 @@ def render(content) @renderer.call(content) end + def name + "markdown" + end + private def try_require(file) require file diff --git a/lib/github/markup/rdoc.rb b/lib/github/markup/rdoc.rb index dcbdf32c..5448f455 100644 --- a/lib/github/markup/rdoc.rb +++ b/lib/github/markup/rdoc.rb @@ -17,6 +17,10 @@ def render(content) end h.convert(content) end + + def name + "rdoc" + end end end end diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 1915b662..0165f4a4 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -11,8 +11,8 @@ markups << GitHub::Markup::RDoc.new markup('org-ruby', /org/) do |content| - Orgmode::Parser.new(content, { - :allow_include_files => false, + Orgmode::Parser.new(content, { + :allow_include_files => false, :skip_syntax_highlight => true }).to_html end @@ -29,14 +29,18 @@ Asciidoctor.render(content, :safe => :secure, :attributes => %w(showtitle idprefix idseparator=- env=github env-github source-highlighter=html-pipeline)) end -command("python2 -S #{Shellwords.escape(File.dirname(__FILE__))}/commands/rest2html", /re?st(\.txt)?/) +command( + "python2 -S #{Shellwords.escape(File.dirname(__FILE__))}/commands/rest2html", + /re?st(\.txt)?/, + "restructuredtext" +) # pod2html is nice enough to generate a full-on HTML document for us, # so we return the favor by ripping out the good parts. # # Any block passed to `command` will be handed the command's STDOUT for # post processing. -command('/usr/bin/env perl -MPod::Simple::HTML -e Pod::Simple::HTML::go', /pod/) do |rendered| +command('/usr/bin/env perl -MPod::Simple::HTML -e Pod::Simple::HTML::go', /pod/, "pod") do |rendered| if rendered =~ /\s*(.+)\s*/mi $1 end diff --git a/test/markup_test.rb b/test/markup_test.rb index 392424f7..9a54262c 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -43,8 +43,20 @@ def test_knows_what_it_can_and_cannot_render assert_equal true, GitHub::Markup.can_render?('README.litcoffee') end + def test_each_render_has_a_name + assert_equal "markdown", GitHub::Markup.renderer('README.md').name + assert_equal "redcloth", GitHub::Markup.renderer('README.textile').name + assert_equal "rdoc", GitHub::Markup.renderer('README.rdoc').name + assert_equal "org-ruby", GitHub::Markup.renderer('README.org').name + assert_equal "creole", GitHub::Markup.renderer('README.creole').name + assert_equal "wikicloth", GitHub::Markup.renderer('README.wiki').name + assert_equal "asciidoctor", GitHub::Markup.renderer('README.adoc').name + assert_equal "restructuredtext", GitHub::Markup.renderer('README.rst').name + assert_equal "pod", GitHub::Markup.renderer('README.pod').name + end + def test_raises_error_if_command_exits_non_zero - GitHub::Markup.command('echo "failure message">&2 && false', /fail/) + GitHub::Markup.command('echo "failure message">&2 && false', /fail/, "fail") assert GitHub::Markup.can_render?('README.fail') begin GitHub::Markup.render('README.fail', "stop swallowing errors") From 50befce17286d6c915f994222df29255f1c204b9 Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Mon, 20 Oct 2014 19:10:49 -0400 Subject: [PATCH 158/416] Replace the deprecated RedcarpetCompat instance --- lib/github/markup/markdown.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index 8ad9722f..f2744ca3 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -8,7 +8,7 @@ class Markdown < Implementation GitHub::Markdown.render(content) }, "redcarpet" => proc { |content| - RedcarpetCompat.new(content).to_html + Redcarpet::Markdown.new(Redcarpet::Render::HTML).render(content) }, "rdiscount" => proc { |content| RDiscount.new(content).to_html From 090eea9ea860d9d54578ac11c7aea544f595ddc0 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Mon, 3 Nov 2014 23:00:05 -0500 Subject: [PATCH 159/416] Remove test rst file --- lib/github/commands/foo.rst | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 lib/github/commands/foo.rst diff --git a/lib/github/commands/foo.rst b/lib/github/commands/foo.rst deleted file mode 100644 index e0950998..00000000 --- a/lib/github/commands/foo.rst +++ /dev/null @@ -1,7 +0,0 @@ - -.. image:: https://scan.coverity.com/projects/621/badge.svg - :target: https://scan.coverity.com/projects/621 - :alt: Coverity Scan Build Status - -.. image:: https://scan.coverity.com/projects/621/badge.svg - :alt: Coverity Scan Build Status From e559e02a947e3c3eb58fee87da9bcf74d56f1885 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Thu, 13 Nov 2014 09:42:00 -0500 Subject: [PATCH 160/416] Release 1.3.1 --- HISTORY.md | 6 ++++++ lib/github-markup.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 0cfdac48..2c2ca4e2 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,9 @@ +## 1.3.1 (2014-11-13) + +* Fix name error when trying to use newer versions of RedCarpet [#387](https://github.com/github/markup/pull/387) + +[Full changelog](https://github.com/github/markup/compare/v1.3.0...v1.3.1) + ## 1.3.0 (2014-09-11) * Extend the field limit for tables to 50 characters for RST [#306](https://github.com/github/markup/pull/306) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 18124c91..2f98a768 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.3.0' + VERSION = '1.3.1' Version = VERSION end end From cb554eee94669b0cca89b5895033f73c4759dc69 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 20 Nov 2014 21:07:39 -0800 Subject: [PATCH 161/416] Update test suite to rely on the Minitest gem --- github-markup.gemspec | 1 + test/markup_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index 38604aee..927462dc 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -17,4 +17,5 @@ Gem::Specification.new do |s| s.require_paths = %w[lib] s.add_dependency "posix-spawn", "~> 0.3.8" + s.add_dependency 'minitest', '~> 5.4.3' end diff --git a/test/markup_test.rb b/test/markup_test.rb index 392424f7..894b3dba 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -3,9 +3,9 @@ $LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib" require 'github/markup' -require 'test/unit' +require 'minitest/autorun' -class MarkupTest < Test::Unit::TestCase +class MarkupTest < Minitest::Test Dir['test/markups/README.*'].each do |readme| next if readme =~ /html$/ markup = readme.split('/').last.gsub(/^README\./, '') From 5f32f708f6650ee71cbfe2808e2502afe9d18577 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 20 Nov 2014 21:19:51 -0800 Subject: [PATCH 162/416] Reparations to the travis.yml file --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index efbff2ca..1bb21db3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,9 @@ +language: ruby before_install: sudo pip install docutils rvm: - 1.9.3 - 2.0.0 - 2.1.1 notifications: - disabled: true + email: false bundler_args: --without development From f062f519a20cbba382f6ff66a6d5fd5ee88f528a Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Mon, 22 Dec 2014 12:37:50 -0500 Subject: [PATCH 163/416] Remove rarely used docs for adding new markup langauges --- CONTRIBUTING.md | 45 --------------------------------------------- 1 file changed, 45 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 57ba6e97..935fa2e2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,57 +9,12 @@ Want to contribute? Great! 5. Open a [Pull Request][1] 6. Enjoy a refreshing Diet Coke and wait - -There are two ways to add markups. - -### Commands - -If your markup is in a language other than Ruby, drop a translator -script in `lib/github/commands` which accepts input on STDIN and -returns HTML on STDOUT. See [rest2html][r2h] for an example. - -Once your script is in place, edit `lib/github/markups.rb` and tell -GitHub Markup about it. Again we look to [rest2html][r2hc] for -guidance: - - command(:rest2html, /re?st(.txt)?/) - -Here we're telling GitHub Markup of the existence of a `rest2html` -command which should be used for any file ending in `rest`, -`rst`, `rest.txt` or `rst.txt`. Any regular expression will do. - -Finally add your [tests](#testing). - -### Classes - -If your markup can be translated using a Ruby library, that's -great. Check out `lib/github/markups.rb` for some -examples. Let's look at Markdown: - - markup(:markdown, /md|mkdn?|markdown/) do |content| - Markdown.new(content).to_html - end - -We give the `markup` method three bits of information: the name of the -file to `require`, a regular expression for extensions to match, and a -block to run with unformatted markup which should return HTML. - -If you need to monkeypatch a RubyGem or something, check out the -included RDoc example. - -Finally add your [tests](#testing). - ### Testing To run the tests: $ rake -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 -`README.extension.html` should be the desired output. - -Now run the tests: `rake` - If nothing complains, congratulations! ## Releasing a new version From 2156565106b6fcdab0bf0b2272439dbf52aff1ef Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Mon, 22 Dec 2014 11:38:19 -0500 Subject: [PATCH 164/416] Minitest should be a development dependency --- github-markup.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index 927462dc..fb74b2f8 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -17,5 +17,5 @@ Gem::Specification.new do |s| s.require_paths = %w[lib] s.add_dependency "posix-spawn", "~> 0.3.8" - s.add_dependency 'minitest', '~> 5.4.3' + s.add_development_dependency 'minitest', '~> 5.4.3' end From ef25634ef980a5f6a8f0fc8552ee20ce999ef766 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Mon, 22 Dec 2014 12:51:21 -0500 Subject: [PATCH 165/416] Render with HTML pipeline --- github-markup.gemspec | 2 ++ test/markup_test.rb | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index fb74b2f8..965b941b 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -18,4 +18,6 @@ Gem::Specification.new do |s| s.add_dependency "posix-spawn", "~> 0.3.8" s.add_development_dependency 'minitest', '~> 5.4.3' + s.add_development_dependency 'html-pipeline', '~> 1.0' + s.add_development_dependency 'sanitize' end diff --git a/test/markup_test.rb b/test/markup_test.rb index 894b3dba..1f62a46f 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -4,8 +4,20 @@ require 'github/markup' require 'minitest/autorun' +require 'html/pipeline' class MarkupTest < Minitest::Test + class MarkupFilter < HTML::Pipeline::Filter + def call + filename = context[:filename] + GitHub::Markup.render(filename, File.read(filename)).rstrip.force_encoding("utf-8") + end + end + + Pipeline = HTML::Pipeline.new [ + MarkupFilter + ] + Dir['test/markups/README.*'].each do |readme| next if readme =~ /html$/ markup = readme.split('/').last.gsub(/^README\./, '') @@ -15,7 +27,7 @@ class MarkupTest < Minitest::Test expected_file = "#{readme}.html" expected = File.read(expected_file).rstrip - actual = GitHub::Markup.render(readme, File.read(readme)).rstrip.force_encoding("utf-8") + actual = Pipeline.to_html(nil, :filename => readme) if source != expected assert(source != actual, "#{markup} did not render anything") From ebe8e64b5c622bb1fe0bad171e041ab38e04c38c Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Mon, 22 Dec 2014 13:03:41 -0500 Subject: [PATCH 166/416] Use sanitization filter in tests --- test/markup_test.rb | 5 +- test/markups/README.asciidoc.html | 29 +++++------ test/markups/README.creole.html | 6 ++- test/markups/README.litcoffee.html | 12 ++--- test/markups/README.markdown.html | 2 +- test/markups/README.mediawiki.html | 44 +++++++++++----- test/markups/README.noformat.html | 2 +- test/markups/README.org.html | 77 +++++++++++++++------------ test/markups/README.pod.html | 53 ++++++------------- test/markups/README.rdoc.html | 15 +++--- test/markups/README.rmd.html | 2 +- test/markups/README.rst.html | 84 +++++++++++++++++------------- test/markups/README.rst.txt.html | 39 ++++++++------ test/markups/README.txt.html | 2 +- 14 files changed, 198 insertions(+), 174 deletions(-) diff --git a/test/markup_test.rb b/test/markup_test.rb index 1f62a46f..1221eb2b 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -10,12 +10,13 @@ class MarkupTest < Minitest::Test class MarkupFilter < HTML::Pipeline::Filter def call filename = context[:filename] - GitHub::Markup.render(filename, File.read(filename)).rstrip.force_encoding("utf-8") + GitHub::Markup.render(filename, File.read(filename)).strip.force_encoding("utf-8") end end Pipeline = HTML::Pipeline.new [ - MarkupFilter + MarkupFilter, + HTML::Pipeline::SanitizationFilter ] Dir['test/markups/README.*'].each do |readme| diff --git a/test/markups/README.asciidoc.html b/test/markups/README.asciidoc.html index 0692ac1d..4f06d0f9 100644 --- a/test/markups/README.asciidoc.html +++ b/test/markups/README.asciidoc.html @@ -1,8 +1,8 @@

      Document Title

      -
      -

      First Section

      -
      -
      +
      +

      First Section

      +
      +
      • One

        @@ -14,26 +14,25 @@

        First Section

      -
      -

      Second Section

      -
      -
      +
      +

      Second Section

      +
      +
      - -
      -
      Note
      +
      +
      Note
      + Here is some source code.
      -
      -
      +
      +
      puts "Hello, World!"
      -
      - + \ No newline at end of file diff --git a/test/markups/README.creole.html b/test/markups/README.creole.html index cc16572f..ec67cd0f 100644 --- a/test/markups/README.creole.html +++ b/test/markups/README.creole.html @@ -1,4 +1,8 @@ -

      H1

      H2

      paragraph of text that will be turned into a paragraph element. It can go over several lines with line breaks, it will be turned into a contiguous paragraph element.

      You can force a linebreak in your paragraph text
      thusly.

      • a list element
        • sub list element
      • 2nd list element
      pre formatted text
      +

      H1

      H2

      paragraph of text that will be turned into a paragraph element. It can go over several lines with line breaks, it will be turned into a contiguous paragraph element.

      You can force a linebreak in your paragraph text
      thusly.

        +
      • a list element
        • sub list element
        +
      • +
      • 2nd list element
      • +
      pre formatted text
       
       $ ls -la
       total 56
      diff --git a/test/markups/README.litcoffee.html b/test/markups/README.litcoffee.html
      index e33f2349..5caa8780 100644
      --- a/test/markups/README.litcoffee.html
      +++ b/test/markups/README.litcoffee.html
      @@ -6,13 +6,13 @@ 

      Literate CoffeeScript Test

      comment comment

      -
      test "basic literate CoffeeScript parsing", ->
      +
      test "basic literate CoffeeScript parsing", ->
         ok yes
       

      now with a...

      -
      test "broken up indentation", ->
      +
      test "broken up indentation", ->
       

      ... broken up ...

      @@ -27,7 +27,7 @@

      Literate CoffeeScript Test

      Code must be separated from text by a blank line.

      -
      test "code blocks must be preceded by a blank line", ->
      +
      test "code blocks must be preceded by a blank line", ->
       

      The next line is part of the text and will not be executed. @@ -38,7 +38,7 @@

      Literate CoffeeScript Test

      Code in backticks is not parsed and...

      -
      test "comments in indented blocks work", ->
      +
      test "comments in indented blocks work", ->
         do ->
           do ->
             # Regular comment.
      @@ -62,5 +62,5 @@ 

      Literate CoffeeScript Test

      Tabs work too:

      -

      test "tabbed code", -> - ok yes

      +

      test "tabbed code", -> + ok yes

      \ No newline at end of file diff --git a/test/markups/README.markdown.html b/test/markups/README.markdown.html index a1b9abab..ab0cc685 100644 --- a/test/markups/README.markdown.html +++ b/test/markups/README.markdown.html @@ -1,4 +1,4 @@
      • One
      • Two
      • -
      + \ No newline at end of file diff --git a/test/markups/README.mediawiki.html b/test/markups/README.mediawiki.html index a84d3d7b..6f9ac5e3 100644 --- a/test/markups/README.mediawiki.html +++ b/test/markups/README.mediawiki.html @@ -1,19 +1,29 @@ - -

      » JRuby Project Wiki Home Page -

      Embedding JRuby

      +

      » JRuby Project Wiki Home Page +

      Embedding JRuby

      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. -

      -

      Table of Contents

      -

      -

      Red Bridge (JRuby Embed)

      +

      +

      Table of Contents

      + +
      + + +

      +Red Bridge (JRuby Embed)

      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 legacy API should still work, but we strongly recommend Red Bridge for all new projects.

      -

      Features of Red Bridge

      +

      +Features of Red Bridge

      Red Bridge consists of two layers: Embed Core on the bottom, and implementations of JSR223 and BSF 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. @@ -23,19 +33,25 @@

      API documentation has all the gory details. It's worth talking about a couple of the finer points here.

      -

      Previous Embedding JRuby Page

      +

      +Previous Embedding JRuby Page

      -

      We recommend using Embed Core; however, if you're maintaining code that uses the old API, you can find its documentation on the legacy embedding[1] page. +

      We recommend using Embed Core; however, if you're maintaining code that uses the old API, you can find its documentation on the legacy embedding[1] page.

      -

      References

      +

      +References

      -

      1. ^ This link goes nowhere.

      \ No newline at end of file +

      1. +^ This link goes nowhere.
      \ No newline at end of file diff --git a/test/markups/README.noformat.html b/test/markups/README.noformat.html index b36565cc..c2e3c5fd 100644 --- a/test/markups/README.noformat.html +++ b/test/markups/README.noformat.html @@ -1,2 +1,2 @@ * One -* Two +* Two \ No newline at end of file diff --git a/test/markups/README.org.html b/test/markups/README.org.html index 0326e393..73f9cf4b 100644 --- a/test/markups/README.org.html +++ b/test/markups/README.org.html @@ -1,38 +1,47 @@ -

      org-ruby

      +

      org-ruby

      - - - + + + + + + + + + + + +
      Status:Under Development
      Location:http://github.com/wallyqs/org-ruby
      Version:0.9.0
      Status:Under Development
      Location:http://github.com/wallyqs/org-ruby
      Version:0.9.0
      -

      1 Description

      +

      1 Description

      Helpful Ruby routines for parsing orgmode files. The most significant thing this library does today is convert orgmode files to textile. Currently, you cannot do much to customize the conversion. The supplied textile conversion is optimized for - extracting “content” from the orgfile as opposed to “metadata.”

      -

      2 History

      -

      2.1 2014-02-08: Version 0.9.0

      + extracting “content” from the orgfile as opposed to “metadata.”

      +

      2 History

      +

      2.1 2014-02-08: Version 0.9.0

        -
      • Let’s make sure #+INCLUDE: is not supported
      • +
      • Let’s make sure #+INCLUDE: is not supported
      • And confirm that syntax highlight is supported
      -
      +
       module GitHub
         module Markup
      -    VERSION = 'test'
      +    VERSION = 'test'
           Version = VERSION
         end
       end
       
      -

      2.2 2009-12-30: Version 0.5.1

      +

      2.2 2009-12-30: Version 0.5.1

        -
      • Minor enhancement: Recognize lines starting with “:” as examples.
      • +
      • Minor enhancement: Recognize lines starting with “:” as examples.
      • Minor enhancement: Recognize #+BEGIN_SRC as source blocks
      • -
      • Minor enhancement: Add “src” and “example” classes to <pre> blocks.
      • +
      • Minor enhancement: Add “src” and “example” classes to <pre> blocks.
      -

      2.3 2009-12-30: Version 0.5.0

      +

      2.3 2009-12-30: Version 0.5.0

      • Parse (but not necessarily use) in-buffer settings. The following in-buffer settings are used: @@ -47,7 +56,7 @@

        2.3 2009-12-30: Version the tree to export

      -
    • Rewrite “file:(blah).org” links to “http:(blah).html” links. This +
    • Rewrite “file:(blah).org” links to “http:(blah).html” links. This makes the inter-links to other org-mode files work.
    • Uses <th> tags inside table rows that precede table separators.
    • Bugfixes: @@ -56,7 +65,7 @@

      2.3 2009-12-30: Version

    • -

      2.4 2009-12-29: Version 0.4.2

      +

      2.4 2009-12-29: Version 0.4.2

      • Got rid of the extraneous newline at the start of code blocks.
      • Everything now shows up in code blocks, even org-mode metadata.
      • @@ -67,59 +76,59 @@

        2.4 2009-12-29: Version

      -

      2.5 2009-12-29: Version 0.4.1

      +

      2.5 2009-12-29: Version 0.4.1

      • HTML is now escaped by default
      • org-mode comments will show up in a code block.
      -

      2.6 2009-12-29: Version 0.4

      +

      2.6 2009-12-29: Version 0.4

        -
      • The first thing output in HTML gets the class “title”
      • +
      • The first thing output in HTML gets the class “title”
      • HTML output is now indented
      • Proper support for multi-paragraph list items.

        See? This paragraph is part of the last bullet.

      • Fixed bugs:
          -
        • “rake spec” wouldn’t work on Linux. Needed “require ‘rubygems’”.
        • +
        • “rake spec” wouldn’t work on Linux. Needed “require ‘rubygems’”.
      -

      2.7 2009-12-27: Version 0.3

      +

      2.7 2009-12-27: Version 0.3

        -
      • Uses rubypants to get better typography (smart quotes, elipses, etc…).
      • +
      • Uses rubypants to get better typography (smart quotes, elipses, etc…).
      • Fixed bugs:
        • Tables and lists did not get properly closed at the end of file
        • -
        • You couldn’t do inline formatting inside table cells
        • +
        • You couldn’t do inline formatting inside table cells
        • Characters in PRE blocks were not HTML escaped.
      -

      2.8 2009-12-26: Version 0.2

      +

      2.8 2009-12-26: Version 0.2

      • Added to_html output on the parser.
      • Added support for the full range of inline markup: bold, - italic, code, verbatim, underline, strikethrough.
      • + italic, code, verbatim, underline, strikethrough.
      • Lots of refactoring to make the code more maintainable.
      -

      2.9 2009-12-23: Version 0.1

      +

      2.9 2009-12-23: Version 0.1

      • Added support for block code, like this: -
        +    
           def flush!
        -  @logger.debug "FLUSH ==========> #{@output_type}"
        +  @logger.debug "FLUSH ==========> #{@output_type}"
           if (@output_type == :blank) then
        -    @output << "\n"
        +    @output << "\n"
           elsif (@buffer.length > 0) then
             if @cancel_modifier then
        -      @output << "p. " if @output_type == :paragraph
        +      @output << "p. " if @output_type == :paragraph
               @cancel_modifier = false
             end
             @output << @paragraph_modifier if (@paragraph_modifier and not sticky_modifier?)
        -    @output << @buffer.textile_substitution << "\n"
        +    @output << @buffer.textile_substitution << "\n"
           end
        -  @buffer = ""
        +  @buffer = ""
         end
             
      • @@ -127,4 +136,4 @@

        2.9 2009-12-23: Version greatly simplified a lot of the messiness of textile conversion.
      • Added support for line breaks within list items.
      • -

      + \ No newline at end of file diff --git a/test/markups/README.pod.html b/test/markups/README.pod.html index 8bc00b37..73ea8409 100644 --- a/test/markups/README.pod.html +++ b/test/markups/README.pod.html @@ -1,20 +1,14 @@ - + -

      Matrixy

      +

      Matrixy

      -

      INTRODUCTION

      +

      INTRODUCTION

      This is a port of the MATLAB/Octave programming language to Parrot. See the ROADMAP file for more information on the status of this project, and what else needs to be done.

      -

      ABOUT

      +

      ABOUT

      Primary goals are:

      @@ -22,9 +16,7 @@

      =item* Create a working compiler that understands the majority of the MATLAB/Octave programming language.

      -

      IMPLEMENTATION

      +

      IMPLEMENTATION

      This project is broken into three primary components:

      @@ -42,7 +34,7 @@

      @@ -51,15 +43,11 @@

      toolbox/.

      -

      DEPENDENCIES

      +

      DEPENDENCIES

      Matrixy depends on these dependencies:

      -

      Parrot

      +

      Parrot

      To get a proper version of Parrot to build Matrixy, you will need to check out and build Parrot from source:

      @@ -67,42 +55,31 @@

      svn co http://svn.parrot.org/parrot/trunk parrot cd parrot perl Configure.pl - make && make test && make install-dev + make && make test && make install-dev -

      Parrot-Linear-Algebra

      +

      Parrot-Linear-Algebra

      The linear algebra package for Parrot is available separately and provides functionality required by Matrixy. This includes matrix data types and matrix manipulation libraries

      -

      BUILDING

      +

      BUILDING

      Once all dependencies are in place, you can build Matrixy using this sequence of commands:

          perl Configure.pl
           nmake test
      -

      TODO

      +

      TODO

          * Parser
           * Standard Builtins
           * Test against Octave Test Suite.
      -

      BUGS

      +

      BUGS

      Lots!

      -

      CONTACT

      +

      CONTACT

      If you need to contact the Matrixy team, go to the project home page at:

      -

      www.github.com\Whiteknight\matrixy

      - +

      www.github.com\Whiteknight\matrixy

      \ No newline at end of file diff --git a/test/markups/README.rdoc.html b/test/markups/README.rdoc.html index b53c3b70..93770dde 100644 --- a/test/markups/README.rdoc.html +++ b/test/markups/README.rdoc.html @@ -1,11 +1,12 @@ -
      • +
          +
        • One

          -
        • +
        • +
        • Two

          -
        +
      • +
      -

      This is an absolute link. So is this: github.com

      +

      This is an absolute link. So is this: github.com

      -

      This is a relative link. So is this: rawr.html

      +

      This is a relative link. So is this: rawr.html

      \ No newline at end of file diff --git a/test/markups/README.rmd.html b/test/markups/README.rmd.html index e712d1c7..39644656 100644 --- a/test/markups/README.rmd.html +++ b/test/markups/README.rmd.html @@ -3,4 +3,4 @@

      Title

      • One
      • Two
      • -
      + \ No newline at end of file diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index 09c2bf32..a074e8d5 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -1,61 +1,73 @@ -

      Header 1

      -

      Subtitle

      +

      Header 1

      +

      Subtitle

      Example text.

      -
      -

      Table of Contents

      -
        -
      • Header 2
      • -
      • Field list
      • +
        +

        Table of Contents

        +
        -

        Header 2

        -
          +

          Header 2

          +
          1. Blah blah code blah
          2. More code, hooray
          3. Somé UTF-8°

          The UTF-8 quote character in this table used to cause python to go boom. Now docutils just silently ignores it.

          - ---- +
          + + + + - - + + + - - + + + - - + + + - - + + + - - + + +
          Travishttp://travis-ci.org/tony/pullv
          Travishttp://travis-ci.org/tony/pullv
          Docshttp://pullv.rtfd.org
          Docshttp://pullv.rtfd.org
          APIhttp://pullv.readthedocs.org/en/latest/api.html
          APIhttp://pullv.readthedocs.org/en/latest/api.html
          Issueshttps://github.com/tony/pullv/issues
          Issueshttps://github.com/tony/pullv/issues
          Sourcehttps://github.com/tony/pullv
          Sourcehttps://github.com/tony/pullv
          -Coverity Scan Build Status +Coverity Scan Build Status Coverity Scan Build Status -

          Field list

          - --+

          Field list

          +
          + + - - + + + + - + + - + + + - + + + -
          123456789 123456789 123456789 123456789 123456789 1:
           Uh-oh! This name is too long!
          123456789 123456789 123456789 123456789 123456789 1:
           Uh-oh! This name is too long!
          123456789 123456789 123456789 123456789 1234567890:this is a long name, +
          123456789 123456789 123456789 123456789 1234567890:this is a long name, but no problem!
          123456789 12345:this is not so long, but long enough for the default!
          123456789 12345:this is not so long, but long enough for the default!
          123456789 1234:this should work even with the default :)
          123456789 1234:this should work even with the default :)
          - + \ No newline at end of file diff --git a/test/markups/README.rst.txt.html b/test/markups/README.rst.txt.html index c8e8b33d..d2e61dc6 100644 --- a/test/markups/README.rst.txt.html +++ b/test/markups/README.rst.txt.html @@ -1,31 +1,36 @@ -

          Header 1

          +

          Header 1

          Example text.

          Header 2

          -
            +
            1. Blah blah code blah
            2. More code, hooray
            3. Somé UTF-8°
            - ---- +
            + + + + - - + + + - - + + + - - + + + - - + + + - - + + +
            Travishttp://travis-ci.org/tony/pullv
            Travishttp://travis-ci.org/tony/pullv
            Docshttp://pullv.rtfd.org
            Docshttp://pullv.rtfd.org
            APIhttp://pullv.readthedocs.org/en/latest/api.html
            APIhttp://pullv.readthedocs.org/en/latest/api.html
            Issueshttps://github.com/tony/pullv/issues
            Issueshttps://github.com/tony/pullv/issues
            Sourcehttps://github.com/tony/pullv
            Sourcehttps://github.com/tony/pullv
            \ No newline at end of file diff --git a/test/markups/README.txt.html b/test/markups/README.txt.html index b36565cc..c2e3c5fd 100644 --- a/test/markups/README.txt.html +++ b/test/markups/README.txt.html @@ -1,2 +1,2 @@ * One -* Two +* Two \ No newline at end of file From 80ffb79c4d903a5a53e08b58bc9b02db85091a9a Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Mon, 22 Dec 2014 13:05:26 -0500 Subject: [PATCH 167/416] Be more specific with santize dependency --- github-markup.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index 965b941b..a6dfeca7 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -19,5 +19,5 @@ Gem::Specification.new do |s| s.add_dependency "posix-spawn", "~> 0.3.8" s.add_development_dependency 'minitest', '~> 5.4.3' s.add_development_dependency 'html-pipeline', '~> 1.0' - s.add_development_dependency 'sanitize' + s.add_development_dependency 'sanitize', '~> 3.0' end From a548494d5f8d5d56d3d19b07db231ca4c2451240 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Mon, 22 Dec 2014 14:05:55 -0500 Subject: [PATCH 168/416] Explain how markup is rendered to HTML on GitHub --- README.md | 38 +++++++------------------------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index d6d0c8b1..9bb01367 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,13 @@ GitHub Markup ============= -We use this library on GitHub when rendering your README or any other -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). +This library is the first step of a journey that every markup file in a repository goes on before it is rendered on GitHub.com: + +0. This library converts the raw markup to HTML. See the list of [supported markup formats](#markups) below. +0. The HTML is sanitized, aggressively removing things that could harm you and your kin—such as `script` tags, inline-styles, and `class` or `id` attributes. See the [sanitization filter](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/sanitization_filter.rb) for the full whitelist. +0. Syntax highlighting is performed on code blocks. See [github/linguist](https://github.com/github/linguist#syntax-highlighting) for more information about syntax highlighting. +0. The HTML is passed through other filters in the [html-pipeline](https://github.com/jch/html-pipeline) that add special sauce, such as [emoji](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/emoji_filter.rb), [task lists](https://github.com/github/task_list/blob/master/lib/task_list/filter.rb), [named anchors](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/toc_filter.rb), [CDN caching for images](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/camo_filter.rb), and [autolinking](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/autolink_filter.rb). +0. The resulting HTML is rendered on GitHub.com. Markups ------- @@ -41,32 +46,3 @@ Contributing ------------ See [Contributing](CONTRIBUTING.md) - -HTML sanitization ------------------ - -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. - -The following HTML elements, organized by category, are whitelisted: - -|Type | Elements -|------|---------- -|Headings | `h1`, `h2`, `h3`, `h4`, `h5`, `h6`, `h7`, `h8` -|Prose | `p`, `div`, `blockquote` -|Formatted | `pre` -| Inline | `b`, `i`, `strong`, `em`, `tt`, `code`, `ins`, `del`, `sup`, `sub`, `kbd`, `samp`, `q`, `var` -| Lists | `ol`, `ul`, `li`, `dl`, `dt`, `dd` -| Tables | `table`, `thead`, `tbody`, `tfoot`, `tr`, `td`, `th` -| Breaks | `br`, `hr` -| Ruby (East Asian) | `ruby`, `rt`, `rp` - -The following attributes, organized by element, are whitelisted: - -|Element | Attributes -|------|---------- -| `a` | `href` (`http://`, `https://`, `mailto://`, `github-windows://`, and `github-mac://` URI schemes and relative paths only) -| `img` | `src` (`http://` and `https://` URI schemes and relative paths only) -| `div` | `itemscope`, `itemtype` -| 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` - -Note that the `id` attribute is *not* whitelisted. From 9dd6237de9aee7dc69914a5d982e285f83e54faf Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Mon, 22 Dec 2014 14:21:28 -0500 Subject: [PATCH 169/416] Need dev dependencies on travis --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1bb21db3..892f8919 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,3 @@ rvm: - 2.1.1 notifications: email: false -bundler_args: --without development From 79a9ef422b5a926dd58956156550964f4569a272 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Mon, 22 Dec 2014 14:40:53 -0500 Subject: [PATCH 170/416] Fix pod output --- test/markups/README.pod.html | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/markups/README.pod.html b/test/markups/README.pod.html index 73ea8409..ea810bb6 100644 --- a/test/markups/README.pod.html +++ b/test/markups/README.pod.html @@ -1,14 +1,14 @@ -

            Matrixy

            +

            Matrixy

            -

            INTRODUCTION

            +

            INTRODUCTION

            This is a port of the MATLAB/Octave programming language to Parrot. See the ROADMAP file for more information on the status of this project, and what else needs to be done.

            -

            ABOUT

            +

            ABOUT

            Primary goals are:

            @@ -16,7 +16,7 @@

            ABOUT

            =item* Create a working compiler that understands the majority of the MATLAB/Octave programming language.

            -

            IMPLEMENTATION

            +

            IMPLEMENTATION

            This project is broken into three primary components:

            @@ -43,11 +43,11 @@

            IMPLEMENTATION

            or mostly M with some inline PIR code in toolbox/.

            -

            DEPENDENCIES

            +

            DEPENDENCIES

            Matrixy depends on these dependencies:

            -

            Parrot

            +

            Parrot

            To get a proper version of Parrot to build Matrixy, you will need to check out and build Parrot from source:

            @@ -57,28 +57,28 @@

            Parrot

            perl Configure.pl make && make test && make install-dev -

            Parrot-Linear-Algebra

            +

            Parrot-Linear-Algebra

            The linear algebra package for Parrot is available separately and provides functionality required by Matrixy. This includes matrix data types and matrix manipulation libraries

            -

            BUILDING

            +

            BUILDING

            Once all dependencies are in place, you can build Matrixy using this sequence of commands:

                perl Configure.pl
                 nmake test
            -

            TODO

            +

            TODO

                * Parser
                 * Standard Builtins
                 * Test against Octave Test Suite.
            -

            BUGS

            +

            BUGS

            Lots!

            -

            CONTACT

            +

            CONTACT

            If you need to contact the Matrixy team, go to the project home page at:

            From a62e16979ae437aa5daf256e6a1dfe812ca77f39 Mon Sep 17 00:00:00 2001 From: Philip Liberato Date: Thu, 25 Dec 2014 18:27:07 -0500 Subject: [PATCH 171/416] Added the link to Pod::Simple on CPAN. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d6d0c8b1..2b8f0911 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a * [.rst](http://docutils.sourceforge.net/rst.html) -- `easy_install docutils` * [.asciidoc, .adoc, .asc](http://asciidoc.org/) -- `gem install asciidoctor` (http://asciidoctor.org) * [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::HTML` - comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN. + comes with Perl >= 5.10. Lower versions should install [Pod::Simple](http://search.cpan.org/~dwheeler/Pod-Simple-3.28/lib/Pod/Simple.pod) from CPAN. Installation ----------- From ad1392533fd3ad8a1aa9ba1fc72728f1cfb620c5 Mon Sep 17 00:00:00 2001 From: David English Date: Tue, 13 Jan 2015 22:00:58 -0800 Subject: [PATCH 172/416] Updated deprecated .exists? in markup.rb --- lib/github/markup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github/markup.rb b/lib/github/markup.rb index 4e3bf917..82de5172 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -31,7 +31,7 @@ def markup(file, pattern, opts = {}, &block) end def command(command, regexp, &block) - if File.exists?(file = File.dirname(__FILE__) + "/commands/#{command}") + if File.exist?(file = File.dirname(__FILE__) + "/commands/#{command}") command = file end From 52744998791b00a175ef38a13cf628db53c582d1 Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Thu, 15 Jan 2015 20:57:25 +0100 Subject: [PATCH 173/416] Get html_equal tests running with minitest --- Gemfile | 4 ++-- github-markup.gemspec | 2 +- test/markup_test.rb | 25 +++++++++++++------------ 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Gemfile b/Gemfile index b65b9356..2e980fcc 100644 --- a/Gemfile +++ b/Gemfile @@ -8,6 +8,6 @@ gem "RedCloth" gem "rdoc", "~>3.6" gem "org-ruby", "= 0.9.9" gem "creole", "~>0.3.6" -gem "wikicloth", :platforms => :ruby +gem "wikicloth", "=0.8.1", :platforms => :ruby gem "asciidoctor", "= 0.1.4" -gem "rake" +gem "rake" \ No newline at end of file diff --git a/github-markup.gemspec b/github-markup.gemspec index cfd7caa2..0d61cbbd 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |s| # See ext/mkrf_conf.rb for platform-specific dependencies s.add_development_dependency 'minitest', '~> 5.4.3' s.add_development_dependency 'html-pipeline', '~> 1.0' - s.add_development_dependency 'sanitize', '~> 3.0' + s.add_development_dependency 'sanitize', '~> 2.1.0' s.add_development_dependency 'nokogiri', '~> 1.6.1' s.add_development_dependency 'nokogiri-diff', '~> 0.2.0' end diff --git a/test/markup_test.rb b/test/markup_test.rb index dc2acbb1..3d24b7a6 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -17,20 +17,21 @@ def normalize_html(text) end def assert_html_equal(expected, actual, msg = nil) - assert_block(msg) do - expected_doc = Nokogiri::HTML(expected) {|config| config.noblanks} - actual_doc = Nokogiri::HTML(actual) {|config| config.noblanks} - - expected_doc.search('//text()').each {|node| node.content = normalize_html node.content} - actual_doc.search('//text()').each {|node| node.content = normalize_html node.content} - - ignore_changes = {"+" => Regexp.union(/^\s*id=".*"\s*$/), "-" => nil} - expected_doc.diff(actual_doc) do |change, node| - if change != ' ' && !node.blank? then - break unless node.to_html =~ ignore_changes[change] + assertion = Proc.new do + expected_doc = Nokogiri::HTML(expected) {|config| config.noblanks} + actual_doc = Nokogiri::HTML(actual) {|config| config.noblanks} + + expected_doc.search('//text()').each {|node| node.content = normalize_html node.content} + actual_doc.search('//text()').each {|node| node.content = normalize_html node.content} + + ignore_changes = {"+" => Regexp.union(/^\s*id=".*"\s*$/), "-" => nil} + expected_doc.diff(actual_doc) do |change, node| + if change != ' ' && !node.blank? then + break unless node.to_html =~ ignore_changes[change] + end end end - end + assert(assertion.call, msg) end class MarkupTest < Minitest::Test From c272303f8bd1843a7cbcdec0e30052d445de325b Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Thu, 15 Jan 2015 21:42:44 +0100 Subject: [PATCH 174/416] Define CommandImplementation#execute conditional on presence of Posix::Spawn --- Rakefile | 2 -- ext/mkrf_conf.rb | 1 + lib/github/markup/command_implementation.rb | 20 ++++++++++---------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Rakefile b/Rakefile index a436eba6..82f7f9a0 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,5 @@ #!/usr/bin/env rake -require "bundler/gem_tasks" - require 'rake/testtask' Rake::TestTask.new(:test) do |test| test.libs << 'lib' << 'test' diff --git a/ext/mkrf_conf.rb b/ext/mkrf_conf.rb index 6b69b6ce..97a09674 100644 --- a/ext/mkrf_conf.rb +++ b/ext/mkrf_conf.rb @@ -8,6 +8,7 @@ installer = Gem::DependencyInstaller.new begin unless RUBY_PLATFORM == 'java' + $stderr.puts "Now installing posix-spawn. You may want to add 'gem posix-spawn' to the Gemfile of your project." installer.install "posix-spawn", "~> 0.3.8" end rescue diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index 7e44fd6c..58fffcd5 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -37,7 +37,16 @@ def call_block(rendered, content) end end - if RUBY_PLATFORM == 'java' + if defined?(Posix::Spawn) + def execute(command, target) + spawn = POSIX::Spawn::Child.new(*command, :input => target) + if spawn.status.success? + sanitize(spawn.out, target.encoding) + else + raise CommandError.new(spawn.err.strip) + end + end + else def execute(command, target) output = Open3.popen3(*command) do |stdin, stdout, stderr, wait_thr| stdin.puts target @@ -50,15 +59,6 @@ def execute(command, target) end sanitize(output.join(''), target.encoding) end - else - def execute(command, target) - spawn = POSIX::Spawn::Child.new(*command, :input => target) - if spawn.status.success? - sanitize(spawn.out, target.encoding) - else - raise CommandError.new(spawn.err.strip) - end - end end def sanitize(input, encoding) From ad4359fd0bbc3158a6ddf4f33f9f96307aa11762 Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Thu, 15 Jan 2015 21:53:38 +0100 Subject: [PATCH 175/416] Fallback on open3 if posix-spawn is unavailable. --- lib/github/markup/command_implementation.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index 58fffcd5..1b43dd71 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -1,7 +1,7 @@ -if RUBY_PLATFORM == 'java' - require "open3" -else +begin require "posix-spawn" +rescue LoadError + require "open3" end require "github/markup/implementation" From b5f2f8955b9b35b5a12963471e71dd7a93fb34d8 Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Thu, 15 Jan 2015 22:02:28 +0100 Subject: [PATCH 176/416] Don't test jdk7 --- .travis.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6242fc42..c14ebca0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,15 +7,6 @@ rvm: - 2.1.1 - jruby-19mode jdk: - - oraclejdk7 - oraclejdk8 -matrix: - exclude: - - rvm: 1.9.3 - jdk: oraclejdk7 - - rvm: 2.0.0 - jdk: oraclejdk7 - - rvm: 2.1.1 - jdk: oraclejdk7 notifications: email: false \ No newline at end of file From 8bb56ca9983d4059359535ae5a2f513f466cf40b Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Thu, 15 Jan 2015 22:40:37 +0100 Subject: [PATCH 177/416] Extconf hack no longer necessary --- ext/mkrf_conf.rb | 16 ---------------- github-markup.gemspec | 1 - 2 files changed, 17 deletions(-) delete mode 100644 ext/mkrf_conf.rb diff --git a/ext/mkrf_conf.rb b/ext/mkrf_conf.rb deleted file mode 100644 index 97a09674..00000000 --- a/ext/mkrf_conf.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'rubygems' -require 'rubygems/command.rb' -require 'rubygems/dependency_installer.rb' -begin - Gem::Command.build_args = ARGV - rescue NoMethodError -end -installer = Gem::DependencyInstaller.new -begin - unless RUBY_PLATFORM == 'java' - $stderr.puts "Now installing posix-spawn. You may want to add 'gem posix-spawn' to the Gemfile of your project." - installer.install "posix-spawn", "~> 0.3.8" - end -rescue - exit(1) -end diff --git a/github-markup.gemspec b/github-markup.gemspec index 0d61cbbd..ed414f54 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -15,7 +15,6 @@ Gem::Specification.new do |s| s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) } s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = %w[lib] - s.extensions = "ext/mkrf_conf.rb" # See ext/mkrf_conf.rb for platform-specific dependencies s.add_development_dependency 'minitest', '~> 5.4.3' From 8f46ed3ab16af411c763f96829c3b63a55f69ea5 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 16 Jan 2015 10:34:51 -0500 Subject: [PATCH 178/416] point to other places before creating issues --- CONTRIBUTING.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 935fa2e2..fec6b48a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,15 @@ # Contributing -Want to contribute? Great! +This library's only job is to decide which markup format to use and call out to an external library to convert the markup to HTML (see the [README](README.md) for more information on how markup is rendered on GitHub.com). + +If you are having an issue with: + +* **Syntax highlighting** - see [github/linguist](https://github.com/github/linguist#syntax-highlighting) for more information about syntax highlighting. +* **Markdown on GitHub** - contact support@github.com to report issues with markdown processing. + +Anything else - [search open issues](https://github.com/github/markup/issues) or create an issue and and we'll help point you in the right direction. + +## Submitting a Pull Request 1. Fork it. 2. Create a branch (`git checkout -b my_markup`) @@ -9,7 +18,7 @@ Want to contribute? Great! 5. Open a [Pull Request][1] 6. Enjoy a refreshing Diet Coke and wait -### Testing +## Testing To run the tests: From f6027249a281c868b2acc7772e5354f753b19b75 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 16 Jan 2015 10:37:02 -0500 Subject: [PATCH 179/416] Restore "test" as the default rake task --- .travis.yml | 3 +-- CONTRIBUTING.md | 4 ++-- Rakefile | 4 +++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index c14ebca0..0a44f56e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: ruby before_install: sudo pip install docutils -script: bundle exec rake test rvm: - 1.9.3 - 2.0.0 @@ -9,4 +8,4 @@ rvm: jdk: - oraclejdk8 notifications: - email: false \ No newline at end of file + email: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e5867fa1..57ba6e97 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,12 +53,12 @@ Finally add your [tests](#testing). To run the tests: - $ rake test + $ rake 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 `README.extension.html` should be the desired output. -Now run the tests: `rake test` +Now run the tests: `rake` If nothing complains, congratulations! diff --git a/Rakefile b/Rakefile index 82f7f9a0..5a7b12e6 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,7 @@ #!/usr/bin/env rake +require "bundler/gem_tasks" + require 'rake/testtask' Rake::TestTask.new(:test) do |test| test.libs << 'lib' << 'test' @@ -12,4 +14,4 @@ task :console do sh "irb -I lib -r bundler/setup -r github/markup" end -task :default \ No newline at end of file +task :default => :test From 0ad1e5d764c4857bcc1bc354c9ffb60add2e4613 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 16 Jan 2015 10:46:39 -0500 Subject: [PATCH 180/416] No longer true --- github-markup.gemspec | 1 - 1 file changed, 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index ed414f54..62e4770b 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,7 +16,6 @@ Gem::Specification.new do |s| s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = %w[lib] - # See ext/mkrf_conf.rb for platform-specific dependencies s.add_development_dependency 'minitest', '~> 5.4.3' s.add_development_dependency 'html-pipeline', '~> 1.0' s.add_development_dependency 'sanitize', '~> 2.1.0' From 2dea6e8c3d62d70b1503c9fbd23bef0381953e01 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 13 Feb 2015 00:01:04 -0800 Subject: [PATCH 181/416] Add comments to describe these calls --- lib/github/commands/rest2html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index ca9f26ff..2d750407 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -66,8 +66,8 @@ class GitHubHTMLTranslator(HTMLTranslator): # see also: http://bit.ly/1exfq2h (warning! sourceforge link.) def depart_document(self, node): HTMLTranslator.depart_document(self, node) - self.html_body.pop(0) - self.html_body.pop() + self.html_body.pop(0) # pop the starting
            off + self.html_body.pop() # pop the ending
            off # technique for visiting sections, without generating additional divs # see also: http://bit.ly/NHtyRx From a1d3798e7de27e1fd55c7c6a0d0f5a8fe206a95a Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Sun, 15 Feb 2015 10:49:30 -0800 Subject: [PATCH 182/416] Add empty `a` to support contents with sectnums --- lib/github/commands/rest2html | 3 +++ test/markups/README.toc.rst | 30 ++++++++++++++++++++++++++++++ test/markups/README.toc.rst.html | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 test/markups/README.toc.rst create mode 100644 test/markups/README.toc.rst.html diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 2d750407..63ecc0ed 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -71,7 +71,10 @@ class GitHubHTMLTranslator(HTMLTranslator): # technique for visiting sections, without generating additional divs # see also: http://bit.ly/NHtyRx + # the a is to support ::contents with ::sectnums: http://git.io/N1yC def visit_section(self, node): + id_attribute = node.attributes['ids'][0] + self.body.append('\n' % id_attribute) self.section_level += 1 def depart_section(self, node): diff --git a/test/markups/README.toc.rst b/test/markups/README.toc.rst new file mode 100644 index 00000000..a86b88a5 --- /dev/null +++ b/test/markups/README.toc.rst @@ -0,0 +1,30 @@ +.. contents:: + :backlinks: none + +.. sectnum:: + +Introduction +============ + +What is pycparser? +------------------ + +**pycparser** is a parser for the C language, written in pure Python. It is a +module designed to be easily integrated into applications that need to parse +C source code. + +What is it good for? +-------------------- + +Anything that needs C code to be parsed. The following are some uses for +**pycparser**, taken from real user reports: + +* C code obfuscator +* Front-end for various specialized C compilers +* Static code checker +* Automatic unit-test discovery +* Adding specialized extensions to the C language + +**pycparser** is unique in the sense that it's written in pure Python - a very +high level language that's easy to experiment with and tweak. To people familiar +with Lex and Yacc, **pycparser**'s code will be simple to understand. diff --git a/test/markups/README.toc.rst.html b/test/markups/README.toc.rst.html new file mode 100644 index 00000000..4890e99b --- /dev/null +++ b/test/markups/README.toc.rst.html @@ -0,0 +1,32 @@ + + +

            1   Introduction

            + +

            1.1   What is pycparser?

            +

            pycparser is a parser for the C language, written in pure Python. It is a +module designed to be easily integrated into applications that need to parse +C source code.

            + +

            1.2   What is it good for?

            +

            Anything that needs C code to be parsed. The following are some uses for +pycparser, taken from real user reports:

            +
              +
            • C code obfuscator
            • +
            • Front-end for various specialized C compilers
            • +
            • Static code checker
            • +
            • Automatic unit-test discovery
            • +
            • Adding specialized extensions to the C language
            • +
            +

            pycparser is unique in the sense that it's written in pure Python - a very +high level language that's easy to experiment with and tweak. To people familiar +with Lex and Yacc, pycparser's code will be simple to understand.

            From 73011b63ed083fe5f4a68caf13a3bcbd0846cbd2 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Sun, 15 Feb 2015 10:49:39 -0800 Subject: [PATCH 183/416] Spruce up old tests --- test/markups/README.rst.html | 2 ++ test/markups/README.rst.txt.html | 1 + 2 files changed, 3 insertions(+) diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index a074e8d5..77b79b98 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -8,6 +8,7 @@

            Subtitle

          1. Field list
      +

      Header 2

      1. Blah blah code blah
      2. @@ -46,6 +47,7 @@

        Header 2

        Coverity Scan Build Status Coverity Scan Build Status +

        Field list

        diff --git a/test/markups/README.rst.txt.html b/test/markups/README.rst.txt.html index d2e61dc6..6d5d0675 100644 --- a/test/markups/README.rst.txt.html +++ b/test/markups/README.rst.txt.html @@ -1,5 +1,6 @@

        Header 1

        Example text.

        +

        Header 2

        1. Blah blah code blah
        2. From f18830796e1f9d3e5ce8fd728ec6938e23b63928 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Sun, 15 Feb 2015 18:03:44 -0800 Subject: [PATCH 184/416] Add tt to mediawiki file --- test/markups/README.mediawiki | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/markups/README.mediawiki b/test/markups/README.mediawiki index 36c3ef6b..c3cc004a 100644 --- a/test/markups/README.mediawiki +++ b/test/markups/README.mediawiki @@ -6,6 +6,9 @@ __TOC__ = Red Bridge (JRuby Embed) = +one- +
          a-b
          + 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 [[DirectJRubyEmbedding|legacy API]] should still work, but we strongly recommend Red Bridge for all new projects. == Features of Red Bridge == From 828a250dff478fe98046b8db1e3c60d81448ee2b Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Sun, 15 Feb 2015 18:04:49 -0800 Subject: [PATCH 185/416] Append `tt` to the list of escaped tags --- lib/github/markups.rb | 8 +++++--- test/markups/README.mediawiki.html | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/github/markups.rb b/lib/github/markups.rb index eb562909..4ead5b1b 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -12,8 +12,8 @@ end markup('org-ruby', /org/) do |content| - Orgmode::Parser.new(content, { - :allow_include_files => false, + Orgmode::Parser.new(content, { + :allow_include_files => false, :skip_syntax_highlight => true }).to_html end @@ -23,7 +23,9 @@ end markup(:wikicloth, /mediawiki|wiki/) do |content| - WikiCloth::WikiCloth.new(:data => content).to_html(:noedit => true) + wikicloth = WikiCloth::WikiCloth.new(:data => content) + WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS << 'tt' + wikicloth.to_html(:noedit => true) end markup(:asciidoctor, /adoc|asc(iidoc)?/) do |content| diff --git a/test/markups/README.mediawiki.html b/test/markups/README.mediawiki.html index 6f9ac5e3..fcc56bfe 100644 --- a/test/markups/README.mediawiki.html +++ b/test/markups/README.mediawiki.html @@ -18,6 +18,9 @@

          Red Bridge (JRuby Embed)

          +

          one-<two +

          a-b
          +

          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 legacy API should still work, but we strongly recommend Red Bridge for all new projects.

          From 9ab60bfbefcf163248c1f71ceb89ac5a866ef63c Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 17 Feb 2015 15:56:48 -0800 Subject: [PATCH 186/416] Release 1.3.2 --- HISTORY.md | 7 +++++++ lib/github-markup.rb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 2c2ca4e2..85c79500 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,10 @@ +## 1.3.2 (2015-02-17) + +* RST: Output code instead of tt for inline literals [#370](https://github.com/github/markup/pull/370) +* RST: Add IDs to headers so that `.. contents` works with `.. sectnum` [#391](https://github.com/github/markup/pull/391) + +[Full changelog](https://github.com/github/markup/compare/v1.3.1...v1.3.2) + ## 1.3.1 (2014-11-13) * Fix name error when trying to use newer versions of RedCarpet [#387](https://github.com/github/markup/pull/387) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 2f98a768..d8a1a259 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.3.1' + VERSION = '1.3.2' Version = VERSION end end From b6111b9a519a35286951ebf956a7f899acb8b0f7 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 17 Feb 2015 20:33:26 -0800 Subject: [PATCH 187/416] The command is POSIX, not Posix --- lib/github/markup/command_implementation.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index 1b43dd71..92e1923d 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -36,8 +36,8 @@ def call_block(rendered, content) rendered end end - - if defined?(Posix::Spawn) + + if defined?(POSIX::Spawn) def execute(command, target) spawn = POSIX::Spawn::Child.new(*command, :input => target) if spawn.status.success? @@ -60,11 +60,11 @@ def execute(command, target) sanitize(output.join(''), target.encoding) end end - + def sanitize(input, encoding) input.gsub("\r", '').force_encoding(encoding) end - + end end end From a3e84c96c0e1bc12cc22238ad8c5c300b4d61c43 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 17 Feb 2015 20:39:41 -0800 Subject: [PATCH 188/416] Release 1.3.3 --- HISTORY.md | 6 ++++++ lib/github-markup.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 85c79500..b15f6178 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,9 @@ +## 1.3.3 (2015-02-17) + +* Address a slight typo with `POSIX` [#456](https://github.com/github/markup/pull/456) + +[Full changelog](https://github.com/github/markup/compare/v1.3.2...v1.3.3) + ## 1.3.2 (2015-02-17) * RST: Output code instead of tt for inline literals [#370](https://github.com/github/markup/pull/370) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index d8a1a259..cd9adf3c 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.3.2' + VERSION = '1.3.3' Version = VERSION end end From 78aa3779447cb66c1ea93ab32db5cad412e7fb09 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Tue, 3 Mar 2015 20:46:14 -0800 Subject: [PATCH 189/416] Fix link to linguist --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fec6b48a..42d0d818 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ This library's only job is to decide which markup format to use and call out to If you are having an issue with: -* **Syntax highlighting** - see [github/linguist](https://github.com/github/linguist#syntax-highlighting) for more information about syntax highlighting. +* **Syntax highlighting** - see [github/linguist](https://github.com/github/linguist/blob/master/CONTRIBUTING.md#fixing-syntax-highlighting) for more information about syntax highlighting. * **Markdown on GitHub** - contact support@github.com to report issues with markdown processing. Anything else - [search open issues](https://github.com/github/markup/issues) or create an issue and and we'll help point you in the right direction. From 2ab36061ef48e4e657f747ec0f3a9f6c09e48fa8 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Tue, 3 Mar 2015 20:48:46 -0800 Subject: [PATCH 190/416] Call out CSS issues --- CONTRIBUTING.md | 3 ++- README.md | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 42d0d818..14a6cfbd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,8 @@ This library's only job is to decide which markup format to use and call out to If you are having an issue with: * **Syntax highlighting** - see [github/linguist](https://github.com/github/linguist/blob/master/CONTRIBUTING.md#fixing-syntax-highlighting) for more information about syntax highlighting. -* **Markdown on GitHub** - contact support@github.com to report issues with markdown processing. +* **Markdown on GitHub** - contact support@github.com +* **Styling issues on GitHub** - contact support@github.com Anything else - [search open issues](https://github.com/github/markup/issues) or create an issue and and we'll help point you in the right direction. diff --git a/README.md b/README.md index 3869633c..63b34ef0 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ This library is the first step of a journey that every markup file in a reposito 0. The HTML is passed through other filters in the [html-pipeline](https://github.com/jch/html-pipeline) that add special sauce, such as [emoji](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/emoji_filter.rb), [task lists](https://github.com/github/task_list/blob/master/lib/task_list/filter.rb), [named anchors](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/toc_filter.rb), [CDN caching for images](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/camo_filter.rb), and [autolinking](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/autolink_filter.rb). 0. The resulting HTML is rendered on GitHub.com. +Please see our [contributing guidelines](CONTRIBUTING.md) before reporting an issue. + Markups ------- From 6404e98837e5dbbee53db4ca6964db5c46b5cdb9 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Tue, 3 Mar 2015 20:50:28 -0800 Subject: [PATCH 191/416] tweaks --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 14a6cfbd..658ac0f0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ This library's only job is to decide which markup format to use and call out to If you are having an issue with: -* **Syntax highlighting** - see [github/linguist](https://github.com/github/linguist/blob/master/CONTRIBUTING.md#fixing-syntax-highlighting) for more information about syntax highlighting. +* **Syntax highlighting** - see [github/linguist](https://github.com/github/linguist/blob/master/CONTRIBUTING.md#fixing-syntax-highlighting) * **Markdown on GitHub** - contact support@github.com * **Styling issues on GitHub** - contact support@github.com From bc732ccaa7c7868fd77351804af284401136adc8 Mon Sep 17 00:00:00 2001 From: Bart Kamphorst Date: Mon, 30 Mar 2015 15:54:40 +0200 Subject: [PATCH 192/416] Upgrade wikicloth to JRuby-compatible version 0.8.3. --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 2e980fcc..c9e73947 100644 --- a/Gemfile +++ b/Gemfile @@ -8,6 +8,6 @@ gem "RedCloth" gem "rdoc", "~>3.6" gem "org-ruby", "= 0.9.9" gem "creole", "~>0.3.6" -gem "wikicloth", "=0.8.1", :platforms => :ruby +gem "wikicloth", "=0.8.3" gem "asciidoctor", "= 0.1.4" -gem "rake" \ No newline at end of file +gem "rake" From ec367e577cefa3e9ba6578d9e557b92741fd7859 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Thu, 30 Apr 2015 08:57:16 -0400 Subject: [PATCH 193/416] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 658ac0f0..83784b46 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ If you are having an issue with: * **Syntax highlighting** - see [github/linguist](https://github.com/github/linguist/blob/master/CONTRIBUTING.md#fixing-syntax-highlighting) * **Markdown on GitHub** - contact support@github.com -* **Styling issues on GitHub** - contact support@github.com +* **Styling issues on GitHub** - see [primer/markdown](https://github.com/primer/markdown) Anything else - [search open issues](https://github.com/github/markup/issues) or create an issue and and we'll help point you in the right direction. From d2860bf6b52d8b34e6f62e752abff4282057e603 Mon Sep 17 00:00:00 2001 From: himynameismartin Date: Sat, 2 May 2015 20:53:13 +0200 Subject: [PATCH 194/416] Add Ruby syntax highlighting --- README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 63b34ef0..92e570c3 100644 --- a/README.md +++ b/README.md @@ -31,18 +31,24 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a Installation ----------- - gem install github-markup +``` +gem install github-markup +``` Usage ----- - require 'github/markup' - GitHub::Markup.render('README.markdown', "* One\n* Two") +```ruby +require 'github/markup' +GitHub::Markup.render('README.markdown', "* One\n* Two") +``` Or, more realistically: - require 'github/markup' - GitHub::Markup.render(file, File.read(file)) +```ruby +require 'github/markup' +GitHub::Markup.render(file, File.read(file)) +``` Contributing ------------ From 45cad6b262cb507d7ed787cecc3e86f78ea23f5e Mon Sep 17 00:00:00 2001 From: SkyCrawl Date: Wed, 6 May 2015 00:27:49 +0200 Subject: [PATCH 195/416] Adding a convenience "render by symbol" --- .gitignore | 2 ++ lib/github/markup.rb | 38 ++++++++++++++++++++++++++++++-------- lib/github/markups.rb | 32 ++++++++++++++++++++++++-------- test/markup_test.rb | 8 ++++++-- 4 files changed, 62 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index a08b381b..2535ee2a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ pkg/ .bundle Gemfile.lock vendor/ +.project +.buildpath diff --git a/lib/github/markup.rb b/lib/github/markup.rb index a2ead501..3551720b 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -4,14 +4,19 @@ module GitHub module Markup extend self - @@markups = [] + + @@markups = {} def markups @@markups end + + def markup_impls + markups.values + end def preload! - markups.each do |markup| + markup_impls.each do |markup| markup.load end end @@ -25,17 +30,34 @@ def render(filename, content = nil) content end end - - def markup(file, pattern, opts = {}, &block) - markups << GemImplementation.new(pattern, file, &block) + + def render(symbol, content) + if content.nil? + raise ArgumentError, 'Can not render a nil.' + elsif markups.has_key?(symbol) + markups[symbol].render(content) + else + content + end + end + + def markup(symbol, file, pattern, opts = {}, &block) + markup(symbol, GemImplementation.new(pattern, file, &block)) + end + + def markup(symbol, impl) + if markups.has_key?(symbol) + raise ArgumentError, "The '#{symbol}' symbol is already defined." + end + markups[symbol] = impl end - def command(command, regexp, name, &block) + def command(symbol, command, regexp, name, &block) if File.exist?(file = File.dirname(__FILE__) + "/commands/#{command}") command = file end - markups << CommandImplementation.new(regexp, command, name, &block) + markup(symbol, CommandImplementation.new(regexp, command, name, &block)) end def can_render?(filename) @@ -43,7 +65,7 @@ def can_render?(filename) end def renderer(filename) - markups.find { |impl| + markup_impls.find { |impl| impl.match?(filename) } end diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 0165f4a4..3a05e5ed 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -2,34 +2,50 @@ require "github/markup/rdoc" require "shellwords" -markups << GitHub::Markup::Markdown.new +module GitHub + module Markups + # all of supported markups: + MARKUP_ASCIIDOC = :asciidoc + MARKUP_CREOLE = :creole + MARKUP_MARKDOWN = :markdown + MARKUP_MEDIAWIKI = :mediawiki + MARKUP_ORG = :org + MARKUP_POD = :pod + MARKUP_RDOC = :rdoc + MARKUP_RST = :rst + MARKUP_TEXTILE = :textile + end +end + +markup(GitHub::Markups::MARKUP_MARKDOWN, GitHub::Markup::Markdown.new) -markup(:redcloth, /textile/) do |content| +markup(GitHub::Markups::MARKUP_TEXTILE, :redcloth, /textile/) do |content| RedCloth.new(content).to_html end -markups << GitHub::Markup::RDoc.new +markup(GitHub::Markups::MARKUP_RDOC, GitHub::Markup::RDoc.new) -markup('org-ruby', /org/) do |content| +markup(GitHub::Markups::MARKUP_ORG, 'org-ruby', /org/) do |content| Orgmode::Parser.new(content, { :allow_include_files => false, :skip_syntax_highlight => true }).to_html end -markup(:creole, /creole/) do |content| +markup(GitHub::Markups::MARKUP_CREOLE, :creole, /creole/) do |content| Creole.creolize(content) end -markup(:wikicloth, /mediawiki|wiki/) do |content| +markup(GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, /mediawiki|wiki/) do |content| WikiCloth::WikiCloth.new(:data => content).to_html(:noedit => true) end -markup(:asciidoctor, /adoc|asc(iidoc)?/) do |content| +markup(GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/) do |content| Asciidoctor.render(content, :safe => :secure, :attributes => %w(showtitle idprefix idseparator=- env=github env-github source-highlighter=html-pipeline)) end command( + GitHub::Markups::MARKUP_RST, "python2 -S #{Shellwords.escape(File.dirname(__FILE__))}/commands/rest2html", /re?st(\.txt)?/, "restructuredtext" @@ -40,7 +56,7 @@ # # Any block passed to `command` will be handed the command's STDOUT for # post processing. -command('/usr/bin/env perl -MPod::Simple::HTML -e Pod::Simple::HTML::go', /pod/, "pod") do |rendered| +command(GitHub::Markups::MARKUP_POD, '/usr/bin/env perl -MPod::Simple::HTML -e Pod::Simple::HTML::go', /pod/, "pod") do |rendered| if rendered =~ /\s*(.+)\s*/mi $1 end diff --git a/test/markup_test.rb b/test/markup_test.rb index 4c8fdf45..c850b12c 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -75,7 +75,7 @@ def call message end end - + def test_knows_what_it_can_and_cannot_render assert_equal false, GitHub::Markup.can_render?('README.html') assert_equal true, GitHub::Markup.can_render?('README.markdown') @@ -96,9 +96,13 @@ def test_each_render_has_a_name assert_equal "restructuredtext", GitHub::Markup.renderer('README.rst').name assert_equal "pod", GitHub::Markup.renderer('README.pod').name end + + def test_rendering_by_symbol + assert_equal "test", GitHub::Markup.render(GitHub::Markups::MARKUP_MARKDOWN, '**test**') + end def test_raises_error_if_command_exits_non_zero - GitHub::Markup.command('test/fixtures/fail.sh', /fail/, 'fail') + GitHub::Markup.command(:doesntmatter, 'test/fixtures/fail.sh', /fail/, 'fail') assert GitHub::Markup.can_render?('README.fail') begin GitHub::Markup.render('README.fail', "stop swallowing errors") From d286e878f1afbd2ffa5ac77029e2e16fb97b6147 Mon Sep 17 00:00:00 2001 From: SkyCrawl Date: Wed, 6 May 2015 00:48:53 +0200 Subject: [PATCH 196/416] Bug fixes --- lib/github/markup.rb | 19 ++++++++++++++++--- lib/github/markups.rb | 33 +++++++++------------------------ 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/lib/github/markup.rb b/lib/github/markup.rb index 3551720b..24e6baa1 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -2,6 +2,19 @@ require "github/markup/gem_implementation" module GitHub + module Markups + # all of supported markups: + MARKUP_ASCIIDOC = :asciidoc + MARKUP_CREOLE = :creole + MARKUP_MARKDOWN = :markdown + MARKUP_MEDIAWIKI = :mediawiki + MARKUP_ORG = :org + MARKUP_POD = :pod + MARKUP_RDOC = :rdoc + MARKUP_RST = :rst + MARKUP_TEXTILE = :textile + end + module Markup extend self @@ -42,10 +55,10 @@ def render(symbol, content) end def markup(symbol, file, pattern, opts = {}, &block) - markup(symbol, GemImplementation.new(pattern, file, &block)) + markup_impl(symbol, GemImplementation.new(pattern, file, &block)) end - def markup(symbol, impl) + def markup_impl(symbol, impl) if markups.has_key?(symbol) raise ArgumentError, "The '#{symbol}' symbol is already defined." end @@ -57,7 +70,7 @@ def command(symbol, command, regexp, name, &block) command = file end - markup(symbol, CommandImplementation.new(regexp, command, name, &block)) + markup_impl(symbol, CommandImplementation.new(regexp, command, name, &block)) end def can_render?(filename) diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 3a05e5ed..664a4a79 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -2,50 +2,35 @@ require "github/markup/rdoc" require "shellwords" -module GitHub - module Markups - # all of supported markups: - MARKUP_ASCIIDOC = :asciidoc - MARKUP_CREOLE = :creole - MARKUP_MARKDOWN = :markdown - MARKUP_MEDIAWIKI = :mediawiki - MARKUP_ORG = :org - MARKUP_POD = :pod - MARKUP_RDOC = :rdoc - MARKUP_RST = :rst - MARKUP_TEXTILE = :textile - end -end - -markup(GitHub::Markups::MARKUP_MARKDOWN, GitHub::Markup::Markdown.new) +markup_impl(::GitHub::Markups::MARKUP_MARKDOWN, ::GitHub::Markup::Markdown.new) -markup(GitHub::Markups::MARKUP_TEXTILE, :redcloth, /textile/) do |content| +markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, /textile/) do |content| RedCloth.new(content).to_html end -markup(GitHub::Markups::MARKUP_RDOC, GitHub::Markup::RDoc.new) +markup_impl(::GitHub::Markups::MARKUP_RDOC, GitHub::Markup::RDoc.new) -markup(GitHub::Markups::MARKUP_ORG, 'org-ruby', /org/) do |content| +markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', /org/) do |content| Orgmode::Parser.new(content, { :allow_include_files => false, :skip_syntax_highlight => true }).to_html end -markup(GitHub::Markups::MARKUP_CREOLE, :creole, /creole/) do |content| +markup(::GitHub::Markups::MARKUP_CREOLE, :creole, /creole/) do |content| Creole.creolize(content) end -markup(GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, /mediawiki|wiki/) do |content| +markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, /mediawiki|wiki/) do |content| WikiCloth::WikiCloth.new(:data => content).to_html(:noedit => true) end -markup(GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/) do |content| +markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/) do |content| Asciidoctor.render(content, :safe => :secure, :attributes => %w(showtitle idprefix idseparator=- env=github env-github source-highlighter=html-pipeline)) end command( - GitHub::Markups::MARKUP_RST, + ::GitHub::Markups::MARKUP_RST, "python2 -S #{Shellwords.escape(File.dirname(__FILE__))}/commands/rest2html", /re?st(\.txt)?/, "restructuredtext" @@ -56,7 +41,7 @@ module Markups # # Any block passed to `command` will be handed the command's STDOUT for # post processing. -command(GitHub::Markups::MARKUP_POD, '/usr/bin/env perl -MPod::Simple::HTML -e Pod::Simple::HTML::go', /pod/, "pod") do |rendered| +command(::GitHub::Markups::MARKUP_POD, '/usr/bin/env perl -MPod::Simple::HTML -e Pod::Simple::HTML::go', /pod/, "pod") do |rendered| if rendered =~ /\s*(.+)\s*/mi $1 end From 9205275c1a132cce2236171ac82dd93ba187c572 Mon Sep 17 00:00:00 2001 From: SkyCrawl Date: Wed, 6 May 2015 01:12:20 +0200 Subject: [PATCH 197/416] Bug fixes --- lib/github/markup.rb | 2 +- test/markup_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/github/markup.rb b/lib/github/markup.rb index 24e6baa1..ddc7312f 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -44,7 +44,7 @@ def render(filename, content = nil) end end - def render(symbol, content) + def render_s(symbol, content) if content.nil? raise ArgumentError, 'Can not render a nil.' elsif markups.has_key?(symbol) diff --git a/test/markup_test.rb b/test/markup_test.rb index c850b12c..d0b6d09a 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -98,7 +98,7 @@ def test_each_render_has_a_name end def test_rendering_by_symbol - assert_equal "test", GitHub::Markup.render(GitHub::Markups::MARKUP_MARKDOWN, '**test**') + assert_equal '

          test

          ', GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, '`test`').strip end def test_raises_error_if_command_exits_non_zero From 3cc56d2eff215b033954c690cb01df1d7d70dddf Mon Sep 17 00:00:00 2001 From: SkyCrawl Date: Wed, 6 May 2015 18:56:32 +0200 Subject: [PATCH 198/416] Updating README to reflect recet changes --- README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 92e570c3..fe2318ec 100644 --- a/README.md +++ b/README.md @@ -38,18 +38,31 @@ gem install github-markup Usage ----- +Basic form: + ```ruby require 'github/markup' -GitHub::Markup.render('README.markdown', "* One\n* Two") + +GitHub::Markup.render('README.markdown', '* One\n* Two') ``` -Or, more realistically: +More realistic form: ```ruby require 'github/markup' + GitHub::Markup.render(file, File.read(file)) ``` +And a convenience form: + +```ruby +require 'github/markup' + +GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, '* One\n* Two') +``` + + Contributing ------------ From 14a8a614efb383049dcab8dc787df513374eae71 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 5 Jun 2015 14:37:41 -0700 Subject: [PATCH 199/416] Unlock email addresses Fixes https://github.com/github/markup/issues/463 --- lib/github/commands/rest2html | 2 +- test/markups/README.rst | 2 ++ test/markups/README.rst.html | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 63ecc0ed..413437f9 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -48,7 +48,7 @@ from docutils.core import publish_parts from docutils.writers.html4css1 import Writer, HTMLTranslator SETTINGS = { - 'cloak_email_addresses': True, + 'cloak_email_addresses': False, 'file_insertion_enabled': False, 'raw_enabled': False, 'strip_comments': True, diff --git a/test/markups/README.rst b/test/markups/README.rst index efd1685b..53f1e62d 100644 --- a/test/markups/README.rst +++ b/test/markups/README.rst @@ -55,3 +55,5 @@ Field list but no problem! :123456789 12345: this is not so long, but long enough for the default! :123456789 1234: this should work even with the default :) + +someone@somewhere.org diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index 77b79b98..3719a66c 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -72,4 +72,6 @@

          Field list

        -
        this should work even with the default :)
        \ No newline at end of file + + +

        someone@somewhere.org

        From 07cf1870d508fd94ae15da31136d4b0ecff52cab Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 5 Jun 2015 14:42:24 -0700 Subject: [PATCH 200/416] Support `:kbd:` shortcut Closes https://github.com/github/markup/issues/497. --- lib/github/commands/rest2html | 8 ++++++++ test/markups/README.rst | 2 ++ test/markups/README.rst.html | 2 ++ 3 files changed, 12 insertions(+) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 413437f9..b9dc5c29 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -44,6 +44,8 @@ except: import codecs +from docutils import nodes +from docutils.parsers.rst import roles from docutils.core import publish_parts from docutils.writers.html4css1 import Writer, HTMLTranslator @@ -127,6 +129,10 @@ class GitHubHTMLTranslator(HTMLTranslator): self.body.append(self.starttag(node, 'img', **atts)) self.body.append(self.context.pop()) +def kbd(name, rawtext, text, lineno, inliner, options=None, content=None): + + return [nodes.raw('', '%s' % text, format='html')], [] + def main(): """ Parses the given ReST file or the redirected string input and returns the @@ -145,6 +151,8 @@ def main(): writer = Writer() writer.translator_class = GitHubHTMLTranslator + roles.register_canonical_role('kbd', kbd) + parts = publish_parts(text, writer=writer, settings_overrides=SETTINGS) if 'html_body' in parts: html = parts['html_body'] diff --git a/test/markups/README.rst b/test/markups/README.rst index 53f1e62d..ccabe9e7 100644 --- a/test/markups/README.rst +++ b/test/markups/README.rst @@ -57,3 +57,5 @@ Field list :123456789 1234: this should work even with the default :) someone@somewhere.org + +Press :kbd:`Ctrl+C` to quit diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index 3719a66c..af777045 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -75,3 +75,5 @@

        Field list

        someone@somewhere.org

        + +

        Press Ctrl+C to quit

        From 16b6ddc60f1f63e9e4834503a8c1f8136716339b Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Mon, 8 Dec 2014 02:43:22 -0700 Subject: [PATCH 201/416] upgrade to Asciidoctor 1.5.2 --- Gemfile | 4 ++-- lib/github/markups.rb | 3 ++- test/markups/README.asciidoc | 11 ++++++++++- test/markups/README.asciidoc.html | 25 +++++++++++++++++++++++-- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 2e980fcc..637836b0 100644 --- a/Gemfile +++ b/Gemfile @@ -9,5 +9,5 @@ gem "rdoc", "~>3.6" gem "org-ruby", "= 0.9.9" gem "creole", "~>0.3.6" gem "wikicloth", "=0.8.1", :platforms => :ruby -gem "asciidoctor", "= 0.1.4" -gem "rake" \ No newline at end of file +gem "asciidoctor", "= 1.5.2" +gem "rake" diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 0165f4a4..debf837e 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -26,7 +26,8 @@ end markup(:asciidoctor, /adoc|asc(iidoc)?/) do |content| - Asciidoctor.render(content, :safe => :secure, :attributes => %w(showtitle idprefix idseparator=- env=github env-github source-highlighter=html-pipeline)) + Asciidoctor::Compliance.unique_id_start_index = 1 + Asciidoctor.convert(content, :safe => :secure, :attributes => %w(showtitle=@ idprefix idseparator=- env=github env-github source-highlighter=html-pipeline)) end command( diff --git a/test/markups/README.asciidoc b/test/markups/README.asciidoc index 6a0462cb..de6d124e 100644 --- a/test/markups/README.asciidoc +++ b/test/markups/README.asciidoc @@ -5,10 +5,19 @@ * One * Two -== Second Section +Refer to <> or <>. + +== Another Section NOTE: Here is some source code. ```ruby puts "Hello, World!" ``` + +* [ ] todo +* [x] done + +== Another Section + +content diff --git a/test/markups/README.asciidoc.html b/test/markups/README.asciidoc.html index 4f06d0f9..8ddb19d9 100644 --- a/test/markups/README.asciidoc.html +++ b/test/markups/README.asciidoc.html @@ -12,10 +12,13 @@

        First Section

        +
        -

        Second Section

        +

        Another Section

        @@ -34,5 +37,23 @@

        Second Section

        puts "Hello, World!"
        +
        +
          +
        • +

          ❏ todo

          +
        • +
        • +

          ✓ done

          +
        • +
        +
        + + +
        +

        Another Section

        +
        +
        +

        content

        +
        +
        - \ No newline at end of file From 4daed5252d4b24d7a4d727cde44d83f0668452d8 Mon Sep 17 00:00:00 2001 From: Patrick Maupin Date: Fri, 26 Jun 2015 00:16:23 -0500 Subject: [PATCH 202/416] Display unknown restructuredText directives This addresses issue #514. Previous behavior was to silently ignore unknown directives and comments, which made .rst documents that utilized rst extensions appear to be incomplete. This fix allows all the information to be displayed, and further allows comments to be placed to indicate that the github rst viewer is not the preferred viewer for the document. This patch will not alter the appearance of any document that is specifically coded for display at github which doesn't use restucturedText comments. Additional possible enhancements include figuring out how to gray out this text, and/or to support a special github directive at the start of the text file that controls whether this new behavior is enabled. --- lib/github/commands/rest2html | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index b9dc5c29..065e7f66 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -48,6 +48,59 @@ from docutils import nodes from docutils.parsers.rst import roles from docutils.core import publish_parts from docutils.writers.html4css1 import Writer, HTMLTranslator +from docutils.parsers.rst.states import Body +from docutils import nodes + +# By default, docutils provides two choices for unknown directives: +# - Show errors if the reporting level is high enough +# - Silently do not display them otherwise +# Comments are not displayed, either. + +# This code monkey-patches docutils to show preformatted lines +# in both these cases. + +# Recommended practice for repositories with rst files: +# - If github is the preferred viewer for the rst files (e.g. README.rst), +# then design the files to properly display for github. E.g., do not +# include unknown directives or restructuredText comments. +# - If github is NOT the preferred viewer for the rst files (e.g. +# the files are designed to be used with sphinx extensions at readthedocs) +# then include a restructuredText comment at the top of the file +# explaining that the document will display much more nicely with its +# preferred viewer, e.g. at readthedocs. + +original_behavior = False # Documents original docutils behavior + +def unknown_directive(self, type_name): + lineno = self.state_machine.abs_line_number() + indented, indent, offset, blank_finish = \ + self.state_machine.get_first_known_indented(0, strip_indent=False) + text = '\n'.join(indented) + if original_behavior: + error = self.reporter.error( + 'Unknown directive type "%s".' % type_name, + nodes.literal_block(text, text), line=lineno) + return [error], blank_finish + else: + return [nodes.literal_block(text, text)], blank_finish + +def comment(self, match): + if not match.string[match.end():].strip() \ + and self.state_machine.is_next_line_blank(): # an empty comment? + return [nodes.comment()], 1 # "A tiny but practical wart." + indented, indent, offset, blank_finish = \ + self.state_machine.get_first_known_indented(match.end()) + while indented and not indented[-1].strip(): + indented.trim_end() + text = '\n'.join(indented) + if original_behavior: + return [nodes.comment(text, text)], blank_finish + else: + return [nodes.literal_block(text, text)], blank_finish + +Body.comment = comment +Body.unknown_directive = unknown_directive + SETTINGS = { 'cloak_email_addresses': False, From f68fcab3e83971f128b252429635702c3f48f449 Mon Sep 17 00:00:00 2001 From: Patrick Maupin Date: Fri, 26 Jun 2015 10:38:31 -0500 Subject: [PATCH 203/416] Add github display control comment Also add test file to show new operation. --- lib/github/commands/rest2html | 20 ++++-- test/markups/README.directives.rst | 103 +++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 5 deletions(-) create mode 100644 test/markups/README.directives.rst diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 065e7f66..d517a9df 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -70,6 +70,7 @@ from docutils import nodes # preferred viewer, e.g. at readthedocs. original_behavior = False # Documents original docutils behavior +github_display = True def unknown_directive(self, type_name): lineno = self.state_machine.abs_line_number() @@ -81,8 +82,10 @@ def unknown_directive(self, type_name): 'Unknown directive type "%s".' % type_name, nodes.literal_block(text, text), line=lineno) return [error], blank_finish - else: + elif github_display: return [nodes.literal_block(text, text)], blank_finish + else: + return [nodes.comment(text, text)], blank_finish def comment(self, match): if not match.string[match.end():].strip() \ @@ -92,11 +95,18 @@ def comment(self, match): self.state_machine.get_first_known_indented(match.end()) while indented and not indented[-1].strip(): indented.trim_end() + if not original_behavior: + firstline = ''.join(indented[:1]).split() + if ' '.join(firstline[:2]) == 'github display': + if len(firstline) == 3 and firstline[2] in ('on', 'off'): + global github_display + github_display = firstline[2] == 'on' + if len(indented) == 1: + return [nodes.comment()], 1 + text = '\n'.join(indented[1:]) + return [nodes.literal_block(text, text)], blank_finish text = '\n'.join(indented) - if original_behavior: - return [nodes.comment(text, text)], blank_finish - else: - return [nodes.literal_block(text, text)], blank_finish + return [nodes.comment(text, text)], blank_finish Body.comment = comment Body.unknown_directive = unknown_directive diff --git a/test/markups/README.directives.rst b/test/markups/README.directives.rst new file mode 100644 index 00000000..f9016423 --- /dev/null +++ b/test/markups/README.directives.rst @@ -0,0 +1,103 @@ +================================================== +restructuredText (rst) directives and comments +================================================== + +Introduction +================= + +An rst directive starts with two periods, and has a keyword +followed by two colons, like this:: + + .. MyDirective:: + +The rst parser is quite flexible and configurable. Directives +may be added for specialized operations. Sphinx is a system +that was designed for writing documentation, and, for example, +readthedocs.org uses sphinx. + +Display of rst files at github needs to cover two distinct +use-cases: + +- The github display is the primary method for displaying + the file (e.g. for README.rst files) + +- The github display is incidental to the primary method + for displaying the file (e.g. for readthedocs documentation) + +Currently, github handles the first case fine, but could +confuse viewers for the second case, because sometimes +content is missing from the github display. + +It would seem that one possibility for distinguishing these +two cases is to add a github directive to control the display. + +Unfortunately, this would place a burden on every other rst +parser to ignore the github directive (some of them will error +on unknown directives). + +Instead, we can assign semantic content to specific comments. + +This is a fairly ugly hack, but it has the benefit of not +requiring any document changes that would create problems with +any conformant parser. + + +The proposed special comment is:: + + .. github display [on | off] + + +If you pass this the "on" value, then all unknown directives +will be displayed as literal code blocks. If you pass this +the "off" value, then unknown directives will not be displayed. + +In addition to controlling the display of literal code blocks, +this also allows you to show comments specifically for github. + +For example, somebody could place this at the top of their file:: + + .. github display + + This file was designed to be viewed at readthedocs. Some + content will not display properly when viewing using the + github browser. + +Tests +========== + +By default, unknown directives should be displayed. + +.. UnknownDirective:: This is an unknown directive + + it has a lot of stuff underneath it + +But we can turn this off, and the next directive should +not be displayed. + +.. github display off + +.. UnknownDirective:: This is an unknown directive + + it has a lot of stuff underneath it + +Or we can turn it back on... + +.. github display on + +.. UnknownDirective:: This is an unknown directive (3) + + it has a lot of stuff underneath it + +Here is a comment that should display at github + +.. github display + + YOU SHOULD SEE THIS! + +And here is a comment that should not display at github + +.. foobar + + YOU SHOULD NOT SEE THIS! + +This concludes the tests. From 0c6261a91d0fffceac6d956f932938e8c0b14dbd Mon Sep 17 00:00:00 2001 From: Patrick Maupin Date: Fri, 26 Jun 2015 10:42:27 -0500 Subject: [PATCH 204/416] Add HTML output of directives test --- test/markups/README.directives.rst.html | 75 +++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 test/markups/README.directives.rst.html diff --git a/test/markups/README.directives.rst.html b/test/markups/README.directives.rst.html new file mode 100644 index 00000000..df4f3be3 --- /dev/null +++ b/test/markups/README.directives.rst.html @@ -0,0 +1,75 @@ +

        restructuredText (rst) directives and comments

        + +

        Introduction

        +

        An rst directive starts with two periods, and has a keyword +followed by two colons, like this:

        +
        +.. MyDirective::
        +
        +

        The rst parser is quite flexible and configurable. Directives +may be added for specialized operations. Sphinx is a system +that was designed for writing documentation, and, for example, +readthedocs.org uses sphinx.

        +

        Display of rst files at github needs to cover two distinct +use-cases:

        +
          +
        • The github display is the primary method for displaying +the file (e.g. for README.rst files)
        • +
        • The github display is incidental to the primary method +for displaying the file (e.g. for readthedocs documentation)
        • +
        +

        Currently, github handles the first case fine, but could +confuse viewers for the second case, because sometimes +content is missing from the github display.

        +

        It would seem that one possibility for distinguishing these +two cases is to add a github directive to control the display.

        +

        Unfortunately, this would place a burden on every other rst +parser to ignore the github directive (some of them will error +on unknown directives).

        +

        Instead, we can assign semantic content to specific comments.

        +

        This is a fairly ugly hack, but it has the benefit of not +requiring any document changes that would create problems with +any conformant parser.

        +

        The proposed special comment is:

        +
        +.. github display [on | off]
        +
        +

        If you pass this the "on" value, then all unknown directives +will be displayed as literal code blocks. If you pass this +the "off" value, then unknown directives will not be displayed.

        +

        In addition to controlling the display of literal code blocks, +this also allows you to show comments specifically for github.

        +

        For example, somebody could place this at the top of their file:

        +
        +.. github display
        +
        +  This file was designed to be viewed at readthedocs.  Some
        +  content will not display properly when viewing using the
        +  github browser.
        +
        + +

        Tests

        +

        By default, unknown directives should be displayed.

        +
        +.. UnknownDirective::  This is an unknown directive
        +
        +      it has a lot of stuff underneath it
        +
        +
        +

        But we can turn this off, and the next directive should +not be displayed.

        +

        Or we can turn it back on...

        +
        +.. UnknownDirective::  This is an unknown directive (3)
        +
        +      it has a lot of stuff underneath it
        +
        +
        +

        Here is a comment that should display at github

        +
        +
        +YOU SHOULD SEE THIS!
        +
        +

        And here is a comment that should not display at github

        +

        This concludes the tests.

        + From cf688b2eac3c1a94966878bf7c2b3e1e9a583369 Mon Sep 17 00:00:00 2001 From: Patrick Maupin Date: Fri, 26 Jun 2015 11:23:07 -0500 Subject: [PATCH 205/416] Update expected test result My docutils configuration must be slightly different than github's. --- test/markups/README.directives.rst.html | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/test/markups/README.directives.rst.html b/test/markups/README.directives.rst.html index df4f3be3..f42c58f2 100644 --- a/test/markups/README.directives.rst.html +++ b/test/markups/README.directives.rst.html @@ -1,4 +1,4 @@ -

        restructuredText (rst) directives and comments

        +

        restructuredText (rst) directives and comments

        Introduction

        An rst directive starts with two periods, and has a keyword @@ -12,7 +12,7 @@

        Introduction

        readthedocs.org uses sphinx.

        Display of rst files at github needs to cover two distinct use-cases:

        -
          +
          • The github display is the primary method for displaying the file (e.g. for README.rst files)
          • The github display is incidental to the primary method @@ -34,9 +34,9 @@

            Introduction

             .. github display [on | off]
             
            -

            If you pass this the "on" value, then all unknown directives +

            If you pass this the "on" value, then all unknown directives will be displayed as literal code blocks. If you pass this -the "off" value, then unknown directives will not be displayed.

            +the "off" value, then unknown directives will not be displayed.

            In addition to controlling the display of literal code blocks, this also allows you to show comments specifically for github.

            For example, somebody could place this at the top of their file:

            @@ -71,5 +71,4 @@

            Tests

            YOU SHOULD SEE THIS!

            And here is a comment that should not display at github

            -

            This concludes the tests.

            - +

            This concludes the tests.

            \ No newline at end of file From ff25f45e7ef329cff0d2b8ac17f0e519fffb8910 Mon Sep 17 00:00:00 2001 From: Patrick Maupin Date: Fri, 26 Jun 2015 14:35:52 -0500 Subject: [PATCH 206/416] Add HTML classes for comments and unknown directives --- lib/github/commands/rest2html | 8 ++++++-- test/markups/README.directives.rst.html | 11 ++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index d517a9df..4fc23755 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -83,7 +83,9 @@ def unknown_directive(self, type_name): nodes.literal_block(text, text), line=lineno) return [error], blank_finish elif github_display: - return [nodes.literal_block(text, text)], blank_finish + cls = ['unknown_directive'] + result = [nodes.literal_block(text, text, classes=cls)] + return result, blank_finish else: return [nodes.comment(text, text)], blank_finish @@ -104,7 +106,9 @@ def comment(self, match): if len(indented) == 1: return [nodes.comment()], 1 text = '\n'.join(indented[1:]) - return [nodes.literal_block(text, text)], blank_finish + cls = ['github_comment'] + result = [nodes.literal_block(text, text, classes=cls)] + return result, blank_finish text = '\n'.join(indented) return [nodes.comment(text, text)], blank_finish diff --git a/test/markups/README.directives.rst.html b/test/markups/README.directives.rst.html index f42c58f2..df4f3be3 100644 --- a/test/markups/README.directives.rst.html +++ b/test/markups/README.directives.rst.html @@ -1,4 +1,4 @@ -

            restructuredText (rst) directives and comments

            +

            restructuredText (rst) directives and comments

            Introduction

            An rst directive starts with two periods, and has a keyword @@ -12,7 +12,7 @@

            Introduction

            readthedocs.org uses sphinx.

            Display of rst files at github needs to cover two distinct use-cases:

            -
              +
              • The github display is the primary method for displaying the file (e.g. for README.rst files)
              • The github display is incidental to the primary method @@ -34,9 +34,9 @@

                Introduction

                 .. github display [on | off]
                 
                -

                If you pass this the "on" value, then all unknown directives +

                If you pass this the "on" value, then all unknown directives will be displayed as literal code blocks. If you pass this -the "off" value, then unknown directives will not be displayed.

                +the "off" value, then unknown directives will not be displayed.

                In addition to controlling the display of literal code blocks, this also allows you to show comments specifically for github.

                For example, somebody could place this at the top of their file:

                @@ -71,4 +71,5 @@

                Tests

                YOU SHOULD SEE THIS!

                And here is a comment that should not display at github

                -

                This concludes the tests.

                \ No newline at end of file +

                This concludes the tests.

                + From 01fb321c18c924705b1bc906619a55a57c939f8e Mon Sep 17 00:00:00 2001 From: Patrick Maupin Date: Fri, 26 Jun 2015 14:45:49 -0500 Subject: [PATCH 207/416] Update expected results --- test/markups/README.directives.rst.html | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/test/markups/README.directives.rst.html b/test/markups/README.directives.rst.html index df4f3be3..f42c58f2 100644 --- a/test/markups/README.directives.rst.html +++ b/test/markups/README.directives.rst.html @@ -1,4 +1,4 @@ -

                restructuredText (rst) directives and comments

                +

                restructuredText (rst) directives and comments

                Introduction

                An rst directive starts with two periods, and has a keyword @@ -12,7 +12,7 @@

                Introduction

                readthedocs.org uses sphinx.

                Display of rst files at github needs to cover two distinct use-cases:

                -
                  +
                  • The github display is the primary method for displaying the file (e.g. for README.rst files)
                  • The github display is incidental to the primary method @@ -34,9 +34,9 @@

                    Introduction

                     .. github display [on | off]
                     
                    -

                    If you pass this the "on" value, then all unknown directives +

                    If you pass this the "on" value, then all unknown directives will be displayed as literal code blocks. If you pass this -the "off" value, then unknown directives will not be displayed.

                    +the "off" value, then unknown directives will not be displayed.

                    In addition to controlling the display of literal code blocks, this also allows you to show comments specifically for github.

                    For example, somebody could place this at the top of their file:

                    @@ -71,5 +71,4 @@

                    Tests

                    YOU SHOULD SEE THIS!

                    And here is a comment that should not display at github

                    -

                    This concludes the tests.

                    - +

                    This concludes the tests.

                    \ No newline at end of file From 44cfb29895ab2b6f09ff5efa3194248911f22d40 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Wed, 8 Jul 2015 14:12:47 -0400 Subject: [PATCH 208/416] Add code of conduct to contributing guidelines --- CONTRIBUTING.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 83784b46..318fbe9b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,8 @@ # Contributing +This project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to uphold this code. +[code-of-conduct]: http://todogroup.org/opencodeofconduct/#GitHub%20Markup/opensource@github.com + This library's only job is to decide which markup format to use and call out to an external library to convert the markup to HTML (see the [README](README.md) for more information on how markup is rendered on GitHub.com). If you are having an issue with: From f34f5387f10ff784a3c62bb5f73bb236354f6f7b Mon Sep 17 00:00:00 2001 From: kakwa Date: Sat, 18 Jul 2015 10:41:16 +0200 Subject: [PATCH 209/416] pep8 compliance --- lib/github/commands/rest2html | 58 +++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index b9dc5c29..9200b705 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -58,18 +58,20 @@ SETTINGS = { 'sectsubtitle_xform': True, 'initial_header_level': 2, 'report_level': 5, - 'syntax_highlight' : 'none', - 'math_output' : 'latex', + 'syntax_highlight': 'none', + 'math_output': 'latex', 'field_name_limit': 50, } + class GitHubHTMLTranslator(HTMLTranslator): + # removes the
                    tag wrapped around docs # see also: http://bit.ly/1exfq2h (warning! sourceforge link.) def depart_document(self, node): HTMLTranslator.depart_document(self, node) - self.html_body.pop(0) # pop the starting
                    off - self.html_body.pop() # pop the ending
                    off + self.html_body.pop(0) # pop the starting
                    off + self.html_body.pop() # pop the ending
                    off # technique for visiting sections, without generating additional divs # see also: http://bit.ly/NHtyRx @@ -102,36 +104,38 @@ class GitHubHTMLTranslator(HTMLTranslator): def visit_table(self, node): classes = ' '.join(['docutils', self.settings.table_style]).strip() self.body.append( - self.starttag(node, 'table', CLASS=classes)) + self.starttag(node, 'table', CLASS=classes)) def depart_table(self, node): self.body.append('
        \n') def depart_image(self, node): - uri = node['uri'] - ext = os.path.splitext(uri)[1].lower() - # we need to swap RST's use of `object` with `img` tags - # see http://git.io/5me3dA - if ext == ".svg": - # preserve essential attributes - atts = {} - for attribute, value in node.attributes.items(): - # we have no time for empty values - if value: - if attribute == "uri": - atts['src'] = value - else: - atts[attribute] = value - - # toss off `object` tag - self.body.pop() + uri = node['uri'] + ext = os.path.splitext(uri)[1].lower() + # we need to swap RST's use of `object` with `img` tags + # see http://git.io/5me3dA + if ext == ".svg": + # preserve essential attributes + atts = {} + for attribute, value in node.attributes.items(): + # we have no time for empty values + if value: + if attribute == "uri": + atts['src'] = value + else: + atts[attribute] = value + + # toss off `object` tag + self.body.pop() # add on `img` with attributes - self.body.append(self.starttag(node, 'img', **atts)) - self.body.append(self.context.pop()) + self.body.append(self.starttag(node, 'img', **atts)) + self.body.append(self.context.pop()) + def kbd(name, rawtext, text, lineno, inliner, options=None, content=None): - return [nodes.raw('', '%s' % text, format='html')], [] + return [nodes.raw('', '%s' % text, format='html')], [] + def main(): """ @@ -143,9 +147,9 @@ def main(): """ try: text = codecs.open(sys.argv[1], 'r', 'utf-8').read() - except IOError: # given filename could not be found + except IOError: # given filename could not be found return '' - except IndexError: # no filename given + except IndexError: # no filename given text = sys.stdin.read() writer = Writer() From 68557d2756e62cf5a12f4648dcc36dc99169645f Mon Sep 17 00:00:00 2001 From: kakwa Date: Sat, 18 Jul 2015 10:42:01 +0200 Subject: [PATCH 210/416] enable raw html --- lib/github/commands/rest2html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 9200b705..6f9ff7c7 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -52,7 +52,7 @@ from docutils.writers.html4css1 import Writer, HTMLTranslator SETTINGS = { 'cloak_email_addresses': False, 'file_insertion_enabled': False, - 'raw_enabled': False, + 'raw_enabled': True, 'strip_comments': True, 'doctitle_xform': True, 'sectsubtitle_xform': True, From 04c5f11c6a9d0b8fc9d879a1d68b8216e297570e Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Sun, 19 Jul 2015 21:39:46 -0700 Subject: [PATCH 211/416] uphold => honor --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 318fbe9b..0236a554 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contributing -This project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to uphold this code. +This project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to honor this code. [code-of-conduct]: http://todogroup.org/opencodeofconduct/#GitHub%20Markup/opensource@github.com This library's only job is to decide which markup format to use and call out to an external library to convert the markup to HTML (see the [README](README.md) for more information on how markup is rendered on GitHub.com). From 5716bc1e41383f50f8f7740b37449ffb8721c5ab Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 31 Jul 2015 11:29:52 -0700 Subject: [PATCH 212/416] :gem: bump to 1.4.0 --- lib/github-markup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index cd9adf3c..ef1dc9f4 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.3.3' + VERSION = '1.4.0' Version = VERSION end end From c5e6585d92daecd531090eb800aa4b8a440baf32 Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Wed, 2 Sep 2015 14:58:43 +0100 Subject: [PATCH 213/416] Added doctest blocks to reStructuredText Many Python projects use Sphinx to create documentation from .rst markup. Using a doctest:: directive the markup can include blocks of code that is both tested and rendered in the final documentation. These blocks are not rendered on github.com though, e.g. in a README.rst. To remedy this (without adding Sphinx as a dependency) this PR aliases doctest:: directives to code:: directives,. The language of such blocks is set to 'python', since doctest only supports Python. Refs dateutil/dateutil#83 --- lib/github/commands/rest2html | 18 +++++++++++++++++- test/markups/README.rst | 13 +++++++++++++ test/markups/README.rst.html | 10 ++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index b9dc5c29..13b56c1f 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -45,7 +45,8 @@ except: import codecs from docutils import nodes -from docutils.parsers.rst import roles +from docutils.parsers.rst import directives, roles +from docutils.parsers.rst.directives.body import CodeBlock from docutils.core import publish_parts from docutils.writers.html4css1 import Writer, HTMLTranslator @@ -63,6 +64,18 @@ SETTINGS = { 'field_name_limit': 50, } + +class DoctestDirective(CodeBlock): + """Render Sphinx 'doctest:: [group]' blocks as 'code:: python' + """ + + def run(self): + """Discard any doctest group argument, render contents as python code + """ + self.arguments = ['python'] + return super(DoctestDirective, self).run() + + class GitHubHTMLTranslator(HTMLTranslator): # removes the
        tag wrapped around docs # see also: http://bit.ly/1exfq2h (warning! sourceforge link.) @@ -153,6 +166,9 @@ def main(): roles.register_canonical_role('kbd', kbd) + # Render source code in Sphinx doctest blocks + directives.register_directive('doctest', DoctestDirective) + parts = publish_parts(text, writer=writer, settings_overrides=SETTINGS) if 'html_body' in parts: html = parts['html_body'] diff --git a/test/markups/README.rst b/test/markups/README.rst index ccabe9e7..4e3e1be5 100644 --- a/test/markups/README.rst +++ b/test/markups/README.rst @@ -31,6 +31,19 @@ The UTF-8 quote character in this table used to cause python to go boom. Now doc Tabular Data, 5 Made up ratings, 11 +.. code:: + + A block of code + +.. code:: python + + python.code('hooray') + +.. doctest:: ignored + + >>> some_function() + 'result' + ============== ========================================================== Travis http://travis-ci.org/tony/pullv Docs http://pullv.rtfd.org diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index af777045..c29fa34e 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -16,6 +16,16 @@

        Header 2

      3. Somé UTF-8°

      The UTF-8 quote character in this table used to cause python to go boom. Now docutils just silently ignores it.

      +
      +A block of code
      +
      +
      +python.code('hooray')
      +
      +
      +>>> some_function()
      +'result'
      +
      From 5393ae93cd0f51d9990e3a33c30d44ce4c64a235 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 1 Oct 2015 01:01:13 -0700 Subject: [PATCH 214/416] Add test for raw RST --- test/markups/README.rst | 5 +++++ test/markups/README.rst.html | 2 ++ 2 files changed, 7 insertions(+) diff --git a/test/markups/README.rst b/test/markups/README.rst index 4e3e1be5..0bd4267e 100644 --- a/test/markups/README.rst +++ b/test/markups/README.rst @@ -72,3 +72,8 @@ Field list someone@somewhere.org Press :kbd:`Ctrl+C` to quit + + +.. raw:: html + +

      RAW HTML!

      diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index c29fa34e..21f9a76d 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -87,3 +87,5 @@

      Field list

      someone@somewhere.org

      Press Ctrl+C to quit

      + +

      RAW HTML!

      p {color:blue;} From eb4ea4f6d72e1f0d3d51e1b21946bdbd4ed0947c Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 1 Oct 2015 01:04:43 -0700 Subject: [PATCH 215/416] Drop 1.9.3 --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0a44f56e..dceeb4db 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: ruby before_install: sudo pip install docutils rvm: - - 1.9.3 - 2.0.0 - 2.1.1 - jruby-19mode From 6a5895852891d695f49a248cc4098e045310abb1 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 1 Oct 2015 01:04:57 -0700 Subject: [PATCH 216/416] Ensure `sudo: false` --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dceeb4db..abcc525c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: ruby -before_install: sudo pip install docutils +sudo: false +before_install: pip install docutils rvm: - 2.0.0 - 2.1.1 From 8b22d8221b41f8ce99faeed5f8c21a1cd8a3477c Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 1 Oct 2015 01:05:05 -0700 Subject: [PATCH 217/416] Not so many Git depths --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index abcc525c..45731388 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,3 +9,5 @@ jdk: - oraclejdk8 notifications: email: false +git: + depth: 10 From 5759fa0091ebf959168bf3b3da5a6028dbd7c0b2 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 1 Oct 2015 01:09:13 -0700 Subject: [PATCH 218/416] Properly install `python-docutils` --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 45731388..9d71d6b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: ruby sudo: false -before_install: pip install docutils rvm: - 2.0.0 - 2.1.1 @@ -11,3 +10,7 @@ notifications: email: false git: depth: 10 +addons: + apt: + packages: + - python-docutils From 5f7d58f9ecf787a029ce0be316211aab3c6c2365 Mon Sep 17 00:00:00 2001 From: Serguei Okladnikov Date: Fri, 1 Apr 2016 18:10:42 +0000 Subject: [PATCH 219/416] allow multiple files for command line tool useful for prepare for printing multiple documents: github-markup repo/docs/* instead of echo repo/docs/* | xargs github-markup --- bin/github-markup | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/bin/github-markup b/bin/github-markup index 76e5e369..17ac1cab 100755 --- a/bin/github-markup +++ b/bin/github-markup @@ -3,8 +3,26 @@ $LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib" require 'github/markup' -if ARGV[0] && File.exists?(file = ARGV[0]) - puts GitHub::Markup.render(file) -else - puts "usage: #$0 FILE" +if ARGV.size < 1 + print "usage: #$0 FILE [ FILES ... ]\n" + exit end + +sources = [] + +ARGV.each { |s| + begin + file = File.open( s, "r" ) + sources.push [ s, file ] + rescue Exception => e + print "error: #{e.message}\n" + ensure + end +} + +sources.each { |s| + name,file = s + print GitHub::Markup.render( name, file.read ) + file.close +} + From 418da907838f6c1808d7354a5be01595e0eea7a5 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 22 Jul 2016 09:06:24 -0700 Subject: [PATCH 220/416] Gotta cache 'em all --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9d71d6b8..2affce3b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ notifications: email: false git: depth: 10 -addons: - apt: - packages: - - python-docutils +before_install: sudo pip install docutils +cache: + - bundler + - pip From 2cb105cc4a90348ce2e88357eb114b252acab1a2 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 22 Jul 2016 09:08:26 -0700 Subject: [PATCH 221/416] no sudo --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2affce3b..ac4c0541 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ notifications: email: false git: depth: 10 -before_install: sudo pip install docutils +before_install: pip install docutils cache: - bundler - pip From d54fdcdb13221d9566745b77b42428e17ae57483 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 22 Jul 2016 09:11:34 -0700 Subject: [PATCH 222/416] Fine come back sudo --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ac4c0541..6a407b33 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ language: ruby -sudo: false rvm: - 2.0.0 - 2.1.1 @@ -10,7 +9,7 @@ notifications: email: false git: depth: 10 -before_install: pip install docutils +before_install: sudo pip install docutils cache: - bundler - pip From 863ca20086353ac49f79d285ad41bc8a9cd2911e Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 22 Jul 2016 09:15:04 -0700 Subject: [PATCH 223/416] do we need this --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6a407b33..efdde4e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,8 @@ notifications: email: false git: depth: 10 -before_install: sudo pip install docutils +sudo: false +# before_install: sudo pip install docutils cache: - bundler - pip From a56c587f58af47232a25b66fdd380829682a6d92 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 22 Jul 2016 09:17:02 -0700 Subject: [PATCH 224/416] Lock it --- github-markup.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/github-markup.gemspec b/github-markup.gemspec index 62e4770b..a906474f 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,6 +16,7 @@ Gem::Specification.new do |s| s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = %w[lib] + s.add_development_dependency 'activesupport', '~> 4.0' s.add_development_dependency 'minitest', '~> 5.4.3' s.add_development_dependency 'html-pipeline', '~> 1.0' s.add_development_dependency 'sanitize', '~> 2.1.0' From 35b68c7f5c51fcdab368742fbdc843c662900287 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 22 Jul 2016 09:20:10 -0700 Subject: [PATCH 225/416] Yep need it. --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index efdde4e1..6a407b33 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,8 +9,7 @@ notifications: email: false git: depth: 10 -sudo: false -# before_install: sudo pip install docutils +before_install: sudo pip install docutils cache: - bundler - pip From 6413e7b42ad02f2c4c936f79bf7fe6ba8eb4119a Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 22 Jul 2016 09:31:26 -0700 Subject: [PATCH 226/416] JRuby needs this for C --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 6a407b33..ae456462 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,3 +13,6 @@ before_install: sudo pip install docutils cache: - bundler - pip +env: + global: + - "JRUBY_OPTS=-Xcext.enabled=true" From cf74e842dfd082d8001417c1bb94edd2ae06d61b Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 22 Jul 2016 09:48:31 -0700 Subject: [PATCH 227/416] It never ends --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index ae456462..878d01da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,3 +16,6 @@ cache: env: global: - "JRUBY_OPTS=-Xcext.enabled=true" +matrix: + allow_failures: + - rvm: jruby-19mode From 53211f7bb407750d23b9c01b217c4d47e108bf95 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Wed, 24 Aug 2016 15:42:53 +0200 Subject: [PATCH 228/416] Makes rest2html work in both python2 and python3 --- lib/github/commands/rest2html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 7ecfe272..958cd3cf 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -31,9 +31,11 @@ import sys import os # This fixes docutils failing with unicode parameters to CSV-Table. The -S -# switch and the following 2 lines can be removed after upgrading to python 3. -reload(sys) -sys.setdefaultencoding('utf-8') +# switch and the following 3 lines can be removed after upgrading to python 3. +if sys.version_info[0] < 3: + reload(sys) + sys.setdefaultencoding('utf-8') + import site try: From 62ff5993081920ad75016f2b87019dd14e3af137 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Tue, 6 Sep 2016 21:13:53 +0200 Subject: [PATCH 229/416] Handle sys.stdin and sys.stdout encoding issues in python 3.x This code will keep current behavior for python 2.x. --- lib/github/commands/rest2html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 958cd3cf..db3b1bfa 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -45,6 +45,7 @@ except: pass import codecs +import io from docutils import nodes from docutils.parsers.rst import directives, roles @@ -164,7 +165,11 @@ def main(): except IOError: # given filename could not be found return '' except IndexError: # no filename given - text = sys.stdin.read() + if sys.version_info[0] < 3: # python 2.x + text = sys.stdin.read() + else: # python 3 + input_stream = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8') + text = input_stream.read() writer = Writer() writer.translator_class = GitHubHTMLTranslator @@ -187,5 +192,9 @@ def main(): return '' if __name__ == '__main__': - sys.stdout.write("%s%s" % (main(), "\n")) + if sys.version_info[0] < 3: # python 2.x + sys.stdout.write("%s%s" % (main(), "\n")) + else: # python 3 + output_stream = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') + output_stream.write("%s%s" % (main(), "\n")) sys.stdout.flush() From 88ab49174890e7ab8f76c35f075a045ece619ed5 Mon Sep 17 00:00:00 2001 From: ericsnowcurrently Date: Wed, 5 Oct 2016 11:18:45 -0700 Subject: [PATCH 230/416] Use a more contemporary install command for .rst format. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 92e570c3..2b153719 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a * [.org](http://orgmode.org/) -- `gem install org-ruby` * [.creole](http://wikicreole.org/) -- `gem install creole` * [.mediawiki, .wiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth` -* [.rst](http://docutils.sourceforge.net/rst.html) -- `easy_install docutils` +* [.rst](http://docutils.sourceforge.net/rst.html) -- `python3 -m pip install sphinx` * [.asciidoc, .adoc, .asc](http://asciidoc.org/) -- `gem install asciidoctor` (http://asciidoctor.org) * [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::HTML` comes with Perl >= 5.10. Lower versions should install [Pod::Simple](http://search.cpan.org/~dwheeler/Pod-Simple-3.28/lib/Pod/Simple.pod) from CPAN. From a62c5cd5114e19fda59d71241fa2d52fa791fff6 Mon Sep 17 00:00:00 2001 From: strixaluco Date: Mon, 24 Oct 2016 10:39:21 +0800 Subject: [PATCH 231/416] rdoc URL updated --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 92e570c3..789ffaa7 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a * [.markdown, .mdown, .mkdn, .md](http://daringfireball.net/projects/markdown/) -- `gem install redcarpet` (https://github.com/vmg/redcarpet) * [.textile](http://www.textism.com/tools/textile/) -- `gem install RedCloth` -* [.rdoc](http://rdoc.sourceforge.net/) -- `gem install rdoc -v 3.6.1` +* [.rdoc](https://rdoc.github.io/rdoc/) -- `gem install rdoc -v 3.6.1` * [.org](http://orgmode.org/) -- `gem install org-ruby` * [.creole](http://wikicreole.org/) -- `gem install creole` * [.mediawiki, .wiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth` From d9748cadc9e208283a079898d6c6e64e4eeb408b Mon Sep 17 00:00:00 2001 From: hcpl Date: Tue, 1 Nov 2016 20:28:24 +0200 Subject: [PATCH 232/416] Remove the sectsubtitle_xform setting --- lib/github/commands/rest2html | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 7ecfe272..082d3671 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -56,7 +56,6 @@ SETTINGS = { 'raw_enabled': True, 'strip_comments': True, 'doctitle_xform': True, - 'sectsubtitle_xform': True, 'initial_header_level': 2, 'report_level': 5, 'syntax_highlight': 'none', From 59aa433ec7b8a42bd04bb1c8566d5ee5948689a3 Mon Sep 17 00:00:00 2001 From: Manuel Krebber Date: Tue, 29 Nov 2016 13:32:56 +0100 Subject: [PATCH 233/416] Added support for highlighting doctest blocks in reStructuredText files. --- lib/github/commands/rest2html | 3 +++ test/markups/README.rst | 3 +++ test/markups/README.rst.html | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 7ecfe272..dd3f560d 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -105,6 +105,9 @@ class GitHubHTMLTranslator(HTMLTranslator): else: self.body.append(self.starttag(node, 'pre')) + def visit_doctest_block(self, node): + self.body.append(self.starttag(node, 'pre', lang='pycon')) + # always wrap two-backtick rst inline literals in , not # this also avoids the generation of superfluous tags def visit_literal(self, node): diff --git a/test/markups/README.rst b/test/markups/README.rst index 0bd4267e..54bd71ce 100644 --- a/test/markups/README.rst +++ b/test/markups/README.rst @@ -44,6 +44,9 @@ The UTF-8 quote character in this table used to cause python to go boom. Now doc >>> some_function() 'result' +>>> some_function() +'result' + ============== ========================================================== Travis http://travis-ci.org/tony/pullv Docs http://pullv.rtfd.org diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index 21f9a76d..7b8e9fca 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -26,6 +26,10 @@

      Header 2

      >>> some_function() 'result' +
      +>>> some_function()
      +'result'
      +
      From e97e4769e1e43fa27193596e968d529537c94f6c Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Thu, 22 Dec 2016 11:06:39 +0300 Subject: [PATCH 234/416] Make rest2html work with docutils 0.13 In that docutils version, HTMLTranslator.visit_image no longer appends empty string to self.context, so trying to pop() from there raises an IndexError. Instead of the hard-coded pop call, call the overridden method, which will call pop() on docutils 0.12 and will do nothing on docutils 0.13. Fixes #971. Also, fix the comment indentation. --- lib/github/commands/rest2html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 7ecfe272..fff69fc6 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -139,9 +139,9 @@ class GitHubHTMLTranslator(HTMLTranslator): # toss off `object` tag self.body.pop() - # add on `img` with attributes + # add on `img` with attributes self.body.append(self.starttag(node, 'img', **atts)) - self.body.append(self.context.pop()) + HTMLTranslator.depart_image(self, node) def kbd(name, rawtext, text, lineno, inliner, options=None, content=None): From 6904a21bd966c138e7dbd7f1ec24fe511c17891e Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Mon, 30 Jan 2017 14:30:48 +1100 Subject: [PATCH 235/416] Add CommonMarker gem --- lib/github/markup/markdown.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index 8ccf7f07..8e396a32 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -4,6 +4,9 @@ module GitHub module Markup class Markdown < Implementation MARKDOWN_GEMS = { + "commonmarker" => proc { |content| + CommonMarker.render_html(content, :default, %i[tagfilter autolink table strikethrough]) + }, "github/markdown" => proc { |content| GitHub::Markdown.render(content) }, From 0c2da9734f44920dedf32471e60cf56163ff2b26 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Mon, 30 Jan 2017 14:33:38 +1100 Subject: [PATCH 236/416] :gem: bump to 1.4.1 --- lib/github-markup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index ef1dc9f4..89cce44e 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.4.0' + VERSION = '1.4.1' Version = VERSION end end From e494209fea8568455e563840a6a4f955d2162d07 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Thu, 9 Mar 2017 09:32:41 +1100 Subject: [PATCH 237/416] Ruby 1.9 adjustments --- Gemfile | 1 + lib/github/markup/markdown.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 637836b0..a5c14b0e 100644 --- a/Gemfile +++ b/Gemfile @@ -11,3 +11,4 @@ gem "creole", "~>0.3.6" gem "wikicloth", "=0.8.1", :platforms => :ruby gem "asciidoctor", "= 1.5.2" gem "rake" +gem "rinku", '~> 1' diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index 8e396a32..014f37fe 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -5,7 +5,7 @@ module Markup class Markdown < Implementation MARKDOWN_GEMS = { "commonmarker" => proc { |content| - CommonMarker.render_html(content, :default, %i[tagfilter autolink table strikethrough]) + CommonMarker.render_html(content, :default, [:tagfilter, :autolink, :table, :strikethrough]) }, "github/markdown" => proc { |content| GitHub::Markdown.render(content) From 5ded14c01037b09dadb8940da4224930c78cde7c Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Thu, 9 Mar 2017 09:33:37 +1100 Subject: [PATCH 238/416] :gem: bump to 1.4.2 --- lib/github-markup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 89cce44e..cd11c1d0 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.4.1' + VERSION = '1.4.2' Version = VERSION end end From 26dee7157ae3b1efe428b21333f00084eaabff21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20R=C3=B8nn-Jensen?= Date: Mon, 13 Mar 2017 15:44:48 +0100 Subject: [PATCH 239/416] (chore) (refactor) pipe result of each gsub instead of modifying original Simpler to just pipe the result of each command to the next. --- test/markup_test.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/markup_test.rb b/test/markup_test.rb index 4c8fdf45..970f98d1 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -9,11 +9,10 @@ require 'nokogiri/diff' def normalize_html(text) - text.strip! - text.gsub!(/\s\s+/,' ') - text.gsub!(/\p{Pi}|\p{Pf}|&quot;/u,'"') - text.gsub!("\u2026",'...') - text + text.strip + .gsub(/\s\s+/,' ') + .gsub!(/\p{Pi}|\p{Pf}|&quot;/u,'"') + .gsub!("\u2026",'...') end def assert_html_equal(expected, actual, msg = nil) From 549f59cdcf2f9ef4e5c9675ce0eb48bc700f74e2 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Tue, 14 Mar 2017 20:12:54 +1100 Subject: [PATCH 240/416] Bump for latest CommonMarker --- lib/github/markup/markdown.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index 014f37fe..521e0756 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -5,7 +5,7 @@ module Markup class Markdown < Implementation MARKDOWN_GEMS = { "commonmarker" => proc { |content| - CommonMarker.render_html(content, :default, [:tagfilter, :autolink, :table, :strikethrough]) + CommonMarker.render_html(content, :DEFAULT, [:tagfilter, :autolink, :table, :strikethrough]) }, "github/markdown" => proc { |content| GitHub::Markdown.render(content) From 23f435f6c4ccddc8dcf6e67938d6e4760232b697 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Tue, 14 Mar 2017 20:13:12 +1100 Subject: [PATCH 241/416] :gem: bump to 1.4.3 --- lib/github-markup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index cd11c1d0..686ce59d 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.4.2' + VERSION = '1.4.3' Version = VERSION end end From 7370b3f875b41d688add03cd5ad21a9b24c510ec Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Thu, 16 Mar 2017 09:24:15 +1100 Subject: [PATCH 242/416] Don't append to ESCAPED_TAGS forever. --- lib/github/markups.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 89f1b410..90350396 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -23,7 +23,7 @@ markup(:wikicloth, /mediawiki|wiki/) do |content| wikicloth = WikiCloth::WikiCloth.new(:data => content) - WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS << 'tt' + WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS << 'tt' unless WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS.include?('tt') wikicloth.to_html(:noedit => true) end From 0183799c923540b7085256aecb48f0db61932109 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Thu, 16 Mar 2017 09:48:03 +1100 Subject: [PATCH 243/416] :gem: bump to 1.4.4 --- lib/github-markup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 686ce59d..cfcff229 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.4.3' + VERSION = '1.4.4' Version = VERSION end end From 004694189a51f4a99cce68edd4690c55a77047dd Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Thu, 16 Mar 2017 10:50:25 +1100 Subject: [PATCH 244/416] Use metacpan.org for searches --- lib/github/commands/pod2html | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/github/commands/pod2html b/lib/github/commands/pod2html index b9539468..0bf436f6 100755 --- a/lib/github/commands/pod2html +++ b/lib/github/commands/pod2html @@ -6,6 +6,7 @@ use Pod::Simple::XHTML 3.11; my $p = Pod::Simple::XHTML->new; $p->html_header(''); $p->html_footer(''); +$p->perldoc_url_prefix('http://metacpan.org/search?q='); $p->strip_verbatim_indent(sub { my $lines = shift; (my $indent = $lines->[0]) =~ s/\S.*//; From c69660e045ed9f0da3fc8bc9862b86255c32e44a Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Thu, 16 Mar 2017 10:56:56 +1100 Subject: [PATCH 245/416] Attempt install on Travis --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index b6591f59..bced84b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,9 @@ notifications: git: depth: 10 before_install: + - sudo apt-get install perl + - curl -L http://cpanmin.us | perl - --sudo App::cpanminus + - sudo cpanm --installdeps --notest Pod::Simple - sudo pip install docutils cache: - bundler From 8c693c60321a420f1c097e2cf3c461fa0fb0db27 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Thu, 16 Mar 2017 11:00:49 +1100 Subject: [PATCH 246/416] Drop "-w" --- lib/github/commands/pod2html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github/commands/pod2html b/lib/github/commands/pod2html index 0bf436f6..538da8f8 100755 --- a/lib/github/commands/pod2html +++ b/lib/github/commands/pod2html @@ -1,4 +1,4 @@ -#!/usr/bin/env perl -w +#!/usr/bin/env perl use strict; use Pod::Simple::XHTML 3.11; From 774bb322c47a8447d2be85a4a8b68f8918b4df06 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Thu, 16 Mar 2017 11:09:36 +1100 Subject: [PATCH 247/416] Only pop context when installed docutils wants This changed at some point recently. (My system docutils wanted to do this, but the current latest on PyPI (0.13.1) doesn't.) This is an old-style object (!) so we have to use this hack. --- lib/github/commands/rest2html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 7ecfe272..3cfd8ad5 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -141,7 +141,7 @@ class GitHubHTMLTranslator(HTMLTranslator): self.body.pop() # add on `img` with attributes self.body.append(self.starttag(node, 'img', **atts)) - self.body.append(self.context.pop()) + HTMLTranslator.depart_image(self, node) def kbd(name, rawtext, text, lineno, inliner, options=None, content=None): From 179819e484f59b1ef07f343d4e5a124e7d537caf Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Wed, 19 Aug 2015 19:06:08 +0200 Subject: [PATCH 248/416] Use Linguist to detect the language --- Gemfile | 1 + lib/github/markup.rb | 26 +++++++++------ lib/github/markup/command_implementation.rb | 4 +-- lib/github/markup/gem_implementation.rb | 4 +-- lib/github/markup/implementation.rb | 15 +++------ lib/github/markup/markdown.rb | 2 +- lib/github/markup/rdoc.rb | 2 +- lib/github/markups.rb | 15 +++++---- test/markup_test.rb | 36 ++++++++++----------- 9 files changed, 54 insertions(+), 51 deletions(-) diff --git a/Gemfile b/Gemfile index edd0c249..0482a419 100644 --- a/Gemfile +++ b/Gemfile @@ -12,3 +12,4 @@ gem "wikicloth", "=0.8.3" gem "asciidoctor", "= 1.5.2" gem "rake" gem "rinku", '~> 1' +gem "github-linguist", ">= 4.7.5" diff --git a/lib/github/markup.rb b/lib/github/markup.rb index ddc7312f..c5a6ad84 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -37,7 +37,7 @@ def preload! def render(filename, content = nil) content ||= File.read(filename) - if impl = renderer(filename) + if impl = renderer(filename, content) impl.render(content) else content @@ -53,9 +53,9 @@ def render_s(symbol, content) content end end - - def markup(symbol, file, pattern, opts = {}, &block) - markup_impl(symbol, GemImplementation.new(pattern, file, &block)) + + def markup(symbol, gem_name, pattern, opts = {}, &block) + markup_impl(symbol, GemImplementation.new(pattern, gem_name, &block)) end def markup_impl(symbol, impl) @@ -65,24 +65,30 @@ def markup_impl(symbol, impl) markups[symbol] = impl end - def command(symbol, command, regexp, name, &block) + def command(symbol, command, languages, name, &block) if File.exist?(file = File.dirname(__FILE__) + "/commands/#{command}") command = file end - markup_impl(symbol, CommandImplementation.new(regexp, command, name, &block)) + markup_impl(symbol, CommandImplementation.new(languages, command, name, &block)) end - def can_render?(filename) - !!renderer(filename) + def can_render?(filename, content) + !!renderer(filename, content) end - def renderer(filename) + def renderer(filename, content) + language = language(filename, content) markup_impls.find { |impl| - impl.match?(filename) + impl.match?(language) } end + def language(filename, content) + blob = Linguist::Blob.new(filename, content) + return Linguist.detect(blob) + end + # Define markups markups_rb = File.dirname(__FILE__) + '/markups.rb' instance_eval File.read(markups_rb), markups_rb diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index be3f6b46..d0f2fc47 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -15,8 +15,8 @@ class CommandError < RuntimeError class CommandImplementation < Implementation attr_reader :command, :block, :name - def initialize(regexp, command, name, &block) - super regexp + def initialize(languages, command, name, &block) + super languages @command = command.to_s @block = block @name = name diff --git a/lib/github/markup/gem_implementation.rb b/lib/github/markup/gem_implementation.rb index 270f5a88..08383f52 100644 --- a/lib/github/markup/gem_implementation.rb +++ b/lib/github/markup/gem_implementation.rb @@ -5,8 +5,8 @@ module Markup class GemImplementation < Implementation attr_reader :gem_name, :renderer - def initialize(regexp, gem_name, &renderer) - super regexp + def initialize(languages, gem_name, &renderer) + super languages @gem_name = gem_name.to_s @renderer = renderer end diff --git a/lib/github/markup/implementation.rb b/lib/github/markup/implementation.rb index 463a39d4..46df1510 100644 --- a/lib/github/markup/implementation.rb +++ b/lib/github/markup/implementation.rb @@ -1,10 +1,10 @@ module GitHub module Markup class Implementation - attr_reader :regexp + attr_reader :languages - def initialize(regexp) - @regexp = regexp + def initialize(languages) + @languages = languages end def load @@ -15,13 +15,8 @@ def render(content) raise NotImplementedError, "subclasses of GitHub::Markup::Implementation must define #render" end - def match?(filename) - file_ext_regexp =~ filename - end - - private - def file_ext_regexp - @file_ext_regexp ||= /\.(#{regexp})\z/ + def match?(language) + languages.include? language end end end diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index 521e0756..6d2607ee 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -28,7 +28,7 @@ class Markdown < Implementation } def initialize - super(/md|rmd|mkdn?|mdwn|mdown|markdown|litcoffee/i) + super([Linguist::Language["Markdown"], Linguist::Language["RMarkdown"], Linguist::Language["Literate CoffeeScript"]]) end def load diff --git a/lib/github/markup/rdoc.rb b/lib/github/markup/rdoc.rb index bc008cb4..e96ddf07 100644 --- a/lib/github/markup/rdoc.rb +++ b/lib/github/markup/rdoc.rb @@ -6,7 +6,7 @@ module GitHub module Markup class RDoc < Implementation def initialize - super(/rdoc/) + super([Linguist::Language["RDoc"]]) end def render(content) diff --git a/lib/github/markups.rb b/lib/github/markups.rb index e951fb16..24ecaffa 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -1,33 +1,34 @@ require "github/markup/markdown" require "github/markup/rdoc" require "shellwords" +require "linguist" markup_impl(::GitHub::Markups::MARKUP_MARKDOWN, ::GitHub::Markup::Markdown.new) -markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, /textile/) do |content| +markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, [Linguist::Language["Textile"]]) do |content| RedCloth.new(content).to_html end markup_impl(::GitHub::Markups::MARKUP_RDOC, GitHub::Markup::RDoc.new) -markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', /org/) do |content| +markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', [Linguist::Language["Org"]]) do |content| Orgmode::Parser.new(content, { :allow_include_files => false, :skip_syntax_highlight => true }).to_html end -markup(::GitHub::Markups::MARKUP_CREOLE, :creole, /creole/) do |content| +markup(::GitHub::Markups::MARKUP_CREOLE, :creole, [Linguist::Language["Creole"]]) do |content| Creole.creolize(content) end -markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, /mediawiki|wiki/) do |content| +markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, [Linguist::Language["MediaWiki"]]) do |content| wikicloth = WikiCloth::WikiCloth.new(:data => content) WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS << 'tt' unless WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS.include?('tt') wikicloth.to_html(:noedit => true) end -markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/) do |content| +markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, [Linguist::Language["AsciiDoc"]]) do |content| Asciidoctor::Compliance.unique_id_start_index = 1 Asciidoctor.convert(content, :safe => :secure, :attributes => %w(showtitle=@ idprefix idseparator=- env=github env-github source-highlighter=html-pipeline)) end @@ -35,8 +36,8 @@ command( ::GitHub::Markups::MARKUP_RST, "python2 -S #{Shellwords.escape(File.dirname(__FILE__))}/commands/rest2html", - /re?st(\.txt)?/, + [Linguist::Language["reStructuredText"]], "restructuredtext" ) -command(::GitHub::Markups::MARKUP_POD, :pod2html, /pod/, "pod") +command(::GitHub::Markups::MARKUP_POD, :pod2html, [Linguist::Language["Pod"]], "pod") diff --git a/test/markup_test.rb b/test/markup_test.rb index d0b6d09a..6c8365d4 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -77,24 +77,24 @@ def call end def test_knows_what_it_can_and_cannot_render - assert_equal false, GitHub::Markup.can_render?('README.html') - assert_equal true, GitHub::Markup.can_render?('README.markdown') - assert_equal true, GitHub::Markup.can_render?('README.rmd') - assert_equal true, GitHub::Markup.can_render?('README.Rmd') - assert_equal false, GitHub::Markup.can_render?('README.cmd') - assert_equal true, GitHub::Markup.can_render?('README.litcoffee') + assert_equal false, GitHub::Markup.can_render?('README.html', '

      Title

      ') + assert_equal true, GitHub::Markup.can_render?('README.markdown', '=== Title') + assert_equal true, GitHub::Markup.can_render?('README.rmd', '=== Title') + assert_equal true, GitHub::Markup.can_render?('README.Rmd', '=== Title') + assert_equal false, GitHub::Markup.can_render?('README.cmd', 'echo 1') + assert_equal true, GitHub::Markup.can_render?('README.litcoffee', 'Title') end def test_each_render_has_a_name - assert_equal "markdown", GitHub::Markup.renderer('README.md').name - assert_equal "redcloth", GitHub::Markup.renderer('README.textile').name - assert_equal "rdoc", GitHub::Markup.renderer('README.rdoc').name - assert_equal "org-ruby", GitHub::Markup.renderer('README.org').name - assert_equal "creole", GitHub::Markup.renderer('README.creole').name - assert_equal "wikicloth", GitHub::Markup.renderer('README.wiki').name - assert_equal "asciidoctor", GitHub::Markup.renderer('README.adoc').name - assert_equal "restructuredtext", GitHub::Markup.renderer('README.rst').name - assert_equal "pod", GitHub::Markup.renderer('README.pod').name + assert_equal "markdown", GitHub::Markup.renderer('README.md', '=== Title').name + assert_equal "redcloth", GitHub::Markup.renderer('README.textile', '* One').name + assert_equal "rdoc", GitHub::Markup.renderer('README.rdoc', '* One').name + assert_equal "org-ruby", GitHub::Markup.renderer('README.org', '* Title').name + assert_equal "creole", GitHub::Markup.renderer('README.creole', '= Title =').name + assert_equal "wikicloth", GitHub::Markup.renderer('README.wiki', '

      Title

      ').name + assert_equal "asciidoctor", GitHub::Markup.renderer('README.adoc', '== Title').name + assert_equal "restructuredtext", GitHub::Markup.renderer('README.rst', 'Title').name + assert_equal "pod", GitHub::Markup.renderer('README.pod', '=begin').name end def test_rendering_by_symbol @@ -102,10 +102,10 @@ def test_rendering_by_symbol end def test_raises_error_if_command_exits_non_zero - GitHub::Markup.command(:doesntmatter, 'test/fixtures/fail.sh', /fail/, 'fail') - assert GitHub::Markup.can_render?('README.fail') + GitHub::Markup.command(:doesntmatter, 'test/fixtures/fail.sh', [Linguist::Language['Java']], 'fail') + assert GitHub::Markup.can_render?('README.java', 'stop swallowing errors') begin - GitHub::Markup.render('README.fail', "stop swallowing errors") + GitHub::Markup.render('README.java', "stop swallowing errors") rescue GitHub::Markup::CommandError => e assert_equal "failure message", e.message else From 75578714e1242aa3660dd052cb430923a4078d65 Mon Sep 17 00:00:00 2001 From: Serguei Okladnikov Date: Thu, 16 Mar 2017 13:11:18 +0400 Subject: [PATCH 249/416] return error code to shell --- bin/github-markup | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/github-markup b/bin/github-markup index 17ac1cab..0d442bb2 100755 --- a/bin/github-markup +++ b/bin/github-markup @@ -5,7 +5,7 @@ require 'github/markup' if ARGV.size < 1 print "usage: #$0 FILE [ FILES ... ]\n" - exit + exit 1 end sources = [] @@ -15,13 +15,13 @@ ARGV.each { |s| file = File.open( s, "r" ) sources.push [ s, file ] rescue Exception => e - print "error: #{e.message}\n" + $stderr.print "error: #{e.message}\n" + exit 1 ensure end } -sources.each { |s| - name,file = s +sources.each { |name, file| print GitHub::Markup.render( name, file.read ) file.close } From 60293d9edbfc1014d29f98ebb42a6ba749d30770 Mon Sep 17 00:00:00 2001 From: Kannan Goundan Date: Thu, 16 Mar 2017 21:37:55 -0700 Subject: [PATCH 250/416] bin/github-markup: Follow symlinks to find installation folder. --- bin/github-markup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/github-markup b/bin/github-markup index 76e5e369..829b3413 100755 --- a/bin/github-markup +++ b/bin/github-markup @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -$LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib" +$LOAD_PATH.unshift File.dirname(File.realpath(__FILE__)) + "/../lib" require 'github/markup' if ARGV[0] && File.exists?(file = ARGV[0]) From 93853fc269fb17dbb8d5b3931c672648182d7cf6 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Fri, 17 Mar 2017 11:48:52 +0100 Subject: [PATCH 251/416] Bump to 1.4.5 --- lib/github-markup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index cfcff229..e19f743f 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.4.4' + VERSION = '1.4.5' Version = VERSION end end From 28710c27d1a07bde43dd5c97119655d5d9a0f157 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Mon, 20 Mar 2017 14:20:35 +1100 Subject: [PATCH 252/416] Allow empty blobs in Linguist --- Gemfile | 2 +- lib/github/markup.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 0482a419..836667ba 100644 --- a/Gemfile +++ b/Gemfile @@ -12,4 +12,4 @@ gem "wikicloth", "=0.8.3" gem "asciidoctor", "= 1.5.2" gem "rake" gem "rinku", '~> 1' -gem "github-linguist", ">= 4.7.5" +gem "github-linguist", ">= 5.0.7" diff --git a/lib/github/markup.rb b/lib/github/markup.rb index c5a6ad84..712ef7c7 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -86,7 +86,7 @@ def renderer(filename, content) def language(filename, content) blob = Linguist::Blob.new(filename, content) - return Linguist.detect(blob) + return Linguist.detect(blob, allow_empty: true) end # Define markups From 7c2096e5f09c2b4ff27a028e351c2a786e2d3c8f Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Mon, 20 Mar 2017 14:20:47 +1100 Subject: [PATCH 253/416] :gem: bump to 1.4.6 --- lib/github-markup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index e19f743f..24bc80ab 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.4.5' + VERSION = '1.4.6' Version = VERSION end end From 5685837fbddb60d6b7a5ed8870add3d5fabe16e9 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Mon, 20 Mar 2017 18:06:25 +1100 Subject: [PATCH 254/416] Fix CONTRIBUTING.md link --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0236a554..8daf522d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,7 @@ # Contributing This project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to honor this code. + [code-of-conduct]: http://todogroup.org/opencodeofconduct/#GitHub%20Markup/opensource@github.com This library's only job is to decide which markup format to use and call out to an external library to convert the markup to HTML (see the [README](README.md) for more information on how markup is rendered on GitHub.com). From 40023768d4d8ca719da3637857a435733ae53f61 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Tue, 21 Mar 2017 10:16:08 +1100 Subject: [PATCH 255/416] Fix up Gemfile/gemspec --- Gemfile | 2 -- github-markup.gemspec | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 836667ba..29454c5c 100644 --- a/Gemfile +++ b/Gemfile @@ -11,5 +11,3 @@ gem "creole", "~>0.3.6" gem "wikicloth", "=0.8.3" gem "asciidoctor", "= 1.5.2" gem "rake" -gem "rinku", '~> 1' -gem "github-linguist", ">= 5.0.7" diff --git a/github-markup.gemspec b/github-markup.gemspec index a906474f..f52621ff 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,10 +16,13 @@ Gem::Specification.new do |s| s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = %w[lib] + s.add_dependency "github-linguist", "~> 5.0", ">= 5.0.7" + s.add_dependency "rinku", '~> 1' + s.add_development_dependency 'rake', '~> 12' s.add_development_dependency 'activesupport', '~> 4.0' - s.add_development_dependency 'minitest', '~> 5.4.3' + s.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3' s.add_development_dependency 'html-pipeline', '~> 1.0' - s.add_development_dependency 'sanitize', '~> 2.1.0' - s.add_development_dependency 'nokogiri', '~> 1.6.1' + s.add_development_dependency 'sanitize', '~> 2.1', '>= 2.1.0' + s.add_development_dependency 'nokogiri', '~> 1.6', '>= 1.6.1' s.add_development_dependency 'nokogiri-diff', '~> 0.2.0' end From c3aa7582da42506b1323009618c16ad8095f8977 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Tue, 21 Mar 2017 10:21:23 +1100 Subject: [PATCH 256/416] Switch Markdown dependency to commonmarker --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 29454c5c..1079130d 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ gemspec gem "posix-spawn", :platforms => :ruby gem "redcarpet", :platforms => :ruby gem "kramdown", :platforms => :jruby -gem "RedCloth" +gem "commonmarker", "~> 0.14.9" gem "rdoc", "~>3.6" gem "org-ruby", "= 0.9.9" gem "creole", "~>0.3.6" From c7b5e1405234ad0e2b07fed00b3bf92ae46d7bf6 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Tue, 21 Mar 2017 10:23:43 +1100 Subject: [PATCH 257/416] Update README.md --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index dee00b31..6c60a7ea 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,13 @@ GitHub Markup This library is the first step of a journey that every markup file in a repository goes on before it is rendered on GitHub.com: -0. This library converts the raw markup to HTML. See the list of [supported markup formats](#markups) below. -0. The HTML is sanitized, aggressively removing things that could harm you and your kin—such as `script` tags, inline-styles, and `class` or `id` attributes. See the [sanitization filter](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/sanitization_filter.rb) for the full whitelist. -0. Syntax highlighting is performed on code blocks. See [github/linguist](https://github.com/github/linguist#syntax-highlighting) for more information about syntax highlighting. -0. The HTML is passed through other filters in the [html-pipeline](https://github.com/jch/html-pipeline) that add special sauce, such as [emoji](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/emoji_filter.rb), [task lists](https://github.com/github/task_list/blob/master/lib/task_list/filter.rb), [named anchors](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/toc_filter.rb), [CDN caching for images](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/camo_filter.rb), and [autolinking](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/autolink_filter.rb). -0. The resulting HTML is rendered on GitHub.com. +1. This library converts the raw markup to HTML. See the list of [supported markup formats](#markups) below. +1. The HTML is sanitized, aggressively removing things that could harm you and your kin—such as `script` tags, inline-styles, and `class` or `id` attributes. See the [sanitization filter](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/sanitization_filter.rb) for the full whitelist. +1. Syntax highlighting is performed on code blocks. See [github/linguist](https://github.com/github/linguist#syntax-highlighting) for more information about syntax highlighting. +1. The HTML is passed through other filters in the [html-pipeline](https://github.com/jch/html-pipeline) that add special sauce, such as [emoji](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/emoji_filter.rb), [task lists](https://github.com/github/task_list/blob/master/lib/task_list/filter.rb), [named anchors](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/toc_filter.rb), [CDN caching for images](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/camo_filter.rb), and [autolinking](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/autolink_filter.rb). +1. The resulting HTML is rendered on GitHub.com. + +Please note that **only the first step** is covered by this gem — the rest happens on GitHub.com. In particular, `markup` itself does no sanitization of the resulting HTML, as it expects that to be covered by whatever pipeline is consuming the HTML. Please see our [contributing guidelines](CONTRIBUTING.md) before reporting an issue. @@ -17,7 +19,7 @@ Markups The following markups are supported. The dependencies listed are required if you wish to run the library. You can also run `script/bootstrap` to fetch them all. -* [.markdown, .mdown, .mkdn, .md](http://daringfireball.net/projects/markdown/) -- `gem install redcarpet` (https://github.com/vmg/redcarpet) +* [.markdown, .mdown, .mkdn, .md](http://daringfireball.net/projects/markdown/) -- `gem install commonmarker` (https://github.com/gjtorikian/commonmarker) * [.textile](http://www.textism.com/tools/textile/) -- `gem install RedCloth` * [.rdoc](https://rdoc.github.io/rdoc/) -- `gem install rdoc -v 3.6.1` * [.org](http://orgmode.org/) -- `gem install org-ruby` @@ -67,4 +69,4 @@ GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, '* One\n* Two') Contributing ------------ -See [Contributing](CONTRIBUTING.md) +See [Contributing](CONTRIBUTING.md). From b373ed5aba229fae41160e2daf63b2e008136322 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Tue, 21 Mar 2017 18:41:34 +1100 Subject: [PATCH 258/416] :gem: bump to 1.4.7 --- lib/github-markup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 24bc80ab..85d9a346 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.4.6' + VERSION = '1.4.7' Version = VERSION end end From cc638bd23b3df66a4390e393afb9b6d769d8ff9a Mon Sep 17 00:00:00 2001 From: Dan Book Date: Tue, 21 Mar 2017 23:54:54 -0400 Subject: [PATCH 259/416] Link directly to pod pages on metacpan --- lib/github/commands/pod2html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github/commands/pod2html b/lib/github/commands/pod2html index 538da8f8..faf46e4a 100755 --- a/lib/github/commands/pod2html +++ b/lib/github/commands/pod2html @@ -6,7 +6,7 @@ use Pod::Simple::XHTML 3.11; my $p = Pod::Simple::XHTML->new; $p->html_header(''); $p->html_footer(''); -$p->perldoc_url_prefix('http://metacpan.org/search?q='); +$p->perldoc_url_prefix('https://metacpan.org/pod/'); $p->strip_verbatim_indent(sub { my $lines = shift; (my $indent = $lines->[0]) =~ s/\S.*//; From f36ba9ff0e91a6dae8ddcaf0184c3277e7cefe8d Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Wed, 22 Mar 2017 15:04:51 +1100 Subject: [PATCH 260/416] Try some fixes for Travis --- .travis.yml | 3 +++ github-markup.gemspec | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bced84b0..39f45602 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,9 @@ git: depth: 10 before_install: - sudo apt-get install perl + - sudo add-apt-repository --yes ppa:kalakris/cmake + - sudo apt-get update -qq + - sudo apt-get install cmake - curl -L http://cpanmin.us | perl - --sudo App::cpanminus - sudo cpanm --installdeps --notest Pod::Simple - sudo pip install docutils diff --git a/github-markup.gemspec b/github-markup.gemspec index f52621ff..ca9263da 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -23,6 +23,6 @@ Gem::Specification.new do |s| s.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3' s.add_development_dependency 'html-pipeline', '~> 1.0' s.add_development_dependency 'sanitize', '~> 2.1', '>= 2.1.0' - s.add_development_dependency 'nokogiri', '~> 1.6', '>= 1.6.1' + s.add_development_dependency 'nokogiri', '~> 1.6' s.add_development_dependency 'nokogiri-diff', '~> 0.2.0' end From 585dba5a6d5460ca40631814d6632a70ea86d83c Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Wed, 22 Mar 2017 15:10:30 +1100 Subject: [PATCH 261/416] Be really specific about Nokogiri --- github-markup.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index ca9263da..0990bb3f 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -23,6 +23,6 @@ Gem::Specification.new do |s| s.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3' s.add_development_dependency 'html-pipeline', '~> 1.0' s.add_development_dependency 'sanitize', '~> 2.1', '>= 2.1.0' - s.add_development_dependency 'nokogiri', '~> 1.6' + s.add_development_dependency 'nokogiri', '1.6.8.1' s.add_development_dependency 'nokogiri-diff', '~> 0.2.0' end From b0a461ea7dd6412b3939521b683da7d26282b8d9 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Wed, 22 Mar 2017 15:11:34 +1100 Subject: [PATCH 262/416] RedCloth back into GemFile for textile --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index 1079130d..01010778 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,7 @@ gemspec gem "posix-spawn", :platforms => :ruby gem "redcarpet", :platforms => :ruby gem "kramdown", :platforms => :jruby +gem "RedCloth" gem "commonmarker", "~> 0.14.9" gem "rdoc", "~>3.6" gem "org-ruby", "= 0.9.9" From e6f1ce6b4c85c898bc85d9979a055d3b86995ddc Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Wed, 22 Mar 2017 15:14:20 +1100 Subject: [PATCH 263/416] Fix litcoffee test fixture --- test/markups/README.litcoffee.html | 41 +++++++++++------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/test/markups/README.litcoffee.html b/test/markups/README.litcoffee.html index 5caa8780..51ffe528 100644 --- a/test/markups/README.litcoffee.html +++ b/test/markups/README.litcoffee.html @@ -1,43 +1,28 @@

      Literate CoffeeScript Test

      -
      -

      Taken from https://github.com/jashkenas/coffee-script/blob/master/test/literate.litcoffee

      +

      Taken from https://github.com/jashkenas/coffee-script/blob/master/test/literate.litcoffee

      -

      comment comment

      -
      test "basic literate CoffeeScript parsing", ->
         ok yes
       
      -

      now with a...

      -
      test "broken up indentation", ->
       
      -

      ... broken up ...

      -
        do ->
       
      -

      ... nested block.

      -
          ok yes
       
      -

      Code must be separated from text by a blank line.

      -
      test "code blocks must be preceded by a blank line", ->
       
      -

      The next line is part of the text and will not be executed. - fail()

      - +fail()

        ok yes
       
      -

      Code in backticks is not parsed and...

      -
      test "comments in indented blocks work", ->
         do ->
           do ->
      @@ -49,18 +34,22 @@ 

      Literate CoffeeScript Test

      ok yes
      -

      Regular Markdown features, like links and unordered lists, are fine:

      -
        -
      • I

      • -
      • Am

      • -
      • A

      • -
      • List

      • +
      • +

        I

        +
      • +
      • +

        Am

        +
      • +
      • +

        A

        +
      • +
      • +

        List

        +
      -

      Tabs work too:

      -

      test "tabbed code", -> - ok yes

      \ No newline at end of file +ok yes

      From 4ed5a130f405a4217ff6bc3ef47555a582dac0c5 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Wed, 22 Mar 2017 16:33:11 +1100 Subject: [PATCH 264/416] Use :GITHUB_PRE_LANG --- Gemfile | 2 +- lib/github/markup/markdown.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 01010778..d057e0e4 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ gem "posix-spawn", :platforms => :ruby gem "redcarpet", :platforms => :ruby gem "kramdown", :platforms => :jruby gem "RedCloth" -gem "commonmarker", "~> 0.14.9" +gem "commonmarker", "~> 0.14.12" gem "rdoc", "~>3.6" gem "org-ruby", "= 0.9.9" gem "creole", "~>0.3.6" diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index 6d2607ee..0d8555c3 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -5,7 +5,7 @@ module Markup class Markdown < Implementation MARKDOWN_GEMS = { "commonmarker" => proc { |content| - CommonMarker.render_html(content, :DEFAULT, [:tagfilter, :autolink, :table, :strikethrough]) + CommonMarker.render_html(content, :GITHUB_PRE_LANG, [:tagfilter, :autolink, :table, :strikethrough]) }, "github/markdown" => proc { |content| GitHub::Markdown.render(content) From 64b676bc6ed43f2fef09601dee9ecaf1e2f3ab81 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Wed, 22 Mar 2017 16:40:25 +1100 Subject: [PATCH 265/416] Fix dependencies --- github-markup.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index 0990bb3f..ebec6a19 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,8 +16,8 @@ Gem::Specification.new do |s| s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = %w[lib] - s.add_dependency "github-linguist", "~> 5.0", ">= 5.0.7" - s.add_dependency "rinku", '~> 1' + s.add_dependency "github-linguist", "~> 5.0", ">= 5.0.8" + s.add_dependency "rinku" s.add_development_dependency 'rake', '~> 12' s.add_development_dependency 'activesupport', '~> 4.0' s.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3' From db774f6441f8ae5c80da41725aa4ddcc5653cd0c Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Wed, 22 Mar 2017 16:34:04 +1100 Subject: [PATCH 266/416] :gem: bump for 1.4.8 --- lib/github-markup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 85d9a346..196c838a 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.4.7' + VERSION = '1.4.8' Version = VERSION end end From ec0eb75ae13755cae9e655770e592959d800a6a1 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Thu, 23 Mar 2017 12:02:45 +1100 Subject: [PATCH 267/416] Update Textile link, fixes #590 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6c60a7ea..059109b1 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The following markups are supported. The dependencies listed are required if you wish to run the library. You can also run `script/bootstrap` to fetch them all. * [.markdown, .mdown, .mkdn, .md](http://daringfireball.net/projects/markdown/) -- `gem install commonmarker` (https://github.com/gjtorikian/commonmarker) -* [.textile](http://www.textism.com/tools/textile/) -- `gem install RedCloth` +* [.textile](https://www.promptworks.com/textile) -- `gem install RedCloth` * [.rdoc](https://rdoc.github.io/rdoc/) -- `gem install rdoc -v 3.6.1` * [.org](http://orgmode.org/) -- `gem install org-ruby` * [.creole](http://wikicreole.org/) -- `gem install creole` From bbee330095529e0a428b42b01a68fbefed89c7e8 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Mon, 27 Mar 2017 13:06:57 +1100 Subject: [PATCH 268/416] Revert #537 temporarily for final 1.4 release --- github-markup.gemspec | 1 - lib/github/markup.rb | 26 ++++++--------- lib/github/markup/command_implementation.rb | 4 +-- lib/github/markup/gem_implementation.rb | 4 +-- lib/github/markup/implementation.rb | 15 ++++++--- lib/github/markup/markdown.rb | 2 +- lib/github/markup/rdoc.rb | 2 +- lib/github/markups.rb | 15 ++++----- test/markup_test.rb | 36 ++++++++++----------- 9 files changed, 51 insertions(+), 54 deletions(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index ebec6a19..6320a489 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,7 +16,6 @@ Gem::Specification.new do |s| s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = %w[lib] - s.add_dependency "github-linguist", "~> 5.0", ">= 5.0.8" s.add_dependency "rinku" s.add_development_dependency 'rake', '~> 12' s.add_development_dependency 'activesupport', '~> 4.0' diff --git a/lib/github/markup.rb b/lib/github/markup.rb index 712ef7c7..ddc7312f 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -37,7 +37,7 @@ def preload! def render(filename, content = nil) content ||= File.read(filename) - if impl = renderer(filename, content) + if impl = renderer(filename) impl.render(content) else content @@ -53,9 +53,9 @@ def render_s(symbol, content) content end end - - def markup(symbol, gem_name, pattern, opts = {}, &block) - markup_impl(symbol, GemImplementation.new(pattern, gem_name, &block)) + + def markup(symbol, file, pattern, opts = {}, &block) + markup_impl(symbol, GemImplementation.new(pattern, file, &block)) end def markup_impl(symbol, impl) @@ -65,30 +65,24 @@ def markup_impl(symbol, impl) markups[symbol] = impl end - def command(symbol, command, languages, name, &block) + def command(symbol, command, regexp, name, &block) if File.exist?(file = File.dirname(__FILE__) + "/commands/#{command}") command = file end - markup_impl(symbol, CommandImplementation.new(languages, command, name, &block)) + markup_impl(symbol, CommandImplementation.new(regexp, command, name, &block)) end - def can_render?(filename, content) - !!renderer(filename, content) + def can_render?(filename) + !!renderer(filename) end - def renderer(filename, content) - language = language(filename, content) + def renderer(filename) markup_impls.find { |impl| - impl.match?(language) + impl.match?(filename) } end - def language(filename, content) - blob = Linguist::Blob.new(filename, content) - return Linguist.detect(blob, allow_empty: true) - end - # Define markups markups_rb = File.dirname(__FILE__) + '/markups.rb' instance_eval File.read(markups_rb), markups_rb diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index d0f2fc47..be3f6b46 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -15,8 +15,8 @@ class CommandError < RuntimeError class CommandImplementation < Implementation attr_reader :command, :block, :name - def initialize(languages, command, name, &block) - super languages + def initialize(regexp, command, name, &block) + super regexp @command = command.to_s @block = block @name = name diff --git a/lib/github/markup/gem_implementation.rb b/lib/github/markup/gem_implementation.rb index 08383f52..270f5a88 100644 --- a/lib/github/markup/gem_implementation.rb +++ b/lib/github/markup/gem_implementation.rb @@ -5,8 +5,8 @@ module Markup class GemImplementation < Implementation attr_reader :gem_name, :renderer - def initialize(languages, gem_name, &renderer) - super languages + def initialize(regexp, gem_name, &renderer) + super regexp @gem_name = gem_name.to_s @renderer = renderer end diff --git a/lib/github/markup/implementation.rb b/lib/github/markup/implementation.rb index 46df1510..463a39d4 100644 --- a/lib/github/markup/implementation.rb +++ b/lib/github/markup/implementation.rb @@ -1,10 +1,10 @@ module GitHub module Markup class Implementation - attr_reader :languages + attr_reader :regexp - def initialize(languages) - @languages = languages + def initialize(regexp) + @regexp = regexp end def load @@ -15,8 +15,13 @@ def render(content) raise NotImplementedError, "subclasses of GitHub::Markup::Implementation must define #render" end - def match?(language) - languages.include? language + def match?(filename) + file_ext_regexp =~ filename + end + + private + def file_ext_regexp + @file_ext_regexp ||= /\.(#{regexp})\z/ end end end diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index 0d8555c3..e3a9b77c 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -28,7 +28,7 @@ class Markdown < Implementation } def initialize - super([Linguist::Language["Markdown"], Linguist::Language["RMarkdown"], Linguist::Language["Literate CoffeeScript"]]) + super(/md|rmd|mkdn?|mdwn|mdown|markdown|litcoffee/i) end def load diff --git a/lib/github/markup/rdoc.rb b/lib/github/markup/rdoc.rb index e96ddf07..bc008cb4 100644 --- a/lib/github/markup/rdoc.rb +++ b/lib/github/markup/rdoc.rb @@ -6,7 +6,7 @@ module GitHub module Markup class RDoc < Implementation def initialize - super([Linguist::Language["RDoc"]]) + super(/rdoc/) end def render(content) diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 24ecaffa..e951fb16 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -1,34 +1,33 @@ require "github/markup/markdown" require "github/markup/rdoc" require "shellwords" -require "linguist" markup_impl(::GitHub::Markups::MARKUP_MARKDOWN, ::GitHub::Markup::Markdown.new) -markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, [Linguist::Language["Textile"]]) do |content| +markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, /textile/) do |content| RedCloth.new(content).to_html end markup_impl(::GitHub::Markups::MARKUP_RDOC, GitHub::Markup::RDoc.new) -markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', [Linguist::Language["Org"]]) do |content| +markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', /org/) do |content| Orgmode::Parser.new(content, { :allow_include_files => false, :skip_syntax_highlight => true }).to_html end -markup(::GitHub::Markups::MARKUP_CREOLE, :creole, [Linguist::Language["Creole"]]) do |content| +markup(::GitHub::Markups::MARKUP_CREOLE, :creole, /creole/) do |content| Creole.creolize(content) end -markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, [Linguist::Language["MediaWiki"]]) do |content| +markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, /mediawiki|wiki/) do |content| wikicloth = WikiCloth::WikiCloth.new(:data => content) WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS << 'tt' unless WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS.include?('tt') wikicloth.to_html(:noedit => true) end -markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, [Linguist::Language["AsciiDoc"]]) do |content| +markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/) do |content| Asciidoctor::Compliance.unique_id_start_index = 1 Asciidoctor.convert(content, :safe => :secure, :attributes => %w(showtitle=@ idprefix idseparator=- env=github env-github source-highlighter=html-pipeline)) end @@ -36,8 +35,8 @@ command( ::GitHub::Markups::MARKUP_RST, "python2 -S #{Shellwords.escape(File.dirname(__FILE__))}/commands/rest2html", - [Linguist::Language["reStructuredText"]], + /re?st(\.txt)?/, "restructuredtext" ) -command(::GitHub::Markups::MARKUP_POD, :pod2html, [Linguist::Language["Pod"]], "pod") +command(::GitHub::Markups::MARKUP_POD, :pod2html, /pod/, "pod") diff --git a/test/markup_test.rb b/test/markup_test.rb index 6c8365d4..d0b6d09a 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -77,24 +77,24 @@ def call end def test_knows_what_it_can_and_cannot_render - assert_equal false, GitHub::Markup.can_render?('README.html', '

      Title

      ') - assert_equal true, GitHub::Markup.can_render?('README.markdown', '=== Title') - assert_equal true, GitHub::Markup.can_render?('README.rmd', '=== Title') - assert_equal true, GitHub::Markup.can_render?('README.Rmd', '=== Title') - assert_equal false, GitHub::Markup.can_render?('README.cmd', 'echo 1') - assert_equal true, GitHub::Markup.can_render?('README.litcoffee', 'Title') + assert_equal false, GitHub::Markup.can_render?('README.html') + assert_equal true, GitHub::Markup.can_render?('README.markdown') + assert_equal true, GitHub::Markup.can_render?('README.rmd') + assert_equal true, GitHub::Markup.can_render?('README.Rmd') + assert_equal false, GitHub::Markup.can_render?('README.cmd') + assert_equal true, GitHub::Markup.can_render?('README.litcoffee') end def test_each_render_has_a_name - assert_equal "markdown", GitHub::Markup.renderer('README.md', '=== Title').name - assert_equal "redcloth", GitHub::Markup.renderer('README.textile', '* One').name - assert_equal "rdoc", GitHub::Markup.renderer('README.rdoc', '* One').name - assert_equal "org-ruby", GitHub::Markup.renderer('README.org', '* Title').name - assert_equal "creole", GitHub::Markup.renderer('README.creole', '= Title =').name - assert_equal "wikicloth", GitHub::Markup.renderer('README.wiki', '

      Title

      ').name - assert_equal "asciidoctor", GitHub::Markup.renderer('README.adoc', '== Title').name - assert_equal "restructuredtext", GitHub::Markup.renderer('README.rst', 'Title').name - assert_equal "pod", GitHub::Markup.renderer('README.pod', '=begin').name + assert_equal "markdown", GitHub::Markup.renderer('README.md').name + assert_equal "redcloth", GitHub::Markup.renderer('README.textile').name + assert_equal "rdoc", GitHub::Markup.renderer('README.rdoc').name + assert_equal "org-ruby", GitHub::Markup.renderer('README.org').name + assert_equal "creole", GitHub::Markup.renderer('README.creole').name + assert_equal "wikicloth", GitHub::Markup.renderer('README.wiki').name + assert_equal "asciidoctor", GitHub::Markup.renderer('README.adoc').name + assert_equal "restructuredtext", GitHub::Markup.renderer('README.rst').name + assert_equal "pod", GitHub::Markup.renderer('README.pod').name end def test_rendering_by_symbol @@ -102,10 +102,10 @@ def test_rendering_by_symbol end def test_raises_error_if_command_exits_non_zero - GitHub::Markup.command(:doesntmatter, 'test/fixtures/fail.sh', [Linguist::Language['Java']], 'fail') - assert GitHub::Markup.can_render?('README.java', 'stop swallowing errors') + GitHub::Markup.command(:doesntmatter, 'test/fixtures/fail.sh', /fail/, 'fail') + assert GitHub::Markup.can_render?('README.fail') begin - GitHub::Markup.render('README.java', "stop swallowing errors") + GitHub::Markup.render('README.fail', "stop swallowing errors") rescue GitHub::Markup::CommandError => e assert_equal "failure message", e.message else From 3087f06280a52362a2258c8e509c5da06a2b826c Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Mon, 27 Mar 2017 13:07:17 +1100 Subject: [PATCH 269/416] :gem: bump for 1.4.9 --- lib/github-markup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 196c838a..fe275b43 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.4.8' + VERSION = '1.4.9' Version = VERSION end end From a970742bd4aaba60aa8b6b42609b9ebb38d15ca9 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Mon, 27 Mar 2017 13:09:05 +1100 Subject: [PATCH 270/416] Revert "Revert #537 temporarily for final 1.4 release" This reverts commit bbee330095529e0a428b42b01a68fbefed89c7e8. --- github-markup.gemspec | 1 + lib/github/markup.rb | 26 +++++++++------ lib/github/markup/command_implementation.rb | 4 +-- lib/github/markup/gem_implementation.rb | 4 +-- lib/github/markup/implementation.rb | 15 +++------ lib/github/markup/markdown.rb | 2 +- lib/github/markup/rdoc.rb | 2 +- lib/github/markups.rb | 15 +++++---- test/markup_test.rb | 36 ++++++++++----------- 9 files changed, 54 insertions(+), 51 deletions(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index 6320a489..ebec6a19 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,6 +16,7 @@ Gem::Specification.new do |s| s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = %w[lib] + s.add_dependency "github-linguist", "~> 5.0", ">= 5.0.8" s.add_dependency "rinku" s.add_development_dependency 'rake', '~> 12' s.add_development_dependency 'activesupport', '~> 4.0' diff --git a/lib/github/markup.rb b/lib/github/markup.rb index ddc7312f..712ef7c7 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -37,7 +37,7 @@ def preload! def render(filename, content = nil) content ||= File.read(filename) - if impl = renderer(filename) + if impl = renderer(filename, content) impl.render(content) else content @@ -53,9 +53,9 @@ def render_s(symbol, content) content end end - - def markup(symbol, file, pattern, opts = {}, &block) - markup_impl(symbol, GemImplementation.new(pattern, file, &block)) + + def markup(symbol, gem_name, pattern, opts = {}, &block) + markup_impl(symbol, GemImplementation.new(pattern, gem_name, &block)) end def markup_impl(symbol, impl) @@ -65,24 +65,30 @@ def markup_impl(symbol, impl) markups[symbol] = impl end - def command(symbol, command, regexp, name, &block) + def command(symbol, command, languages, name, &block) if File.exist?(file = File.dirname(__FILE__) + "/commands/#{command}") command = file end - markup_impl(symbol, CommandImplementation.new(regexp, command, name, &block)) + markup_impl(symbol, CommandImplementation.new(languages, command, name, &block)) end - def can_render?(filename) - !!renderer(filename) + def can_render?(filename, content) + !!renderer(filename, content) end - def renderer(filename) + def renderer(filename, content) + language = language(filename, content) markup_impls.find { |impl| - impl.match?(filename) + impl.match?(language) } end + def language(filename, content) + blob = Linguist::Blob.new(filename, content) + return Linguist.detect(blob, allow_empty: true) + end + # Define markups markups_rb = File.dirname(__FILE__) + '/markups.rb' instance_eval File.read(markups_rb), markups_rb diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index be3f6b46..d0f2fc47 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -15,8 +15,8 @@ class CommandError < RuntimeError class CommandImplementation < Implementation attr_reader :command, :block, :name - def initialize(regexp, command, name, &block) - super regexp + def initialize(languages, command, name, &block) + super languages @command = command.to_s @block = block @name = name diff --git a/lib/github/markup/gem_implementation.rb b/lib/github/markup/gem_implementation.rb index 270f5a88..08383f52 100644 --- a/lib/github/markup/gem_implementation.rb +++ b/lib/github/markup/gem_implementation.rb @@ -5,8 +5,8 @@ module Markup class GemImplementation < Implementation attr_reader :gem_name, :renderer - def initialize(regexp, gem_name, &renderer) - super regexp + def initialize(languages, gem_name, &renderer) + super languages @gem_name = gem_name.to_s @renderer = renderer end diff --git a/lib/github/markup/implementation.rb b/lib/github/markup/implementation.rb index 463a39d4..46df1510 100644 --- a/lib/github/markup/implementation.rb +++ b/lib/github/markup/implementation.rb @@ -1,10 +1,10 @@ module GitHub module Markup class Implementation - attr_reader :regexp + attr_reader :languages - def initialize(regexp) - @regexp = regexp + def initialize(languages) + @languages = languages end def load @@ -15,13 +15,8 @@ def render(content) raise NotImplementedError, "subclasses of GitHub::Markup::Implementation must define #render" end - def match?(filename) - file_ext_regexp =~ filename - end - - private - def file_ext_regexp - @file_ext_regexp ||= /\.(#{regexp})\z/ + def match?(language) + languages.include? language end end end diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index e3a9b77c..0d8555c3 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -28,7 +28,7 @@ class Markdown < Implementation } def initialize - super(/md|rmd|mkdn?|mdwn|mdown|markdown|litcoffee/i) + super([Linguist::Language["Markdown"], Linguist::Language["RMarkdown"], Linguist::Language["Literate CoffeeScript"]]) end def load diff --git a/lib/github/markup/rdoc.rb b/lib/github/markup/rdoc.rb index bc008cb4..e96ddf07 100644 --- a/lib/github/markup/rdoc.rb +++ b/lib/github/markup/rdoc.rb @@ -6,7 +6,7 @@ module GitHub module Markup class RDoc < Implementation def initialize - super(/rdoc/) + super([Linguist::Language["RDoc"]]) end def render(content) diff --git a/lib/github/markups.rb b/lib/github/markups.rb index e951fb16..24ecaffa 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -1,33 +1,34 @@ require "github/markup/markdown" require "github/markup/rdoc" require "shellwords" +require "linguist" markup_impl(::GitHub::Markups::MARKUP_MARKDOWN, ::GitHub::Markup::Markdown.new) -markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, /textile/) do |content| +markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, [Linguist::Language["Textile"]]) do |content| RedCloth.new(content).to_html end markup_impl(::GitHub::Markups::MARKUP_RDOC, GitHub::Markup::RDoc.new) -markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', /org/) do |content| +markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', [Linguist::Language["Org"]]) do |content| Orgmode::Parser.new(content, { :allow_include_files => false, :skip_syntax_highlight => true }).to_html end -markup(::GitHub::Markups::MARKUP_CREOLE, :creole, /creole/) do |content| +markup(::GitHub::Markups::MARKUP_CREOLE, :creole, [Linguist::Language["Creole"]]) do |content| Creole.creolize(content) end -markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, /mediawiki|wiki/) do |content| +markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, [Linguist::Language["MediaWiki"]]) do |content| wikicloth = WikiCloth::WikiCloth.new(:data => content) WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS << 'tt' unless WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS.include?('tt') wikicloth.to_html(:noedit => true) end -markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/) do |content| +markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, [Linguist::Language["AsciiDoc"]]) do |content| Asciidoctor::Compliance.unique_id_start_index = 1 Asciidoctor.convert(content, :safe => :secure, :attributes => %w(showtitle=@ idprefix idseparator=- env=github env-github source-highlighter=html-pipeline)) end @@ -35,8 +36,8 @@ command( ::GitHub::Markups::MARKUP_RST, "python2 -S #{Shellwords.escape(File.dirname(__FILE__))}/commands/rest2html", - /re?st(\.txt)?/, + [Linguist::Language["reStructuredText"]], "restructuredtext" ) -command(::GitHub::Markups::MARKUP_POD, :pod2html, /pod/, "pod") +command(::GitHub::Markups::MARKUP_POD, :pod2html, [Linguist::Language["Pod"]], "pod") diff --git a/test/markup_test.rb b/test/markup_test.rb index d0b6d09a..6c8365d4 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -77,24 +77,24 @@ def call end def test_knows_what_it_can_and_cannot_render - assert_equal false, GitHub::Markup.can_render?('README.html') - assert_equal true, GitHub::Markup.can_render?('README.markdown') - assert_equal true, GitHub::Markup.can_render?('README.rmd') - assert_equal true, GitHub::Markup.can_render?('README.Rmd') - assert_equal false, GitHub::Markup.can_render?('README.cmd') - assert_equal true, GitHub::Markup.can_render?('README.litcoffee') + assert_equal false, GitHub::Markup.can_render?('README.html', '

      Title

      ') + assert_equal true, GitHub::Markup.can_render?('README.markdown', '=== Title') + assert_equal true, GitHub::Markup.can_render?('README.rmd', '=== Title') + assert_equal true, GitHub::Markup.can_render?('README.Rmd', '=== Title') + assert_equal false, GitHub::Markup.can_render?('README.cmd', 'echo 1') + assert_equal true, GitHub::Markup.can_render?('README.litcoffee', 'Title') end def test_each_render_has_a_name - assert_equal "markdown", GitHub::Markup.renderer('README.md').name - assert_equal "redcloth", GitHub::Markup.renderer('README.textile').name - assert_equal "rdoc", GitHub::Markup.renderer('README.rdoc').name - assert_equal "org-ruby", GitHub::Markup.renderer('README.org').name - assert_equal "creole", GitHub::Markup.renderer('README.creole').name - assert_equal "wikicloth", GitHub::Markup.renderer('README.wiki').name - assert_equal "asciidoctor", GitHub::Markup.renderer('README.adoc').name - assert_equal "restructuredtext", GitHub::Markup.renderer('README.rst').name - assert_equal "pod", GitHub::Markup.renderer('README.pod').name + assert_equal "markdown", GitHub::Markup.renderer('README.md', '=== Title').name + assert_equal "redcloth", GitHub::Markup.renderer('README.textile', '* One').name + assert_equal "rdoc", GitHub::Markup.renderer('README.rdoc', '* One').name + assert_equal "org-ruby", GitHub::Markup.renderer('README.org', '* Title').name + assert_equal "creole", GitHub::Markup.renderer('README.creole', '= Title =').name + assert_equal "wikicloth", GitHub::Markup.renderer('README.wiki', '

      Title

      ').name + assert_equal "asciidoctor", GitHub::Markup.renderer('README.adoc', '== Title').name + assert_equal "restructuredtext", GitHub::Markup.renderer('README.rst', 'Title').name + assert_equal "pod", GitHub::Markup.renderer('README.pod', '=begin').name end def test_rendering_by_symbol @@ -102,10 +102,10 @@ def test_rendering_by_symbol end def test_raises_error_if_command_exits_non_zero - GitHub::Markup.command(:doesntmatter, 'test/fixtures/fail.sh', /fail/, 'fail') - assert GitHub::Markup.can_render?('README.fail') + GitHub::Markup.command(:doesntmatter, 'test/fixtures/fail.sh', [Linguist::Language['Java']], 'fail') + assert GitHub::Markup.can_render?('README.java', 'stop swallowing errors') begin - GitHub::Markup.render('README.fail', "stop swallowing errors") + GitHub::Markup.render('README.java', "stop swallowing errors") rescue GitHub::Markup::CommandError => e assert_equal "failure message", e.message else From 665ab4d007ad0831098a269fe876a89995b88200 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Mon, 27 Mar 2017 13:09:28 +1100 Subject: [PATCH 271/416] Linguist optional; fallback to filenames --- github-markup.gemspec | 2 +- lib/github/markup.rb | 22 +++++++++++++------- lib/github/markup/command_implementation.rb | 4 ++-- lib/github/markup/gem_implementation.rb | 4 ++-- lib/github/markup/implementation.rb | 23 +++++++++++++++++---- lib/github/markup/markdown.rb | 4 +++- lib/github/markup/rdoc.rb | 2 +- lib/github/markups.rb | 16 +++++++------- test/markup_test.rb | 2 +- 9 files changed, 52 insertions(+), 27 deletions(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index ebec6a19..69e10b45 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,7 +16,6 @@ Gem::Specification.new do |s| s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = %w[lib] - s.add_dependency "github-linguist", "~> 5.0", ">= 5.0.8" s.add_dependency "rinku" s.add_development_dependency 'rake', '~> 12' s.add_development_dependency 'activesupport', '~> 4.0' @@ -25,4 +24,5 @@ Gem::Specification.new do |s| s.add_development_dependency 'sanitize', '~> 2.1', '>= 2.1.0' s.add_development_dependency 'nokogiri', '1.6.8.1' s.add_development_dependency 'nokogiri-diff', '~> 0.2.0' + s.add_development_dependency "github-linguist", "~> 5.0", ">= 5.0.8" end diff --git a/lib/github/markup.rb b/lib/github/markup.rb index 712ef7c7..f7befbe0 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -1,3 +1,9 @@ +begin + require "linguist" +rescue LoadError + # Rely on extensions instead. +end + require "github/markup/command_implementation" require "github/markup/gem_implementation" @@ -54,8 +60,8 @@ def render_s(symbol, content) end end - def markup(symbol, gem_name, pattern, opts = {}, &block) - markup_impl(symbol, GemImplementation.new(pattern, gem_name, &block)) + def markup(symbol, gem_name, regexp, languages, opts = {}, &block) + markup_impl(symbol, GemImplementation.new(regexp, languages, gem_name, &block)) end def markup_impl(symbol, impl) @@ -65,12 +71,12 @@ def markup_impl(symbol, impl) markups[symbol] = impl end - def command(symbol, command, languages, name, &block) + def command(symbol, command, regexp, languages, name, &block) if File.exist?(file = File.dirname(__FILE__) + "/commands/#{command}") command = file end - markup_impl(symbol, CommandImplementation.new(languages, command, name, &block)) + markup_impl(symbol, CommandImplementation.new(regexp, languages, command, name, &block)) end def can_render?(filename, content) @@ -80,13 +86,15 @@ def can_render?(filename, content) def renderer(filename, content) language = language(filename, content) markup_impls.find { |impl| - impl.match?(language) + impl.match?(filename, language) } end def language(filename, content) - blob = Linguist::Blob.new(filename, content) - return Linguist.detect(blob, allow_empty: true) + if defined?(::Linguist) + blob = Linguist::Blob.new(filename, content) + return Linguist.detect(blob, allow_empty: true) + end end # Define markups diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index d0f2fc47..439ed293 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -15,8 +15,8 @@ class CommandError < RuntimeError class CommandImplementation < Implementation attr_reader :command, :block, :name - def initialize(languages, command, name, &block) - super languages + def initialize(regexp, languages, command, name, &block) + super(regexp, languages) @command = command.to_s @block = block @name = name diff --git a/lib/github/markup/gem_implementation.rb b/lib/github/markup/gem_implementation.rb index 08383f52..1391de97 100644 --- a/lib/github/markup/gem_implementation.rb +++ b/lib/github/markup/gem_implementation.rb @@ -5,8 +5,8 @@ module Markup class GemImplementation < Implementation attr_reader :gem_name, :renderer - def initialize(languages, gem_name, &renderer) - super languages + def initialize(regexp, languages, gem_name, &renderer) + super(regexp, languages) @gem_name = gem_name.to_s @renderer = renderer end diff --git a/lib/github/markup/implementation.rb b/lib/github/markup/implementation.rb index 46df1510..fb31165b 100644 --- a/lib/github/markup/implementation.rb +++ b/lib/github/markup/implementation.rb @@ -1,10 +1,15 @@ module GitHub module Markup class Implementation + attr_reader :regexp attr_reader :languages - def initialize(languages) - @languages = languages + def initialize(regexp, languages) + @regexp = regexp + + if defined?(::Linguist) + @languages = languages.map {|l| Linguist::Language[l]} + end end def load @@ -15,8 +20,18 @@ def render(content) raise NotImplementedError, "subclasses of GitHub::Markup::Implementation must define #render" end - def match?(language) - languages.include? language + def match?(filename, language) + if defined?(::Linguist) + languages.include? language + else + file_ext_regexp =~ filename + end + end + + private + + def file_ext_regexp + @file_ext_regexp ||= /\.(#{regexp})\z/ end end end diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index 0d8555c3..0894fa03 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -28,7 +28,9 @@ class Markdown < Implementation } def initialize - super([Linguist::Language["Markdown"], Linguist::Language["RMarkdown"], Linguist::Language["Literate CoffeeScript"]]) + super( + /md|rmd|mkdn?|mdwn|mdown|markdown|litcoffee/i, + ["Markdown", "RMarkdown", "Literate CoffeeScript"]) end def load diff --git a/lib/github/markup/rdoc.rb b/lib/github/markup/rdoc.rb index e96ddf07..1064f24b 100644 --- a/lib/github/markup/rdoc.rb +++ b/lib/github/markup/rdoc.rb @@ -6,7 +6,7 @@ module GitHub module Markup class RDoc < Implementation def initialize - super([Linguist::Language["RDoc"]]) + super(/rdoc/, ["RDoc"]) end def render(content) diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 24ecaffa..538ee7d0 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -1,34 +1,33 @@ require "github/markup/markdown" require "github/markup/rdoc" require "shellwords" -require "linguist" markup_impl(::GitHub::Markups::MARKUP_MARKDOWN, ::GitHub::Markup::Markdown.new) -markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, [Linguist::Language["Textile"]]) do |content| +markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, /textile/, ["Textile"]) do |content| RedCloth.new(content).to_html end markup_impl(::GitHub::Markups::MARKUP_RDOC, GitHub::Markup::RDoc.new) -markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', [Linguist::Language["Org"]]) do |content| +markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', /org/, ["Org"]) do |content| Orgmode::Parser.new(content, { :allow_include_files => false, :skip_syntax_highlight => true }).to_html end -markup(::GitHub::Markups::MARKUP_CREOLE, :creole, [Linguist::Language["Creole"]]) do |content| +markup(::GitHub::Markups::MARKUP_CREOLE, :creole, /creole/, ["Creole"]) do |content| Creole.creolize(content) end -markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, [Linguist::Language["MediaWiki"]]) do |content| +markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, /mediawiki|wiki/, ["MediaWiki"]) do |content| wikicloth = WikiCloth::WikiCloth.new(:data => content) WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS << 'tt' unless WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS.include?('tt') wikicloth.to_html(:noedit => true) end -markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, [Linguist::Language["AsciiDoc"]]) do |content| +markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/, ["AsciiDoc"]) do |content| Asciidoctor::Compliance.unique_id_start_index = 1 Asciidoctor.convert(content, :safe => :secure, :attributes => %w(showtitle=@ idprefix idseparator=- env=github env-github source-highlighter=html-pipeline)) end @@ -36,8 +35,9 @@ command( ::GitHub::Markups::MARKUP_RST, "python2 -S #{Shellwords.escape(File.dirname(__FILE__))}/commands/rest2html", - [Linguist::Language["reStructuredText"]], + /re?st(\.txt)?/, + ["reStructuredText"], "restructuredtext" ) -command(::GitHub::Markups::MARKUP_POD, :pod2html, [Linguist::Language["Pod"]], "pod") +command(::GitHub::Markups::MARKUP_POD, :pod2html, /pod/, ["Pod"], "pod") diff --git a/test/markup_test.rb b/test/markup_test.rb index 6c8365d4..ccd1818e 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -102,7 +102,7 @@ def test_rendering_by_symbol end def test_raises_error_if_command_exits_non_zero - GitHub::Markup.command(:doesntmatter, 'test/fixtures/fail.sh', [Linguist::Language['Java']], 'fail') + GitHub::Markup.command(:doesntmatter, 'test/fixtures/fail.sh', /fail/, ['Java'], 'fail') assert GitHub::Markup.can_render?('README.java', 'stop swallowing errors') begin GitHub::Markup.render('README.java', "stop swallowing errors") From 3b342a4666352a2b8f96f6e52b310da31f63a9a6 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Mon, 27 Mar 2017 13:17:58 +1100 Subject: [PATCH 272/416] :gem: bump to 1.5.0 --- lib/github-markup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index fe275b43..37db64f9 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.4.9' + VERSION = '1.5.0' Version = VERSION end end From 0c845949591878b6b9551417961474a85ffbad77 Mon Sep 17 00:00:00 2001 From: PikachuEXE Date: Mon, 27 Mar 2017 17:19:22 +0800 Subject: [PATCH 273/416] Update change log for recent versions Only 1.4.9 & 1.5.0 included Too lazy to back-fill older versions [ci skip] --- HISTORY.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/HISTORY.md b/HISTORY.md index b15f6178..16c308c0 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,20 @@ +## 1.5.0 - 2017-03-27 + +### Added + +* Re-introduce [#537](https://github.com/github/markup/pull/537) to detect language of markup document + However `github-linguist` is optional and this gem will fallback to extensions for detection. + +[Full changelog](https://github.com/github/markup/compare/v1.4.9...v1.5.0) + +## 1.4.9 - 2017-03-27 + +### Changed + +* Reverted [#537](https://github.com/github/markup/pull/537) to avoid extra dependencies + +[Full changelog](https://github.com/github/markup/compare/v1.4.8...v1.4.9) + ## 1.3.3 (2015-02-17) * Address a slight typo with `POSIX` [#456](https://github.com/github/markup/pull/456) From 4b52d6dec527bdd524d19bec6544f8f8e1996e15 Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Tue, 28 Mar 2017 19:37:19 +0200 Subject: [PATCH 274/416] Remove superfluous dependency on rinku --- github-markup.gemspec | 1 - 1 file changed, 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index 69e10b45..93b00b1c 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -16,7 +16,6 @@ Gem::Specification.new do |s| s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = %w[lib] - s.add_dependency "rinku" s.add_development_dependency 'rake', '~> 12' s.add_development_dependency 'activesupport', '~> 4.0' s.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3' From 05cca0f4a5800c7077bb1e1f3f89d6181904086f Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Sat, 1 Apr 2017 00:28:08 -0600 Subject: [PATCH 275/416] resolves #519 enable source-to-source navigation for inter-document xrefs - set outfilesuffix=.adoc so inter-document xref links are created between AsciiDoc files --- Gemfile | 2 +- lib/github/markups.rb | 2 +- test/markups/README.asciidoc | 2 ++ test/markups/README.asciidoc.html | 3 +++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index d057e0e4..a17a4244 100644 --- a/Gemfile +++ b/Gemfile @@ -10,5 +10,5 @@ gem "rdoc", "~>3.6" gem "org-ruby", "= 0.9.9" gem "creole", "~>0.3.6" gem "wikicloth", "=0.8.3" -gem "asciidoctor", "= 1.5.2" +gem "asciidoctor", "= 1.5.5" gem "rake" diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 538ee7d0..ee334ea3 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -29,7 +29,7 @@ markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/, ["AsciiDoc"]) do |content| Asciidoctor::Compliance.unique_id_start_index = 1 - Asciidoctor.convert(content, :safe => :secure, :attributes => %w(showtitle=@ idprefix idseparator=- env=github env-github source-highlighter=html-pipeline)) + Asciidoctor.convert(content, :safe => :secure, :attributes => %w(showtitle=@ idprefix idseparator=- outfilesuffix=.adoc env=github env-github source-highlighter=html-pipeline)) end command( diff --git a/test/markups/README.asciidoc b/test/markups/README.asciidoc index de6d124e..6b5c49d0 100644 --- a/test/markups/README.asciidoc +++ b/test/markups/README.asciidoc @@ -7,6 +7,8 @@ Refer to <> or <>. +Navigate to <>. + == Another Section NOTE: Here is some source code. diff --git a/test/markups/README.asciidoc.html b/test/markups/README.asciidoc.html index 8ddb19d9..cd8fe8c1 100644 --- a/test/markups/README.asciidoc.html +++ b/test/markups/README.asciidoc.html @@ -15,6 +15,9 @@

      First Section

      +
      +

      Navigate to another document.

      +
      From 9fe05362ecd3ea5257b1699a3f3d09a0d6c3f646 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Mon, 3 Apr 2017 12:24:03 +1000 Subject: [PATCH 276/416] Pass filename to all renderers --- lib/github/markup.rb | 4 ++-- lib/github/markup/command_implementation.rb | 2 +- lib/github/markup/gem_implementation.rb | 4 ++-- lib/github/markup/implementation.rb | 2 +- lib/github/markup/markdown.rb | 2 +- lib/github/markup/rdoc.rb | 2 +- lib/github/markups.rb | 10 +++++----- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/github/markup.rb b/lib/github/markup.rb index f7befbe0..3f363555 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -44,7 +44,7 @@ def render(filename, content = nil) content ||= File.read(filename) if impl = renderer(filename, content) - impl.render(content) + impl.render(filename, content) else content end @@ -54,7 +54,7 @@ def render_s(symbol, content) if content.nil? raise ArgumentError, 'Can not render a nil.' elsif markups.has_key?(symbol) - markups[symbol].render(content) + markups[symbol].render(nil, content) else content end diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index 439ed293..ed67113c 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -22,7 +22,7 @@ def initialize(regexp, languages, command, name, &block) @name = name end - def render(content) + def render(filename, content) rendered = execute(command, content) rendered = rendered.to_s.empty? ? content : rendered call_block(rendered, content) diff --git a/lib/github/markup/gem_implementation.rb b/lib/github/markup/gem_implementation.rb index 1391de97..29582ce8 100644 --- a/lib/github/markup/gem_implementation.rb +++ b/lib/github/markup/gem_implementation.rb @@ -17,9 +17,9 @@ def load @loaded = true end - def render(content) + def render(filename, content) load - renderer.call(content) + renderer.call(filename, content) end def name diff --git a/lib/github/markup/implementation.rb b/lib/github/markup/implementation.rb index fb31165b..aaa92534 100644 --- a/lib/github/markup/implementation.rb +++ b/lib/github/markup/implementation.rb @@ -16,7 +16,7 @@ def load # no-op by default end - def render(content) + def render(filename, content) raise NotImplementedError, "subclasses of GitHub::Markup::Implementation must define #render" end diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index 0894fa03..d0546056 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -44,7 +44,7 @@ def load raise LoadError, "no suitable markdown gem found" end - def render(content) + def render(filename, content) load @renderer.call(content) end diff --git a/lib/github/markup/rdoc.rb b/lib/github/markup/rdoc.rb index 1064f24b..749618d9 100644 --- a/lib/github/markup/rdoc.rb +++ b/lib/github/markup/rdoc.rb @@ -9,7 +9,7 @@ def initialize super(/rdoc/, ["RDoc"]) end - def render(content) + def render(filename, content) if ::RDoc::VERSION.to_i >= 4 h = ::RDoc::Markup::ToHtml.new(::RDoc::Options.new) else diff --git a/lib/github/markups.rb b/lib/github/markups.rb index ee334ea3..19b539b1 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -4,30 +4,30 @@ markup_impl(::GitHub::Markups::MARKUP_MARKDOWN, ::GitHub::Markup::Markdown.new) -markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, /textile/, ["Textile"]) do |content| +markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, /textile/, ["Textile"]) do |filename, content| RedCloth.new(content).to_html end markup_impl(::GitHub::Markups::MARKUP_RDOC, GitHub::Markup::RDoc.new) -markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', /org/, ["Org"]) do |content| +markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', /org/, ["Org"]) do |filename, content| Orgmode::Parser.new(content, { :allow_include_files => false, :skip_syntax_highlight => true }).to_html end -markup(::GitHub::Markups::MARKUP_CREOLE, :creole, /creole/, ["Creole"]) do |content| +markup(::GitHub::Markups::MARKUP_CREOLE, :creole, /creole/, ["Creole"]) do |filename, content| Creole.creolize(content) end -markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, /mediawiki|wiki/, ["MediaWiki"]) do |content| +markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, /mediawiki|wiki/, ["MediaWiki"]) do |filename, content| wikicloth = WikiCloth::WikiCloth.new(:data => content) WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS << 'tt' unless WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS.include?('tt') wikicloth.to_html(:noedit => true) end -markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/, ["AsciiDoc"]) do |content| +markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/, ["AsciiDoc"]) do |filename, content| Asciidoctor::Compliance.unique_id_start_index = 1 Asciidoctor.convert(content, :safe => :secure, :attributes => %w(showtitle=@ idprefix idseparator=- outfilesuffix=.adoc env=github env-github source-highlighter=html-pipeline)) end From 36b3680a022fc6d1aa64675309e0ffb1e945b4d5 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Sun, 2 Apr 2017 20:53:50 -0600 Subject: [PATCH 277/416] set outfilesuffix to match extension of input filename - set outfilesuffix to match extension of input filename - update test for inter-document xref - set docname attribute - add test for docname attribute value - pass attributes as a hash to ensure docname value is properly escaped --- lib/github/markups.rb | 13 ++++++++++++- test/markups/README.asciidoc | 2 +- test/markups/README.asciidoc.html | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 19b539b1..61138e85 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -28,8 +28,19 @@ end markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/, ["AsciiDoc"]) do |filename, content| + attributes = { + 'showtitle' => '@', + 'idprefix' => '', + 'idseparator' => '-', + 'docname' => File.basename(filename, (extname = File.extname(filename))), + 'docfilesuffix' => extname, + 'outfilesuffix' => extname, + 'env' => 'github', + 'env-github' => '', + 'source-highlighter' => 'html-pipeline' + } Asciidoctor::Compliance.unique_id_start_index = 1 - Asciidoctor.convert(content, :safe => :secure, :attributes => %w(showtitle=@ idprefix idseparator=- outfilesuffix=.adoc env=github env-github source-highlighter=html-pipeline)) + Asciidoctor.convert(content, :safe => :secure, :attributes => attributes) end command( diff --git a/test/markups/README.asciidoc b/test/markups/README.asciidoc index 6b5c49d0..d3c872f7 100644 --- a/test/markups/README.asciidoc +++ b/test/markups/README.asciidoc @@ -7,7 +7,7 @@ Refer to <> or <>. -Navigate to <>. +Navigate from {docname}{outfilesuffix} to <>. == Another Section diff --git a/test/markups/README.asciidoc.html b/test/markups/README.asciidoc.html index cd8fe8c1..6f478cab 100644 --- a/test/markups/README.asciidoc.html +++ b/test/markups/README.asciidoc.html @@ -16,7 +16,7 @@

      First Section

      Refer to Another Section or Another Section.

      -

      Navigate to another document.

      +

      Navigate from README.asciidoc to another document.

      From df24c578031dbd7d8369b7bc6d6a0f79b810df62 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Mon, 3 Apr 2017 13:07:53 +1000 Subject: [PATCH 278/416] :gem: bump to 1.6.0 --- HISTORY.md | 8 ++++++++ lib/github-markup.rb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 16c308c0..6762da3a 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,11 @@ +## 1.6.0 - 2017-04-03 + +### Changed + +* Added filename argument to all renderers for additional context +* Removed superfluous `rinku` dependency [#1035](https://github.com/github/markup/pull/1035) +* Enable source-to-source navigation for `.adoc` AsciiDoc files, plus additional attributes passed through [#1039](https://github.com/github/markup/pull/1039) and [#1041](https://github.com/github/markup/pull/1041) + ## 1.5.0 - 2017-03-27 ### Added diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 37db64f9..9eaeacbc 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.5.0' + VERSION = '1.6.0' Version = VERSION end end From 516b151a6f5679eda635c183121d814fcb81dd7c Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sun, 4 Sep 2016 14:46:37 -0400 Subject: [PATCH 279/416] rest2html: Add support for highlight directive This adds support for the `highlight` directive, a Sphinx feature which allows one to set the default syntax highlighting language used for code blocks. --- lib/github/commands/rest2html | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 7ecfe272..00479482 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -46,7 +46,7 @@ import codecs from docutils import nodes from docutils.parsers.rst import directives, roles -from docutils.parsers.rst.directives.body import CodeBlock +from docutils.parsers.rst.directives.body import CodeBlock, Directive from docutils.core import publish_parts from docutils.writers.html4css1 import Writer, HTMLTranslator @@ -64,6 +64,18 @@ SETTINGS = { 'field_name_limit': 50, } +default_highlight_language = None + +class HighlightDirective(Directive): + required_arguments = 1 + optional_arguments = 1 + option_spec = {} + def run(self): + """Track the default syntax highlighting language + """ + global default_highlight_language + default_highlight_language = self.arguments[0] + return [] class DoctestDirective(CodeBlock): """Render Sphinx 'doctest:: [group]' blocks as 'code:: python' @@ -102,6 +114,8 @@ class GitHubHTMLTranslator(HTMLTranslator): language = classes[1] del classes[:] self.body.append(self.starttag(node, 'pre', lang=language)) + elif default_highlight_language is not None: + self.body.append(self.starttag(node, 'pre', lang=default_highlight_language)) else: self.body.append(self.starttag(node, 'pre')) @@ -172,6 +186,9 @@ def main(): # Render source code in Sphinx doctest blocks directives.register_directive('doctest', DoctestDirective) + # Set default highlight language + directives.register_directive('highlight', HighlightDirective) + parts = publish_parts(text, writer=writer, settings_overrides=SETTINGS) if 'html_body' in parts: html = parts['html_body'] From a49b58c0b2eff699ea5c94f12168019cf78deba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20R=C3=B8nn-Jensen?= Date: Mon, 29 May 2017 11:58:28 +0200 Subject: [PATCH 280/416] Update all gsub since `gsub!` can return nil and fail --- test/markup_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/markup_test.rb b/test/markup_test.rb index 970f98d1..3cc1b998 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -11,8 +11,8 @@ def normalize_html(text) text.strip .gsub(/\s\s+/,' ') - .gsub!(/\p{Pi}|\p{Pf}|&quot;/u,'"') - .gsub!("\u2026",'...') + .gsub(/\p{Pi}|\p{Pf}|&quot;/u,'"') + .gsub("\u2026",'...') end def assert_html_equal(expected, actual, msg = nil) From d8fee0deffcf87500b8c0cf51f91a0d326462330 Mon Sep 17 00:00:00 2001 From: Jeff Puckett Date: Sun, 11 Jun 2017 16:12:36 +0000 Subject: [PATCH 281/416] doc fix example with newline interpolation --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 059109b1..b6e0bd5e 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Basic form: ```ruby require 'github/markup' -GitHub::Markup.render('README.markdown', '* One\n* Two') +GitHub::Markup.render('README.markdown', "* One\n* Two") ``` More realistic form: @@ -62,7 +62,7 @@ And a convenience form: ```ruby require 'github/markup' -GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, '* One\n* Two') +GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "* One\n* Two") ``` From 2a9e03baabac5c2a476b30e5779cd7b5a8142076 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Wed, 12 Jul 2017 20:49:34 -0500 Subject: [PATCH 282/416] Tweak param signature for kbd role Represent ``options`` is dict and ``content`` is list-like. This is the same practice used in sphinx-doc/docutils. --- lib/github/commands/rest2html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index ed6507f5..0efea607 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -230,8 +230,7 @@ class GitHubHTMLTranslator(HTMLTranslator): HTMLTranslator.depart_image(self, node) -def kbd(name, rawtext, text, lineno, inliner, options=None, content=None): - +def kbd(name, rawtext, text, lineno, inliner, options={}, content=[]): return [nodes.raw('', '%s' % text, format='html')], [] From 70ca704ebb5a06d9c77a8f9dbab8d624af26a733 Mon Sep 17 00:00:00 2001 From: Takuya Noguchi Date: Sat, 15 Jul 2017 08:15:05 +0900 Subject: [PATCH 283/416] Add Ruby 2.1/2.2/2.3/2.4 and JRuby 9000 for CI target --- .travis.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 39f45602..556a3078 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,11 @@ language: ruby rvm: - 2.0.0 - - 2.1.1 - - jruby-19mode + - 2.1.10 + - 2.2.7 + - 2.3.4 + - 2.4.1 + - jruby-9.1.9.0 jdk: - oraclejdk8 notifications: @@ -25,4 +28,4 @@ env: - "JRUBY_OPTS=-Xcext.enabled=true" matrix: allow_failures: - - rvm: jruby-19mode + - rvm: jruby-9.1.9.0 From b0707fbe278591bcce237b86c0f3f9fd1301a5b7 Mon Sep 17 00:00:00 2001 From: Takuya Noguchi Date: Sat, 15 Jul 2017 15:06:49 +0900 Subject: [PATCH 284/416] Just use docutils instead of sphinx --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b6e0bd5e..5ee85f87 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a * [.org](http://orgmode.org/) -- `gem install org-ruby` * [.creole](http://wikicreole.org/) -- `gem install creole` * [.mediawiki, .wiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth` -* [.rst](http://docutils.sourceforge.net/rst.html) -- `python3 -m pip install sphinx` +* [.rst](http://docutils.sourceforge.net/rst.html) -- `pip install docutils` * [.asciidoc, .adoc, .asc](http://asciidoc.org/) -- `gem install asciidoctor` (http://asciidoctor.org) * [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::XHTML` comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN. From 377cbc4c918df30be3cabddbdbb8ea90b4dc23e7 Mon Sep 17 00:00:00 2001 From: Vasyl Solovei Date: Tue, 18 Jul 2017 20:15:20 +0300 Subject: [PATCH 285/416] Upgrade to Asciidoctor 1.5.6.1 New patch version has been released. Change log available here: https://github.com/asciidoctor/asciidoctor/blob/master/CHANGELOG.adoc#1561-2017-07-23---mojavelinux --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index a17a4244..4a84781d 100644 --- a/Gemfile +++ b/Gemfile @@ -10,5 +10,5 @@ gem "rdoc", "~>3.6" gem "org-ruby", "= 0.9.9" gem "creole", "~>0.3.6" gem "wikicloth", "=0.8.3" -gem "asciidoctor", "= 1.5.5" +gem "asciidoctor", "= 1.5.6.1" gem "rake" From a7b988adab77b7494ce5889e2f0dbef6d3d74442 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Tue, 25 Jul 2017 11:10:11 +1000 Subject: [PATCH 286/416] :gem: bump to 1.6.1 --- HISTORY.md | 9 +++++++++ lib/github-markup.rb | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 6762da3a..71857e06 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,12 @@ +## 1.6.1 - 2017-07-25 + +### Changed + +* Added support for highlight directive in rST [#925](https://github.com/github/markup/pull/925) +* 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) +* Test against newer Ruby versions [#1086](https://github.com/github/markup/pull/1086) +* Upgrade to Asciidoctor 1.5.6.1 [#1088](https://github.com/github/markup/pull/1088) + ## 1.6.0 - 2017-04-03 ### Changed diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 9eaeacbc..bfb8ff7e 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.6.0' + VERSION = '1.6.1' Version = VERSION end end From 8040a8efaf7abce608332e0245949a8a3e093f19 Mon Sep 17 00:00:00 2001 From: Rendaw Date: Wed, 30 Aug 2017 02:54:33 +0900 Subject: [PATCH 287/416] Update rdoc link in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ee85f87..3470adfe 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a * [.markdown, .mdown, .mkdn, .md](http://daringfireball.net/projects/markdown/) -- `gem install commonmarker` (https://github.com/gjtorikian/commonmarker) * [.textile](https://www.promptworks.com/textile) -- `gem install RedCloth` -* [.rdoc](https://rdoc.github.io/rdoc/) -- `gem install rdoc -v 3.6.1` +* [.rdoc](https://ruby.github.io/rdoc/) -- `gem install rdoc -v 3.6.1` * [.org](http://orgmode.org/) -- `gem install org-ruby` * [.creole](http://wikicreole.org/) -- `gem install creole` * [.mediawiki, .wiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth` From 6f85555b309d438c43f09333b607c9a1c9c0e5d6 Mon Sep 17 00:00:00 2001 From: Askar Safin Date: Fri, 29 Sep 2017 12:18:11 +0300 Subject: [PATCH 288/416] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3470adfe..a3296101 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Markups The following markups are supported. The dependencies listed are required if you wish to run the library. You can also run `script/bootstrap` to fetch them all. -* [.markdown, .mdown, .mkdn, .md](http://daringfireball.net/projects/markdown/) -- `gem install commonmarker` (https://github.com/gjtorikian/commonmarker) +* [.markdown, .mdown, .mkdn, .md](http://daringfireball.net/projects/markdown/) -- `gem install commonmarker` (https://github.com/gjtorikian/commonmarker). Github uses commonmarker for rendering markdown * [.textile](https://www.promptworks.com/textile) -- `gem install RedCloth` * [.rdoc](https://ruby.github.io/rdoc/) -- `gem install rdoc -v 3.6.1` * [.org](http://orgmode.org/) -- `gem install org-ruby` From 670c1208f126c9aed907cda0d60d7dd76f9980f0 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 2 Oct 2017 16:17:41 +1100 Subject: [PATCH 289/416] Fix grammar --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a3296101..3520fc1e 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Markups The following markups are supported. The dependencies listed are required if you wish to run the library. You can also run `script/bootstrap` to fetch them all. -* [.markdown, .mdown, .mkdn, .md](http://daringfireball.net/projects/markdown/) -- `gem install commonmarker` (https://github.com/gjtorikian/commonmarker). Github uses commonmarker for rendering markdown +* [.markdown, .mdown, .mkdn, .md](http://daringfireball.net/projects/markdown/) -- `gem install commonmarker` (https://github.com/gjtorikian/commonmarker). GitHub uses CommonMarker for rendering Markdown. * [.textile](https://www.promptworks.com/textile) -- `gem install RedCloth` * [.rdoc](https://ruby.github.io/rdoc/) -- `gem install rdoc -v 3.6.1` * [.org](http://orgmode.org/) -- `gem install org-ruby` From 05ef578ea94bddee471473034f72ad16ac3f5559 Mon Sep 17 00:00:00 2001 From: Patrick Bollinger Date: Sat, 21 Oct 2017 20:05:59 -0400 Subject: [PATCH 290/416] Update link and information about primer-markdown module #1119 --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8daf522d..63e57ee4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ If you are having an issue with: * **Syntax highlighting** - see [github/linguist](https://github.com/github/linguist/blob/master/CONTRIBUTING.md#fixing-syntax-highlighting) * **Markdown on GitHub** - contact support@github.com -* **Styling issues on GitHub** - see [primer/markdown](https://github.com/primer/markdown) +* **Styling issues on GitHub** - see [primer-markdown](https://github.com/primer/primer-css/tree/master/modules/primer-markdown) module in the [primer/primer-css](https://github.com/primer/primer-css) repository Anything else - [search open issues](https://github.com/github/markup/issues) or create an issue and and we'll help point you in the right direction. From 9f6f20e64e42c6e07ed7a7cc0864d0e680edd609 Mon Sep 17 00:00:00 2001 From: Cleberson Ramirio Date: Fri, 3 Nov 2017 17:28:19 -0200 Subject: [PATCH 291/416] Adding gem project links where the markdown link does not refer directly to the gem used --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3520fc1e..970230ca 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,11 @@ The following markups are supported. The dependencies listed are required if you wish to run the library. You can also run `script/bootstrap` to fetch them all. * [.markdown, .mdown, .mkdn, .md](http://daringfireball.net/projects/markdown/) -- `gem install commonmarker` (https://github.com/gjtorikian/commonmarker). GitHub uses CommonMarker for rendering Markdown. -* [.textile](https://www.promptworks.com/textile) -- `gem install RedCloth` +* [.textile](https://www.promptworks.com/textile) -- `gem install RedCloth` (https://github.com/jgarber/redcloth) * [.rdoc](https://ruby.github.io/rdoc/) -- `gem install rdoc -v 3.6.1` -* [.org](http://orgmode.org/) -- `gem install org-ruby` -* [.creole](http://wikicreole.org/) -- `gem install creole` -* [.mediawiki, .wiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth` +* [.org](http://orgmode.org/) -- `gem install org-ruby` (https://github.com/wallyqs/org-ruby) +* [.creole](http://wikicreole.org/) -- `gem install creole` (https://github.com/larsch/creole) +* [.mediawiki, .wiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth` (https://github.com/nricciar/wikicloth) * [.rst](http://docutils.sourceforge.net/rst.html) -- `pip install docutils` * [.asciidoc, .adoc, .asc](http://asciidoc.org/) -- `gem install asciidoctor` (http://asciidoctor.org) * [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::XHTML` From 0a7784e46fa06999e4e6bf78170991a58ab25bf4 Mon Sep 17 00:00:00 2001 From: Cleberson Ramirio Date: Fri, 3 Nov 2017 17:30:32 -0200 Subject: [PATCH 292/416] removing redundant information The project link already makes it clear that github uses GitHub uses CommonMarker for rendering Markdown --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 970230ca..b4ab5226 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Markups The following markups are supported. The dependencies listed are required if you wish to run the library. You can also run `script/bootstrap` to fetch them all. -* [.markdown, .mdown, .mkdn, .md](http://daringfireball.net/projects/markdown/) -- `gem install commonmarker` (https://github.com/gjtorikian/commonmarker). GitHub uses CommonMarker for rendering Markdown. +* [.markdown, .mdown, .mkdn, .md](http://daringfireball.net/projects/markdown/) -- `gem install commonmarker` (https://github.com/gjtorikian/commonmarker) * [.textile](https://www.promptworks.com/textile) -- `gem install RedCloth` (https://github.com/jgarber/redcloth) * [.rdoc](https://ruby.github.io/rdoc/) -- `gem install rdoc -v 3.6.1` * [.org](http://orgmode.org/) -- `gem install org-ruby` (https://github.com/wallyqs/org-ruby) From 1ea698f1305bf580471e24715f49158db44f4754 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Fri, 10 Nov 2017 03:40:20 +0000 Subject: [PATCH 293/416] spelling: ellipses --- test/markups/README.org | 2 +- test/markups/README.org.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/markups/README.org b/test/markups/README.org index c479b047..dded60e3 100644 --- a/test/markups/README.org +++ b/test/markups/README.org @@ -91,7 +91,7 @@ end ** 2009-12-27: Version 0.3 - - Uses rubypants to get better typography (smart quotes, elipses, etc...). + - Uses rubypants to get better typography (smart quotes, ellipses, etc...). - Fixed bugs: - Tables and lists did not get properly closed at the end of file - You couldn't do inline formatting inside table cells diff --git a/test/markups/README.org.html b/test/markups/README.org.html index 73f9cf4b..ddf8b27e 100644 --- a/test/markups/README.org.html +++ b/test/markups/README.org.html @@ -96,7 +96,7 @@

      2.6 2009-12-29: Version 0.4

      2.7 2009-12-27: Version 0.3

        -
      • Uses rubypants to get better typography (smart quotes, elipses, etc…).
      • +
      • Uses rubypants to get better typography (smart quotes, ellipses, etc…).
      • Fixed bugs:
        • Tables and lists did not get properly closed at the end of file
        • From 2e67defed88d1bcee8da6f63ff9228cc7869a3fa Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Fri, 10 Nov 2017 03:43:17 +0000 Subject: [PATCH 294/416] spelling: precedence --- test/markups/README.pod | 2 +- test/markups/README.pod.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/markups/README.pod b/test/markups/README.pod index f6ad2c48..8c92eb5b 100644 --- a/test/markups/README.pod +++ b/test/markups/README.pod @@ -26,7 +26,7 @@ This project is broken into three primary components: =item * The first is the parser, located in the C directory. The parser proper is composed of three source files, F which is a Perl6Grammar file, and F which is the associated actions file -written in NQP, and F which is the operator precidence parser. +written in NQP, and F which is the operator precedence parser. In addition, several helper functions used by the parser are located in C. diff --git a/test/markups/README.pod.html b/test/markups/README.pod.html index 16af4ece..a62c65db 100644 --- a/test/markups/README.pod.html +++ b/test/markups/README.pod.html @@ -21,7 +21,7 @@

          IMPLEMENTATION

            -
          • The first is the parser, located in the src/parser/ directory. The parser proper is composed of three source files, grammar.pg which is a Perl6Grammar file, and actions.pm which is the associated actions file written in NQP, and grammar-oper.pm which is the operator precidence parser. In addition, several helper functions used by the parser are located in src/internals.

            +
          • The first is the parser, located in the src/parser/ directory. The parser proper is composed of three source files, grammar.pg which is a Perl6Grammar file, and actions.pm which is the associated actions file written in NQP, and grammar-oper.pm which is the operator precedence parser. In addition, several helper functions used by the parser are located in src/internals.

          • The second component is the library of builtin functions in the src/builtins/ directory. These functions are, currently, written primarily in PIR. Function names prefixed with an underscore are "private" functions for use with the parser. Other functions should have names which are the same as names for regular MATLAB or Octave functions, since they will be available to the HLL. These are also separated into different namespaces depending on visibility and utility.

            From 367e4393902d6aa6873ea6c098b6dfb4f4944706 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Mon, 27 Nov 2017 15:16:15 +1100 Subject: [PATCH 295/416] github-markup: display basename instead of entire $0 --- bin/github-markup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/github-markup b/bin/github-markup index d15cfc47..ec967359 100755 --- a/bin/github-markup +++ b/bin/github-markup @@ -4,7 +4,7 @@ $LOAD_PATH.unshift File.dirname(File.realpath(__FILE__)) + "/../lib" require 'github/markup' if ARGV.size < 1 - print "usage: #$0 FILE [ FILES ... ]\n" + print "usage: #{File.basename($0)} FILE [ FILES ... ]\n" exit 1 end From aea670b40e8a90f633f4178b0da1b717a244c2d5 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 27 Nov 2017 15:24:07 +1100 Subject: [PATCH 296/416] Use dist: precise --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 556a3078..1fba7ac9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +dist: precise +sudo: required language: ruby rvm: - 2.0.0 From 5d2190d05591ddf6a1900675ad427b7b130a4866 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 27 Nov 2017 15:32:01 +1100 Subject: [PATCH 297/416] Use trusty instead --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1fba7ac9..6fd23479 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -dist: precise +dist: trusty sudo: required language: ruby rvm: @@ -15,10 +15,8 @@ notifications: git: depth: 10 before_install: - - sudo apt-get install perl - - sudo add-apt-repository --yes ppa:kalakris/cmake - sudo apt-get update -qq - - sudo apt-get install cmake + - sudo apt-get install perl - curl -L http://cpanmin.us | perl - --sudo App::cpanminus - sudo cpanm --installdeps --notest Pod::Simple - sudo pip install docutils From fb467aade6aacc700ab21ff424c3c3738ff6c747 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 27 Nov 2017 15:48:57 +1100 Subject: [PATCH 298/416] :gem: bump to 1.6.2 --- HISTORY.md | 7 +++++++ lib/github-markup.rb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 71857e06..82b7022e 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,10 @@ +## 1.6.2 - 2017-11-27 + +### Changed + +* Only report basename in usage [#1131](https://github.com/github/markup/pull/1131) +* rest2html parameter signature fix [#1082](https://github.com/github/markup/pull/1082) + ## 1.6.1 - 2017-07-25 ### Changed diff --git a/lib/github-markup.rb b/lib/github-markup.rb index bfb8ff7e..ecd8b584 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.6.1' + VERSION = '1.6.2' Version = VERSION end end From 47a8cdcf1e4017d0345de6499f50cfd6c0a1a792 Mon Sep 17 00:00:00 2001 From: Roy Storey Date: Wed, 29 Nov 2017 11:11:51 +1300 Subject: [PATCH 299/416] reduce friction to create environment --- CONTRIBUTING.md | 4 ++++ script/bootstrap.contrib | 15 +++++++++++++++ 2 files changed, 19 insertions(+) create mode 100755 script/bootstrap.contrib diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 63e57ee4..9b5969ab 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,6 +23,10 @@ Anything else - [search open issues](https://github.com/github/markup/issues) or 5. Open a [Pull Request][1] 6. Enjoy a refreshing Diet Coke and wait +**dependencies** + +You can run `script/bootstrap.contrib` to fetch them all. + ## Testing To run the tests: diff --git a/script/bootstrap.contrib b/script/bootstrap.contrib new file mode 100755 index 00000000..834b6b61 --- /dev/null +++ b/script/bootstrap.contrib @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e + +cd $(dirname "$0")/.. + +bundle install --path vendor/bundle +virtualenv vendor/python && source vendor/python/bin/activate +pip install docutils + +echo "" +echo "*** DONE ***" +echo "" +echo "activate python environment with 'source vendor/python/bin/activate'" +echo "run tests with 'bundle exec rake'" From 3d861e8ef528b340a2e450c1cad243dec03623ee Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Tue, 12 Dec 2017 12:33:50 +1100 Subject: [PATCH 300/416] Pass through symlink info See github/linguist#3946 --- lib/github/markup.rb | 17 +++++++++-------- test/markup_test.rb | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/github/markup.rb b/lib/github/markup.rb index 3f363555..a0a9ff0c 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -40,10 +40,11 @@ def preload! end end - def render(filename, content = nil) + def render(filename, content = nil, symlink = nil) content ||= File.read(filename) + symlink = (File.symlink?(filename) rescue false) if symlink.nil? - if impl = renderer(filename, content) + if impl = renderer(filename, content, symlink) impl.render(filename, content) else content @@ -79,20 +80,20 @@ def command(symbol, command, regexp, languages, name, &block) markup_impl(symbol, CommandImplementation.new(regexp, languages, command, name, &block)) end - def can_render?(filename, content) - !!renderer(filename, content) + def can_render?(filename, content, symlink = false) + !!renderer(filename, content, symlink) end - def renderer(filename, content) - language = language(filename, content) + def renderer(filename, content, symlink = false) + language = language(filename, content, symlink) markup_impls.find { |impl| impl.match?(filename, language) } end - def language(filename, content) + def language(filename, content, symlink = false) if defined?(::Linguist) - blob = Linguist::Blob.new(filename, content) + blob = Linguist::Blob.new(filename, content, symlink: symlink) return Linguist.detect(blob, allow_empty: true) end end diff --git a/test/markup_test.rb b/test/markup_test.rb index 81a7d1e8..8e02ed21 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -104,7 +104,7 @@ def test_raises_error_if_command_exits_non_zero GitHub::Markup.command(:doesntmatter, 'test/fixtures/fail.sh', /fail/, ['Java'], 'fail') assert GitHub::Markup.can_render?('README.java', 'stop swallowing errors') begin - GitHub::Markup.render('README.java', "stop swallowing errors") + GitHub::Markup.render('README.java', "stop swallowing errors", false) rescue GitHub::Markup::CommandError => e assert_equal "failure message", e.message else From f6484c4e3db74396809fad60c2b0a33bc046a132 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Tue, 30 Jan 2018 12:16:32 +1100 Subject: [PATCH 301/416] pull in linguist 6 --- github-markup.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index 93b00b1c..f599cd2d 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -23,5 +23,5 @@ Gem::Specification.new do |s| s.add_development_dependency 'sanitize', '~> 2.1', '>= 2.1.0' s.add_development_dependency 'nokogiri', '1.6.8.1' s.add_development_dependency 'nokogiri-diff', '~> 0.2.0' - s.add_development_dependency "github-linguist", "~> 5.0", ">= 5.0.8" + s.add_development_dependency "github-linguist", "~> 6.0" end From 31ae286e13e1a8c21e0824399f3781f190d0dd57 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Tue, 30 Jan 2018 12:27:33 +1100 Subject: [PATCH 302/416] wikicloth doesn't pin dependencies so we have to --- github-markup.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/github-markup.gemspec b/github-markup.gemspec index f599cd2d..bf05db18 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -24,4 +24,5 @@ Gem::Specification.new do |s| s.add_development_dependency 'nokogiri', '1.6.8.1' s.add_development_dependency 'nokogiri-diff', '~> 0.2.0' s.add_development_dependency "github-linguist", "~> 6.0" + s.add_development_dependency "twitter-text", "~> 1.14" end From 6704f82a258ccd9cd2a19f1ec90b8ecd460cb140 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Tue, 30 Jan 2018 12:37:16 +1100 Subject: [PATCH 303/416] try here --- Gemfile | 1 + github-markup.gemspec | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 4a84781d..a5a58995 100644 --- a/Gemfile +++ b/Gemfile @@ -10,5 +10,6 @@ gem "rdoc", "~>3.6" gem "org-ruby", "= 0.9.9" gem "creole", "~>0.3.6" gem "wikicloth", "=0.8.3" +gem "twitter-text", "~> 1.14" gem "asciidoctor", "= 1.5.6.1" gem "rake" diff --git a/github-markup.gemspec b/github-markup.gemspec index bf05db18..f599cd2d 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -24,5 +24,4 @@ Gem::Specification.new do |s| s.add_development_dependency 'nokogiri', '1.6.8.1' s.add_development_dependency 'nokogiri-diff', '~> 0.2.0' s.add_development_dependency "github-linguist", "~> 6.0" - s.add_development_dependency "twitter-text", "~> 1.14" end From 898963cf1fb468f7ee2dbf5fd424ddc362ab282d Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Tue, 30 Jan 2018 12:52:26 +1100 Subject: [PATCH 304/416] bump nokogiri to ~> 1.8.1 --- github-markup.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index f599cd2d..7c663d09 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3' s.add_development_dependency 'html-pipeline', '~> 1.0' s.add_development_dependency 'sanitize', '~> 2.1', '>= 2.1.0' - s.add_development_dependency 'nokogiri', '1.6.8.1' + s.add_development_dependency 'nokogiri', '~> 1.8.1' s.add_development_dependency 'nokogiri-diff', '~> 0.2.0' s.add_development_dependency "github-linguist", "~> 6.0" end From 2f2a13bdfb3b1a3031e5b2c6d05e1124c1e2cfbd Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Tue, 30 Jan 2018 13:00:16 +1100 Subject: [PATCH 305/416] drop support for ruby 2.0 nokogiri 1.8 requires >= 2.1.0 --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6fd23479..f118d5cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ dist: trusty sudo: required language: ruby rvm: - - 2.0.0 - 2.1.10 - 2.2.7 - 2.3.4 From b8b14ecd91247ab8972f3205a03f55583d2bddda Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Tue, 30 Jan 2018 13:13:24 +1100 Subject: [PATCH 306/416] :gem: bump to 1.7.0 --- HISTORY.md | 7 +++++++ lib/github-markup.rb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 82b7022e..da5839ee 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,10 @@ +## 1.7.0 - 2018-01-30 + +### Changed + +* Updates for Linguist v6 [#1139](https://github.com/github/markup/pull/1139) +* Update to Nokogiri ~> 1.8; drop support for Ruby 2.0 [#1156](https://github.com/github/markup/pull/1156) + ## 1.6.2 - 2017-11-27 ### Changed diff --git a/lib/github-markup.rb b/lib/github-markup.rb index ecd8b584..514bfddd 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.6.2' + VERSION = '1.7.0' Version = VERSION end end From 165860dda088a2564f439601142acb71a686ed91 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Wed, 31 Jan 2018 10:24:15 +1100 Subject: [PATCH 307/416] Remove filesystem access --- lib/github/markup.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/github/markup.rb b/lib/github/markup.rb index a0a9ff0c..84c1e45f 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -40,10 +40,7 @@ def preload! end end - def render(filename, content = nil, symlink = nil) - content ||= File.read(filename) - symlink = (File.symlink?(filename) rescue false) if symlink.nil? - + def render(filename, content, symlink = false) if impl = renderer(filename, content, symlink) impl.render(filename, content) else From 6305aeed9d9775bad2b90c95f1d8e4b444ff487f Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Wed, 31 Jan 2018 10:37:48 +1100 Subject: [PATCH 308/416] :gem: bump to 2.0.0 --- HISTORY.md | 4 ++++ lib/github-markup.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index da5839ee..b42ecbe6 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,7 @@ +## 2.0.0 - 2018-01-31 + +* Remove filesystem access [#1157](https://github.com/github/markup/pull/1157) + ## 1.7.0 - 2018-01-30 ### Changed diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 514bfddd..bb6e258a 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '1.7.0' + VERSION = '2.0.0' Version = VERSION end end From 516365224c0dcc4f3106950bf546eb28f5951166 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 16 Feb 2018 09:09:30 +0000 Subject: [PATCH 309/416] CONTRIBUTING: note license. This is to be more explicit about the contribution process and license. --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9b5969ab..98435b25 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,7 @@ # Contributing +Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE). + This project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to honor this code. [code-of-conduct]: http://todogroup.org/opencodeofconduct/#GitHub%20Markup/opensource@github.com From 31ed04343a8761d7898f30bd0eed35136175cedb Mon Sep 17 00:00:00 2001 From: JJ Merelo Date: Mon, 12 Mar 2018 17:32:38 +0100 Subject: [PATCH 310/416] Adds perl6 test from perl6/doc home --- test/markups/README.pod6 | 67 +++++++++++++++++++++++++++++++++++ test/markups/README.pod6.html | 42 ++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100755 test/markups/README.pod6 create mode 100644 test/markups/README.pod6.html diff --git a/test/markups/README.pod6 b/test/markups/README.pod6 new file mode 100755 index 00000000..ee65afbe --- /dev/null +++ b/test/markups/README.pod6 @@ -0,0 +1,67 @@ +=begin Html + +Welcome to the official documentation of the Perl 6 +programming language! +Besides online browsing and searching, you can also +view everything in one file or +contribute +by reporting mistakes or sending patches. + +
            + +
            + +
            Language Reference & Tutorials
            +
            + A collection of documents describing, in detail, the various + conceptual parts of the language. + + +
            + +
            Type Reference
            +
            + Index of built-in classes and roles. +
            + +
            Routine Reference
            +
            + Index of built-in subroutines and methods. +
            + +
            Perl 6 Programs
            +
            + A collection of documents describing how to + run the Perl 6 executable program and other utilities, + how to debug Perl 6 programs, and how to hack on Perl 6 + source code. +
            + + + +
            + +
            + + +

            The Perl 6 homepage offers a +comprehensive list of Perl 6 resources, including tutorials, how-tos +and FAQs (Frequently Asked Questions).

            + +

            +Perl 6 compiler developers may also be interested in +The Perl 6 Specification. +Documentation for the different but related Perl 5 language +can be found on the Perl 5 documentation website. +

            +=end Html + +# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6 diff --git a/test/markups/README.pod6.html b/test/markups/README.pod6.html new file mode 100644 index 00000000..511f5390 --- /dev/null +++ b/test/markups/README.pod6.html @@ -0,0 +1,42 @@ + + + + Codestin Search App + + + + + + + +
            + + + +
            + Welcome to the official documentation of the Perl 6 programming language! Besides online browsing and searching, you can also view everything in one file or contribute by reporting mistakes or sending patches.
            Language Reference & Tutorials
            A collection of documents describing, in detail, the various conceptual parts of the language.
            Type Reference
            Index of built-in classes and roles.
            Routine Reference
            Index of built-in subroutines and methods.
            Perl 6 Programs
            A collection of documents describing how to run the Perl 6 executable program and other utilities, how to debug Perl 6 programs, and how to hack on Perl 6 source code.

            The Perl 6 homepage offers a comprehensive list of Perl 6 resources, including tutorials, how-tos and FAQs (Frequently Asked Questions).

            Perl 6 compiler developers may also be interested in The Perl 6 Specification. Documentation for the different but related Perl 5 language can be found on the Perl 5 documentation website.

            +
            + + + + + From 3286a7eb442fcfdda59bdcd3ff7740a6a79ea971 Mon Sep 17 00:00:00 2001 From: JJ Merelo Date: Mon, 12 Mar 2018 17:47:28 +0100 Subject: [PATCH 311/416] Adds files (and modifies) for perl6 refs #907 --- README.md | 8 ++++++++ lib/github/commands/pod62html | 3 +++ lib/github/markup.rb | 1 + lib/github/markups.rb | 3 ++- 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100755 lib/github/commands/pod62html diff --git a/README.md b/README.md index b4ab5226..b00b9023 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,14 @@ Installation gem install github-markup ``` +or + +``` +bundle install +``` + +from this directory + Usage ----- diff --git a/lib/github/commands/pod62html b/lib/github/commands/pod62html new file mode 100755 index 00000000..4bea53ba --- /dev/null +++ b/lib/github/commands/pod62html @@ -0,0 +1,3 @@ +#!/bin/bash + +perl6 --doc=HTML "$1" diff --git a/lib/github/markup.rb b/lib/github/markup.rb index 84c1e45f..44344909 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -19,6 +19,7 @@ module Markups MARKUP_RDOC = :rdoc MARKUP_RST = :rst MARKUP_TEXTILE = :textile + MARKUP_POD6 = :pod6 end module Markup diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 61138e85..917c6215 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -51,4 +51,5 @@ "restructuredtext" ) -command(::GitHub::Markups::MARKUP_POD, :pod2html, /pod/, ["Pod"], "pod") +command(::GitHub::Markups::MARKUP_POD6, :pod6tohtml, /pod/, ["Pod6"], "pod6") +command(::GitHub::Markups::MARKUP_POD, :pod2html, /pod$/, ["Pod"], "pod") From 8c5fc3d9995cfdda08b96d9606a42100e30a55f2 Mon Sep 17 00:00:00 2001 From: JJ Merelo Date: Mon, 12 Mar 2018 18:12:07 +0100 Subject: [PATCH 312/416] Cleanup --- .gitignore | 1 + lib/github/commands/pod62html | 2 ++ lib/github/markups.rb | 2 +- test/markup_test.rb | 5 +++-- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 2535ee2a..c8263789 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ Gemfile.lock vendor/ .project .buildpath +*~ \ No newline at end of file diff --git a/lib/github/commands/pod62html b/lib/github/commands/pod62html index 4bea53ba..3b36e8f3 100755 --- a/lib/github/commands/pod62html +++ b/lib/github/commands/pod62html @@ -1,3 +1,5 @@ #!/bin/bash +echo "Processing " +echo "$1" perl6 --doc=HTML "$1" diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 917c6215..8099846c 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -51,5 +51,5 @@ "restructuredtext" ) -command(::GitHub::Markups::MARKUP_POD6, :pod6tohtml, /pod/, ["Pod6"], "pod6") +command(::GitHub::Markups::MARKUP_POD6, :pod6tohtml, /pod6/, ["Pod6"], "pod6") command(::GitHub::Markups::MARKUP_POD, :pod2html, /pod$/, ["Pod"], "pod") diff --git a/test/markup_test.rb b/test/markup_test.rb index 8e02ed21..709161d6 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -1,4 +1,4 @@ -# encoding: UTF-8 +# encoding: utf-8 $LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib" @@ -93,7 +93,8 @@ def test_each_render_has_a_name assert_equal "wikicloth", GitHub::Markup.renderer('README.wiki', '

            Title

            ').name assert_equal "asciidoctor", GitHub::Markup.renderer('README.adoc', '== Title').name assert_equal "restructuredtext", GitHub::Markup.renderer('README.rst', 'Title').name - assert_equal "pod", GitHub::Markup.renderer('README.pod', '=begin').name + assert_equal "pod", GitHub::Markup.renderer('README.pod', '=head1').name + assert_equal "pod6", GitHub::Markup.renderer('README.pod6', '=begin').name end def test_rendering_by_symbol From c08633c4d2772aa56ac3f48dec28797291d75198 Mon Sep 17 00:00:00 2001 From: JJ Merelo Date: Mon, 12 Mar 2018 18:12:41 +0100 Subject: [PATCH 313/416] Cleanup --- test/markup_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/markup_test.rb b/test/markup_test.rb index 709161d6..f417d915 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -93,8 +93,8 @@ def test_each_render_has_a_name assert_equal "wikicloth", GitHub::Markup.renderer('README.wiki', '

            Title

            ').name assert_equal "asciidoctor", GitHub::Markup.renderer('README.adoc', '== Title').name assert_equal "restructuredtext", GitHub::Markup.renderer('README.rst', 'Title').name - assert_equal "pod", GitHub::Markup.renderer('README.pod', '=head1').name - assert_equal "pod6", GitHub::Markup.renderer('README.pod6', '=begin').name +# assert_equal "pod", GitHub::Markup.renderer('README.pod', '=head1').name +# assert_equal "pod6", GitHub::Markup.renderer('README.pod6', '=begin').name end def test_rendering_by_symbol From a6dc07724335a51e7f9cff860522beaaec1d2c7e Mon Sep 17 00:00:00 2001 From: JJ Merelo Date: Mon, 12 Mar 2018 20:33:04 +0100 Subject: [PATCH 314/416] Reduced errors to 0 --- lib/github/commands/pod62html | 9 +- lib/github/markup.rb | 1 - lib/github/markups.rb | 2 +- test/markup_test.rb | 5 +- test/markups/README.pod6 | 215 ++++++++++++++++++++++++---------- test/markups/README.pod6.html | 154 +++++++++++++++++++++--- 6 files changed, 292 insertions(+), 94 deletions(-) diff --git a/lib/github/commands/pod62html b/lib/github/commands/pod62html index 3b36e8f3..28937eca 100755 --- a/lib/github/commands/pod62html +++ b/lib/github/commands/pod62html @@ -1,5 +1,6 @@ -#!/bin/bash +#!/usr/bin/env perl6 -echo "Processing " -echo "$1" -perl6 --doc=HTML "$1" +use v6; + +use Pod::To::HTML; +put Pod::To::HTML.render(slurp); diff --git a/lib/github/markup.rb b/lib/github/markup.rb index 44344909..4f22c9ea 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -74,7 +74,6 @@ def command(symbol, command, regexp, languages, name, &block) if File.exist?(file = File.dirname(__FILE__) + "/commands/#{command}") command = file end - markup_impl(symbol, CommandImplementation.new(regexp, languages, command, name, &block)) end diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 8099846c..278e7068 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -51,5 +51,5 @@ "restructuredtext" ) -command(::GitHub::Markups::MARKUP_POD6, :pod6tohtml, /pod6/, ["Pod6"], "pod6") +command(::GitHub::Markups::MARKUP_POD6, :pod62html, /pod6/, ["Perl 6"], "pod6") command(::GitHub::Markups::MARKUP_POD, :pod2html, /pod$/, ["Pod"], "pod") diff --git a/test/markup_test.rb b/test/markup_test.rb index f417d915..66195103 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -52,7 +52,6 @@ def call define_method "test_#{markup}" do skip "Skipping MediaWiki test because wikicloth is currently not compatible with JRuby." if markup == "mediawiki" && RUBY_PLATFORM == "java" - source = File.read(readme) expected_file = "#{readme}.html" expected = File.read(expected_file).rstrip @@ -67,7 +66,6 @@ def call f.close_write f.read end - assert_html_equal expected, actual, <Title').name assert_equal "asciidoctor", GitHub::Markup.renderer('README.adoc', '== Title').name assert_equal "restructuredtext", GitHub::Markup.renderer('README.rst', 'Title').name -# assert_equal "pod", GitHub::Markup.renderer('README.pod', '=head1').name -# assert_equal "pod6", GitHub::Markup.renderer('README.pod6', '=begin').name + assert_equal "pod", GitHub::Markup.renderer('README.pod', '=head1').name end def test_rendering_by_symbol diff --git a/test/markups/README.pod6 b/test/markups/README.pod6 index ee65afbe..a153b1bb 100755 --- a/test/markups/README.pod6 +++ b/test/markups/README.pod6 @@ -1,67 +1,152 @@ -=begin Html - -Welcome to the official documentation of the Perl 6 -programming language! -Besides online browsing and searching, you can also -view everything in one file or -contribute -by reporting mistakes or sending patches. - -
            - -
            - -
            Language Reference & Tutorials
            -
            - A collection of documents describing, in detail, the various - conceptual parts of the language. - - -
            - -
            Type Reference
            -
            - Index of built-in classes and roles. -
            - -
            Routine Reference
            -
            - Index of built-in subroutines and methods. -
            - -
            Perl 6 Programs
            -
            - A collection of documents describing how to - run the Perl 6 executable program and other utilities, - how to debug Perl 6 programs, and how to hack on Perl 6 - source code. -
            - - - -
            - -
            - - -

            The Perl 6 homepage offers a -comprehensive list of Perl 6 resources, including tutorials, how-tos -and FAQs (Frequently Asked Questions).

            - -

            -Perl 6 compiler developers may also be interested in -The Perl 6 Specification. -Documentation for the different but related Perl 5 language -can be found on the Perl 5 documentation website. -

            -=end Html +=begin pod + +=TITLE About the Docs + +=SUBTITLE Meta-documentation + +This document collection represents the on-going effort to document the Perl 6 programming +language with the goals of being: comprehensive; easy to use; easy to +navigate; and useful to both newcomers and experienced Perl 6 +programmers. + +An HTML version of the documentation is located online at +L. + +The official source for this documentation is located at L. + +This particular document is a quick overview of the process +described in more detail in L. +This document also provides a short introduction to writing Perl 6 +Pod files, which can be rendered into HTML and other formats. + +=head1 Structure + +All of the documentation is written in Perl 6 Pod and kept in the C +directory, and the C and C sub-directories. +These files are processed as collections of definitions or +"documentables", which are then post-processed and linked together. + +=head1 Generating HTML from Pod + +To generate HTML from the Pod files, you'll need: + +=item A recent version of the Rakudo Perl 6 compiler + +=item The Perl 6 modules Pod::To::HTML, Pod::To::BigPage, and URI::Escape +(can be installed via L). + +=item B: L, for creating graphs +of the relationships between Perl 6 types + +=item B: L and L, for syntax +highlighting + +To generate the documentation into the C folder, run: + +=begin code :lang +perl6 htmlify.p6 +=end code + +To host the documentation from a web server, have Perl 5 +and Mojolicious::Lite installed, then run: + +=begin code :lang +perl app.pl daemon +=end code + +=head1 Contributing + +The documentation is written in Perl 6 Pod. + +For a quick introduction to Perl 6 Pod, see L. + +For full details about the Perl 6 Pod specification, see L. + +=head2 Adding definitions + +Documentables can be defined using an C<=headN> Pod directive, where +C is greater than zero (e.g., C<=head1>, C<=head2>, …). + +All of the paragraphs and blocks following that directive, up until the +next directive of the same level, will be considered part of the +documentable. So, in: + +=begin code :allow :skip-test +=head2 R + +Some paragraphs, followed by some code: + + my Code $examples = "amazing"; + +Mind === blown. + +=head3 Minor details about R + +It's fantastic. + +=head2 And now, for something completely different + +… + +=end code + +The documentable R extends down to the C<=head2 And now…>. + +Documentables may contain other documentables. Class documentables, for +example, often contain the methods the class implements. + +Definitions must be in one of the following forms to be recognized as +the start of a documentable named, say, þ. First the code in the document source: + +=begin code :skip-test + +=item X | infix,þ> (This a special case, which +is always considered a definition) + +=item C + +=item B Infix> + +=item C + +=item B> + +=item C (A special case for the L documentables) + +=end code + +Then the results on the rendered page: + +=item X | infix,þ> (This is a special case, which +is always considered a definition) + +=item C + +=item B Infix> + +=item C + +=item B> + +=item C (A special case for the L documentables) + +These items should now be searchable by using the search field in the HTML docs. + +You can add emphasis with bold (B >>) or italicized (B >>), +with or without code formatting (B >>). Due to current parser limitations, +special steps have to be taken to use B >> with other formatting codes; for example: + +=begin code :skip-test +=item X|foo> a fancy subroutine +=end code + +renders like this + +=item X|foo> a fancy subroutine + +Notice that text after a pipe ('|') has no formatting. Also note that B >> +preserves spaces and treats text as verbatim. +=end pod # vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6 diff --git a/test/markups/README.pod6.html b/test/markups/README.pod6.html index 511f5390..c0039bc8 100644 --- a/test/markups/README.pod6.html +++ b/test/markups/README.pod6.html @@ -1,16 +1,14 @@ - - - - Codestin Search App - - - - - -
            + + +
            -
            - Welcome to the official documentation of the Perl 6 programming language! Besides online browsing and searching, you can also view everything in one file or contribute by reporting mistakes or sending patches.
            Language Reference & Tutorials
            A collection of documents describing, in detail, the various conceptual parts of the language.
            Type Reference
            Index of built-in classes and roles.
            Routine Reference
            Index of built-in subroutines and methods.
            Perl 6 Programs
            A collection of documents describing how to run the Perl 6 executable program and other utilities, how to debug Perl 6 programs, and how to hack on Perl 6 source code.

            The Perl 6 homepage offers a comprehensive list of Perl 6 resources, including tutorials, how-tos and FAQs (Frequently Asked Questions).

            Perl 6 compiler developers may also be interested in The Perl 6 Specification. Documentation for the different but related Perl 5 language can be found on the Perl 5 documentation website.

            -
            +

            About the Docs

            +

            Meta-documentation

            + +
      +

      Table of Contents

      +
      + + + + + + + + + + + + + + + + +
      1Structure
      2Generating HTML from Pod
      3Contributing
      3.1Adding definitions
      + + +
      +

      This document collection represents the on-going effort to document the Perl 6 programming language with the goals of being: comprehensive; easy to use; easy to navigate; and useful to both newcomers and experienced Perl 6 programmers.

      +

      An HTML version of the documentation is located online at https://docs.perl6.org.

      +

      The official source for this documentation is located at perl6/doc on GitHub.

      +

      This particular document is a quick overview of the process described in more detail in CONTRIBUTING on GitHub. This document also provides a short introduction to writing Perl 6 Pod files, which can be rendered into HTML and other formats.

      +

      Structure

      +

      All of the documentation is written in Perl 6 Pod and kept in the doc/ directory, and the doc/Language/ and doc/Type/ sub-directories. These files are processed as collections of definitions or "documentables", which are then post-processed and linked together.

      +

      Generating HTML from Pod

      +

      To generate HTML from the Pod files, you'll need:

      +
        +
      • +

        A recent version of the Rakudo Perl 6 compiler

        +
      • +
      • +

        The Perl 6 modules Pod::To::HTML, Pod::To::BigPage, and URI::Escape (can be installed via zef).

        +
      • +
      • +

        Optional: GraphViz, for creating graphs of the relationships between Perl 6 types

        +
      • +
      • +

        Optional: Atom Highlights and language-perl6, for syntax highlighting

        +
      • +
      +

      To generate the documentation into the html/ folder, run:

      +
      perl6 htmlify.p6
      +
      +

      To host the documentation from a web server, have Perl 5 and Mojolicious::Lite installed, then run:

      +
      perl app.pl daemon
      +
      +

      Contributing

      +

      The documentation is written in Perl 6 Pod.

      +

      For a quick introduction to Perl 6 Pod, see Perl 6 Pod.

      +

      For full details about the Perl 6 Pod specification, see Synopsis 26, Documentation.

      +

      Adding definitions

      +

      Documentables can be defined using an =headN Pod directive, where N is greater than zero (e.g., =head1, =head2, …).

      +

      All of the paragraphs and blocks following that directive, up until the next directive of the same level, will be considered part of the documentable. So, in:

      +
      =head2 My Definition
      +
      +Some paragraphs, followed by some code:
      +
      +    my Code $examples = "amazing";
      +
      +Mind === blown.
      +
      +=head3 Minor details about My Definition
       
      -
      -
      +It's fantastic.
       
      +=head2 And now, for something completely different
      +
      +…
      +
      +
      +

      The documentable My Definition extends down to the =head2 And now….

      +

      Documentables may contain other documentables. Class documentables, for example, often contain the methods the class implements.

      +

      Definitions must be in one of the following forms to be recognized as the start of a documentable named, say, þ. First the code in the document source:

      +
      =item X<C<How to use the þ infix> | infix,þ> (This a special case, which
      +is always considered a definition)
      +
      +=item C<The þ Infix>
      +
      +=item B<The C<þ> Infix>
      +
      +=item C<Infix þ>
      +
      +=item B<Infix C<þ>>
      +
      +=item C<trait is cached> (A special case for the L<trait|/language/functions#Traits> documentables)
      +
      +
      +

      Then the results on the rendered page:

      +
        +
      • +

        How to use the þ infix (This is a special case, which is always considered a definition)

        +
      • +
      • +

        The þ Infix

        +
      • +
      • +

        The þ Infix

        +
      • +
      • +

        Infix þ

        +
      • +
      • +

        Infix þ

        +
      • +
      • +

        trait is cached (A special case for the trait documentables)

        +
      • +
      +

      These items should now be searchable by using the search field in the HTML docs.

      +

      You can add emphasis with bold ( B<> ) or italicized ( I<> ), with or without code formatting ( C<> ). Due to current parser limitations, special steps have to be taken to use X<> with other formatting codes; for example:

      +
      =item X<B<foo>|foo> a fancy subroutine
      +
      +

      renders like this

      +
        +
      • +

        foo a fancy subroutine

        +
      • +
      +

      Notice that text after a pipe ('|') has no formatting. Also note that C<> preserves spaces and treats text as verbatim.

      + +
      From f3cd92ace7794575892567c4e20555ee44893725 Mon Sep 17 00:00:00 2001 From: JJ Merelo Date: Mon, 12 Mar 2018 20:37:38 +0100 Subject: [PATCH 315/416] Test-driving travis now --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index f118d5cc..f46ceb8b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ git: before_install: - sudo apt-get update -qq - sudo apt-get install perl + - wget -O /tmp/perl6.deb https://nxadm.github.io/rakudo-pkg/latest-release.html?os=ubuntu&version=14.04&arch=amd64 && sudo dpkg -i /tmp/perl6.deb && install-zef-as-user && zef install Pod::To::HTML - curl -L http://cpanmin.us | perl - --sudo App::cpanminus - sudo cpanm --installdeps --notest Pod::Simple - sudo pip install docutils From ce7705c0c327e47db9a2e486696503ee93724948 Mon Sep 17 00:00:00 2001 From: JJ Merelo Date: Mon, 12 Mar 2018 20:42:03 +0100 Subject: [PATCH 316/416] Use direct link --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f46ceb8b..29a41d4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ git: before_install: - sudo apt-get update -qq - sudo apt-get install perl - - wget -O /tmp/perl6.deb https://nxadm.github.io/rakudo-pkg/latest-release.html?os=ubuntu&version=14.04&arch=amd64 && sudo dpkg -i /tmp/perl6.deb && install-zef-as-user && zef install Pod::To::HTML + - wget -O /tmp/perl6.deb https://github.com/nxadm/rakudo-pkg/releases/download/v2018.02.1/rakudo-pkg-Ubuntu14.04_2018.02.1-01_amd64.deb && sudo dpkg -i /tmp/perl6.deb && install-zef-as-user && zef install Pod::To::HTML - curl -L http://cpanmin.us | perl - --sudo App::cpanminus - sudo cpanm --installdeps --notest Pod::Simple - sudo pip install docutils From fed288a7551114c9d1e39dd7fef66080d51c5fde Mon Sep 17 00:00:00 2001 From: JJ Merelo Date: Mon, 12 Mar 2018 20:48:31 +0100 Subject: [PATCH 317/416] Adjusts path --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 29a41d4e..b7d7ecf1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ git: before_install: - sudo apt-get update -qq - sudo apt-get install perl - - wget -O /tmp/perl6.deb https://github.com/nxadm/rakudo-pkg/releases/download/v2018.02.1/rakudo-pkg-Ubuntu14.04_2018.02.1-01_amd64.deb && sudo dpkg -i /tmp/perl6.deb && install-zef-as-user && zef install Pod::To::HTML + - wget -O /tmp/perl6.deb https://github.com/nxadm/rakudo-pkg/releases/download/v2018.02.1/rakudo-pkg-Ubuntu14.04_2018.02.1-01_amd64.deb && sudo dpkg -i /tmp/perl6.deb && export PATH=$PATH:/.perl6/bin:/opt/rakudo-pkg/bin && install-zef-as-user && zef install Pod::To::HTML - curl -L http://cpanmin.us | perl - --sudo App::cpanminus - sudo cpanm --installdeps --notest Pod::Simple - sudo pip install docutils From d0f9a825fb2db1c30db769c771ec3ffb531ac75d Mon Sep 17 00:00:00 2001 From: JJ Merelo Date: Mon, 12 Mar 2018 21:27:24 +0100 Subject: [PATCH 318/416] Adds POD6 to README. Closes #907 when accepted (along with the rest of the commits). --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b00b9023..8bb045bc 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,8 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a * [.asciidoc, .adoc, .asc](http://asciidoc.org/) -- `gem install asciidoctor` (http://asciidoctor.org) * [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::XHTML` comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN. - +* [.pod6](https://docs.perl6.org/language/pod) -- No additional + dependency. Installation ----------- From 005be7eb52d0e6850b08b884c5e21e2882006503 Mon Sep 17 00:00:00 2001 From: Pali Date: Thu, 21 Jun 2018 09:48:06 +0200 Subject: [PATCH 319/416] POD: Create anchor for every =item directive Setting anchor_items to true is needed for creating link to specific =item directive. By default Pod::Simple::XHTML module does not enable it. Webpage https://metacpan.org/ for POD documentation has it already enabled and linking to =item directive is working fine. Lot of POD documents already link to =item directives and without setting anchor_items to true documents are semi-broken on GitHub. --- lib/github/commands/pod2html | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/github/commands/pod2html b/lib/github/commands/pod2html index faf46e4a..aaed6022 100755 --- a/lib/github/commands/pod2html +++ b/lib/github/commands/pod2html @@ -7,6 +7,7 @@ my $p = Pod::Simple::XHTML->new; $p->html_header(''); $p->html_footer(''); $p->perldoc_url_prefix('https://metacpan.org/pod/'); +$p->anchor_items(1); $p->strip_verbatim_indent(sub { my $lines = shift; (my $indent = $lines->[0]) =~ s/\S.*//; From 4359089b3d39585bd7a98808ec540264105887cd Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Fri, 29 Jun 2018 12:21:15 +1000 Subject: [PATCH 320/416] :gem: bump to 2.0.1 --- HISTORY.md | 4 ++++ lib/github-markup.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index b42ecbe6..ecb6c52b 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,7 @@ +## 2.0.1 - 2018-06-29 + +* Create anchor for every =item directive in POD files [#1165](https://github.com/github/markup/pull/1165) + ## 2.0.0 - 2018-01-31 * Remove filesystem access [#1157](https://github.com/github/markup/pull/1157) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index bb6e258a..f29810cf 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '2.0.0' + VERSION = '2.0.1' Version = VERSION end end From d8a547cc2ebac5601d488f34b2aa63e95f6879c6 Mon Sep 17 00:00:00 2001 From: Lee Dohm <1038121+lee-dohm@users.noreply.github.com> Date: Mon, 27 Aug 2018 16:53:04 -0700 Subject: [PATCH 321/416] Add Code of Conduct --- CODE_OF_CONDUCT.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..16e77760 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [opensource@github.com](mailto:opensource@github.com). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [https://contributor-covenant.org/version/1/4][version] + +[homepage]: https://contributor-covenant.org +[version]: https://contributor-covenant.org/version/1/4/ From 2b0bdcfa322ff2c282b5c7dbdf19d69bf6085b1d Mon Sep 17 00:00:00 2001 From: Lee Dohm <1038121+lee-dohm@users.noreply.github.com> Date: Mon, 27 Aug 2018 17:33:05 -0700 Subject: [PATCH 322/416] Update CONTRIBUTING guide to point to Code of Conduct --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 98435b25..f6a81e94 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,9 +2,9 @@ Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE). -This project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to honor this code. +This project adheres to a [Code of Conduct][code-of-conduct]. By participating, you are expected to honor this code. -[code-of-conduct]: http://todogroup.org/opencodeofconduct/#GitHub%20Markup/opensource@github.com +[code-of-conduct]: CODE_OF_CONDUCT.md This library's only job is to decide which markup format to use and call out to an external library to convert the markup to HTML (see the [README](README.md) for more information on how markup is rendered on GitHub.com). From 56a58500418779ee3e06db2bfcd86654acbf2ce7 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 8 Oct 2018 09:36:25 +1100 Subject: [PATCH 323/416] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b4ab5226..1362c56d 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ GitHub Markup This library is the first step of a journey that every markup file in a repository goes on before it is rendered on GitHub.com: -1. This library converts the raw markup to HTML. See the list of [supported markup formats](#markups) below. -1. The HTML is sanitized, aggressively removing things that could harm you and your kin—such as `script` tags, inline-styles, and `class` or `id` attributes. See the [sanitization filter](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/sanitization_filter.rb) for the full whitelist. +1. This library selects an _underlying library_ to convert the raw markup to HTML. See the list of [supported markup formats](#markups) below. +1. The HTML is sanitized, aggressively removing things that could harm you and your kin—such as `script` tags, inline-styles, and `class` or `id` attributes. 1. Syntax highlighting is performed on code blocks. See [github/linguist](https://github.com/github/linguist#syntax-highlighting) for more information about syntax highlighting. 1. The HTML is passed through other filters in the [html-pipeline](https://github.com/jch/html-pipeline) that add special sauce, such as [emoji](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/emoji_filter.rb), [task lists](https://github.com/github/task_list/blob/master/lib/task_list/filter.rb), [named anchors](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/toc_filter.rb), [CDN caching for images](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/camo_filter.rb), and [autolinking](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/autolink_filter.rb). 1. The resulting HTML is rendered on GitHub.com. From b88d561dea16af841b35af204ce9d15c005c97fb Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 15 Oct 2018 09:29:23 +1100 Subject: [PATCH 324/416] don't render rmd as markdown --- lib/github/markup/markdown.rb | 2 +- test/markup_test.rb | 4 +--- test/markups/README.rmd | 3 --- test/markups/README.rmd.html | 6 ------ 4 files changed, 2 insertions(+), 13 deletions(-) delete mode 100644 test/markups/README.rmd delete mode 100644 test/markups/README.rmd.html diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index d0546056..c51476fd 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -29,7 +29,7 @@ class Markdown < Implementation def initialize super( - /md|rmd|mkdn?|mdwn|mdown|markdown|litcoffee/i, + /md|mkdn?|mdwn|mdown|markdown|litcoffee/i, ["Markdown", "RMarkdown", "Literate CoffeeScript"]) end diff --git a/test/markup_test.rb b/test/markup_test.rb index 8e02ed21..b324c1ab 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -1,4 +1,4 @@ -# encoding: UTF-8 +# encoding: utf-8 $LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib" @@ -78,8 +78,6 @@ def call def test_knows_what_it_can_and_cannot_render assert_equal false, GitHub::Markup.can_render?('README.html', '

      Title

      ') assert_equal true, GitHub::Markup.can_render?('README.markdown', '=== Title') - assert_equal true, GitHub::Markup.can_render?('README.rmd', '=== Title') - assert_equal true, GitHub::Markup.can_render?('README.Rmd', '=== Title') assert_equal false, GitHub::Markup.can_render?('README.cmd', 'echo 1') assert_equal true, GitHub::Markup.can_render?('README.litcoffee', 'Title') end diff --git a/test/markups/README.rmd b/test/markups/README.rmd deleted file mode 100644 index f9f5f702..00000000 --- a/test/markups/README.rmd +++ /dev/null @@ -1,3 +0,0 @@ -# Title -* One -* Two diff --git a/test/markups/README.rmd.html b/test/markups/README.rmd.html deleted file mode 100644 index 39644656..00000000 --- a/test/markups/README.rmd.html +++ /dev/null @@ -1,6 +0,0 @@ -

      Title

      - -
        -
      • One
      • -
      • Two
      • -
      \ No newline at end of file From e8a9b373269d33877a82ca5bbf3fd645ec8a1f3d Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 15 Oct 2018 09:52:50 +1100 Subject: [PATCH 325/416] :gem: bump to 2.0.2 --- HISTORY.md | 4 ++++ lib/github-markup.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index ecb6c52b..a6c31006 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,7 @@ +## 2.0.2 - 2018-10-15 + +* Don't render rmd files as Markdown [#1235](https://github.com/github/markup/pull/1235) + ## 2.0.1 - 2018-06-29 * Create anchor for every =item directive in POD files [#1165](https://github.com/github/markup/pull/1165) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index f29810cf..f39d32a7 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '2.0.1' + VERSION = '2.0.2' Version = VERSION end end From 8f5eea157936077fd9f26b0171bb5e033f45fb0b Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Thu, 18 Oct 2018 13:25:21 +1100 Subject: [PATCH 326/416] markup options, cleanup --- Gemfile | 2 +- lib/github/markup.rb | 56 ++++++++++----------- lib/github/markup/command_implementation.rb | 2 +- lib/github/markup/gem_implementation.rb | 6 +-- lib/github/markup/implementation.rb | 2 +- lib/github/markup/markdown.rb | 21 ++++---- lib/github/markup/rdoc.rb | 2 +- lib/github/markups.rb | 10 ++-- test/markup_test.rb | 7 ++- 9 files changed, 57 insertions(+), 51 deletions(-) diff --git a/Gemfile b/Gemfile index a5a58995..cbd97b7b 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ gem "posix-spawn", :platforms => :ruby gem "redcarpet", :platforms => :ruby gem "kramdown", :platforms => :jruby gem "RedCloth" -gem "commonmarker", "~> 0.14.12" +gem "commonmarker", "~> 0.18.1" gem "rdoc", "~>3.6" gem "org-ruby", "= 0.9.9" gem "creole", "~>0.3.6" diff --git a/lib/github/markup.rb b/lib/github/markup.rb index 84c1e45f..5a78d006 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -20,38 +20,36 @@ module Markups MARKUP_RST = :rst MARKUP_TEXTILE = :textile end - + module Markup extend self - + @@markups = {} def markups @@markups end - + def markup_impls markups.values end def preload! - markup_impls.each do |markup| - markup.load - end + markup_impls.each(&:load) end - def render(filename, content, symlink = false) - if impl = renderer(filename, content, symlink) - impl.render(filename, content) + def render(filename, content, symlink: false, options: {}) + if (impl = renderer(filename, content, symlink: symlink)) + impl.render(filename, content, options: options) else content end end - + def render_s(symbol, content) - if content.nil? - raise ArgumentError, 'Can not render a nil.' - elsif markups.has_key?(symbol) + raise ArgumentError, 'Can not render a nil.' if content.nil? + + if markups.key?(symbol) markups[symbol].render(nil, content) else content @@ -59,11 +57,12 @@ def render_s(symbol, content) end def markup(symbol, gem_name, regexp, languages, opts = {}, &block) - markup_impl(symbol, GemImplementation.new(regexp, languages, gem_name, &block)) + impl = GemImplementation.new(regexp, languages, gem_name, &block) + markup_impl(symbol, impl) end - + def markup_impl(symbol, impl) - if markups.has_key?(symbol) + if markups.key?(symbol) raise ArgumentError, "The '#{symbol}' symbol is already defined." end markups[symbol] = impl @@ -74,25 +73,26 @@ def command(symbol, command, regexp, languages, name, &block) command = file end - markup_impl(symbol, CommandImplementation.new(regexp, languages, command, name, &block)) + impl = CommandImplementation.new(regexp, languages, command, name, &block) + markup_impl(symbol, impl) end - def can_render?(filename, content, symlink = false) - !!renderer(filename, content, symlink) + def can_render?(filename, content, symlink: false) + renderer(filename, content, symlink: symlink) != nil end - def renderer(filename, content, symlink = false) - language = language(filename, content, symlink) - markup_impls.find { |impl| + def renderer(filename, content, symlink: false) + language = language(filename, content, symlink: symlink) + markup_impls.find do |impl| impl.match?(filename, language) - } + end end - def language(filename, content, symlink = false) - if defined?(::Linguist) - blob = Linguist::Blob.new(filename, content, symlink: symlink) - return Linguist.detect(blob, allow_empty: true) - end + def language(filename, content, symlink: false) + return unless defined?(::Linguist) + + blob = Linguist::Blob.new(filename, content, symlink: symlink) + Linguist.detect(blob, allow_empty: true) end # Define markups diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index ed67113c..4ecf2ad5 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -22,7 +22,7 @@ def initialize(regexp, languages, command, name, &block) @name = name end - def render(filename, content) + def render(filename, content, options: {}) rendered = execute(command, content) rendered = rendered.to_s.empty? ? content : rendered call_block(rendered, content) diff --git a/lib/github/markup/gem_implementation.rb b/lib/github/markup/gem_implementation.rb index 29582ce8..843717e6 100644 --- a/lib/github/markup/gem_implementation.rb +++ b/lib/github/markup/gem_implementation.rb @@ -12,14 +12,14 @@ def initialize(regexp, languages, gem_name, &renderer) end def load - return if @loaded + return if defined?(@loaded) && @loaded require gem_name @loaded = true end - def render(filename, content) + def render(filename, content, options: {}) load - renderer.call(filename, content) + renderer.call(filename, content, options: options) end def name diff --git a/lib/github/markup/implementation.rb b/lib/github/markup/implementation.rb index aaa92534..f2854e22 100644 --- a/lib/github/markup/implementation.rb +++ b/lib/github/markup/implementation.rb @@ -16,7 +16,7 @@ def load # no-op by default end - def render(filename, content) + def render(filename, content, options: {}) raise NotImplementedError, "subclasses of GitHub::Markup::Implementation must define #render" end diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index c51476fd..aa012d48 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -4,25 +4,26 @@ module GitHub module Markup class Markdown < Implementation MARKDOWN_GEMS = { - "commonmarker" => proc { |content| - CommonMarker.render_html(content, :GITHUB_PRE_LANG, [:tagfilter, :autolink, :table, :strikethrough]) + "commonmarker" => proc { |content, options: {}| + commonmarker_opts = [:GITHUB_PRE_LANG].concat(options.fetch(:commonmarker_opts, [])) + CommonMarker.render_html(content, commonmarker_opts, [:tagfilter, :autolink, :table, :strikethrough]) }, - "github/markdown" => proc { |content| + "github/markdown" => proc { |content, options: {}| GitHub::Markdown.render(content) }, - "redcarpet" => proc { |content| + "redcarpet" => proc { |content, options: {}| Redcarpet::Markdown.new(Redcarpet::Render::HTML).render(content) }, - "rdiscount" => proc { |content| + "rdiscount" => proc { |content, options: {}| RDiscount.new(content).to_html }, - "maruku" => proc { |content| + "maruku" => proc { |content, options: {}| Maruku.new(content).to_html }, - "kramdown" => proc { |content| + "kramdown" => proc { |content, options: {}| Kramdown::Document.new(content).to_html }, - "bluecloth" => proc { |content| + "bluecloth" => proc { |content, options: {}| BlueCloth.new(content).to_html }, } @@ -44,9 +45,9 @@ def load raise LoadError, "no suitable markdown gem found" end - def render(filename, content) + def render(filename, content, options: {}) load - @renderer.call(content) + @renderer.call(content, options: options) end def name diff --git a/lib/github/markup/rdoc.rb b/lib/github/markup/rdoc.rb index 749618d9..32cb4194 100644 --- a/lib/github/markup/rdoc.rb +++ b/lib/github/markup/rdoc.rb @@ -9,7 +9,7 @@ def initialize super(/rdoc/, ["RDoc"]) end - def render(filename, content) + def render(filename, content, options: {}) if ::RDoc::VERSION.to_i >= 4 h = ::RDoc::Markup::ToHtml.new(::RDoc::Options.new) else diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 61138e85..440e0dbf 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -4,30 +4,30 @@ markup_impl(::GitHub::Markups::MARKUP_MARKDOWN, ::GitHub::Markup::Markdown.new) -markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, /textile/, ["Textile"]) do |filename, content| +markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, /textile/, ["Textile"]) do |filename, content, options: {}| RedCloth.new(content).to_html end markup_impl(::GitHub::Markups::MARKUP_RDOC, GitHub::Markup::RDoc.new) -markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', /org/, ["Org"]) do |filename, content| +markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', /org/, ["Org"]) do |filename, content, options: {}| Orgmode::Parser.new(content, { :allow_include_files => false, :skip_syntax_highlight => true }).to_html end -markup(::GitHub::Markups::MARKUP_CREOLE, :creole, /creole/, ["Creole"]) do |filename, content| +markup(::GitHub::Markups::MARKUP_CREOLE, :creole, /creole/, ["Creole"]) do |filename, content, options: {}| Creole.creolize(content) end -markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, /mediawiki|wiki/, ["MediaWiki"]) do |filename, content| +markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, /mediawiki|wiki/, ["MediaWiki"]) do |filename, content, options: {}| wikicloth = WikiCloth::WikiCloth.new(:data => content) WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS << 'tt' unless WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS.include?('tt') wikicloth.to_html(:noedit => true) end -markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/, ["AsciiDoc"]) do |filename, content| +markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/, ["AsciiDoc"]) do |filename, content, options: {}| attributes = { 'showtitle' => '@', 'idprefix' => '', diff --git a/test/markup_test.rb b/test/markup_test.rb index b324c1ab..eedaccdf 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -102,7 +102,7 @@ def test_raises_error_if_command_exits_non_zero GitHub::Markup.command(:doesntmatter, 'test/fixtures/fail.sh', /fail/, ['Java'], 'fail') assert GitHub::Markup.can_render?('README.java', 'stop swallowing errors') begin - GitHub::Markup.render('README.java', "stop swallowing errors", false) + GitHub::Markup.render('README.java', "stop swallowing errors", symlink: false) rescue GitHub::Markup::CommandError => e assert_equal "failure message", e.message else @@ -114,4 +114,9 @@ def test_preserve_markup content = "Noël" assert_equal content.encoding.name, GitHub::Markup.render('Foo.rst', content).encoding.name end + + def test_commonmarker_options + assert_equal "

      hello world

      \n", GitHub::Markup.render("test.md", "hello world") + assert_equal "

      hello world

      \n", GitHub::Markup.render("test.md", "hello world", options: {commonmarker_opts: [:UNSAFE]}) + end end From 3405de8b8fe17f40fad34c9697853176bff16057 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Thu, 18 Oct 2018 15:55:34 +1100 Subject: [PATCH 327/416] more README clarity --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1362c56d..8d619414 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ GitHub Markup ============= -This library is the first step of a journey that every markup file in a repository goes on before it is rendered on GitHub.com: +This library is the **first step** of a journey that every markup file in a repository goes on before it is rendered on GitHub.com: -1. This library selects an _underlying library_ to convert the raw markup to HTML. See the list of [supported markup formats](#markups) below. +1. `github-markup` selects an _underlying library_ to convert the raw markup to HTML. See the list of [supported markup formats](#markups) below. 1. The HTML is sanitized, aggressively removing things that could harm you and your kin—such as `script` tags, inline-styles, and `class` or `id` attributes. 1. Syntax highlighting is performed on code blocks. See [github/linguist](https://github.com/github/linguist#syntax-highlighting) for more information about syntax highlighting. 1. The HTML is passed through other filters in the [html-pipeline](https://github.com/jch/html-pipeline) that add special sauce, such as [emoji](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/emoji_filter.rb), [task lists](https://github.com/github/task_list/blob/master/lib/task_list/filter.rb), [named anchors](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/toc_filter.rb), [CDN caching for images](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/camo_filter.rb), and [autolinking](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/autolink_filter.rb). From d8048aedc63a01c7486df8b64abd7c6d6b6cd0c6 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Thu, 18 Oct 2018 15:57:55 +1100 Subject: [PATCH 328/416] :gem: bump to 3.0.0 --- HISTORY.md | 5 +++++ lib/github-markup.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index a6c31006..97f3e825 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,8 @@ +## 3.0.0 - 2018-10-18 + +* Allow passing options through to CommonMarker [#1236](https://github.com/github/markup/pull/1236) +* Symlink option is now a keyword arg [#1236](https://github.com/github/markup/pull/1236) + ## 2.0.2 - 2018-10-15 * Don't render rmd files as Markdown [#1235](https://github.com/github/markup/pull/1235) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index f39d32a7..cb58c742 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '2.0.2' + VERSION = '3.0.0' Version = VERSION end end From c45c7e60b25ade1b42e6c9fc67e3c7d93d79d7ab Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Fri, 19 Oct 2018 09:52:28 +1100 Subject: [PATCH 329/416] remove RMarkdown from the linguist match list --- lib/github/markup/markdown.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index aa012d48..11cf662d 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -31,7 +31,7 @@ class Markdown < Implementation def initialize super( /md|mkdn?|mdwn|mdown|markdown|litcoffee/i, - ["Markdown", "RMarkdown", "Literate CoffeeScript"]) + ["Markdown", "Literate CoffeeScript"]) end def load From 91736268b38d869df6ef1d4ea9902f2e8c82c69b Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Fri, 19 Oct 2018 09:55:59 +1100 Subject: [PATCH 330/416] :gem: bump to 3.0.1 --- HISTORY.md | 4 ++++ lib/github-markup.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 97f3e825..6ead2e6d 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,7 @@ +## 3.0.1 - 2018-10-19 + +* Remove linguist-detected RMarkdown files from the Markdown renderer [#1237](https://github.com/github/markup/pull/1237) + ## 3.0.0 - 2018-10-18 * Allow passing options through to CommonMarker [#1236](https://github.com/github/markup/pull/1236) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index cb58c742..259319e2 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '3.0.0' + VERSION = '3.0.1' Version = VERSION end end From e70b3eedb7ac9f27b4289a8f7b541a8e971f6bf7 Mon Sep 17 00:00:00 2001 From: Jordan Webb Date: Thu, 1 Nov 2018 19:41:26 +0100 Subject: [PATCH 331/416] Clarifying dependencies. Co-Authored-By: JJ --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8bb045bc..71f2e5ed 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a * [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::XHTML` comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN. * [.pod6](https://docs.perl6.org/language/pod) -- No additional - dependency. + dependency beyond perl6 `Pod::To::HTML` (in stdlib) Installation ----------- From 11a355bba9c6d9f25836b9be09262d2362ca9177 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Wed, 7 Nov 2018 10:38:05 +1100 Subject: [PATCH 332/416] we no longer use html-pipeline for this --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8d619414..be9ef8d1 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This library is the **first step** of a journey that every markup file in a repo 1. `github-markup` selects an _underlying library_ to convert the raw markup to HTML. See the list of [supported markup formats](#markups) below. 1. The HTML is sanitized, aggressively removing things that could harm you and your kin—such as `script` tags, inline-styles, and `class` or `id` attributes. 1. Syntax highlighting is performed on code blocks. See [github/linguist](https://github.com/github/linguist#syntax-highlighting) for more information about syntax highlighting. -1. The HTML is passed through other filters in the [html-pipeline](https://github.com/jch/html-pipeline) that add special sauce, such as [emoji](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/emoji_filter.rb), [task lists](https://github.com/github/task_list/blob/master/lib/task_list/filter.rb), [named anchors](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/toc_filter.rb), [CDN caching for images](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/camo_filter.rb), and [autolinking](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/autolink_filter.rb). +1. The HTML is passed through other filters that add special sauce, such as emoji, task lists, named anchors, CDN caching for images, and autolinking. 1. The resulting HTML is rendered on GitHub.com. Please note that **only the first step** is covered by this gem — the rest happens on GitHub.com. In particular, `markup` itself does no sanitization of the resulting HTML, as it expects that to be covered by whatever pipeline is consuming the HTML. From 811148744b9752e22d3c6a1db87bddf01c5107c1 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 10 Dec 2018 12:50:54 +1100 Subject: [PATCH 333/416] cleanup/fixes --- .travis.yml | 6 ++- README.md | 2 +- lib/github/markups.rb | 2 +- test/markup_test.rb | 1 + test/markups/README.pod6.html | 82 +++++++++++++++++------------------ 5 files changed, 46 insertions(+), 47 deletions(-) diff --git a/.travis.yml b/.travis.yml index b7d7ecf1..e409f596 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,9 +14,11 @@ notifications: git: depth: 10 before_install: + - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 379CE192D401AB61 + - echo "deb https://dl.bintray.com/nxadm/rakudo-pkg-debs `lsb_release -cs` main" | sudo tee -a /etc/apt/sources.list.d/rakudo-pkg.list - sudo apt-get update -qq - - sudo apt-get install perl - - wget -O /tmp/perl6.deb https://github.com/nxadm/rakudo-pkg/releases/download/v2018.02.1/rakudo-pkg-Ubuntu14.04_2018.02.1-01_amd64.deb && sudo dpkg -i /tmp/perl6.deb && export PATH=$PATH:/.perl6/bin:/opt/rakudo-pkg/bin && install-zef-as-user && zef install Pod::To::HTML + - sudo apt-get install perl rakudo-pkg + - export PATH=$PATH:/.perl6/bin:/opt/rakudo-pkg/bin && install-zef-as-user && zef install Pod::To::HTML - curl -L http://cpanmin.us | perl - --sudo App::cpanminus - sudo cpanm --installdeps --notest Pod::Simple - sudo pip install docutils diff --git a/README.md b/README.md index f023abf6..0651c33c 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ or bundle install ``` -from this directory +from this directory. Usage ----- diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 518c52cc..585d54b0 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -52,4 +52,4 @@ ) command(::GitHub::Markups::MARKUP_POD6, :pod62html, /pod6/, ["Perl 6"], "pod6") -command(::GitHub::Markups::MARKUP_POD, :pod2html, /pod$/, ["Pod"], "pod") +command(::GitHub::Markups::MARKUP_POD, :pod2html, /pod/, ["Pod"], "pod") diff --git a/test/markup_test.rb b/test/markup_test.rb index e08b7c12..86c83ee7 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -90,6 +90,7 @@ def test_each_render_has_a_name assert_equal "asciidoctor", GitHub::Markup.renderer('README.adoc', '== Title').name assert_equal "restructuredtext", GitHub::Markup.renderer('README.rst', 'Title').name assert_equal "pod", GitHub::Markup.renderer('README.pod', '=head1').name + assert_equal "pod6", GitHub::Markup.renderer('README.pod6', '=begin pod').name end def test_rendering_by_symbol diff --git a/test/markups/README.pod6.html b/test/markups/README.pod6.html index c0039bc8..5f56257f 100644 --- a/test/markups/README.pod6.html +++ b/test/markups/README.pod6.html @@ -1,35 +1,28 @@ - About the Docs - - - /* code gets the browser-default font - * kbd gets a slightly less common monospace font - * samp gets the hard pixelly fonts - */ - kbd { font-family: "Droid Sans Mono", "Luxi Mono", "Inconsolata", monospace } - samp { font-family: "Terminus", "Courier", "Lucida Console", monospace } - /* WHATWG HTML frowns on the use of <u> because it looks like a link, - * so we make it not look like one. - */ - u { text-decoration: none } - .nested { - margin-left: 3em; - } - // footnote things: - aside, u { opacity: 0.7 } - a[id^="fn-"]:target { background: #ff0 } - - - - - - -
      - - -

      About the Docs

      -

      Meta-documentation

      - + + + About the Docs + + + kbd { font-family: "Droid Sans Mono", "Luxi Mono", "Inconsolata", monospace } + samp { font-family: "Terminus", "Courier", "Lucida Console", monospace } + u { text-decoration: none } + .nested { + margin-left: 3em; + } + aside, u { opacity: 0.7 } + a[id^="fn-"]:target { background: #ff0 } + + + + + + +
      + +

      About the Docs

      +

      Meta-documentation

      +

      Table of Contents

      @@ -52,24 +45,24 @@

      Table of Contents

      -
      -

      This document collection represents the on-going effort to document the Perl 6 programming language with the goals of being: comprehensive; easy to use; easy to navigate; and useful to both newcomers and experienced Perl 6 programmers.

      +
      +

      This document collection represents the on-going effort to document the Perl 6 programming language with the goals of being: comprehensive; easy to use; easy to navigate; and useful to both newcomers and experienced Perl 6 programmers.

      An HTML version of the documentation is located online at https://docs.perl6.org.

      The official source for this documentation is located at perl6/doc on GitHub.

      -

      This particular document is a quick overview of the process described in more detail in CONTRIBUTING on GitHub. This document also provides a short introduction to writing Perl 6 Pod files, which can be rendered into HTML and other formats.

      +

      This particular document is a quick overview of the process described in more detail in CONTRIBUTING on GitHub. This document also provides a short introduction to writing Perl 6 Pod files, which can be rendered into HTML and other formats.

      Structure

      -

      All of the documentation is written in Perl 6 Pod and kept in the doc/ directory, and the doc/Language/ and doc/Type/ sub-directories. These files are processed as collections of definitions or "documentables", which are then post-processed and linked together.

      +

      All of the documentation is written in Perl 6 Pod and kept in the doc/ directory, and the doc/Language/ and doc/Type/ sub-directories. These files are processed as collections of definitions or "documentables", which are then post-processed and linked together.

      Generating HTML from Pod

      To generate HTML from the Pod files, you'll need:

      • -

        A recent version of the Rakudo Perl 6 compiler

        +

        A recent version of the Rakudo Perl 6 compiler

      • -

        The Perl 6 modules Pod::To::HTML, Pod::To::BigPage, and URI::Escape (can be installed via zef).

        +

        The Perl 6 modules Pod::To::HTML, Pod::To::BigPage, and URI::Escape (can be installed via zef).

      • -

        Optional: GraphViz, for creating graphs of the relationships between Perl 6 types

        +

        Optional: GraphViz, for creating graphs of the relationships between Perl 6 types

      • Optional: Atom Highlights and language-perl6, for syntax highlighting

        @@ -78,13 +71,13 @@

        Generating HTML from Pod

        To generate the documentation into the html/ folder, run:

        perl6 htmlify.p6
         
        -

        To host the documentation from a web server, have Perl 5 and Mojolicious::Lite installed, then run:

        +

        To host the documentation from a web server, have Perl 5 and Mojolicious::Lite installed, then run:

        perl app.pl daemon
         

        Contributing

        -

        The documentation is written in Perl 6 Pod.

        -

        For a quick introduction to Perl 6 Pod, see Perl 6 Pod.

        -

        For full details about the Perl 6 Pod specification, see Synopsis 26, Documentation.

        +

        The documentation is written in Perl 6 Pod.

        +

        For a quick introduction to Perl 6 Pod, see Perl 6 Pod.

        +

        For full details about the Perl 6 Pod specification, see Synopsis 26, Documentation.

        Adding definitions

        Documentables can be defined using an =headN Pod directive, where N is greater than zero (e.g., =head1, =head2, …).

        All of the paragraphs and blocks following that directive, up until the next directive of the same level, will be considered part of the documentable. So, in:

        @@ -155,4 +148,7 @@

        Adding definitions

      Notice that text after a pipe ('|') has no formatting. Also note that C<> preserves spaces and treats text as verbatim.

      -
      +
      + + + From f7a96cc5a07c97e93bcfe6cce2f8c8d46dc61c9f Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 10 Dec 2018 12:50:58 +1100 Subject: [PATCH 334/416] add testing Dockerfile --- .dockerignore | 1 + Dockerfile | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..94143827 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..aa0f09aa --- /dev/null +++ b/Dockerfile @@ -0,0 +1,39 @@ +FROM ubuntu:trusty + +RUN apt-get update -qq +RUN apt-get install -y apt-transport-https + +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 379CE192D401AB61 +RUN echo "deb https://dl.bintray.com/nxadm/rakudo-pkg-debs `lsb_release -cs` main" | tee -a /etc/apt/sources.list.d/rakudo-pkg.list +RUN apt-get update -qq + +RUN apt-get install -y \ + perl rakudo-pkg curl git build-essential python python-pip \ + libssl-dev libreadline-dev zlib1g-dev \ + libicu-dev cmake pkg-config + +ENV PATH $PATH:/opt/rakudo-pkg/bin +RUN install-zef-as-user && zef install Pod::To::HTML + +RUN curl -L http://cpanmin.us | perl - App::cpanminus +RUN cpanm --installdeps --notest Pod::Simple + +RUN pip install docutils + +ENV PATH $PATH:/root/.rbenv/bin:/root/.rbenv/shims +RUN curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash +RUN rbenv install 2.4.1 +RUN rbenv global 2.4.1 +RUN rbenv rehash + +RUN gem install bundler + +WORKDIR /data/github-markup +COPY github-markup.gemspec . +COPY Gemfile . +COPY Gemfile.lock . +COPY lib/github-markup.rb lib/github-markup.rb +RUN bundle + +ENV LC_ALL en_US.UTF-8 +RUN locale-gen en_US.UTF-8 From 9c5ea1a94050789108afbebea8f18c2d64da20eb Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 10 Dec 2018 13:04:05 +1100 Subject: [PATCH 335/416] use linguist 7 --- github-markup.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index 7c663d09..acfacd2e 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -23,5 +23,5 @@ Gem::Specification.new do |s| s.add_development_dependency 'sanitize', '~> 2.1', '>= 2.1.0' s.add_development_dependency 'nokogiri', '~> 1.8.1' s.add_development_dependency 'nokogiri-diff', '~> 0.2.0' - s.add_development_dependency "github-linguist", "~> 6.0" + s.add_development_dependency "github-linguist", "~> 7" end From 83dfbbb31460f9ac7079f212c7bf02413ed81b05 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 10 Dec 2018 13:31:01 +1100 Subject: [PATCH 336/416] we're calling it Pod 6 --- lib/github/markups.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 585d54b0..c900594d 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -51,5 +51,5 @@ "restructuredtext" ) -command(::GitHub::Markups::MARKUP_POD6, :pod62html, /pod6/, ["Perl 6"], "pod6") +command(::GitHub::Markups::MARKUP_POD6, :pod62html, /pod6/, ["Pod 6"], "pod6") command(::GitHub::Markups::MARKUP_POD, :pod2html, /pod/, ["Pod"], "pod") From e953f7083002053b72d461f1dc743ccb04f6cdef Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Tue, 11 Dec 2018 10:05:15 +1100 Subject: [PATCH 337/416] trim heading/leading text --- lib/github/commands/pod62html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/github/commands/pod62html b/lib/github/commands/pod62html index 28937eca..0416c7bc 100755 --- a/lib/github/commands/pod62html +++ b/lib/github/commands/pod62html @@ -3,4 +3,8 @@ use v6; use Pod::To::HTML; -put Pod::To::HTML.render(slurp); + +$_ = Pod::To::HTML.render(slurp); +s:s{\<\!doctype html\>.*\
      \<\/div\>\s*} = ""; +s:s{\s*\<\/div\>\s*\<\/body\>\s*\<\/html\>\s*} = ""; +.put; From 7d24dd18b7e187d1892e389410295be9f942b487 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Tue, 11 Dec 2018 10:24:51 +1100 Subject: [PATCH 338/416] raise when lang missing --- lib/github/markup/implementation.rb | 6 +++++- test/markups/README.pod6 | 0 2 files changed, 5 insertions(+), 1 deletion(-) mode change 100755 => 100644 test/markups/README.pod6 diff --git a/lib/github/markup/implementation.rb b/lib/github/markup/implementation.rb index f2854e22..458ab0d8 100644 --- a/lib/github/markup/implementation.rb +++ b/lib/github/markup/implementation.rb @@ -8,7 +8,11 @@ def initialize(regexp, languages) @regexp = regexp if defined?(::Linguist) - @languages = languages.map {|l| Linguist::Language[l]} + @languages = languages.map do |l| + lang = Linguist::Language[l] + raise "no match for language #{l.inspect}" if lang.nil? + lang + end end end diff --git a/test/markups/README.pod6 b/test/markups/README.pod6 old mode 100755 new mode 100644 From ed385c6a840cd685f9b9e580bdb935efe0f182e8 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Tue, 11 Dec 2018 10:32:06 +1100 Subject: [PATCH 339/416] update pod6 test --- test/markups/README.pod6 | 1 - test/markups/README.pod6.html | 30 ++---------------------------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/test/markups/README.pod6 b/test/markups/README.pod6 index a153b1bb..c780c5be 100644 --- a/test/markups/README.pod6 +++ b/test/markups/README.pod6 @@ -149,4 +149,3 @@ Notice that text after a pipe ('|') has no formatting. Also note that B > preserves spaces and treats text as verbatim. =end pod -# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6 diff --git a/test/markups/README.pod6.html b/test/markups/README.pod6.html index 5f56257f..3b55d843 100644 --- a/test/markups/README.pod6.html +++ b/test/markups/README.pod6.html @@ -1,26 +1,4 @@ - - - - About the Docs - - - kbd { font-family: "Droid Sans Mono", "Luxi Mono", "Inconsolata", monospace } - samp { font-family: "Terminus", "Courier", "Lucida Console", monospace } - u { text-decoration: none } - .nested { - margin-left: 3em; - } - aside, u { opacity: 0.7 } - a[id^="fn-"]:target { background: #ff0 } - - - - - - -
      - -

      About the Docs

      +

      About the Docs

      Meta-documentation

      @@ -147,8 +125,4 @@

      Adding definitions

      Notice that text after a pipe ('|') has no formatting. Also note that C<> preserves spaces and treats text as verbatim.

      - - - - - + \ No newline at end of file From bf3ad46e3102571e471cb44a3f8bb951da1db26e Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Tue, 11 Dec 2018 11:03:08 +1100 Subject: [PATCH 340/416] vend Pod::To::HTML --- .gitignore | 3 +-- .gitmodules | 3 +++ lib/github/commands/pod62html | 2 +- vendor/Pod-To-HTML | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .gitmodules create mode 160000 vendor/Pod-To-HTML diff --git a/.gitignore b/.gitignore index c8263789..589d00dc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ pkg/ .bundle Gemfile.lock -vendor/ .project .buildpath -*~ \ No newline at end of file +*~ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..1875291b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vendor/Pod-To-HTML"] + path = vendor/Pod-To-HTML + url = https://github.com/perl6/Pod-To-HTML diff --git a/lib/github/commands/pod62html b/lib/github/commands/pod62html index 0416c7bc..e9e5316a 100755 --- a/lib/github/commands/pod62html +++ b/lib/github/commands/pod62html @@ -1,7 +1,7 @@ #!/usr/bin/env perl6 use v6; - +use lib $*PROGRAM.IO.parent.add: '../../../vendor/Pod-To-HTML'; use Pod::To::HTML; $_ = Pod::To::HTML.render(slurp); diff --git a/vendor/Pod-To-HTML b/vendor/Pod-To-HTML new file mode 160000 index 00000000..f5ea68c2 --- /dev/null +++ b/vendor/Pod-To-HTML @@ -0,0 +1 @@ +Subproject commit f5ea68c2bb2145dc79f26bf1d9489acb36c0461c From 27e4eea56f198c7a708b310db0836eae047cda76 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Tue, 11 Dec 2018 11:13:33 +1100 Subject: [PATCH 341/416] add Pod-To-HTML to gem --- github-markup.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/github-markup.gemspec b/github-markup.gemspec index acfacd2e..b143e768 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -12,6 +12,7 @@ Gem::Specification.new do |s| s.license = "MIT" s.files = `git ls-files`.split($\) + s.files += Dir['vendor/Pod-To-HTML/**/*'] s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) } s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = %w[lib] From 455a75d86d4e159d904c5c9191927b39f1fc14b2 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Wed, 12 Dec 2018 10:15:22 +1100 Subject: [PATCH 342/416] minimum 7.1.3 --- github-markup.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index b143e768..2459b753 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -24,5 +24,5 @@ Gem::Specification.new do |s| s.add_development_dependency 'sanitize', '~> 2.1', '>= 2.1.0' s.add_development_dependency 'nokogiri', '~> 1.8.1' s.add_development_dependency 'nokogiri-diff', '~> 0.2.0' - s.add_development_dependency "github-linguist", "~> 7" + s.add_development_dependency "github-linguist", ">= 7.1.3" end From 050b57546db44eb6a1aa34219e21026128f08c0b Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Wed, 12 Dec 2018 14:49:09 +1100 Subject: [PATCH 343/416] :gem: bump to 3.0.2 --- HISTORY.md | 4 ++++ lib/github-markup.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 6ead2e6d..520743ee 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,7 @@ +## 3.0.2 - 2018-12-12 + +* Add support for POD6 [#1173](https://github.com/github/markup/pull/1173) + ## 3.0.1 - 2018-10-19 * Remove linguist-detected RMarkdown files from the Markdown renderer [#1237](https://github.com/github/markup/pull/1237) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 259319e2..0979d20e 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '3.0.1' + VERSION = '3.0.2' Version = VERSION end end From 51cb693229925f3ed275a02d066c442bf1a51661 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Fri, 14 Dec 2018 15:06:43 +1100 Subject: [PATCH 344/416] clean up regexes, remove another weird tag --- lib/github/commands/pod62html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/github/commands/pod62html b/lib/github/commands/pod62html index e9e5316a..f034a556 100755 --- a/lib/github/commands/pod62html +++ b/lib/github/commands/pod62html @@ -5,6 +5,7 @@ use lib $*PROGRAM.IO.parent.add: '../../../vendor/Pod-To-HTML'; use Pod::To::HTML; $_ = Pod::To::HTML.render(slurp); -s:s{\<\!doctype html\>.*\
      \<\/div\>\s*} = ""; -s:s{\s*\<\/div\>\s*\<\/body\>\s*\<\/html\>\s*} = ""; +s:s{'' .* '
      ' \s*} = ""; +s:s{\s* '
      ' \s* '' \s* '' \s*} = ""; +s:s{'
      Date: Mon, 17 Dec 2018 13:36:19 +1100 Subject: [PATCH 345/416] use latest Pod::To::HTML, no more eval --- .gitmodules | 3 +++ lib/github/commands/pod62html | 8 ++++++-- vendor/Pod-To-HTML | 2 +- vendor/p6-pod-load | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) create mode 160000 vendor/p6-pod-load diff --git a/.gitmodules b/.gitmodules index 1875291b..bbb6b614 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "vendor/Pod-To-HTML"] path = vendor/Pod-To-HTML url = https://github.com/perl6/Pod-To-HTML +[submodule "vendor/p6-pod-load"] + path = vendor/p6-pod-load + url = https://github.com/JJ/p6-pod-load diff --git a/lib/github/commands/pod62html b/lib/github/commands/pod62html index f034a556..b8c13b41 100755 --- a/lib/github/commands/pod62html +++ b/lib/github/commands/pod62html @@ -1,11 +1,15 @@ #!/usr/bin/env perl6 use v6; + +use lib $*PROGRAM.IO.parent.add: '../../../vendor/p6-pod-load'; +use Pod::Load; + use lib $*PROGRAM.IO.parent.add: '../../../vendor/Pod-To-HTML'; use Pod::To::HTML; -$_ = Pod::To::HTML.render(slurp); +$_ = Pod::To::HTML.render(load(slurp)); s:s{'' .* '
      ' \s*} = ""; s:s{\s* '
      ' \s* '' \s* '' \s*} = ""; -s:s{'
      Date: Mon, 17 Dec 2018 13:40:07 +1100 Subject: [PATCH 346/416] tweak expected output --- test/markups/README.pod6.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/markups/README.pod6.html b/test/markups/README.pod6.html index 3b55d843..16951ee0 100644 --- a/test/markups/README.pod6.html +++ b/test/markups/README.pod6.html @@ -23,7 +23,6 @@

      Table of Contents

      -

      This document collection represents the on-going effort to document the Perl 6 programming language with the goals of being: comprehensive; easy to use; easy to navigate; and useful to both newcomers and experienced Perl 6 programmers.

      An HTML version of the documentation is located online at https://docs.perl6.org.

      The official source for this documentation is located at perl6/doc on GitHub.

      @@ -125,4 +124,3 @@

      Adding definitions

      Notice that text after a pipe ('|') has no formatting. Also note that C<> preserves spaces and treats text as verbatim.

      -
      \ No newline at end of file From c0452d671ae0eddb97c1614c854cf7e86224e859 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 17 Dec 2018 13:54:45 +1100 Subject: [PATCH 347/416] don't install from zef --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e409f596..b6d066c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ before_install: - echo "deb https://dl.bintray.com/nxadm/rakudo-pkg-debs `lsb_release -cs` main" | sudo tee -a /etc/apt/sources.list.d/rakudo-pkg.list - sudo apt-get update -qq - sudo apt-get install perl rakudo-pkg - - export PATH=$PATH:/.perl6/bin:/opt/rakudo-pkg/bin && install-zef-as-user && zef install Pod::To::HTML + - export PATH=$PATH:/.perl6/bin:/opt/rakudo-pkg/bin - curl -L http://cpanmin.us | perl - --sudo App::cpanminus - sudo cpanm --installdeps --notest Pod::Simple - sudo pip install docutils From d1461feeb2305909dcd7e8325e5b2e1dcadac226 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 17 Dec 2018 14:03:54 +1100 Subject: [PATCH 348/416] remove jvm from travis build matrix --- .travis.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index b6d066c5..15942b74 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,9 +6,6 @@ rvm: - 2.2.7 - 2.3.4 - 2.4.1 - - jruby-9.1.9.0 -jdk: - - oraclejdk8 notifications: email: false git: @@ -28,6 +25,3 @@ cache: env: global: - "JRUBY_OPTS=-Xcext.enabled=true" -matrix: - allow_failures: - - rvm: jruby-9.1.9.0 From a34a7235cbd575c025f82e9713388a3b119805b8 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 17 Dec 2018 14:10:19 +1100 Subject: [PATCH 349/416] add p6 uri --- .gitmodules | 3 +++ lib/github/commands/pod62html | 5 +++-- vendor/uri | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) create mode 160000 vendor/uri diff --git a/.gitmodules b/.gitmodules index bbb6b614..793e296f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "vendor/p6-pod-load"] path = vendor/p6-pod-load url = https://github.com/JJ/p6-pod-load +[submodule "vendor/uri"] + path = vendor/uri + url = https://github.com/perl6-community-modules/uri diff --git a/lib/github/commands/pod62html b/lib/github/commands/pod62html index b8c13b41..1c0ab8a2 100755 --- a/lib/github/commands/pod62html +++ b/lib/github/commands/pod62html @@ -3,9 +3,10 @@ use v6; use lib $*PROGRAM.IO.parent.add: '../../../vendor/p6-pod-load'; -use Pod::Load; - use lib $*PROGRAM.IO.parent.add: '../../../vendor/Pod-To-HTML'; +use lib $*PROGRAM.IO.parent.add: '../../../vendor/uri'; + +use Pod::Load; use Pod::To::HTML; $_ = Pod::To::HTML.render(load(slurp)); diff --git a/vendor/uri b/vendor/uri new file mode 160000 index 00000000..e5c85512 --- /dev/null +++ b/vendor/uri @@ -0,0 +1 @@ +Subproject commit e5c85512db5446fa4f7a38e421170cd602a53dce From 647fac6c17747e9194fcdee1ec547241c8d5ba39 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 17 Dec 2018 14:15:55 +1100 Subject: [PATCH 350/416] add Template-Mustache submodule --- .gitmodules | 3 +++ lib/github/commands/pod62html | 1 + vendor/p6-Template-Mustache | 1 + 3 files changed, 5 insertions(+) create mode 160000 vendor/p6-Template-Mustache diff --git a/.gitmodules b/.gitmodules index 793e296f..e770ee37 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "vendor/uri"] path = vendor/uri url = https://github.com/perl6-community-modules/uri +[submodule "vendor/p6-Template-Mustache"] + path = vendor/p6-Template-Mustache + url = https://github.com/softmoth/p6-Template-Mustache diff --git a/lib/github/commands/pod62html b/lib/github/commands/pod62html index 1c0ab8a2..ba50226c 100755 --- a/lib/github/commands/pod62html +++ b/lib/github/commands/pod62html @@ -5,6 +5,7 @@ use v6; use lib $*PROGRAM.IO.parent.add: '../../../vendor/p6-pod-load'; use lib $*PROGRAM.IO.parent.add: '../../../vendor/Pod-To-HTML'; use lib $*PROGRAM.IO.parent.add: '../../../vendor/uri'; +use lib $*PROGRAM.IO.parent.add: '../../../vendor/p6-Template-Mustache'; use Pod::Load; use Pod::To::HTML; diff --git a/vendor/p6-Template-Mustache b/vendor/p6-Template-Mustache new file mode 160000 index 00000000..d84fdf30 --- /dev/null +++ b/vendor/p6-Template-Mustache @@ -0,0 +1 @@ +Subproject commit d84fdf303480622805de119024e930c05c9fd6d2 From f7fc90c212f34e5ce6d52e4bbed99d43500457c3 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 17 Dec 2018 14:54:41 +1100 Subject: [PATCH 351/416] include all of vendor/ in gem --- github-markup.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index 2459b753..88212c66 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -12,7 +12,7 @@ Gem::Specification.new do |s| s.license = "MIT" s.files = `git ls-files`.split($\) - s.files += Dir['vendor/Pod-To-HTML/**/*'] + s.files += Dir['vendor/**/*'] s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) } s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = %w[lib] From b8843a4b81d31495b90a0c63a3daafef45a4a2f0 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 17 Dec 2018 16:45:38 +1100 Subject: [PATCH 352/416] replace with passthrough --- .gitmodules | 12 --- lib/github/commands/pod62html | 14 +--- test/markups/README.pod6 | 151 ---------------------------------- test/markups/README.pod6.html | 126 ---------------------------- vendor/Pod-To-HTML | 1 - vendor/p6-Template-Mustache | 1 - vendor/p6-pod-load | 1 - vendor/uri | 1 - 8 files changed, 1 insertion(+), 306 deletions(-) delete mode 100644 .gitmodules delete mode 100644 test/markups/README.pod6 delete mode 100644 test/markups/README.pod6.html delete mode 160000 vendor/Pod-To-HTML delete mode 160000 vendor/p6-Template-Mustache delete mode 160000 vendor/p6-pod-load delete mode 160000 vendor/uri diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e770ee37..00000000 --- a/.gitmodules +++ /dev/null @@ -1,12 +0,0 @@ -[submodule "vendor/Pod-To-HTML"] - path = vendor/Pod-To-HTML - url = https://github.com/perl6/Pod-To-HTML -[submodule "vendor/p6-pod-load"] - path = vendor/p6-pod-load - url = https://github.com/JJ/p6-pod-load -[submodule "vendor/uri"] - path = vendor/uri - url = https://github.com/perl6-community-modules/uri -[submodule "vendor/p6-Template-Mustache"] - path = vendor/p6-Template-Mustache - url = https://github.com/softmoth/p6-Template-Mustache diff --git a/lib/github/commands/pod62html b/lib/github/commands/pod62html index ba50226c..b2d27764 100755 --- a/lib/github/commands/pod62html +++ b/lib/github/commands/pod62html @@ -2,16 +2,4 @@ use v6; -use lib $*PROGRAM.IO.parent.add: '../../../vendor/p6-pod-load'; -use lib $*PROGRAM.IO.parent.add: '../../../vendor/Pod-To-HTML'; -use lib $*PROGRAM.IO.parent.add: '../../../vendor/uri'; -use lib $*PROGRAM.IO.parent.add: '../../../vendor/p6-Template-Mustache'; - -use Pod::Load; -use Pod::To::HTML; - -$_ = Pod::To::HTML.render(load(slurp)); -s:s{'' .* '
      ' \s*} = ""; -s:s{\s* '
      ' \s* '' \s* '' \s*} = ""; -s:s{'
      . - -The official source for this documentation is located at L. - -This particular document is a quick overview of the process -described in more detail in L. -This document also provides a short introduction to writing Perl 6 -Pod files, which can be rendered into HTML and other formats. - -=head1 Structure - -All of the documentation is written in Perl 6 Pod and kept in the C -directory, and the C and C sub-directories. -These files are processed as collections of definitions or -"documentables", which are then post-processed and linked together. - -=head1 Generating HTML from Pod - -To generate HTML from the Pod files, you'll need: - -=item A recent version of the Rakudo Perl 6 compiler - -=item The Perl 6 modules Pod::To::HTML, Pod::To::BigPage, and URI::Escape -(can be installed via L). - -=item B: L, for creating graphs -of the relationships between Perl 6 types - -=item B: L and L, for syntax -highlighting - -To generate the documentation into the C folder, run: - -=begin code :lang -perl6 htmlify.p6 -=end code - -To host the documentation from a web server, have Perl 5 -and Mojolicious::Lite installed, then run: - -=begin code :lang -perl app.pl daemon -=end code - -=head1 Contributing - -The documentation is written in Perl 6 Pod. - -For a quick introduction to Perl 6 Pod, see L. - -For full details about the Perl 6 Pod specification, see L. - -=head2 Adding definitions - -Documentables can be defined using an C<=headN> Pod directive, where -C is greater than zero (e.g., C<=head1>, C<=head2>, …). - -All of the paragraphs and blocks following that directive, up until the -next directive of the same level, will be considered part of the -documentable. So, in: - -=begin code :allow :skip-test -=head2 R - -Some paragraphs, followed by some code: - - my Code $examples = "amazing"; - -Mind === blown. - -=head3 Minor details about R - -It's fantastic. - -=head2 And now, for something completely different - -… - -=end code - -The documentable R extends down to the C<=head2 And now…>. - -Documentables may contain other documentables. Class documentables, for -example, often contain the methods the class implements. - -Definitions must be in one of the following forms to be recognized as -the start of a documentable named, say, þ. First the code in the document source: - -=begin code :skip-test - -=item X | infix,þ> (This a special case, which -is always considered a definition) - -=item C - -=item B Infix> - -=item C - -=item B> - -=item C (A special case for the L documentables) - -=end code - -Then the results on the rendered page: - -=item X | infix,þ> (This is a special case, which -is always considered a definition) - -=item C - -=item B Infix> - -=item C - -=item B> - -=item C (A special case for the L documentables) - -These items should now be searchable by using the search field in the HTML docs. - -You can add emphasis with bold (B >>) or italicized (B >>), -with or without code formatting (B >>). Due to current parser limitations, -special steps have to be taken to use B >> with other formatting codes; for example: - -=begin code :skip-test -=item X|foo> a fancy subroutine -=end code - -renders like this - -=item X|foo> a fancy subroutine - -Notice that text after a pipe ('|') has no formatting. Also note that B >> -preserves spaces and treats text as verbatim. -=end pod - diff --git a/test/markups/README.pod6.html b/test/markups/README.pod6.html deleted file mode 100644 index 16951ee0..00000000 --- a/test/markups/README.pod6.html +++ /dev/null @@ -1,126 +0,0 @@ -

      About the Docs

      -

      Meta-documentation

      - - -

      Table of Contents

      - - - - - - - - - - - - - - - - - -
      1Structure
      2Generating HTML from Pod
      3Contributing
      3.1Adding definitions
      - - -

      This document collection represents the on-going effort to document the Perl 6 programming language with the goals of being: comprehensive; easy to use; easy to navigate; and useful to both newcomers and experienced Perl 6 programmers.

      -

      An HTML version of the documentation is located online at https://docs.perl6.org.

      -

      The official source for this documentation is located at perl6/doc on GitHub.

      -

      This particular document is a quick overview of the process described in more detail in CONTRIBUTING on GitHub. This document also provides a short introduction to writing Perl 6 Pod files, which can be rendered into HTML and other formats.

      -

      Structure

      -

      All of the documentation is written in Perl 6 Pod and kept in the doc/ directory, and the doc/Language/ and doc/Type/ sub-directories. These files are processed as collections of definitions or "documentables", which are then post-processed and linked together.

      -

      Generating HTML from Pod

      -

      To generate HTML from the Pod files, you'll need:

      -
        -
      • -

        A recent version of the Rakudo Perl 6 compiler

        -
      • -
      • -

        The Perl 6 modules Pod::To::HTML, Pod::To::BigPage, and URI::Escape (can be installed via zef).

        -
      • -
      • -

        Optional: GraphViz, for creating graphs of the relationships between Perl 6 types

        -
      • -
      • -

        Optional: Atom Highlights and language-perl6, for syntax highlighting

        -
      • -
      -

      To generate the documentation into the html/ folder, run:

      -
      perl6 htmlify.p6
      -
      -

      To host the documentation from a web server, have Perl 5 and Mojolicious::Lite installed, then run:

      -
      perl app.pl daemon
      -
      -

      Contributing

      -

      The documentation is written in Perl 6 Pod.

      -

      For a quick introduction to Perl 6 Pod, see Perl 6 Pod.

      -

      For full details about the Perl 6 Pod specification, see Synopsis 26, Documentation.

      -

      Adding definitions

      -

      Documentables can be defined using an =headN Pod directive, where N is greater than zero (e.g., =head1, =head2, …).

      -

      All of the paragraphs and blocks following that directive, up until the next directive of the same level, will be considered part of the documentable. So, in:

      -
      =head2 My Definition
      -
      -Some paragraphs, followed by some code:
      -
      -    my Code $examples = "amazing";
      -
      -Mind === blown.
      -
      -=head3 Minor details about My Definition
      -
      -It's fantastic.
      -
      -=head2 And now, for something completely different
      -
      -…
      -
      -
      -

      The documentable My Definition extends down to the =head2 And now….

      -

      Documentables may contain other documentables. Class documentables, for example, often contain the methods the class implements.

      -

      Definitions must be in one of the following forms to be recognized as the start of a documentable named, say, þ. First the code in the document source:

      -
      =item X<C<How to use the þ infix> | infix,þ> (This a special case, which
      -is always considered a definition)
      -
      -=item C<The þ Infix>
      -
      -=item B<The C<þ> Infix>
      -
      -=item C<Infix þ>
      -
      -=item B<Infix C<þ>>
      -
      -=item C<trait is cached> (A special case for the L<trait|/language/functions#Traits> documentables)
      -
      -
      -

      Then the results on the rendered page:

      -
        -
      • -

        How to use the þ infix (This is a special case, which is always considered a definition)

        -
      • -
      • -

        The þ Infix

        -
      • -
      • -

        The þ Infix

        -
      • -
      • -

        Infix þ

        -
      • -
      • -

        Infix þ

        -
      • -
      • -

        trait is cached (A special case for the trait documentables)

        -
      • -
      -

      These items should now be searchable by using the search field in the HTML docs.

      -

      You can add emphasis with bold ( B<> ) or italicized ( I<> ), with or without code formatting ( C<> ). Due to current parser limitations, special steps have to be taken to use X<> with other formatting codes; for example:

      -
      =item X<B<foo>|foo> a fancy subroutine
      -
      -

      renders like this

      -
        -
      • -

        foo a fancy subroutine

        -
      • -
      -

      Notice that text after a pipe ('|') has no formatting. Also note that C<> preserves spaces and treats text as verbatim.

      diff --git a/vendor/Pod-To-HTML b/vendor/Pod-To-HTML deleted file mode 160000 index a8d07053..00000000 --- a/vendor/Pod-To-HTML +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a8d07053ce61f4bb90725d31073cf38380a171b4 diff --git a/vendor/p6-Template-Mustache b/vendor/p6-Template-Mustache deleted file mode 160000 index d84fdf30..00000000 --- a/vendor/p6-Template-Mustache +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d84fdf303480622805de119024e930c05c9fd6d2 diff --git a/vendor/p6-pod-load b/vendor/p6-pod-load deleted file mode 160000 index 66fc6158..00000000 --- a/vendor/p6-pod-load +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 66fc6158e7c22e8a7a5f90de342e799c7fb2315e diff --git a/vendor/uri b/vendor/uri deleted file mode 160000 index e5c85512..00000000 --- a/vendor/uri +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e5c85512db5446fa4f7a38e421170cd602a53dce From ea511824a331a933e8f3f2769f2ab7039d700e3c Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 17 Dec 2018 16:48:48 +1100 Subject: [PATCH 353/416] :gem: bump to 3.0.3 --- HISTORY.md | 4 ++++ lib/github-markup.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 520743ee..27a471f9 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,7 @@ +## 3.0.3 - 2018-12-17 + +* Temporarily remove support for POD6 [#1248](https://github.com/github/markup/pull/1248) + ## 3.0.2 - 2018-12-12 * Add support for POD6 [#1173](https://github.com/github/markup/pull/1173) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 0979d20e..be7ad756 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '3.0.2' + VERSION = '3.0.3' Version = VERSION end end From 3e08f13ac9ba51687c3139a4c5f4ed2521ef065d Mon Sep 17 00:00:00 2001 From: jimcheung Date: Fri, 21 Dec 2018 14:39:12 +0800 Subject: [PATCH 354/416] perf(markup): add options to render_s --- lib/github/markup.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/github/markup.rb b/lib/github/markup.rb index 444907a3..1c63c8bd 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -47,11 +47,11 @@ def render(filename, content, symlink: false, options: {}) end end - def render_s(symbol, content) + def render_s(symbol, content, options: {}) raise ArgumentError, 'Can not render a nil.' if content.nil? if markups.key?(symbol) - markups[symbol].render(nil, content) + markups[symbol].render(nil, content, options: options) else content end From 32909da48054fdc36e8e83bf7c47ef27b1ad6a3f Mon Sep 17 00:00:00 2001 From: jimcheung Date: Fri, 21 Dec 2018 16:12:05 +0800 Subject: [PATCH 355/416] perf(markup): add test --- test/markup_test.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/markup_test.rb b/test/markup_test.rb index 86c83ee7..1ff2272a 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -72,7 +72,7 @@ def call message end end - + def test_knows_what_it_can_and_cannot_render assert_equal false, GitHub::Markup.can_render?('README.html', '

      Title

      ') assert_equal true, GitHub::Markup.can_render?('README.markdown', '=== Title') @@ -92,7 +92,7 @@ def test_each_render_has_a_name assert_equal "pod", GitHub::Markup.renderer('README.pod', '=head1').name assert_equal "pod6", GitHub::Markup.renderer('README.pod6', '=begin pod').name end - + def test_rendering_by_symbol assert_equal '

      test

      ', GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, '`test`').strip end @@ -117,5 +117,8 @@ def test_preserve_markup def test_commonmarker_options assert_equal "

      hello world

      \n", GitHub::Markup.render("test.md", "hello world") assert_equal "

      hello world

      \n", GitHub::Markup.render("test.md", "hello world", options: {commonmarker_opts: [:UNSAFE]}) + + assert_equal "

      hello world

      \n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "hello world") + assert_equal "

      hello world

      \n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "hello world", options: {commonmarker_opts: [:UNSAFE]}) end end From 24d25cbf924b59884caee0b3a1539202867d8cb4 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Mon, 25 Feb 2019 09:37:42 +1100 Subject: [PATCH 356/416] remove pod6 from supported list --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 0651c33c..b2bcc809 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,6 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a * [.asciidoc, .adoc, .asc](http://asciidoc.org/) -- `gem install asciidoctor` (http://asciidoctor.org) * [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::XHTML` comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN. -* [.pod6](https://docs.perl6.org/language/pod) -- No additional - dependency beyond perl6 `Pod::To::HTML` (in stdlib) Installation ----------- From 34a79756a9d3177d4f9fa7a323570f75d8db16a6 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Mon, 1 Apr 2019 23:55:47 -0600 Subject: [PATCH 357/416] upgrade to Asciidoctor 2.0.x - upgrade to Asciidoctor 2.0.x (starting with 2.0.5) - switch to fuzzy version match for asciidoctor gem - disable sectanchors (since they get removed by the sanitizer anyway) - use formal xref macro for interdocument xref in test - add test for toggling the document title using showtitle/!showtitle - add test to verify toc is generated at top of document when toc attribute is set --- Gemfile | 2 +- lib/github/markups.rb | 1 + test/markups/README.asciidoc | 4 +- test/markups/README.hidetitle.asciidoc | 4 ++ test/markups/README.hidetitle.asciidoc.html | 3 ++ test/markups/README.toc.asciidoc | 15 +++++++ test/markups/README.toc.asciidoc.html | 46 +++++++++++++++++++++ 7 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 test/markups/README.hidetitle.asciidoc create mode 100644 test/markups/README.hidetitle.asciidoc.html create mode 100644 test/markups/README.toc.asciidoc create mode 100644 test/markups/README.toc.asciidoc.html diff --git a/Gemfile b/Gemfile index cbd97b7b..61920ab8 100644 --- a/Gemfile +++ b/Gemfile @@ -11,5 +11,5 @@ gem "org-ruby", "= 0.9.9" gem "creole", "~>0.3.6" gem "wikicloth", "=0.8.3" gem "twitter-text", "~> 1.14" -gem "asciidoctor", "= 1.5.6.1" +gem "asciidoctor", "~> 2.0.5" gem "rake" diff --git a/lib/github/markups.rb b/lib/github/markups.rb index c900594d..ea816c75 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -32,6 +32,7 @@ 'showtitle' => '@', 'idprefix' => '', 'idseparator' => '-', + 'sectanchors' => nil, 'docname' => File.basename(filename, (extname = File.extname(filename))), 'docfilesuffix' => extname, 'outfilesuffix' => extname, diff --git a/test/markups/README.asciidoc b/test/markups/README.asciidoc index d3c872f7..5f65dd2b 100644 --- a/test/markups/README.asciidoc +++ b/test/markups/README.asciidoc @@ -1,4 +1,6 @@ = Document Title +// sectanchors will be ignored +:sectanchors: == First Section @@ -7,7 +9,7 @@ Refer to <> or <>. -Navigate from {docname}{outfilesuffix} to <>. +Navigate from {docname}{outfilesuffix} to xref:another-document.asciidoc[another document]. == Another Section diff --git a/test/markups/README.hidetitle.asciidoc b/test/markups/README.hidetitle.asciidoc new file mode 100644 index 00000000..38cf76b0 --- /dev/null +++ b/test/markups/README.hidetitle.asciidoc @@ -0,0 +1,4 @@ += Not Shown +:!showtitle: + +This test verifies the author can disable the document title by adding `:!showtitle:` to the document header. diff --git a/test/markups/README.hidetitle.asciidoc.html b/test/markups/README.hidetitle.asciidoc.html new file mode 100644 index 00000000..ae6b258f --- /dev/null +++ b/test/markups/README.hidetitle.asciidoc.html @@ -0,0 +1,3 @@ +
      +

      This test verifies the author can disable the document title by adding :!showtitle: to the document header.

      +
      diff --git a/test/markups/README.toc.asciidoc b/test/markups/README.toc.asciidoc new file mode 100644 index 00000000..a8e42bdd --- /dev/null +++ b/test/markups/README.toc.asciidoc @@ -0,0 +1,15 @@ += Document Title +:toc: +:toc-title: Contents + +== Section A + +=== Subsection A-1 + +=== Subsection A-2 + +== Section B + +=== Subsection B-1 + +=== Subsection B-2 diff --git a/test/markups/README.toc.asciidoc.html b/test/markups/README.toc.asciidoc.html new file mode 100644 index 00000000..e6f598cf --- /dev/null +++ b/test/markups/README.toc.asciidoc.html @@ -0,0 +1,46 @@ +

      Document Title

      + +
      +

      Section A

      +
      +
      +

      Subsection A-1

      + +
      +
      +

      Subsection A-2

      + +
      +
      +
      +
      +

      Section B

      +
      +
      +

      Subsection B-1

      + +
      +
      +

      Subsection B-2

      + +
      +
      +
      From 067c18dc0a96d837e8ccce0ed8b13f2c7ce24e9e Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Wed, 3 Apr 2019 10:33:55 +1100 Subject: [PATCH 358/416] :gem: bump to 3.0.4 --- HISTORY.md | 5 +++++ lib/github-markup.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 27a471f9..981cb46c 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,8 @@ +## 3.0.4 - 2019-04-03 + +* Expose options in #render_s [#1249](https://github.com/github/markup/pull/1249) +* Upgrade to Asciidoctor 2.0.x [#1264](https://github.com/github/markup/pull/1264) + ## 3.0.3 - 2018-12-17 * Temporarily remove support for POD6 [#1248](https://github.com/github/markup/pull/1248) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index be7ad756..1bebb3ab 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '3.0.3' + VERSION = '3.0.4' Version = VERSION end end From 3e973e535221539b160b1d0f1fcf08d3038cbdd8 Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Wed, 3 Apr 2019 10:38:15 +1100 Subject: [PATCH 359/416] use modern sanitize in tests (Vulnerability alert doesn't exactly apply as it's never used in actual execution, but that's okay.) --- github-markup.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index 88212c66..f988c443 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'activesupport', '~> 4.0' s.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3' s.add_development_dependency 'html-pipeline', '~> 1.0' - s.add_development_dependency 'sanitize', '~> 2.1', '>= 2.1.0' + s.add_development_dependency 'sanitize', '>= 4.6.3' s.add_development_dependency 'nokogiri', '~> 1.8.1' s.add_development_dependency 'nokogiri-diff', '~> 0.2.0' s.add_development_dependency "github-linguist", ">= 7.1.3" From d3430c3f453546d9291a59c31539aa6233ebae2f Mon Sep 17 00:00:00 2001 From: jimcheung Date: Mon, 6 May 2019 18:08:59 +0800 Subject: [PATCH 360/416] feat(commonmarker): add commonmarker_exts to options --- lib/github/markup/markdown.rb | 3 ++- test/markup_test.rb | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index 11cf662d..7952bd3b 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -6,7 +6,8 @@ class Markdown < Implementation MARKDOWN_GEMS = { "commonmarker" => proc { |content, options: {}| commonmarker_opts = [:GITHUB_PRE_LANG].concat(options.fetch(:commonmarker_opts, [])) - CommonMarker.render_html(content, commonmarker_opts, [:tagfilter, :autolink, :table, :strikethrough]) + commonmarker_exts = options.fetch(:commonmarker_exts, [:tagfilter, :autolink, :table, :strikethrough]) + CommonMarker.render_html(content, commonmarker_opts, commonmarker_exts) }, "github/markdown" => proc { |content, options: {}| GitHub::Markdown.render(content) diff --git a/test/markup_test.rb b/test/markup_test.rb index 1ff2272a..da859944 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -120,5 +120,8 @@ def test_commonmarker_options assert_equal "

      hello world

      \n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "hello world") assert_equal "

      hello world

      \n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "hello world", options: {commonmarker_opts: [:UNSAFE]}) + + assert_equal "<style>.red{color: #ff2727;}</style>\n", GitHub::Markup.render("test.md", "", options: {commonmarker_opts: [:UNSAFE]}) + assert_equal "\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "", options: {commonmarker_opts: [:UNSAFE], commonmarker_exts: [:autolink, :table, :strikethrough]}) end end From 7b17174957c73e399ea8b05914fd6f0df8b7e3c2 Mon Sep 17 00:00:00 2001 From: jimcheung Date: Tue, 7 May 2019 11:56:27 +0800 Subject: [PATCH 361/416] perf(commonmarker test): improve test case --- test/markup_test.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/markup_test.rb b/test/markup_test.rb index da859944..4c3cc7af 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -121,7 +121,10 @@ def test_commonmarker_options assert_equal "

      hello world

      \n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "hello world") assert_equal "

      hello world

      \n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "hello world", options: {commonmarker_opts: [:UNSAFE]}) - assert_equal "<style>.red{color: #ff2727;}</style>\n", GitHub::Markup.render("test.md", "", options: {commonmarker_opts: [:UNSAFE]}) - assert_equal "\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "", options: {commonmarker_opts: [:UNSAFE], commonmarker_exts: [:autolink, :table, :strikethrough]}) + assert_equal "<style>.red{color: red;}</style>\n", GitHub::Markup.render("test.md", "", options: {commonmarker_opts: [:UNSAFE]}) + assert_equal "\n", GitHub::Markup.render("test.md", "", options: {commonmarker_opts: [:UNSAFE], commonmarker_exts: [:autolink, :table, :strikethrough]}) + + assert_equal "<style>.red{color: red;}</style>\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "", options: {commonmarker_opts: [:UNSAFE]}) + assert_equal "\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "", options: {commonmarker_opts: [:UNSAFE], commonmarker_exts: [:autolink, :table, :strikethrough]}) end end From cd4e3e0c6705115f97d11704cabbf790259d40a6 Mon Sep 17 00:00:00 2001 From: Nick Maloucaze Date: Wed, 22 May 2019 20:02:14 -0300 Subject: [PATCH 362/416] Use squiggly HEREDOC syntax It is recommended to use the squiggly HEREDOC syntax (https://infinum.co/the-capsized-eight/multiline-strings-ruby-2-3-0-the-squiggly-heredoc) for multiline strings. --- github-markup.gemspec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index f988c443..3cdeaef8 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -4,8 +4,10 @@ Gem::Specification.new do |s| s.name = "github-markup" s.version = GitHub::Markup::VERSION s.summary = "The code GitHub uses to render README.markup" - s.description = "This gem is used by GitHub to render any fancy markup such " + - "as Markdown, Textile, Org-Mode, etc. Fork it and add your own!" + s.description = <<~DESC + This gem is used by GitHub to render any fancy markup such as Markdown, + Textile,Org-Mode, etc. Fork it and add your own! + DESC s.authors = ["Chris Wanstrath"] s.email = "chris@ozmm.org" s.homepage = "https://github.com/github/markup" From f82c99532b199558ec861488b26f35e692d973fb Mon Sep 17 00:00:00 2001 From: Nick Maloucaze <39865913+maloucaze@users.noreply.github.com> Date: Wed, 22 May 2019 21:27:22 -0300 Subject: [PATCH 363/416] Update github-markup.gemspec Co-Authored-By: Ashe Connor --- github-markup.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-markup.gemspec b/github-markup.gemspec index 3cdeaef8..594d3507 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -6,7 +6,7 @@ Gem::Specification.new do |s| s.summary = "The code GitHub uses to render README.markup" s.description = <<~DESC This gem is used by GitHub to render any fancy markup such as Markdown, - Textile,Org-Mode, etc. Fork it and add your own! + Textile, Org-Mode, etc. Fork it and add your own! DESC s.authors = ["Chris Wanstrath"] s.email = "chris@ozmm.org" From 2710ab922c6d976137f8c1e8585ba5f41dbce90e Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Wed, 4 Sep 2019 13:43:49 +0200 Subject: [PATCH 364/416] Check whether filename is set when rendering asciidoc --- lib/github/markups.rb | 9 ++++++--- test/markup_test.rb | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/github/markups.rb b/lib/github/markups.rb index ea816c75..0ed55df0 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -33,13 +33,16 @@ 'idprefix' => '', 'idseparator' => '-', 'sectanchors' => nil, - 'docname' => File.basename(filename, (extname = File.extname(filename))), - 'docfilesuffix' => extname, - 'outfilesuffix' => extname, 'env' => 'github', 'env-github' => '', 'source-highlighter' => 'html-pipeline' } + if filename + attributes['docname'] = File.basename(filename, (extname = File.extname(filename))) + attributes['docfilesuffix'] = attributes['outfilesuffix'] = extname + else + attributes['outfilesuffix'] = '.adoc' + end Asciidoctor::Compliance.unique_id_start_index = 1 Asciidoctor.convert(content, :safe => :secure, :attributes => attributes) end diff --git a/test/markup_test.rb b/test/markup_test.rb index 4c3cc7af..24e78000 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -94,7 +94,10 @@ def test_each_render_has_a_name end def test_rendering_by_symbol - assert_equal '

      test

      ', GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, '`test`').strip + markup = '`test`' + result = /

      test<\/code><\/p>/ + assert_match result, GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, markup).strip + assert_match result, GitHub::Markup.render_s(GitHub::Markups::MARKUP_ASCIIDOC, markup).split.join end def test_raises_error_if_command_exits_non_zero From 194e363c2a2cd44caa8e799a5ef4e64fb2824f0c Mon Sep 17 00:00:00 2001 From: Aaron Harpole Date: Thu, 12 Nov 2020 19:26:19 +0000 Subject: [PATCH 365/416] bump version to 3.0.5 --- HISTORY.md | 5 +++++ lib/github-markup.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 981cb46c..8ee4e818 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,8 @@ +## 3.0.5 - 2020-11-12 + +* Add commonmarker_exts to commonmarker options [#1268](https://github.com/github/markup/pull/1268) +* Check whether filename is set when rendering Asciidoc. [#1290](https://github.com/github/markup/pull/1290) + ## 3.0.4 - 2019-04-03 * Expose options in #render_s [#1249](https://github.com/github/markup/pull/1249) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 1bebb3ab..4b064e0e 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '3.0.4' + VERSION = '3.0.5' Version = VERSION end end From b95a3068ae330690da5e20e1556502b4599cebb4 Mon Sep 17 00:00:00 2001 From: Carl Brasic Date: Tue, 30 Mar 2021 14:41:06 -0500 Subject: [PATCH 366/416] Point to python3 executable for rendering RST https://github.com/github/markup/pull/919 added support for python3, but we still explicitly shell out to the `python2` executable. Let's switch to python3 now that it's supported. This bumps the major version because it's a breaking change for anyone running in an environment with only python2. --- lib/github-markup.rb | 2 +- lib/github/markups.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 4b064e0e..df6aa41d 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '3.0.5' + VERSION = '4.0.0' Version = VERSION end end diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 0ed55df0..f12fb7e0 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -49,7 +49,7 @@ command( ::GitHub::Markups::MARKUP_RST, - "python2 -S #{Shellwords.escape(File.dirname(__FILE__))}/commands/rest2html", + "python3 -S #{Shellwords.escape(File.dirname(__FILE__))}/commands/rest2html", /re?st(\.txt)?/, ["reStructuredText"], "restructuredtext" From e1fb4356cd9064384c026b8bcb10fc88c151d505 Mon Sep 17 00:00:00 2001 From: Carl Brasic Date: Tue, 30 Mar 2021 15:31:52 -0500 Subject: [PATCH 367/416] Remove -S flag for python3 This should not be necessary anymore and its presence breaks actual use of pip which installs into the site-packages directory. --- lib/github/markups.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github/markups.rb b/lib/github/markups.rb index f12fb7e0..2c30c99d 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -49,7 +49,7 @@ command( ::GitHub::Markups::MARKUP_RST, - "python3 -S #{Shellwords.escape(File.dirname(__FILE__))}/commands/rest2html", + "python3 #{Shellwords.escape(File.dirname(__FILE__))}/commands/rest2html", /re?st(\.txt)?/, ["reStructuredText"], "restructuredtext" From 935ee3bb2365b372ee1a290e8f0ea4ea0ffc8c6d Mon Sep 17 00:00:00 2001 From: Carl Brasic Date: Tue, 30 Mar 2021 15:33:15 -0500 Subject: [PATCH 368/416] Update bootstrap script to use pip3 --- script/bootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/bootstrap b/script/bootstrap index 8092d517..f89f3181 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -5,4 +5,4 @@ set -e cd $(dirname "$0")/.. bundle install -easy_install docutils +pip3 install docutils From 9899397bdef227900f827001116a85f350377312 Mon Sep 17 00:00:00 2001 From: Carl Brasic Date: Tue, 30 Mar 2021 15:47:37 -0500 Subject: [PATCH 369/416] Update HTML fixture for python3 The README.rst fixture had a test that was python2-specific, it asserted that a segment of markup would be dropped from the output for containing UTF-8 chars. That's no longer true, so we can update the fixture accordingly. --- test/markups/README.rst.html | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index 7b8e9fca..031c3c4a 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -16,6 +16,47 @@

      Header 2

    • Somé UTF-8°
    • The UTF-8 quote character in this table used to cause python to go boom. Now docutils just silently ignores it.

      + +Things that are Awesome (on a scale of 1-11) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      ThingAwesomeness
      Icecream7
      Honey Badgers10.5
      Nickelback-2
      Iron Man10
      Iron Man 23
      Tabular Data5
      Made up ratings11
       A block of code
       
      From 4230afedbb28a0d0e053ac51f5d74a9fdf160349 Mon Sep 17 00:00:00 2001 From: Carl Brasic Date: Wed, 31 Mar 2021 10:14:16 -0500 Subject: [PATCH 370/416] Add changelog entry --- HISTORY.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 8ee4e818..c296602b 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,7 @@ +## 4.0.0 - 2021-03-31 + +* Drop support for Python 2 in RST rendering [#1456](https://github.com/github/markup/pull/1456) + ## 3.0.5 - 2020-11-12 * Add commonmarker_exts to commonmarker options [#1268](https://github.com/github/markup/pull/1268) @@ -72,8 +76,8 @@ ### Added -* Re-introduce [#537](https://github.com/github/markup/pull/537) to detect language of markup document - However `github-linguist` is optional and this gem will fallback to extensions for detection. +* Re-introduce [#537](https://github.com/github/markup/pull/537) to detect language of markup document + However `github-linguist` is optional and this gem will fallback to extensions for detection. [Full changelog](https://github.com/github/markup/compare/v1.4.9...v1.5.0) From 681f5392ec409779298aea881a3eed05351d3e78 Mon Sep 17 00:00:00 2001 From: "Terence D. Honles" Date: Tue, 9 Mar 2021 14:31:40 -0800 Subject: [PATCH 371/416] convert to github actions --- .github/workflows/ci.yml | 58 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 27 ------------------- 2 files changed, 58 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..88ec38f7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,58 @@ +name: CI +on: push + +env: + JRUBY_OPTS: -Xcext.enabled=true + +jobs: + build: + name: "Test / Ruby ${{ matrix.ruby }}" + runs-on: ubuntu-latest + strategy: + matrix: + ruby: + - "2.4" + - "2.5" + - "2.6" + - "2.7" + fail-fast: false + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 10 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + + - uses: actions/setup-python@v2 + with: + # This should match lib/github/markups.rb GitHub::Markups::MARKUP_RST + python-version: '3.x' + + - uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip + + - name: Install Perl dependencies + run: | + curl -1sLf \ + 'https://dl.cloudsmith.io/public/nxadm-pkgs/rakudo-pkg/setup.deb.sh' \ + | sudo -E bash + sudo apt-get update -qq + sudo apt-get install perl rakudo-pkg + + curl -L http://cpanmin.us | perl - --sudo App::cpanminus + sudo cpanm --installdeps --notest Pod::Simple + + - name: Install Python dependencies + run: python -m pip install docutils + + - name: Run rake + run: | + export PATH=$PATH:/.perl6/bin:/opt/rakudo-pkg/bin + bundle exec rake diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 15942b74..00000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -dist: trusty -sudo: required -language: ruby -rvm: - - 2.1.10 - - 2.2.7 - - 2.3.4 - - 2.4.1 -notifications: - email: false -git: - depth: 10 -before_install: - - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 379CE192D401AB61 - - echo "deb https://dl.bintray.com/nxadm/rakudo-pkg-debs `lsb_release -cs` main" | sudo tee -a /etc/apt/sources.list.d/rakudo-pkg.list - - sudo apt-get update -qq - - sudo apt-get install perl rakudo-pkg - - export PATH=$PATH:/.perl6/bin:/opt/rakudo-pkg/bin - - curl -L http://cpanmin.us | perl - --sudo App::cpanminus - - sudo cpanm --installdeps --notest Pod::Simple - - sudo pip install docutils -cache: - - bundler - - pip -env: - global: - - "JRUBY_OPTS=-Xcext.enabled=true" From bd03c94813125c25c4624112179770ab12f077e1 Mon Sep 17 00:00:00 2001 From: "Terence D. Honles" Date: Thu, 1 Apr 2021 22:05:22 -0700 Subject: [PATCH 372/416] fix github action triggers --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88ec38f7..52d4db54 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,5 @@ name: CI -on: push +on: [push, pull_request] env: JRUBY_OPTS: -Xcext.enabled=true From 7a19485f98af6963f71d2479be1cfd2841266e86 Mon Sep 17 00:00:00 2001 From: "Terence D. Honles" Date: Tue, 9 Mar 2021 14:10:30 -0800 Subject: [PATCH 373/416] fix unknown directive options removing the directive entirely --- lib/github/commands/rest2html | 31 ++++++++++++++++++++++++++++++- test/markups/README.rst | 6 ++++++ test/markups/README.rst.html | 3 +++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index 0efea607..c7c89dce 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -47,7 +47,7 @@ except: import codecs import io -from docutils import nodes +from docutils import nodes, utils from docutils.parsers.rst import directives, roles from docutils.parsers.rst.directives.body import CodeBlock, Directive from docutils.core import publish_parts @@ -76,6 +76,35 @@ from docutils import nodes original_behavior = False # Documents original docutils behavior github_display = True +def extract_extension_options(field_list, option_spec): + """ + Overrides `utils.extract_extension_options` and inlines + `utils.assemble_option_dict` to make it ignore unknown options passed to + directives (i.e. ``:caption:`` for ``.. code-block:``). + """ + + dropped = set() + options = {} + for name, value in utils.extract_options(field_list): + convertor = option_spec.get(name) + if name in options or name in dropped: + raise utils.DuplicateOptionError('duplicate option "%s"' % name) + + # silently drop unknown options as long as they are not duplicates + if convertor is None: + dropped.add(name) + continue + + # continue as before + try: + options[name] = convertor(value) + except (ValueError, TypeError) as detail: + raise detail.__class__('(option: "%s"; value: %r)\n%s' + % (name, value, ' '.join(detail.args))) + return options + +utils.extract_extension_options = extract_extension_options + def unknown_directive(self, type_name): lineno = self.state_machine.abs_line_number() indented, indent, offset, blank_finish = \ diff --git a/test/markups/README.rst b/test/markups/README.rst index 54bd71ce..53cba9e0 100644 --- a/test/markups/README.rst +++ b/test/markups/README.rst @@ -39,6 +39,12 @@ The UTF-8 quote character in this table used to cause python to go boom. Now doc python.code('hooray') +.. code:: python + :caption: An ignored Sphinx option + :made-up-option: An ignored made up option + + python.code('hello world') + .. doctest:: ignored >>> some_function() diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index 031c3c4a..3ddfab76 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -64,6 +64,9 @@

      Header 2

      python.code('hooray')
      +python.code('hello world')
      +
      +
       >>> some_function()
       'result'
       
      From cc1340663fd41c833b08fa0139310ee166bbf1a7 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 6 Jun 2021 19:53:25 -0400 Subject: [PATCH 374/416] spelling: exclude Signed-off-by: Josh Soref --- test/markups/README.org | 2 +- test/markups/README.org.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/markups/README.org b/test/markups/README.org index dded60e3..0eca800a 100644 --- a/test/markups/README.org +++ b/test/markups/README.org @@ -58,7 +58,7 @@ end - Skipping text before the first headline (option skip:t) - Skipping tables (option |:nil) - Custom todo keywords - - EXPORT_SELECT_TAGS and EXPORT_EXLUDE_TAGS for controlling parts of + - EXPORT_SELECT_TAGS and EXPORT_EXCLUDE_TAGS for controlling parts of the tree to export - Rewrite "file:(blah).org" links to "http:(blah).html" links. This makes the inter-links to other org-mode files work. diff --git a/test/markups/README.org.html b/test/markups/README.org.html index ddf8b27e..458024af 100644 --- a/test/markups/README.org.html +++ b/test/markups/README.org.html @@ -52,7 +52,7 @@

      2.3 2009-12-30: Version 0.5.0

    • Skipping text before the first headline (option skip:t)
    • Skipping tables (option |:nil)
    • Custom todo keywords
    • -
    • EXPORT_SELECT_TAGS and EXPORT_EXLUDE_TAGS for controlling parts of +
    • EXPORT_SELECT_TAGS and EXPORT_EXCLUDE_TAGS for controlling parts of the tree to export
    • From c806bbfb3f02b0203bc91633b75399eb5e0cf3c4 Mon Sep 17 00:00:00 2001 From: Nick Borromeo Date: Mon, 7 Mar 2022 19:12:02 -0800 Subject: [PATCH 375/416] Bump commonmark version --- Gemfile | 2 +- HISTORY.md | 3 +++ lib/github-markup.rb | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 61920ab8..c38f68e8 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ gem "posix-spawn", :platforms => :ruby gem "redcarpet", :platforms => :ruby gem "kramdown", :platforms => :jruby gem "RedCloth" -gem "commonmarker", "~> 0.18.1" +gem "commonmarker", "~> 0.23.4" gem "rdoc", "~>3.6" gem "org-ruby", "= 0.9.9" gem "creole", "~>0.3.6" diff --git a/HISTORY.md b/HISTORY.md index c296602b..966ef18c 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,6 @@ +## 4.0.1 - 2022-03-07 +* Update to commonmarker 0.23.4; See [Version Changelog](https://github.com/gjtorikian/commonmarker/blob/main/CHANGELOG.md#v0234-2022-03-03) + ## 4.0.0 - 2021-03-31 * Drop support for Python 2 in RST rendering [#1456](https://github.com/github/markup/pull/1456) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index df6aa41d..0244f156 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '4.0.0' + VERSION = '4.0.1' Version = VERSION end end From d35c00f367036effadab9cc7b6022b4cecbe1754 Mon Sep 17 00:00:00 2001 From: Nick Borromeo Date: Mon, 7 Mar 2022 19:12:02 -0800 Subject: [PATCH 376/416] Bump commonmark version --- Gemfile | 2 +- HISTORY.md | 3 +++ lib/github-markup.rb | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 61920ab8..7067b704 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ gem "posix-spawn", :platforms => :ruby gem "redcarpet", :platforms => :ruby gem "kramdown", :platforms => :jruby gem "RedCloth" -gem "commonmarker", "~> 0.18.1" +gem "commonmarker", git: "https://github.com/gjtorikian/commonmarker.git", tag: "v0.18.3" gem "rdoc", "~>3.6" gem "org-ruby", "= 0.9.9" gem "creole", "~>0.3.6" diff --git a/HISTORY.md b/HISTORY.md index c296602b..966ef18c 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,6 @@ +## 4.0.1 - 2022-03-07 +* Update to commonmarker 0.23.4; See [Version Changelog](https://github.com/gjtorikian/commonmarker/blob/main/CHANGELOG.md#v0234-2022-03-03) + ## 4.0.0 - 2021-03-31 * Drop support for Python 2 in RST rendering [#1456](https://github.com/github/markup/pull/1456) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index df6aa41d..0244f156 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '4.0.0' + VERSION = '4.0.1' Version = VERSION end end From 2de4aa63c419d1cc111e01e1678caf127f0a2356 Mon Sep 17 00:00:00 2001 From: Aaron Harpole Date: Mon, 14 Mar 2022 22:10:11 +0000 Subject: [PATCH 377/416] fix some minor changes in the generated HTML --- test/markups/README.rst.html | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index 3ddfab76..6accfdf6 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -9,7 +9,7 @@

      Subtitle

      -

      Header 2

      +

      Header 2

      1. Blah blah code blah
      2. More code, hooray
      3. @@ -106,7 +106,7 @@

        Header 2

        Coverity Scan Build Status -

        Field list

        +

        Field list

        @@ -131,9 +131,7 @@

        Field list

        -

        someone@somewhere.org

        -

        Press Ctrl+C to quit

        -

        RAW HTML!

        p {color:blue;} +

        RAW HTML!

        p {color:blue;} \ No newline at end of file From 4dc7c5612759fc9ce63a7af8bac38f72fc7e1de2 Mon Sep 17 00:00:00 2001 From: Aaron Harpole Date: Mon, 21 Mar 2022 15:41:09 -0700 Subject: [PATCH 378/416] Update HISTORY.md Co-authored-by: Nick Borromeo --- HISTORY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 966ef18c..51f16dfc 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,5 @@ ## 4.0.1 - 2022-03-07 -* Update to commonmarker 0.23.4; See [Version Changelog](https://github.com/gjtorikian/commonmarker/blob/main/CHANGELOG.md#v0234-2022-03-03) +* Update to commonmarker 0.18.3; There isn't a version on RubyGems for this, so this is pointing to a [tag version on GitHub](https://github.com/gjtorikian/commonmarker/blob/v0.18.3/commonmarker.gemspec) ## 4.0.0 - 2021-03-31 From 040f91d9919c51a5ecbe54352a207a3281f07359 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Tue, 12 Apr 2022 07:20:31 +0200 Subject: [PATCH 379/416] Make sure all anchors are created for RST links. --- lib/github/commands/rest2html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/github/commands/rest2html b/lib/github/commands/rest2html index c7c89dce..c6fc663e 100755 --- a/lib/github/commands/rest2html +++ b/lib/github/commands/rest2html @@ -199,8 +199,8 @@ class GitHubHTMLTranslator(HTMLTranslator): # see also: http://bit.ly/NHtyRx # the a is to support ::contents with ::sectnums: http://git.io/N1yC def visit_section(self, node): - id_attribute = node.attributes['ids'][0] - self.body.append('\n' % id_attribute) + for id_attribute in node.attributes['ids']: + self.body.append('\n' % id_attribute) self.section_level += 1 def depart_section(self, node): From a78c9a718bf64daeb6cf2f996c5844fa7fc3457f Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Tue, 12 Apr 2022 07:28:04 +0200 Subject: [PATCH 380/416] Add test. On my system rest2html generates quite some different markup so I'm not sure whether this actually works. --- test/markups/README.rst | 4 ++++ test/markups/README.rst.html | 2 ++ 2 files changed, 6 insertions(+) diff --git a/test/markups/README.rst b/test/markups/README.rst index 53cba9e0..ad7af380 100644 --- a/test/markups/README.rst +++ b/test/markups/README.rst @@ -8,6 +8,8 @@ Example text. .. contents:: Table of Contents +.. _label_for_header_2: + Header 2 -------- @@ -17,6 +19,8 @@ Header 2 3. Somé UTF-8° +4. `Link to the above header `_ + The UTF-8 quote character in this table used to cause python to go boom. Now docutils just silently ignores it. .. csv-table:: Things that are Awesome (on a scale of 1-11) diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index 6accfdf6..ca6807f8 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -9,11 +9,13 @@

        Subtitle

        +

        Header 2

        1. Blah blah code blah
        2. More code, hooray
        3. Somé UTF-8°
        4. +
        5. Link to the above header

        The UTF-8 quote character in this table used to cause python to go boom. Now docutils just silently ignores it.

        From e935a8505554aa175e9af89f1670d2dd5d03c469 Mon Sep 17 00:00:00 2001 From: djdefi Date: Thu, 29 Dec 2022 11:30:34 -0800 Subject: [PATCH 381/416] Remove reference to deprecated support email --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f6a81e94..2c83e31e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,7 +11,7 @@ This library's only job is to decide which markup format to use and call out to If you are having an issue with: * **Syntax highlighting** - see [github/linguist](https://github.com/github/linguist/blob/master/CONTRIBUTING.md#fixing-syntax-highlighting) -* **Markdown on GitHub** - contact support@github.com +* **Markdown on GitHub** - contact [GitHub Support](https://support.github.com/) * **Styling issues on GitHub** - see [primer-markdown](https://github.com/primer/primer-css/tree/master/modules/primer-markdown) module in the [primer/primer-css](https://github.com/primer/primer-css) repository Anything else - [search open issues](https://github.com/github/markup/issues) or create an issue and and we'll help point you in the right direction. From 65bfe283658857d7d506c923bd808c369a8cd90d Mon Sep 17 00:00:00 2001 From: TAbdiukov Date: Tue, 4 Jul 2023 06:23:18 +0200 Subject: [PATCH 382/416] Textile language link now leads to something completely different - replace the link with the current official one --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b2bcc809..93eb15ba 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The following markups are supported. The dependencies listed are required if you wish to run the library. You can also run `script/bootstrap` to fetch them all. * [.markdown, .mdown, .mkdn, .md](http://daringfireball.net/projects/markdown/) -- `gem install commonmarker` (https://github.com/gjtorikian/commonmarker) -* [.textile](https://www.promptworks.com/textile) -- `gem install RedCloth` (https://github.com/jgarber/redcloth) +* [.textile](https://textile-lang.com/) -- `gem install RedCloth` (https://github.com/jgarber/redcloth) * [.rdoc](https://ruby.github.io/rdoc/) -- `gem install rdoc -v 3.6.1` * [.org](http://orgmode.org/) -- `gem install org-ruby` (https://github.com/wallyqs/org-ruby) * [.creole](http://wikicreole.org/) -- `gem install creole` (https://github.com/larsch/creole) From 04873413c9f1df24d3e7d54cfb3fbb830df76076 Mon Sep 17 00:00:00 2001 From: Chris Maynard Date: Tue, 10 Oct 2023 14:58:28 -0700 Subject: [PATCH 383/416] Add markdown support for .mdx files --- HISTORY.md | 3 +++ lib/github-markup.rb | 2 +- lib/github/markup/markdown.rb | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 51f16dfc..57145177 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,6 @@ +## 4.0.2 - 2023-10-10 +* Add support for .mdx files in markdown + ## 4.0.1 - 2022-03-07 * Update to commonmarker 0.18.3; There isn't a version on RubyGems for this, so this is pointing to a [tag version on GitHub](https://github.com/gjtorikian/commonmarker/blob/v0.18.3/commonmarker.gemspec) diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 0244f156..58f9b1c5 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '4.0.1' + VERSION = '4.0.2' Version = VERSION end end diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index 7952bd3b..dcf93229 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -31,8 +31,8 @@ class Markdown < Implementation def initialize super( - /md|mkdn?|mdwn|mdown|markdown|litcoffee/i, - ["Markdown", "Literate CoffeeScript"]) + /md|mkdn?|mdwn|mdown|markdown|mdx|litcoffee/i, + ["Markdown", "MDX", "Literate CoffeeScript"]) end def load From 5488510af8644f45e9caa20ec00b6a0d10955517 Mon Sep 17 00:00:00 2001 From: Justin Kenyon Date: Wed, 12 Jun 2024 15:46:50 -0400 Subject: [PATCH 384/416] Update nokogiri, nokogiri-diff, rdoc This also removes support for Ruby versions < 3 Brings in changes from https://github.com/github/markup/pull/1808 co-authored-by: Tyler Dixon --- .github/workflows/ci.yml | 8 +- .gitignore | 3 +- Gemfile | 4 +- HISTORY.md | 7 + github-markup.gemspec | 7 +- lib/github-markup.rb | 2 +- lib/github/markup/command_implementation.rb | 36 +- test/markup_test.rb | 7 +- test/markups/README.asciidoc.html | 2 +- test/markups/README.hidetitle.asciidoc.html | 2 +- test/markups/README.litcoffee.html | 2 +- test/markups/README.long.rst | 1319 +++++++++++++++++++ test/markups/README.long.rst.html | 1303 ++++++++++++++++++ test/markups/README.mediawiki.html | 14 +- test/markups/README.pod.html | 12 +- test/markups/README.rst.html | 8 +- test/markups/README.toc.asciidoc.html | 2 +- test/markups/README.toc.rst.html | 4 +- 18 files changed, 2683 insertions(+), 59 deletions(-) create mode 100644 test/markups/README.long.rst create mode 100644 test/markups/README.long.rst.html diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 52d4db54..a25fdefc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,10 +11,10 @@ jobs: strategy: matrix: ruby: - - "2.4" - - "2.5" - - "2.6" - - "2.7" + - "3.0" + - "3.1" + - "3.2" + - "3.3" fail-fast: false steps: diff --git a/.gitignore b/.gitignore index 589d00dc..c93c0b18 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ pkg/ Gemfile.lock .project .buildpath -*~ +*~ +vendor/ diff --git a/Gemfile b/Gemfile index c98072f2..fb3c1308 100644 --- a/Gemfile +++ b/Gemfile @@ -1,17 +1,17 @@ source "http://rubygems.org" gemspec -gem "posix-spawn", :platforms => :ruby gem "redcarpet", :platforms => :ruby gem "kramdown", :platforms => :jruby gem "RedCloth" # using a tag version here because 0.18.3 was not published by the author to encourage users to upgrade. # however we want to bump up to this version since this has a security patch gem "commonmarker", git: "https://github.com/gjtorikian/commonmarker.git", tag: "v0.18.3" -gem "rdoc", "~>3.6" +gem "rdoc", "~> 6.7.0" gem "org-ruby", "= 0.9.9" gem "creole", "~>0.3.6" gem "wikicloth", "=0.8.3" gem "twitter-text", "~> 1.14" gem "asciidoctor", "~> 2.0.5" gem "rake" +gem "rexml" diff --git a/HISTORY.md b/HISTORY.md index 57145177..ace518d1 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,10 @@ +## 5.0.0 - 2024-06-12 +* Drop support for Ruby versions < 3 +* Bump nokogiri from 1.8.1 to 1.16.5 +* Bump nokogiri-diff from 0.2.0 to 0.3.0 +* Bump rdoc from 3.6 to 6.7.0 +* Update CommandImplementation to better support large files (affecting RST and POD6 rendering) + ## 4.0.2 - 2023-10-10 * Add support for .mdx files in markdown diff --git a/github-markup.gemspec b/github-markup.gemspec index 594d3507..4818706d 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -13,8 +13,9 @@ Gem::Specification.new do |s| s.homepage = "https://github.com/github/markup" s.license = "MIT" + s.required_ruby_version = '>= 3.0.0' + s.files = `git ls-files`.split($\) - s.files += Dir['vendor/**/*'] s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) } s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = %w[lib] @@ -24,7 +25,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3' s.add_development_dependency 'html-pipeline', '~> 1.0' s.add_development_dependency 'sanitize', '>= 4.6.3' - s.add_development_dependency 'nokogiri', '~> 1.8.1' - s.add_development_dependency 'nokogiri-diff', '~> 0.2.0' + s.add_development_dependency 'nokogiri', '~> 1.16.5' + s.add_development_dependency 'nokogiri-diff', '~> 0.3.0' s.add_development_dependency "github-linguist", ">= 7.1.3" end diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 58f9b1c5..646e341c 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '4.0.2' + VERSION = '5.0.0' Version = VERSION end end diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index 4ecf2ad5..b55f1735 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -1,9 +1,4 @@ -begin - require "posix-spawn" -rescue LoadError - require "open3" -end - +require "open3" require "github/markup/implementation" @@ -39,28 +34,13 @@ def call_block(rendered, content) end end - if defined?(POSIX::Spawn) - def execute(command, target) - spawn = POSIX::Spawn::Child.new(*command, :input => target) - if spawn.status.success? - sanitize(spawn.out, target.encoding) - else - raise CommandError.new(spawn.err.strip) - end - end - else - def execute(command, target) - output = Open3.popen3(*command) do |stdin, stdout, stderr, wait_thr| - stdin.puts target - stdin.close - if wait_thr.value.success? - stdout.readlines - else - raise CommandError.new(stderr.readlines.join('').strip) - end - end - sanitize(output.join(''), target.encoding) - end + def execute(command, target) + # capture3 blocks until both buffers are written to and the process terminates, but + # it won't allow either buffer to fill up + stdout, stderr, status = Open3.capture3(*command, stdin_data: target) + + raise CommandError.new(stderr) unless status.success? + sanitize(stdout, target.encoding) end def sanitize(input, encoding) diff --git a/test/markup_test.rb b/test/markup_test.rb index 24e78000..ced0b5f8 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -66,6 +66,11 @@ def call f.close_write f.read end + + if ENV['UPDATE'] + File.open(expected_file, 'w') { |f| f.write actual } + end + assert_html_equal expected, actual, < e - assert_equal "failure message", e.message + assert_equal "failure message", e.message.strip else fail "an exception was expected but was not raised" end diff --git a/test/markups/README.asciidoc.html b/test/markups/README.asciidoc.html index 6f478cab..8019074b 100644 --- a/test/markups/README.asciidoc.html +++ b/test/markups/README.asciidoc.html @@ -59,4 +59,4 @@

        Another Section

        content

        - + \ No newline at end of file diff --git a/test/markups/README.hidetitle.asciidoc.html b/test/markups/README.hidetitle.asciidoc.html index ae6b258f..02a55fe7 100644 --- a/test/markups/README.hidetitle.asciidoc.html +++ b/test/markups/README.hidetitle.asciidoc.html @@ -1,3 +1,3 @@

        This test verifies the author can disable the document title by adding :!showtitle: to the document header.

        -
        + \ No newline at end of file diff --git a/test/markups/README.litcoffee.html b/test/markups/README.litcoffee.html index 51ffe528..3245a0b5 100644 --- a/test/markups/README.litcoffee.html +++ b/test/markups/README.litcoffee.html @@ -52,4 +52,4 @@

        Literate CoffeeScript Test

        Tabs work too:

        test "tabbed code", -> -ok yes

        +ok yes

        \ No newline at end of file diff --git a/test/markups/README.long.rst b/test/markups/README.long.rst new file mode 100644 index 00000000..b1c007a6 --- /dev/null +++ b/test/markups/README.long.rst @@ -0,0 +1,1319 @@ +=================== +Robot Framework 7.0 +=================== + +.. default-role:: code + +`Robot Framework`_ 7.0 is a new major release with highly enhanced listener interface +(`#3296`_), native `VAR` syntax for creating variables (`#3761`_), support for +mixing embedded and normal arguments with library keywords (`#4710`_), JSON +result format (`#4847`_) and various other enhancements and bug fixes. + +Robot Framework 7.0 was released on Thursday January 11, 2024. Questions and comments +related to the release can be sent to the `#devel` channel on `Robot Framework Slack`_ +and possible bugs submitted to the `issue tracker`_. + +.. _Robot Framework: http://robotframework.org +.. _Robot Framework Foundation: http://robotframework.org/foundation + + +.. _pip: http://pip-installer.org +.. _PyPI: https://pypi.python.org/pypi/robotframework +.. _issue tracker milestone: https://github.com/robotframework/robotframework/milestone/64 +.. _issue tracker: https://github.com/robotframework/robotframework/issues +.. _Slack: http://slack.robotframework.org +.. _Robot Framework Slack: Slack_ +.. _installation instructions: ../../INSTALL.rst + +.. contents:: + :depth: 2 + :local: + +Installation +============ + +If you have pip_ installed, just run + +:: + + pip install --upgrade robotframework + +to install the latest available stable release or use + +:: + + pip install robotframework==7.0 + +to install exactly this version. Alternatively you can download the package +from PyPI_ and install it manually. For more details and other installation +approaches, see the `installation instructions`_. + +Most important enhancements +=========================== + + If you are interested to learn more about the new features in Robot Framework 7.0, + join the `RoboCon conference`__ in February, 2024. `Pekka Klärck`_, Robot Framework + lead developer, will go through the key features briefly in the `onsite conference`__ + in Helsinki and more thoroughly in the `online edition`__. + + The conference has also dozens of other great talks, workshops and a lot of + possibilities to meet other community members as well as developers of various + tools and libraries in the ecosystem. All profits from the conference will be + used for future Robot Framework development. + +.. _Pekka Klärck: https://github.com/pekkaklarck +__ https://robocon.io +__ https://robocon.io/#live-opening-the-conference +__ https://robocon.io/#online-opening-the-conference-live + +Listener enhancements +--------------------- + +Robot Framework's `listener interface`__ is a very powerful mechanism to get +notifications about various events during execution and it also allows modifying +data and results on the fly. It is not typically directly used by normal Robot +Framework users, but they are likely to use tools that use it internally. +The listener API has been significantly enhanced making it possible +to create even more powerful and interesting tools in the future. + +__ http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#listener-interface + +Support keywords and control structures with listener version 3 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The major limitation with the listener API has been that the listener +API version 2 only supports getting notifications, not making modifications, +and that the more powerful listener API version 3 has only supported suites +and tests/tasks. + +The biggest enhancement in the whole Robot Framework 7.0 is that the listener +version 3 has been extended to support also keywords and control structures (`#3296`_). +For example, a listener having the following methods prints information +about started keywords and ended WHILE loops: + +.. code:: python + + from robot import result, running + + + def start_keyword(data: running.Keyword, result: result.Keyword): + print(f"Keyword '{result.full_name}' used on line {data.lineno} started.") + + + def end_while(data: running.While, result: result.While): + print(f"WHILE loop on line {data.lineno} ended with status {result.status} " + f"after {len(result.body)} iterations.") + +With keyword calls it is possible to also get more information about the actually +executed keyword. For example, the following listener prints some information +about the executed keyword and the library it belongs to: + +.. code:: python + + from robot.running import Keyword as KeywordData, LibraryKeyword + from robot.result import Keyword as KeywordResult + + + def start_library_keyword(data: KeywordData, + implementation: LibraryKeyword, + result: KeywordResult): + library = implementation.owner + print(f"Keyword '{implementation.name}' is implemented in library " + f"'{library.name}' at '{implementation.source}' on line " + f"{implementation.lineno}. The library has {library.scope.name} " + f"scope and the current instance is {library.instance}.") + +As the above example already illustrated, it is even possible to get an access to +the actual library instance. This means that listeners can inspect the library +state and also modify it. With user keywords it is even possible to modify +the keyword itself or, via the `owner` resource file, any other keyword in +the resource file. + +Listeners can also modify results if needed. Possible use cases include hiding +sensitive information and adding more details to results based on external sources. + +Notice that although listener can change status of any executed keyword or control +structure, that does not directly affect the status of the executed test. In general +listeners cannot directly fail keywords so that execution would stop or handle +failures so that execution would continue. This kind of functionality may be +added in the future if there are needs. + +The new listener version 3 methods are so powerful and versatile that going them +through thoroughly in these release notes is not possible. For more examples, you +can see the `acceptance tests`__ using the methods in various interesting and even +crazy ways. + +__ https://github.com/robotframework/robotframework/tree/master/atest/testdata/output/listener_interface/body_items_v3 + +Listener version 3 is the default listener version +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Earlier listeners always needed to specify the API version they used with the +`ROBOT_LISTENER_API_VERSION` attribute. Now that the listener version 3 got +the new methods, it is considered so much more powerful than the version 2 +that it was made the default listener version (`#4910`_). + +The listener version 2 continues to work, but using it requires specifying +the listener version as earlier. The are no plans to deprecate the listener +version 2, but we nevertheless highly recommend using the version 3 whenever +possible. + +Libraries can register themselves as listeners by using string `SELF` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Listeners are typically enabled from the command line, but libraries +can register listeners as well. Often libraries themselves want to act +as listeners, and that has earlier required using `self.ROBOT_LIBRARY_LISTENER = self` +in the `__init__` method. Robot Framework 7.0 makes it possible to use string +`SELF` (case-insensitive) for this purpose as well (`#4910`_), which means +that a listener can be specified as a class attribute and not only in `__init__`. +This is especially convenient when using the `@library` decorator: + +.. code:: python + + from robot.api.deco import keyword, library + + + @library(listener='SELF') + class Example: + + def start_suite(self, data, result): + ... + + @keyword + def example(self, arg): + ... + +Nicer API for modifying keyword arguments +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Modifying keyword call arguments programmatically has been made more convenient +(`#5000`_). This enhancement eases modifying arguments using the new listener +version 3 `start/end_keyword` methods. + +Paths are passed to version 3 listeners as `pathlib.Path` objects +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Listeners have methods like `output_file` and `log_file` that are called when +result files are ready so that they get the file path as an argument. Earlier +paths were strings, but nowadays listener version 3 methods get them as +more convenient `pathlib.Path`__ objects. + +__ https://docs.python.org/3/library/pathlib.html + +Native `VAR` syntax +------------------- + +The new `VAR` syntax (`#3761`_) makes it possible to create local variables +as well as global, suite and test/task scoped variables dynamically during +execution. The motivation is to have a more convenient syntax than using +the `Set Variable` keyword for creating local variables and to unify +the syntax for creating variables in different scopes. Except for the mandatory +`VAR` marker, the syntax is also the same as when creating variables in the +Variables section. The syntax is best explained with examples: + +.. code:: robotframework + + *** Test Cases *** + Example + # Create a local variable `${local}` with a value `value`. + VAR ${local} value + + # Create a variable that is available throughout the whole suite. + # Supported scopes are GLOBAL, SUITE, TEST, TASK and LOCAL (default). + VAR ${suite} value scope=SUITE + + # Validate created variables. + Should Be Equal ${local} value + Should Be Equal ${suite} value + + Example continued + # Suite level variables are seen also by subsequent tests. + Should Be Equal ${suite} value + +When creating `${scalar}` variables having long values, it is possible to split +the value to multiple lines. Lines are joined together with a space by default, +but that can be changed with the `separator` configuration option. Similarly as +in the Variables section, it is possible to create also `@{list}` and `&{dict}` +variables. Unlike in the Variables section, variables can be created conditionally +using IF/ELSE structures: + +.. code:: robotframework + + *** Test Cases *** + Long value + VAR ${long} + ... This value is rather long. + ... It has been split to multiple lines. + ... Parts will be joined together with a space. + + Multiline + VAR ${multiline} + ... First line. + ... Second line. + ... Last line. + ... separator=\n + + List + # Creates a list with three items. + VAR @{list} a b c + + Dictionary + # Creates a dictionary with two items. + VAR &{dict} key=value second=item + + Normal IF + IF 1 > 0 + VAR ${x} true value + ELSE + VAR ${x} false value + END + + Inline IF + IF 1 > 0 VAR ${x} true value ELSE VAR ${x} false value + +Mixed argument support with library keywords +-------------------------------------------- + +User keywords got support to use both embedded and normal arguments in Robot +Framework 6.1 (`#4234`__) and now that support has been added also to library keywords +(`#4710`_). The syntax works so, that if a function or method implementing a keyword +accepts more arguments than there are embedded arguments, the remaining arguments +can be passed in as normal arguments. This is illustrated by the following example +keyword: + +.. code:: python + + @keyword('Number of ${animals} should be') + def example(animals, count): + ... + +The above keyword could be used like this: + +.. code:: robotframework + + *** Test Cases *** + Example + Number of horses should be 2 + Number of horses should be count=2 + Number of dogs should be 3 + +__ https://github.com/robotframework/robotframework/issues/4234 + +JSON result format +------------------ + +Robot Framework 6.1 added support to `convert test/task data to JSON and back`__ +and Robot Framework 7.0 extends the JSON serialization support to execution results +(`#4847`_). One of the core use cases for data serialization was making it easy to +transfer data between process and machines, and now it is also easy to pass results +back. + +Also the built-in Rebot tool that is used for post-processing results supports +JSON files both in output and in input. Creating JSON output files is done using +the normal `--output` option so that the specified file has a `.json` extension:: + + rebot --output output.json output.xml + +When reading output files, JSON files are automatically recognized by +the extension:: + + rebot output.json + rebot output1.json output2.json + +When combining or merging results, it is possible to mix JSON and XML files:: + + rebot output1.xml output2.json + rebot --merge original.xml rerun.json + +The JSON output file structure is documented in the `result.json` `schema file`__. + +The plan is to enhance the support for JSON output files in the future so that +they could be created already during execution. For more details see issue `#3423`__. + +__ https://github.com/robotframework/robotframework/blob/master/doc/releasenotes/rf-6.1.rst#json-data-format +__ https://github.com/robotframework/robotframework/tree/master/doc/schema#readme +__ https://github.com/robotframework/robotframework/issues/3423 + +Argument conversion enhancements +-------------------------------- + +Automatic argument conversion is a very powerful feature that library developers +can use to avoid converting arguments manually and to get more useful Libdoc +documentation. There are two important new enhancements to it. + +Support for `Literal` +~~~~~~~~~~~~~~~~~~~~~ + +In Python, the Literal__ type makes it possible to type arguments so that type +checkers accept only certain values. For example, this function only accepts +strings `x`, `y` and `z`: + +.. code:: python + + def example(arg: Literal['x', 'y', 'z']): + ... + +Robot Framework has been enhanced so that it validates that an argument having +a `Literal` type can only be used with the specified values (`#4633`_). For +example, using a keyword with the above implementation with a value `xxx` would +fail. + +In addition to validation, arguments are also converted. For example, if an +argument accepts `Literal[-1, 0, 1]`, used arguments are converted to +integers and then validated. In addition to that, string matching is case, space, +underscore and hyphen insensitive. In all cases exact matches have a precedence +and the argument that is passed to the keyword is guaranteed to be in the exact +format used with `Literal`. + +`Literal` conversion is in many ways similar to Enum__ conversion that Robot +Framework has supported for long time. `Enum` conversion has benefits like +being able to use a custom documentation and it is typically better when using +the same type multiple times. In simple cases being able to just use +`arg: Literal[...]` without defining a new type is very convenient, though. + +__ https://docs.python.org/3/library/typing.html#typing.Literal +__ https://docs.python.org/3/library/enum.html + +Support "stringified" types like `'list[int]'` and `'int | float'` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Python's type hinting syntax has evolved so that generic types can be parameterized +like `list[int]` (new in `Python 3.9`__) and unions written as `int | float` +(new in `Python 3.10`__). Using these constructs with older Python versions causes +errors, but Python type checkers support also "stringified" type hints like +`'list[int]'` and `'int | float'` that work regardless the Python version. + +Support for stringified generics and unions has now been added also to +Robot Framework's argument conversion (`#4711`_). For example, +the following typing now also works with Python 3.8: + +.. code:: python + + def example(a: 'list[int]', b: 'int | float'): + ... + +These stringified types are also compatible with the Remote library API and other +scenarios where using actual types is not possible. + +__ https://peps.python.org/pep-0585 +__ https://peps.python.org/pep-0604 + +Tags set globally can be removed using `-tag` syntax +---------------------------------------------------- + +Individual tests and keywords can nowadays remove tags that have been set in +the Settings section with `Test Tags` or `Keyword Tags` settings by using +the `-tag` syntax with their own `[Tags]` setting (`#4374`_). For example, +tests `T1` and `T3` below get tags `all` and `most`, and test `T2` gets +tags `all` and `one`: + +.. code:: robotframework + + *** Settings *** + Test Tags all most + + *** Test Cases *** + T1 + No Operation + T2 + [Tags] one -most + No Operation + T3 + No Operation + +With tests it is possible to get the same effect by using the `Default Tags` +setting and overriding it where needed. That syntax is, however, considered +deprecated (`#4365`__) and using the new `-tag` syntax is recommended. With +keywords there was no similar functionality earlier. + +__ https://github.com/robotframework/robotframework/issues/4365 + +Dynamic and hybrid library APIs support asynchronous execution +-------------------------------------------------------------- + +Dynamic and hybrid libraries nowadays support asynchronous execution. +In practice the special methods like `get_keyword_names` and `run_keyword` +can be implemented as async methods (`#4803`_). + +Async support was added to the normal static library API in Robot Framework +6.1 (`#4089`_). A bug related to handling asynchronous keywords if execution +is stopped gracefully has also been fixed (`#4808`_). + +.. _#4089: https://github.com/robotframework/robotframework/issues/4089 + +Timestamps in result model and output.xml use standard format +------------------------------------------------------------- + +Timestamps used in the result model and stored to the output.xml file used custom +format like `20231107 19:57:01.123` earlier. Non-standard formats are seldom +a good idea, and in this case parsing the custom format turned out to be slow +as well. + +Nowadays the result model stores timestamps as standard datetime_ objects and +elapsed times as a timedelta_ (`#4258`_). This makes creating timestamps and +operating with them more convenient and considerably faster. The new objects can +be accessed via `start_time`, `end_time` and `elapsed_time` attributes that were +added as forward compatibility already in Robot Framework 6.1 (`#4765`_). +Old information is still available via the old `starttime`, `endtime` and +`elapsedtime` attributes, so this change is fully backwards compatible. + +The timestamp format in output.xml has also been changed from the custom +`YYYYMMDD HH:MM:SS.mmm` format to `ISO 8601`_ compatible +`YYYY-MM-DDTHH:MM:SS.mmmmmm`. Using a standard format makes it +easier to process output.xml files, but this change also has big positive +performance effect. Now that the result model stores timestamps as datetime_ +objects, formatting and parsing them with the available `isoformat()`__ and +`fromisoformat()`__ methods is very fast compared to custom formatting and parsing. + +A related change is that instead of storing start and end times of each executed +item in output.xml, we nowadays store their start and elapsed times. Elapsed times +are represented as floats denoting seconds. Having elapsed times directly available +is a lot more convenient than calculating them based on start and end times. +Storing start and elapsed times also takes less space than storing start and end times. + +As the result of these changes, times are available in the result model and in +output.xml in higher precision than earlier. Earlier times were stored in millisecond +granularity, but nowadays they use microseconds. Logs and reports still use milliseconds, +but that can be changed in the future if there are needs. + +Changes to output.xml are backwards incompatible and affect all external tools +that process timestamps. This is discussed more in `Changes to output.xml`_ +section below along with other output.xml changes. + +.. _datetime: https://docs.python.org/3/library/datetime.html#datetime-objects +.. _timedelta: https://docs.python.org/3/library/datetime.html#timedelta-objects +.. _#4765: https://github.com/robotframework/robotframework/issues/4765 +.. _ISO 8601: https://en.wikipedia.org/wiki/ISO_8601 +__ https://docs.python.org/3/library/datetime.html#datetime.datetime.isoformat +__ https://docs.python.org/3/library/datetime.html#datetime.datetime.fromisoformat + +Dark mode support to report and log +----------------------------------- + +Report and log got a new dark mode (`#3725`_). It is enabled automatically based +on browser and operating system preferences, but there is also a toggle to +switch between the modes. + +Backwards incompatible changes +============================== + +Python 3.6 and 3.7 are no longer supported +------------------------------------------ + +Robot Framework 7.0 requires Python 3.8 or newer (`#4294`_). The last version +that supports Python 3.6 and 3.7 is Robot Framework 6.1.1. + +Changes to output.xml +--------------------- + +The output.xml file has changed in different ways making Robot Framework 7.0 +incompatible with external tools processing output.xml files until these tools +are updated. We try to avoid this kind of breaking changes, but in this case +especially the changes to timestamps were considered so important that we +eventually would have needed to do them anyway. + +Due to the changes being relatively big, it can take some time before external +tools are updated. To allow users to take Robot Framework 7.0 into use also +if they depend on an incompatible tool, it is possible to use the new +`--legacy-output` option both as part of execution and with the Rebot tool +to generate output.xml files that are compatible with older versions. + +Timestamp related changes +~~~~~~~~~~~~~~~~~~~~~~~~~ + +The biggest changes in output.xml are related to timestamps (`#4258`_). +With earlier versions start and end times of executed items, as well as timestamps +of the logged messages, were stored using a custom `YYYYMMDD HH:MM:SS.mmm` format, +but nowadays the format is `ISO 8601`_ compatible `YYYY-MM-DDTHH:MM:SS.mmmmmm`. +In addition to that, instead of saving start and end times to `starttime` and +`endtime` attributes and message times to `timestamp`, start and elapsed times +are now stored to `start` and `elapsed` attributes and message times to `time`. + +Examples: + +.. code:: xml + + + Hello world! + + + + Hello world! + + +The new format is standard compliant, contains more detailed times, makes the elapsed +time directly available and makes the `` elements over 10% shorter. +These are all great benefits, but we are still sorry for all the extra work +this causes for those developing tools that process output.xml files. + +Keyword name related changes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +How keyword names are stored in output.xml has changed slightly (`#4884`_). +With each executed keywords we store both the name of the keyword and the name +of the library or resource file containing it. Earlier the latter was stored to +attribute `library` also with resource files, but nowadays the attribute is generic +`owner`. In addition to `owner` being a better name in general, it also +matches the new `owner` attribute keywords in the result model have. + +Another change is that the original name stored with keywords using embedded +arguments is nowadays in `source_name` attribute when it used to be in `sourcename`. +This change was done to make the attribute consistent with the attribute in +the result model. + +Examples: + +.. code:: xml + + + ... + ... + + + ... + ... + +Other changes +~~~~~~~~~~~~~ + +Nowadays keywords and control structures can have a message. Messages are represented +as the text of the `` element, and they have been present already earlier with +tests and suites. Related to this, control structured cannot anymore have ``. +(`#4883`_) + +These changes should not cause problems for tools processing output.xml files, +but storing messages with each failed keyword and control structure may +increase the output.xml size. + +Schema updates +~~~~~~~~~~~~~~ + +The output.xml schema has been updated and can be found via +https://github.com/robotframework/robotframework/tree/master/doc/schema/. + +Changes to result model +----------------------- + +There have been some changes to the result model that unfortunately affect +external tools using it. The main motivation for these changes has been +cleaning up the model before creating a JSON representation for it (`#4847`_). + +Changes related to keyword names +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The biggest changes are related to keyword names (`#4884`_). Earlier `Keyword` +objects had a `name` attribute that contained the full keyword name like +`BuiltIn.Log`. The actual keyword name and the name of the library or resource +file that the keyword belonged to were in `kwname` and `libname` attributes, +respectively. In addition to these, keywords using embedded arguments also had +a `sourcename` attribute containing the original keyword name. + +Due to reasons explained in `#4884`_, the following changes have been made +in Robot Framework 7.0: + +- Old `kwname` is renamed to `name`. This is consistent with the execution side `Keyword`. +- Old `libname` is renamed to generic `owner`. +- New `full_name` is introduced to replace the old `name`. +- `sourcename` is renamed to `source_name`. +- `kwname`, `libname` and `sourcename` are preserved as properties. They are considered + deprecated, but accessing them does not cause a deprecation warning yet. + +The backwards incompatible part of this change is changing the meaning of the +`name` attribute. It used to be a read-only property yielding the full name +like `BuiltIn.Log`, but now it is a normal attribute that contains just the actual +keyword name like `Log`. All other old attributes have been preserved as properties +and code using them does not need to be updated immediately. + +Deprecated attributes have been removed +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The following attributes that were deprecated already in Robot Framework 4.0 +have been removed (`#4846`_): + +- `TestSuite.keywords`. Use `TestSuite.setup` and `TestSuite.teardown` instead. +- `TestCase.keywords`. Use `TestCase.body`, `TestCase.setup` and `TestCase.teardown` instead. +- `Keyword.keywords`. Use `Keyword.body` and `Keyword.teardown` instead. +- `Keyword.children`. Use `Keyword.body` and `Keyword.teardown` instead. +- `TestCase.critical`. The whole criticality concept has been removed. + +Additionally, `TestSuite.keywords` and `TestCase.keywords` have been removed +from the execution model. + +Changes to parsing model +------------------------ + +There have been some changes also to the parsing model: + +- The node representing the deprecated `[Return]` setting has been renamed from + `Return` to `ReturnSetting`. At the same time, the node representing the + `RETURN` statement has been renamed from `ReturnStatement` to `Return` (`#4939`_). + + To ease transition, `ReturnSetting` has existed as an alias for `Return` starting + from Robot Framework 6.1 (`#4656`_) and `ReturnStatement` is preserved as an alias + now. In addition to that, the `ModelVisitor` base class has special handling for + `visit_ReturnSetting` and `visit_ReturnStatement` visitor methods so that they work + correctly with `ReturnSetting` and `ReturnStatement` with Robot Framework 6.1 and + newer. Issue `#4939`_ explains this in more detail and has a concrete example + how to support also older Robot Framework versions. + +- The node representing the `Test Tags` setting as well as the deprecated + `Force Tags` setting has been renamed from `ForceTags` to `TestTags` (`#4385`_). + `ModelVisitor` has special handling for the `visit_ForceTags` method so + that it will continue to work also after the change. + +- The token type used with `AS` (or `WITH NAME`) in library imports has been changed + to `Token.AS` (`#4375`_). `Token.WITH_NAME` still exists as an alias for `Token.AS`. + +- Statement `type` and `tokens` have been moved from `_fields` to `_attributes` (`#4912`_). + This may affect debugging the model. + +.. _#4656: https://github.com/robotframework/robotframework/issues/4656 + +Changes to Libdoc spec files +---------------------------- + +The following deprecated constructs have been removed from Libdoc spec files (`#4667`_): + +- `datatypes` have been removed from XML or JSON spec files. They were deprecated in + favor of `typedocs` already in Robot Framework 5.0 (`#4160`_). +- Type names are not anymore written to XML specs as content of the `` elements. + The name is available as the `name` attribute of `` elements since + Robot Framework 6.1 (`#4538`_). +- `types` and `typedocs` attributes have been removed from arguments in JSON specs. + The `type` attribute introduced in RF 6.1 (`#4538`_) needs to be used instead. + +Libdoc schema files have been updated and can be found via +https://github.com/robotframework/robotframework/tree/master/doc/schema/. + +.. _#4160: https://github.com/robotframework/robotframework/issues/4160 +.. _#4538: https://github.com/robotframework/robotframework/issues/4538 + +Changes to selecting tests with `--suite`, `--test` and `--include` +------------------------------------------------------------------- + +There are two changes related to selecting tests: + +- When using `--test` and `--include` together, tests matching either of them + are selected (`#4721`_). Earlier tests need to match both options to be selected. + +- When selecting a suite using its parent suite as a prefix like `--suite parent.suite`, + the given name must match the full suite name (`#4720`_). Earlier it was enough if + the prefix matched the closest parent or parents. + +Other backwards incompatible changes +------------------------------------ + +- The default value of the `stdin` argument used with `Process` library keyword + has been changed from `subprocess.PIPE` to `None` (`#4103`_). This change ought + to avoid processes hanging in some cases. Those who depend on the old behavior + need to use `stdin=PIPE` explicitly to enable that. + +- When type hints are specified as strings, they must use format `type`, `type[param]`, + `type[p1, p2]` or `t1 | t2` (`#4711`_). Using other formats will cause errors taking + keywords into use. In practice problems occur if the special characters `[`, `]`, `,` + and `|` occur in unexpected places. For example, `arg: "Hello, world!"` will cause + an error due to the comma. + +- `datetime`, `date` and `timedelta` objects are sent over the Remote interface + differently than earlier (`#4784`_). They all used to be converted to strings, but + nowadays `datetime` is sent as-is, `date` is converted to `datetime` and sent like + that, and `timedelta` is converted to a `float` by using `timedelta.total_seconds()`. + +- Argument conversion support with `collections.abc.ByteString` has been removed (`#4983`_). + The reason is that `ByteString` is deprecated and will be removed in Python 3.14. + It has not been too often needed, but if you happen to use it, you can change + `arg: ByteString` to `arg: bytes | bytearray` and the functionality + stays exactly the same. + +- Paths passed to result file related listener version 3 methods like `output_file` + and `log_file` have been changed from strings to `pathlib.Path` objects (`#4988`_). + Most of the time both kinds of paths work interchangeably, so this change is unlikely + to cause issues. If you need to handle these paths as strings, they can be converted + by using `str(path)`. + +- `robot.utils.normalize` does not anymore support bytes (`#4936`_). + +- Deprecated `accept_plain_values` argument has been removed from the + `timestr_to_secs` utility function (`#4861`_). + +Deprecations +============ + +`[Return]` setting +------------------ + +The `[Return]` setting for specifying the return value from user keywords has +been "loudly" deprecated (`#4876`_). It has been "silently" deprecated since +Robot Framework 5.0 when the much more versatile `RETURN` setting was introduced +(`#4078`_), but now using it will cause a deprecation warning. The plan is to +preserve the `[Return]` setting at least until Robot Framework 8.0. + +If you have lot of data that uses `[Return]`, the easiest way to update it is +using the Robotidy_ tool that can convert `[Return]` to `RETURN` automatically. +If you have data that is executed also with Robot Framework versions that do +not support `RETURN`, you can use the `Return From Keyword` keyword instead. +That keyword will eventually be deprecated and removed as well, though. + +.. _#4078: https://github.com/robotframework/robotframework/issues/4078 +.. _Robotidy: https://robotidy.readthedocs.io + +Singular section headers +------------------------ + +Using singular section headers like `*** Test Case ***` or `*** Setting ***` +nowadays causes a deprecation warning (`#4432`_). They were silently deprecated +in Robot Framework 6.0 for reasons explained in issue `#4431`_. + +.. _#4431: https://github.com/robotframework/robotframework/issues/4431 + +Deprecated attributes in parsing, running and result models +----------------------------------------------------------- + +- In the parsing model, `For.variables`, `ForHeader.variables`, `Try.variable` and + `ExceptHeader.variable` attributes have been deprecated in favor of the new `assign` + attribute (`#4708`_). + +- In running and result models, `For.variables` and `TryBranch.variable` have been + deprecated in favor of the new `assign` attribute (`#4708`_). + +- In the result model, control structures like `FOR` were earlier modeled so that they + looked like keywords. Nowadays they are considered totally different objects and + their keyword specific attributes `name`, `kwnane`, `libname`, `doc`, `args`, + `assign`, `tags` and `timeout` have been deprecated (`#4846`_). + +- `starttime`, `endtime` and `elapsed` time attributes in the result model have been + silently deprecated (`#4258`_). Accessing them does not yet cause a deprecation + warning, but users are recommended to use `start_time`, `end_time` and + `elapsed_time` attributes that are available since Robot Framework 6.1. + +- `kwname`, `libname` and `sourcename` attributes used by the `Keyword` object + in the result model have been silently deprecated (`#4884`_). New code should use + `name`, `owner` and `source_name` instead. + +Other deprecated features +------------------------- + +- Using embedded arguments with a variable that has a value not matching custom + embedded argument patterns nowadays causes a deprecation warning (`#4524`_). + Earlier variables used as embedded arguments were always accepted without + validating values. + +- Using `FOR IN ZIP` loops with lists having different lengths without explicitly + using `mode=SHORTEST` has been deprecated (`#4685`_). The strict mode where lengths + must match will be the default mode in the future. + +- Various utility functions in the `robot.utils` package that are no longer used + by Robot Framework itself, including the whole Python 2/3 compatibility layer, + have been deprecated (`#4501`_). If you need some of these utils, you can copy + their code to your own tool or library. This change may affect existing + libraries and tools in the ecosystem. + +- `case_insensitive` and `whitespace_insensitive` arguments used by some + Collections and String library keywords have been deprecated in favor of + `ignore_case` and `ignore_whitespace`. The new arguments were added for + consistency reasons (`#4954`_) and the old arguments will continue to work + for the time being. + +- Passing time as milliseconds to the `elapsed_time_to_string` utility function + has been deprecated (`#4862`_). + +Acknowledgements +================ + +Robot Framework development is sponsored by the `Robot Framework Foundation`_ +and its over 60 member organizations. If your organization is using Robot Framework +and benefiting from it, consider joining the foundation to support its +development as well. + +Robot Framework 7.0 team funded by the foundation consists of `Pekka Klärck`_ and +`Janne Härkönen `_ (part time). +In addition to work done by them, the community has provided some great contributions: + +- `Ygor Pontelo `__ added async support to the + dynamic and hybrid library APIs (`#4803`_) and fixed a bug with handling async + keywords when execution is stopped gracefully (`#4808`_). + +- `Topi 'top1' Tuulensuu `__ fixed a performance regression + when using `Run Keyword` so that the name of the executed keyword contains a variable + (`#4659`_). + +- `Pasi Saikkonen `__ added dark mode to reports + and logs (`#3725`_). + +- `René `__ added return type information to Libdoc's + HTML output (`#3017`_), fixed `DotDict` equality comparisons (`#4956`_) and + helped finalizing the dark mode support (`#3725`_). + +- `Robin `__ added type hints to modules that + did not yet have them under the public `robot.api` package (`#4841`_). + +- `Mark Moberts `__ added case-insensitive list and + dictionary comparison support to the Collections library (`#4343`_). + +- `Daniel Biehl `__ enhanced performance of traversing + the parsing model using `ModelVisitor` (`#4934`_). + +Big thanks to Robot Framework Foundation, to community members listed above, and to +everyone else who has tested preview releases, submitted bug reports, proposed +enhancements, debugged problems, or otherwise helped with Robot Framework 7.0 +development. + +See you at `RoboCon 2024 `__ either onsite or online! + +| `Pekka Klärck`_ +| Robot Framework lead developer + +Full list of fixes and enhancements +=================================== + +.. list-table:: + :header-rows: 1 + + * - ID + - Type + - Priority + - Summary + * - `#3296`_ + - enhancement + - critical + - Support keywords and control structures with listener version 3 + * - `#3761`_ + - enhancement + - critical + - Native `VAR` syntax to create variables inside tests and keywords + * - `#4294`_ + - enhancement + - critical + - Drop Python 3.6 and 3.7 support + * - `#4710`_ + - enhancement + - critical + - Support library keywords with both embedded and normal arguments + * - `#4847`_ + - enhancement + - critical + - Support JSON serialization with result model + * - `#4659`_ + - bug + - high + - Performance regression when using `Run Keyword` and keyword name contains a variable + * - `#4921`_ + - bug + - high + - Log levels don't work correctly with `robot:flatten` + * - `#3725`_ + - enhancement + - high + - Support dark theme with report and log + * - `#4258`_ + - enhancement + - high + - Change timestamps from custom strings to `datetime` in result model and to ISO 8601 format in output.xml + * - `#4374`_ + - enhancement + - high + - Support removing tags set globally by using `-tag` syntax with `[Tags]` setting + * - `#4633`_ + - enhancement + - high + - Automatic argument conversion and validation for `Literal` + * - `#4711`_ + - enhancement + - high + - Support type aliases in formats `'list[int]'` and `'int | float'` in argument conversion + * - `#4803`_ + - enhancement + - high + - Async support to dynamic and hybrid library APIs + * - `#4808`_ + - bug + - medium + - Async keywords are not stopped when execution is stopped gracefully + * - `#4859`_ + - bug + - medium + - Parsing errors in reStructuredText files have no source + * - `#4880`_ + - bug + - medium + - Initially empty test fails even if pre-run modifier adds content to it + * - `#4886`_ + - bug + - medium + - `Set Variable If` is slow if it has several conditions + * - `#4898`_ + - bug + - medium + - Resolving special variables can fail with confusing message + * - `#4915`_ + - bug + - medium + - `cached_property` attributes are called when importing library + * - `#4924`_ + - bug + - medium + - WHILE `on_limit` missing from listener v2 attributes + * - `#4926`_ + - bug + - medium + - WHILE and TRY content are not removed with `--removekeywords all` + * - `#4945`_ + - bug + - medium + - `TypedDict` with forward references do not work in argument conversion + * - `#4956`_ + - bug + - medium + - DotDict behaves inconsistent on equality checks. `x == y` != `not x != y` and not `x != y` == `not x == y` + * - `#4964`_ + - bug + - medium + - Variables set using `Set Suite Variable` with `children=True` cannot be properly overwritten + * - `#4980`_ + - bug + - medium + - DateTime library uses deprecated `datetime.utcnow()` + * - `#4999`_ + - bug + - medium + - XML Library: Double namespace during Element To String + * - `#5005`_ + - bug + - medium + - `Log Variables` should not consume iterables + * - `#3017`_ + - enhancement + - medium + - Add return type to Libdoc specs and HTML output + * - `#4103`_ + - enhancement + - medium + - Process: Change the default `stdin` behavior from `subprocess.PIPE` to `None` + * - `#4302`_ + - enhancement + - medium + - Remove `Reserved` library + * - `#4343`_ + - enhancement + - medium + - Collections: Support case-insensitive list and dictionary comparisons + * - `#4375`_ + - enhancement + - medium + - Change token type of `AS` (or `WITH NAME`) used with library imports to `Token.AS` + * - `#4385`_ + - enhancement + - medium + - Change the parsing model object produced by `Test Tags` (and `Force Tags`) to `TestTags` + * - `#4432`_ + - enhancement + - medium + - Loudly deprecate singular section headers + * - `#4501`_ + - enhancement + - medium + - Loudly deprecate old Python 2/3 compatibility layer and other deprecated utils + * - `#4524`_ + - enhancement + - medium + - Loudly deprecate variables used as embedded arguments not matching custom patterns + * - `#4545`_ + - enhancement + - medium + - Support creating assigned variable name based on another variable like `${${var}} = Keyword` + * - `#4667`_ + - enhancement + - medium + - Remove deprecated constructs from Libdoc spec files + * - `#4685`_ + - enhancement + - medium + - Deprecate `SHORTEST` mode being default with `FOR IN ZIP` loops + * - `#4708`_ + - enhancement + - medium + - Use `assing`, not `variable`, with FOR and TRY/EXCEPT model objects when referring to assigned variables + * - `#4720`_ + - enhancement + - medium + - Require `--suite parent.suite` to match the full suite name + * - `#4721`_ + - enhancement + - medium + - Change behavior of `--test` and `--include` so that they are cumulative + * - `#4747`_ + - enhancement + - medium + - Support `[Setup]` with user keywords + * - `#4784`_ + - enhancement + - medium + - Remote: Enhance `datetime`, `date` and `timedelta` conversion + * - `#4841`_ + - enhancement + - medium + - Add typing to all modules under `robot.api` + * - `#4846`_ + - enhancement + - medium + - Result model: Loudly deprecate not needed attributes and remove already deprecated ones + * - `#4872`_ + - enhancement + - medium + - Control continue-on-failure mode by using recursive and non-recursive tags together + * - `#4876`_ + - enhancement + - medium + - Loudly deprecate `[Return]` setting + * - `#4877`_ + - enhancement + - medium + - XML: Support ignoring element order with `Elements Should Be Equal` + * - `#4883`_ + - enhancement + - medium + - Result model: Add `message` to keywords and control structures and remove `doc` from controls + * - `#4884`_ + - enhancement + - medium + - Result model: Enhance storing keyword name + * - `#4896`_ + - enhancement + - medium + - Support `separator=` configuration option with scalar variables in Variables section + * - `#4903`_ + - enhancement + - medium + - Support argument conversion and named arguments with dynamic variable files + * - `#4905`_ + - enhancement + - medium + - Support creating variable name based on another variable like `${${VAR}}` in Variables section + * - `#4910`_ + - enhancement + - medium + - Make listener v3 the default listener API + * - `#4912`_ + - enhancement + - medium + - Parsing model: Move `type` and `tokens` from `_fields` to `_attributes` + * - `#4930`_ + - enhancement + - medium + - BuiltIn: New `Reset Log Level` keyword for resetting the log level to the original value + * - `#4939`_ + - enhancement + - medium + - Parsing model: Rename `Return` to `ReturnSetting` and `ReturnStatement` to `Return` + * - `#4942`_ + - enhancement + - medium + - Add public argument conversion API for libraries and other tools + * - `#4952`_ + - enhancement + - medium + - Collections: Make `ignore_order` and `ignore_keys` recursive + * - `#4960`_ + - enhancement + - medium + - Support integer conversion with strings representing whole number floats like `'1.0'` and `'2e10'` + * - `#4976`_ + - enhancement + - medium + - Support string `SELF` (case-insenstive) when library registers itself as listener + * - `#4979`_ + - enhancement + - medium + - Add `robot.result.TestSuite.to/from_xml` methods + * - `#4982`_ + - enhancement + - medium + - DateTime: Support `datetime.date` as an input format with date related keywords + * - `#4983`_ + - enhancement + - medium + - Type conversion: Remove support for deprecated `ByteString` + * - `#5000`_ + - enhancement + - medium + - Nicer API for setting keyword call arguments programmatically + * - `#4934`_ + - --- + - medium + - Enhance performance of visiting parsing model + * - `#4621`_ + - bug + - low + - OperatingSystem library docs have broken link / title + * - `#4798`_ + - bug + - low + - `--removekeywords passed` doesn't remove test setup and teardown + * - `#4867`_ + - bug + - low + - Original order of dictionaries is not preserved when they are pretty printed in log messages + * - `#4870`_ + - bug + - low + - User keyword teardown missing from running model JSON schema + * - `#4904`_ + - bug + - low + - Importing static variable file with arguments does not fail + * - `#4913`_ + - bug + - low + - Trace log level logs arguments twice for embedded arguments + * - `#4927`_ + - bug + - low + - WARN level missing from the log level selector in log.html + * - `#4967`_ + - bug + - low + - Variables are not resolved in keyword name in WUKS error message + * - `#4861`_ + - enhancement + - low + - Remove deprecated `accept_plain_values` from `timestr_to_secs` utility function + * - `#4862`_ + - enhancement + - low + - Deprecate `elapsed_time_to_string` accepting time as milliseconds + * - `#4864`_ + - enhancement + - low + - Process: Make warning about processes hanging if output buffers get full more visible + * - `#4885`_ + - enhancement + - low + - Add `full_name` to replace `longname` to suite and test objects + * - `#4900`_ + - enhancement + - low + - Make keywords and control structures in log look more like original data + * - `#4922`_ + - enhancement + - low + - Change the log level of `Set Log Level` message from INFO to DEBUG + * - `#4933`_ + - enhancement + - low + - Type conversion: Ignore hyphens when matching enum members + * - `#4935`_ + - enhancement + - low + - Use `casefold`, not `lower`, when comparing strings case-insensitively + * - `#4936`_ + - enhancement + - low + - Remove bytes support from `robot.utils.normalize` function + * - `#4954`_ + - enhancement + - low + - Collections and String: Add `ignore_case` as alias for `case_insensitive` + * - `#4958`_ + - enhancement + - low + - Document `robot_running` and `dry_run_active` properties of the BuiltIn library in the User Guide + * - `#4975`_ + - enhancement + - low + - Support `times` and `x` suffixes with `WHILE` limit to make it more compatible with `Wait Until Keyword Succeeds` + * - `#4988`_ + - enhancement + - low + - Change paths passed to listener v3 methods to `pathlib.Path` instances + +Altogether 88 issues. View on the `issue tracker `__. + +.. _#3296: https://github.com/robotframework/robotframework/issues/3296 +.. _#3761: https://github.com/robotframework/robotframework/issues/3761 +.. _#4294: https://github.com/robotframework/robotframework/issues/4294 +.. _#4710: https://github.com/robotframework/robotframework/issues/4710 +.. _#4847: https://github.com/robotframework/robotframework/issues/4847 +.. _#4659: https://github.com/robotframework/robotframework/issues/4659 +.. _#4921: https://github.com/robotframework/robotframework/issues/4921 +.. _#3725: https://github.com/robotframework/robotframework/issues/3725 +.. _#4258: https://github.com/robotframework/robotframework/issues/4258 +.. _#4374: https://github.com/robotframework/robotframework/issues/4374 +.. _#4633: https://github.com/robotframework/robotframework/issues/4633 +.. _#4711: https://github.com/robotframework/robotframework/issues/4711 +.. _#4803: https://github.com/robotframework/robotframework/issues/4803 +.. _#4808: https://github.com/robotframework/robotframework/issues/4808 +.. _#4859: https://github.com/robotframework/robotframework/issues/4859 +.. _#4880: https://github.com/robotframework/robotframework/issues/4880 +.. _#4886: https://github.com/robotframework/robotframework/issues/4886 +.. _#4898: https://github.com/robotframework/robotframework/issues/4898 +.. _#4915: https://github.com/robotframework/robotframework/issues/4915 +.. _#4924: https://github.com/robotframework/robotframework/issues/4924 +.. _#4926: https://github.com/robotframework/robotframework/issues/4926 +.. _#4945: https://github.com/robotframework/robotframework/issues/4945 +.. _#4956: https://github.com/robotframework/robotframework/issues/4956 +.. _#4964: https://github.com/robotframework/robotframework/issues/4964 +.. _#4980: https://github.com/robotframework/robotframework/issues/4980 +.. _#4999: https://github.com/robotframework/robotframework/issues/4999 +.. _#5005: https://github.com/robotframework/robotframework/issues/5005 +.. _#3017: https://github.com/robotframework/robotframework/issues/3017 +.. _#4103: https://github.com/robotframework/robotframework/issues/4103 +.. _#4302: https://github.com/robotframework/robotframework/issues/4302 +.. _#4343: https://github.com/robotframework/robotframework/issues/4343 +.. _#4375: https://github.com/robotframework/robotframework/issues/4375 +.. _#4385: https://github.com/robotframework/robotframework/issues/4385 +.. _#4432: https://github.com/robotframework/robotframework/issues/4432 +.. _#4501: https://github.com/robotframework/robotframework/issues/4501 +.. _#4524: https://github.com/robotframework/robotframework/issues/4524 +.. _#4545: https://github.com/robotframework/robotframework/issues/4545 +.. _#4667: https://github.com/robotframework/robotframework/issues/4667 +.. _#4685: https://github.com/robotframework/robotframework/issues/4685 +.. _#4708: https://github.com/robotframework/robotframework/issues/4708 +.. _#4720: https://github.com/robotframework/robotframework/issues/4720 +.. _#4721: https://github.com/robotframework/robotframework/issues/4721 +.. _#4747: https://github.com/robotframework/robotframework/issues/4747 +.. _#4784: https://github.com/robotframework/robotframework/issues/4784 +.. _#4841: https://github.com/robotframework/robotframework/issues/4841 +.. _#4846: https://github.com/robotframework/robotframework/issues/4846 +.. _#4872: https://github.com/robotframework/robotframework/issues/4872 +.. _#4876: https://github.com/robotframework/robotframework/issues/4876 +.. _#4877: https://github.com/robotframework/robotframework/issues/4877 +.. _#4883: https://github.com/robotframework/robotframework/issues/4883 +.. _#4884: https://github.com/robotframework/robotframework/issues/4884 +.. _#4896: https://github.com/robotframework/robotframework/issues/4896 +.. _#4903: https://github.com/robotframework/robotframework/issues/4903 +.. _#4905: https://github.com/robotframework/robotframework/issues/4905 +.. _#4910: https://github.com/robotframework/robotframework/issues/4910 +.. _#4912: https://github.com/robotframework/robotframework/issues/4912 +.. _#4930: https://github.com/robotframework/robotframework/issues/4930 +.. _#4939: https://github.com/robotframework/robotframework/issues/4939 +.. _#4942: https://github.com/robotframework/robotframework/issues/4942 +.. _#4952: https://github.com/robotframework/robotframework/issues/4952 +.. _#4960: https://github.com/robotframework/robotframework/issues/4960 +.. _#4976: https://github.com/robotframework/robotframework/issues/4976 +.. _#4979: https://github.com/robotframework/robotframework/issues/4979 +.. _#4982: https://github.com/robotframework/robotframework/issues/4982 +.. _#4983: https://github.com/robotframework/robotframework/issues/4983 +.. _#5000: https://github.com/robotframework/robotframework/issues/5000 +.. _#4934: https://github.com/robotframework/robotframework/issues/4934 +.. _#4621: https://github.com/robotframework/robotframework/issues/4621 +.. _#4798: https://github.com/robotframework/robotframework/issues/4798 +.. _#4867: https://github.com/robotframework/robotframework/issues/4867 +.. _#4870: https://github.com/robotframework/robotframework/issues/4870 +.. _#4904: https://github.com/robotframework/robotframework/issues/4904 +.. _#4913: https://github.com/robotframework/robotframework/issues/4913 +.. _#4927: https://github.com/robotframework/robotframework/issues/4927 +.. _#4967: https://github.com/robotframework/robotframework/issues/4967 +.. _#4861: https://github.com/robotframework/robotframework/issues/4861 +.. _#4862: https://github.com/robotframework/robotframework/issues/4862 +.. _#4864: https://github.com/robotframework/robotframework/issues/4864 +.. _#4885: https://github.com/robotframework/robotframework/issues/4885 +.. _#4900: https://github.com/robotframework/robotframework/issues/4900 +.. _#4922: https://github.com/robotframework/robotframework/issues/4922 +.. _#4933: https://github.com/robotframework/robotframework/issues/4933 +.. _#4935: https://github.com/robotframework/robotframework/issues/4935 +.. _#4936: https://github.com/robotframework/robotframework/issues/4936 +.. _#4954: https://github.com/robotframework/robotframework/issues/4954 +.. _#4958: https://github.com/robotframework/robotframework/issues/4958 +.. _#4975: https://github.com/robotframework/robotframework/issues/4975 +.. _#4988: https://github.com/robotframework/robotframework/issues/4988 diff --git a/test/markups/README.long.rst.html b/test/markups/README.long.rst.html new file mode 100644 index 00000000..7f9e1ac3 --- /dev/null +++ b/test/markups/README.long.rst.html @@ -0,0 +1,1303 @@ +

        Robot Framework 7.0

        +

        Robot Framework 7.0 is a new major release with highly enhanced listener interface +(#3296), native VAR syntax for creating variables (#3761), support for +mixing embedded and normal arguments with library keywords (#4710), JSON +result format (#4847) and various other enhancements and bug fixes.

        +

        Robot Framework 7.0 was released on Thursday January 11, 2024. Questions and comments +related to the release can be sent to the #devel channel on Robot Framework Slack +and possible bugs submitted to the issue tracker.

        +
        + +
        + +

        Installation

        +

        If you have pip installed, just run

        +
        +pip install --upgrade robotframework
        +
        +

        to install the latest available stable release or use

        +
        +pip install robotframework==7.0
        +
        +

        to install exactly this version. Alternatively you can download the package +from PyPI and install it manually. For more details and other installation +approaches, see the installation instructions.

        + +

        Most important enhancements

        +
        +

        If you are interested to learn more about the new features in Robot Framework 7.0, +join the RoboCon conference in February, 2024. Pekka Klärck, Robot Framework +lead developer, will go through the key features briefly in the onsite conference +in Helsinki and more thoroughly in the online edition.

        +

        The conference has also dozens of other great talks, workshops and a lot of +possibilities to meet other community members as well as developers of various +tools and libraries in the ecosystem. All profits from the conference will be +used for future Robot Framework development.

        +
        + +

        Listener enhancements

        +

        Robot Framework's listener interface is a very powerful mechanism to get +notifications about various events during execution and it also allows modifying +data and results on the fly. It is not typically directly used by normal Robot +Framework users, but they are likely to use tools that use it internally. +The listener API has been significantly enhanced making it possible +to create even more powerful and interesting tools in the future.

        + +

        Support keywords and control structures with listener version 3

        +

        The major limitation with the listener API has been that the listener +API version 2 only supports getting notifications, not making modifications, +and that the more powerful listener API version 3 has only supported suites +and tests/tasks.

        +

        The biggest enhancement in the whole Robot Framework 7.0 is that the listener +version 3 has been extended to support also keywords and control structures (#3296). +For example, a listener having the following methods prints information +about started keywords and ended WHILE loops:

        +
        +from robot import result, running
        +
        +
        +def start_keyword(data: running.Keyword, result: result.Keyword):
        +    print(f"Keyword '{result.full_name}' used on line {data.lineno} started.")
        +
        +
        +def end_while(data: running.While, result: result.While):
        +    print(f"WHILE loop on line {data.lineno} ended with status {result.status} "
        +          f"after {len(result.body)} iterations.")
        +
        +

        With keyword calls it is possible to also get more information about the actually +executed keyword. For example, the following listener prints some information +about the executed keyword and the library it belongs to:

        +
        +from robot.running import Keyword as KeywordData, LibraryKeyword
        +from robot.result import Keyword as KeywordResult
        +
        +
        +def start_library_keyword(data: KeywordData,
        +                          implementation: LibraryKeyword,
        +                          result: KeywordResult):
        +    library = implementation.owner
        +    print(f"Keyword '{implementation.name}' is implemented in library "
        +          f"'{library.name}' at '{implementation.source}' on line "
        +          f"{implementation.lineno}. The library has {library.scope.name} "
        +          f"scope and the current instance is {library.instance}.")
        +
        +

        As the above example already illustrated, it is even possible to get an access to +the actual library instance. This means that listeners can inspect the library +state and also modify it. With user keywords it is even possible to modify +the keyword itself or, via the owner resource file, any other keyword in +the resource file.

        +

        Listeners can also modify results if needed. Possible use cases include hiding +sensitive information and adding more details to results based on external sources.

        +

        Notice that although listener can change status of any executed keyword or control +structure, that does not directly affect the status of the executed test. In general +listeners cannot directly fail keywords so that execution would stop or handle +failures so that execution would continue. This kind of functionality may be +added in the future if there are needs.

        +

        The new listener version 3 methods are so powerful and versatile that going them +through thoroughly in these release notes is not possible. For more examples, you +can see the acceptance tests using the methods in various interesting and even +crazy ways.

        + +

        Listener version 3 is the default listener version

        +

        Earlier listeners always needed to specify the API version they used with the +ROBOT_LISTENER_API_VERSION attribute. Now that the listener version 3 got +the new methods, it is considered so much more powerful than the version 2 +that it was made the default listener version (#4910).

        +

        The listener version 2 continues to work, but using it requires specifying +the listener version as earlier. The are no plans to deprecate the listener +version 2, but we nevertheless highly recommend using the version 3 whenever +possible.

        + +

        Libraries can register themselves as listeners by using string SELF +

        +

        Listeners are typically enabled from the command line, but libraries +can register listeners as well. Often libraries themselves want to act +as listeners, and that has earlier required using self.ROBOT_LIBRARY_LISTENER = self +in the __init__ method. Robot Framework 7.0 makes it possible to use string +SELF (case-insensitive) for this purpose as well (#4910), which means +that a listener can be specified as a class attribute and not only in __init__. +This is especially convenient when using the @library decorator:

        +
        +from robot.api.deco import keyword, library
        +
        +
        +@library(listener='SELF')
        +class Example:
        +
        +    def start_suite(self, data, result):
        +        ...
        +
        +    @keyword
        +    def example(self, arg):
        +        ...
        +
        + +

        Nicer API for modifying keyword arguments

        +

        Modifying keyword call arguments programmatically has been made more convenient +(#5000). This enhancement eases modifying arguments using the new listener +version 3 start/end_keyword methods.

        + +

        Paths are passed to version 3 listeners as pathlib.Path objects

        +

        Listeners have methods like output_file and log_file that are called when +result files are ready so that they get the file path as an argument. Earlier +paths were strings, but nowadays listener version 3 methods get them as +more convenient pathlib.Path objects.

        + +

        Native VAR syntax

        +

        The new VAR syntax (#3761) makes it possible to create local variables +as well as global, suite and test/task scoped variables dynamically during +execution. The motivation is to have a more convenient syntax than using +the Set Variable keyword for creating local variables and to unify +the syntax for creating variables in different scopes. Except for the mandatory +VAR marker, the syntax is also the same as when creating variables in the +Variables section. The syntax is best explained with examples:

        +
        +*** Test Cases ***
        +Example
        +    # Create a local variable `${local}` with a value `value`.
        +    VAR    ${local}    value
        +
        +    # Create a variable that is available throughout the whole suite.
        +    # Supported scopes are GLOBAL, SUITE, TEST, TASK and LOCAL (default).
        +    VAR    ${suite}    value    scope=SUITE
        +
        +    # Validate created variables.
        +    Should Be Equal    ${local}    value
        +    Should Be Equal    ${suite}    value
        +
        +Example continued
        +    # Suite level variables are seen also by subsequent tests.
        +    Should Be Equal    ${suite}    value
        +
        +

        When creating ${scalar} variables having long values, it is possible to split +the value to multiple lines. Lines are joined together with a space by default, +but that can be changed with the separator configuration option. Similarly as +in the Variables section, it is possible to create also @{list} and &{dict} +variables. Unlike in the Variables section, variables can be created conditionally +using IF/ELSE structures:

        +
        +*** Test Cases ***
        +Long value
        +    VAR    ${long}
        +    ...    This value is rather long.
        +    ...    It has been split to multiple lines.
        +    ...    Parts will be joined together with a space.
        +
        +Multiline
        +    VAR    ${multiline}
        +    ...    First line.
        +    ...    Second line.
        +    ...    Last line.
        +    ...    separator=\n
        +
        +List
        +    # Creates a list with three items.
        +    VAR    @{list}    a    b    c
        +
        +Dictionary
        +    # Creates a dictionary with two items.
        +    VAR    &{dict}    key=value    second=item
        +
        +Normal IF
        +    IF    1 > 0
        +        VAR    ${x}    true value
        +    ELSE
        +        VAR    ${x}    false value
        +    END
        +
        +Inline IF
        +    IF    1 > 0    VAR    ${x}    true value    ELSE    VAR    ${x}    false value
        +
        + +

        Mixed argument support with library keywords

        +

        User keywords got support to use both embedded and normal arguments in Robot +Framework 6.1 (#4234) and now that support has been added also to library keywords +(#4710). The syntax works so, that if a function or method implementing a keyword +accepts more arguments than there are embedded arguments, the remaining arguments +can be passed in as normal arguments. This is illustrated by the following example +keyword:

        +
        +@keyword('Number of ${animals} should be')
        +def example(animals, count):
        +    ...
        +
        +

        The above keyword could be used like this:

        +
        +*** Test Cases ***
        +Example
        +    Number of horses should be    2
        +    Number of horses should be    count=2
        +    Number of dogs should be    3
        +
        + +

        JSON result format

        +

        Robot Framework 6.1 added support to convert test/task data to JSON and back +and Robot Framework 7.0 extends the JSON serialization support to execution results +(#4847). One of the core use cases for data serialization was making it easy to +transfer data between process and machines, and now it is also easy to pass results +back.

        +

        Also the built-in Rebot tool that is used for post-processing results supports +JSON files both in output and in input. Creating JSON output files is done using +the normal --output option so that the specified file has a .json extension:

        +
        +rebot --output output.json output.xml
        +
        +

        When reading output files, JSON files are automatically recognized by +the extension:

        +
        +rebot output.json
        +rebot output1.json output2.json
        +
        +

        When combining or merging results, it is possible to mix JSON and XML files:

        +
        +rebot output1.xml output2.json
        +rebot --merge original.xml rerun.json
        +
        +

        The JSON output file structure is documented in the result.json schema file.

        +

        The plan is to enhance the support for JSON output files in the future so that +they could be created already during execution. For more details see issue #3423.

        + +

        Argument conversion enhancements

        +

        Automatic argument conversion is a very powerful feature that library developers +can use to avoid converting arguments manually and to get more useful Libdoc +documentation. There are two important new enhancements to it.

        + +

        Support for Literal +

        +

        In Python, the Literal type makes it possible to type arguments so that type +checkers accept only certain values. For example, this function only accepts +strings x, y and z:

        +
        +def example(arg: Literal['x', 'y', 'z']):
        +    ...
        +
        +

        Robot Framework has been enhanced so that it validates that an argument having +a Literal type can only be used with the specified values (#4633). For +example, using a keyword with the above implementation with a value xxx would +fail.

        +

        In addition to validation, arguments are also converted. For example, if an +argument accepts Literal[-1, 0, 1], used arguments are converted to +integers and then validated. In addition to that, string matching is case, space, +underscore and hyphen insensitive. In all cases exact matches have a precedence +and the argument that is passed to the keyword is guaranteed to be in the exact +format used with Literal.

        +

        Literal conversion is in many ways similar to Enum conversion that Robot +Framework has supported for long time. Enum conversion has benefits like +being able to use a custom documentation and it is typically better when using +the same type multiple times. In simple cases being able to just use +arg: Literal[...] without defining a new type is very convenient, though.

        + +

        Support "stringified" types like 'list[int]' and 'int | float' +

        +

        Python's type hinting syntax has evolved so that generic types can be parameterized +like list[int] (new in Python 3.9) and unions written as int | float +(new in Python 3.10). Using these constructs with older Python versions causes +errors, but Python type checkers support also "stringified" type hints like +'list[int]' and 'int | float' that work regardless the Python version.

        +

        Support for stringified generics and unions has now been added also to +Robot Framework's argument conversion (#4711). For example, +the following typing now also works with Python 3.8:

        +
        +def example(a: 'list[int]', b: 'int | float'):
        +    ...
        +
        +

        These stringified types are also compatible with the Remote library API and other +scenarios where using actual types is not possible.

        + +

        Tags set globally can be removed using -tag syntax

        +

        Individual tests and keywords can nowadays remove tags that have been set in +the Settings section with Test Tags or Keyword Tags settings by using +the -tag syntax with their own [Tags] setting (#4374). For example, +tests T1 and T3 below get tags all and most, and test T2 gets +tags all and one:

        +
        +*** Settings ***
        +Test Tags      all    most
        +
        +*** Test Cases ***
        +T1
        +    No Operation
        +T2
        +    [Tags]    one    -most
        +    No Operation
        +T3
        +    No Operation
        +
        +

        With tests it is possible to get the same effect by using the Default Tags +setting and overriding it where needed. That syntax is, however, considered +deprecated (#4365) and using the new -tag syntax is recommended. With +keywords there was no similar functionality earlier.

        + +

        Dynamic and hybrid library APIs support asynchronous execution

        +

        Dynamic and hybrid libraries nowadays support asynchronous execution. +In practice the special methods like get_keyword_names and run_keyword +can be implemented as async methods (#4803).

        +

        Async support was added to the normal static library API in Robot Framework +6.1 (#4089). A bug related to handling asynchronous keywords if execution +is stopped gracefully has also been fixed (#4808).

        + +

        Timestamps in result model and output.xml use standard format

        +

        Timestamps used in the result model and stored to the output.xml file used custom +format like 20231107 19:57:01.123 earlier. Non-standard formats are seldom +a good idea, and in this case parsing the custom format turned out to be slow +as well.

        +

        Nowadays the result model stores timestamps as standard datetime objects and +elapsed times as a timedelta (#4258). This makes creating timestamps and +operating with them more convenient and considerably faster. The new objects can +be accessed via start_time, end_time and elapsed_time attributes that were +added as forward compatibility already in Robot Framework 6.1 (#4765). +Old information is still available via the old starttime, endtime and +elapsedtime attributes, so this change is fully backwards compatible.

        +

        The timestamp format in output.xml has also been changed from the custom +YYYYMMDD HH:MM:SS.mmm format to ISO 8601 compatible +YYYY-MM-DDTHH:MM:SS.mmmmmm. Using a standard format makes it +easier to process output.xml files, but this change also has big positive +performance effect. Now that the result model stores timestamps as datetime +objects, formatting and parsing them with the available isoformat() and +fromisoformat() methods is very fast compared to custom formatting and parsing.

        +

        A related change is that instead of storing start and end times of each executed +item in output.xml, we nowadays store their start and elapsed times. Elapsed times +are represented as floats denoting seconds. Having elapsed times directly available +is a lot more convenient than calculating them based on start and end times. +Storing start and elapsed times also takes less space than storing start and end times.

        +

        As the result of these changes, times are available in the result model and in +output.xml in higher precision than earlier. Earlier times were stored in millisecond +granularity, but nowadays they use microseconds. Logs and reports still use milliseconds, +but that can be changed in the future if there are needs.

        +

        Changes to output.xml are backwards incompatible and affect all external tools +that process timestamps. This is discussed more in Changes to output.xml +section below along with other output.xml changes.

        + +

        Dark mode support to report and log

        +

        Report and log got a new dark mode (#3725). It is enabled automatically based +on browser and operating system preferences, but there is also a toggle to +switch between the modes.

        + +

        Backwards incompatible changes

        + +

        Python 3.6 and 3.7 are no longer supported

        +

        Robot Framework 7.0 requires Python 3.8 or newer (#4294). The last version +that supports Python 3.6 and 3.7 is Robot Framework 6.1.1.

        + +

        Changes to output.xml

        +

        The output.xml file has changed in different ways making Robot Framework 7.0 +incompatible with external tools processing output.xml files until these tools +are updated. We try to avoid this kind of breaking changes, but in this case +especially the changes to timestamps were considered so important that we +eventually would have needed to do them anyway.

        +

        Due to the changes being relatively big, it can take some time before external +tools are updated. To allow users to take Robot Framework 7.0 into use also +if they depend on an incompatible tool, it is possible to use the new +--legacy-output option both as part of execution and with the Rebot tool +to generate output.xml files that are compatible with older versions.

        + +

        Timestamp related changes

        +

        The biggest changes in output.xml are related to timestamps (#4258). +With earlier versions start and end times of executed items, as well as timestamps +of the logged messages, were stored using a custom YYYYMMDD HH:MM:SS.mmm format, +but nowadays the format is ISO 8601 compatible YYYY-MM-DDTHH:MM:SS.mmmmmm. +In addition to that, instead of saving start and end times to starttime and +endtime attributes and message times to timestamp, start and elapsed times +are now stored to start and elapsed attributes and message times to time.

        +

        Examples:

        +
        +<!-- Old format -->
        +<msg timestamp="20231108 15:36:34.278" level="INFO">Hello world!</msg>
        +<status status="PASS" starttime="20231108 15:37:35.046" endtime="20231108 15:37:35.046"/>
        +
        +<!-- New format -->
        +<msg time="2023-11-08T15:36:34.278343" level="INFO">Hello world!</msg>
        +<status status="PASS" start="2023-11-08T15:37:35.046153" elapsed="0.000161"/>
        +
        +

        The new format is standard compliant, contains more detailed times, makes the elapsed +time directly available and makes the <status> elements over 10% shorter. +These are all great benefits, but we are still sorry for all the extra work +this causes for those developing tools that process output.xml files.

        + +

        Keyword name related changes

        +

        How keyword names are stored in output.xml has changed slightly (#4884). +With each executed keywords we store both the name of the keyword and the name +of the library or resource file containing it. Earlier the latter was stored to +attribute library also with resource files, but nowadays the attribute is generic +owner. In addition to owner being a better name in general, it also +matches the new owner attribute keywords in the result model have.

        +

        Another change is that the original name stored with keywords using embedded +arguments is nowadays in source_name attribute when it used to be in sourcename. +This change was done to make the attribute consistent with the attribute in +the result model.

        +

        Examples:

        +
        +<!-- Old format -->
        +<kw name="Log" library="BuiltIn">...</kw>
        +<kw name="Number of horses should be" sourcename="Number of ${animals} should be" library="my_resource">...</kw>
        +
        +<!-- New format -->
        +<kw name="Log" owner="BuiltIn">...</kw>
        +<kw name="Number of horses should be" source_name="Number of ${animals} should be" owner="my_resource">...</kw>
        +
        + +

        Other changes

        +

        Nowadays keywords and control structures can have a message. Messages are represented +as the text of the <status> element, and they have been present already earlier with +tests and suites. Related to this, control structured cannot anymore have <doc>. +(#4883)

        +

        These changes should not cause problems for tools processing output.xml files, +but storing messages with each failed keyword and control structure may +increase the output.xml size.

        + +

        Schema updates

        +

        The output.xml schema has been updated and can be found via +https://github.com/robotframework/robotframework/tree/master/doc/schema/.

        + +

        Changes to result model

        +

        There have been some changes to the result model that unfortunately affect +external tools using it. The main motivation for these changes has been +cleaning up the model before creating a JSON representation for it (#4847).

        + +

        Changes related to keyword names

        +

        The biggest changes are related to keyword names (#4884). Earlier Keyword +objects had a name attribute that contained the full keyword name like +BuiltIn.Log. The actual keyword name and the name of the library or resource +file that the keyword belonged to were in kwname and libname attributes, +respectively. In addition to these, keywords using embedded arguments also had +a sourcename attribute containing the original keyword name.

        +

        Due to reasons explained in #4884, the following changes have been made +in Robot Framework 7.0:

        +
          +
        • Old kwname is renamed to name. This is consistent with the execution side Keyword.
        • +
        • Old libname is renamed to generic owner.
        • +
        • New full_name is introduced to replace the old name.
        • +
        • +sourcename is renamed to source_name.
        • +
        • +kwname, libname and sourcename are preserved as properties. They are considered +deprecated, but accessing them does not cause a deprecation warning yet.
        • +
        +

        The backwards incompatible part of this change is changing the meaning of the +name attribute. It used to be a read-only property yielding the full name +like BuiltIn.Log, but now it is a normal attribute that contains just the actual +keyword name like Log. All other old attributes have been preserved as properties +and code using them does not need to be updated immediately.

        + +

        Deprecated attributes have been removed

        +

        The following attributes that were deprecated already in Robot Framework 4.0 +have been removed (#4846):

        +
          +
        • +TestSuite.keywords. Use TestSuite.setup and TestSuite.teardown instead.
        • +
        • +TestCase.keywords. Use TestCase.body, TestCase.setup and TestCase.teardown instead.
        • +
        • +Keyword.keywords. Use Keyword.body and Keyword.teardown instead.
        • +
        • +Keyword.children. Use Keyword.body and Keyword.teardown instead.
        • +
        • +TestCase.critical. The whole criticality concept has been removed.
        • +
        +

        Additionally, TestSuite.keywords and TestCase.keywords have been removed +from the execution model.

        + +

        Changes to parsing model

        +

        There have been some changes also to the parsing model:

        +
          +
        • +

          The node representing the deprecated [Return] setting has been renamed from +Return to ReturnSetting. At the same time, the node representing the +RETURN statement has been renamed from ReturnStatement to Return (#4939).

          +

          To ease transition, ReturnSetting has existed as an alias for Return starting +from Robot Framework 6.1 (#4656) and ReturnStatement is preserved as an alias +now. In addition to that, the ModelVisitor base class has special handling for +visit_ReturnSetting and visit_ReturnStatement visitor methods so that they work +correctly with ReturnSetting and ReturnStatement with Robot Framework 6.1 and +newer. Issue #4939 explains this in more detail and has a concrete example +how to support also older Robot Framework versions.

          +
        • +
        • +

          The node representing the Test Tags setting as well as the deprecated +Force Tags setting has been renamed from ForceTags to TestTags (#4385). +ModelVisitor has special handling for the visit_ForceTags method so +that it will continue to work also after the change.

          +
        • +
        • +

          The token type used with AS (or WITH NAME) in library imports has been changed +to Token.AS (#4375). Token.WITH_NAME still exists as an alias for Token.AS.

          +
        • +
        • +

          Statement type and tokens have been moved from _fields to _attributes (#4912). +This may affect debugging the model.

          +
        • +
        + +

        Changes to Libdoc spec files

        +

        The following deprecated constructs have been removed from Libdoc spec files (#4667):

        +
          +
        • +datatypes have been removed from XML or JSON spec files. They were deprecated in +favor of typedocs already in Robot Framework 5.0 (#4160).
        • +
        • Type names are not anymore written to XML specs as content of the <type> elements. +The name is available as the name attribute of <type> elements since +Robot Framework 6.1 (#4538).
        • +
        • +types and typedocs attributes have been removed from arguments in JSON specs. +The type attribute introduced in RF 6.1 (#4538) needs to be used instead.
        • +
        +

        Libdoc schema files have been updated and can be found via +https://github.com/robotframework/robotframework/tree/master/doc/schema/.

        + +

        Changes to selecting tests with --suite, --test and --include

        +

        There are two changes related to selecting tests:

        +
          +
        • When using --test and --include together, tests matching either of them +are selected (#4721). Earlier tests need to match both options to be selected.
        • +
        • When selecting a suite using its parent suite as a prefix like --suite parent.suite, +the given name must match the full suite name (#4720). Earlier it was enough if +the prefix matched the closest parent or parents.
        • +
        + +

        Other backwards incompatible changes

        +
          +
        • The default value of the stdin argument used with Process library keyword +has been changed from subprocess.PIPE to None (#4103). This change ought +to avoid processes hanging in some cases. Those who depend on the old behavior +need to use stdin=PIPE explicitly to enable that.
        • +
        • When type hints are specified as strings, they must use format type, type[param], +type[p1, p2] or t1 | t2 (#4711). Using other formats will cause errors taking +keywords into use. In practice problems occur if the special characters [, ], , +and | occur in unexpected places. For example, arg: "Hello, world!" will cause +an error due to the comma.
        • +
        • +datetime, date and timedelta objects are sent over the Remote interface +differently than earlier (#4784). They all used to be converted to strings, but +nowadays datetime is sent as-is, date is converted to datetime and sent like +that, and timedelta is converted to a float by using timedelta.total_seconds().
        • +
        • Argument conversion support with collections.abc.ByteString has been removed (#4983). +The reason is that ByteString is deprecated and will be removed in Python 3.14. +It has not been too often needed, but if you happen to use it, you can change +arg: ByteString to arg: bytes | bytearray and the functionality +stays exactly the same.
        • +
        • Paths passed to result file related listener version 3 methods like output_file +and log_file have been changed from strings to pathlib.Path objects (#4988). +Most of the time both kinds of paths work interchangeably, so this change is unlikely +to cause issues. If you need to handle these paths as strings, they can be converted +by using str(path).
        • +
        • +robot.utils.normalize does not anymore support bytes (#4936).
        • +
        • Deprecated accept_plain_values argument has been removed from the +timestr_to_secs utility function (#4861).
        • +
        + +

        Deprecations

        + +

        [Return] setting

        +

        The [Return] setting for specifying the return value from user keywords has +been "loudly" deprecated (#4876). It has been "silently" deprecated since +Robot Framework 5.0 when the much more versatile RETURN setting was introduced +(#4078), but now using it will cause a deprecation warning. The plan is to +preserve the [Return] setting at least until Robot Framework 8.0.

        +

        If you have lot of data that uses [Return], the easiest way to update it is +using the Robotidy tool that can convert [Return] to RETURN automatically. +If you have data that is executed also with Robot Framework versions that do +not support RETURN, you can use the Return From Keyword keyword instead. +That keyword will eventually be deprecated and removed as well, though.

        + +

        Singular section headers

        +

        Using singular section headers like *** Test Case *** or *** Setting *** +nowadays causes a deprecation warning (#4432). They were silently deprecated +in Robot Framework 6.0 for reasons explained in issue #4431.

        + +

        Deprecated attributes in parsing, running and result models

        +
          +
        • In the parsing model, For.variables, ForHeader.variables, Try.variable and +ExceptHeader.variable attributes have been deprecated in favor of the new assign +attribute (#4708).
        • +
        • In running and result models, For.variables and TryBranch.variable have been +deprecated in favor of the new assign attribute (#4708).
        • +
        • In the result model, control structures like FOR were earlier modeled so that they +looked like keywords. Nowadays they are considered totally different objects and +their keyword specific attributes name, kwnane, libname, doc, args, +assign, tags and timeout have been deprecated (#4846).
        • +
        • +starttime, endtime and elapsed time attributes in the result model have been +silently deprecated (#4258). Accessing them does not yet cause a deprecation +warning, but users are recommended to use start_time, end_time and +elapsed_time attributes that are available since Robot Framework 6.1.
        • +
        • +kwname, libname and sourcename attributes used by the Keyword object +in the result model have been silently deprecated (#4884). New code should use +name, owner and source_name instead.
        • +
        + +

        Other deprecated features

        +
          +
        • Using embedded arguments with a variable that has a value not matching custom +embedded argument patterns nowadays causes a deprecation warning (#4524). +Earlier variables used as embedded arguments were always accepted without +validating values.
        • +
        • Using FOR IN ZIP loops with lists having different lengths without explicitly +using mode=SHORTEST has been deprecated (#4685). The strict mode where lengths +must match will be the default mode in the future.
        • +
        • Various utility functions in the robot.utils package that are no longer used +by Robot Framework itself, including the whole Python 2/3 compatibility layer, +have been deprecated (#4501). If you need some of these utils, you can copy +their code to your own tool or library. This change may affect existing +libraries and tools in the ecosystem.
        • +
        • +case_insensitive and whitespace_insensitive arguments used by some +Collections and String library keywords have been deprecated in favor of +ignore_case and ignore_whitespace. The new arguments were added for +consistency reasons (#4954) and the old arguments will continue to work +for the time being.
        • +
        • Passing time as milliseconds to the elapsed_time_to_string utility function +has been deprecated (#4862).
        • +
        + +

        Acknowledgements

        +

        Robot Framework development is sponsored by the Robot Framework Foundation +and its over 60 member organizations. If your organization is using Robot Framework +and benefiting from it, consider joining the foundation to support its +development as well.

        +

        Robot Framework 7.0 team funded by the foundation consists of Pekka Klärck and +Janne Härkönen (part time). +In addition to work done by them, the community has provided some great contributions:

        +
          +
        • +Ygor Pontelo added async support to the +dynamic and hybrid library APIs (#4803) and fixed a bug with handling async +keywords when execution is stopped gracefully (#4808).
        • +
        • +Topi 'top1' Tuulensuu fixed a performance regression +when using Run Keyword so that the name of the executed keyword contains a variable +(#4659).
        • +
        • +Pasi Saikkonen added dark mode to reports +and logs (#3725).
        • +
        • +René added return type information to Libdoc's +HTML output (#3017), fixed DotDict equality comparisons (#4956) and +helped finalizing the dark mode support (#3725).
        • +
        • +Robin added type hints to modules that +did not yet have them under the public robot.api package (#4841).
        • +
        • +Mark Moberts added case-insensitive list and +dictionary comparison support to the Collections library (#4343).
        • +
        • +Daniel Biehl enhanced performance of traversing +the parsing model using ModelVisitor (#4934).
        • +
        +

        Big thanks to Robot Framework Foundation, to community members listed above, and to +everyone else who has tested preview releases, submitted bug reports, proposed +enhancements, debugged problems, or otherwise helped with Robot Framework 7.0 +development.

        +

        See you at RoboCon 2024 either onsite or online!

        +
        + +
        Robot Framework lead developer
        +
        + +

        Full list of fixes and enhancements

        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        IDTypePrioritySummary
        #3296enhancementcriticalSupport keywords and control structures with listener version 3
        #3761enhancementcriticalNative VAR syntax to create variables inside tests and keywords
        #4294enhancementcriticalDrop Python 3.6 and 3.7 support
        #4710enhancementcriticalSupport library keywords with both embedded and normal arguments
        #4847enhancementcriticalSupport JSON serialization with result model
        #4659bughighPerformance regression when using Run Keyword and keyword name contains a variable
        #4921bughighLog levels don't work correctly with robot:flatten +
        #3725enhancementhighSupport dark theme with report and log
        #4258enhancementhighChange timestamps from custom strings to datetime in result model and to ISO 8601 format in output.xml
        #4374enhancementhighSupport removing tags set globally by using -tag syntax with [Tags] setting
        #4633enhancementhighAutomatic argument conversion and validation for Literal +
        #4711enhancementhighSupport type aliases in formats 'list[int]' and 'int | float' in argument conversion
        #4803enhancementhighAsync support to dynamic and hybrid library APIs
        #4808bugmediumAsync keywords are not stopped when execution is stopped gracefully
        #4859bugmediumParsing errors in reStructuredText files have no source
        #4880bugmediumInitially empty test fails even if pre-run modifier adds content to it
        #4886bugmedium +Set Variable If is slow if it has several conditions
        #4898bugmediumResolving special variables can fail with confusing message
        #4915bugmedium +cached_property attributes are called when importing library
        #4924bugmediumWHILE on_limit missing from listener v2 attributes
        #4926bugmediumWHILE and TRY content are not removed with --removekeywords all +
        #4945bugmedium +TypedDict with forward references do not work in argument conversion
        #4956bugmediumDotDict behaves inconsistent on equality checks. x == y != not x != y and not x != y == not x == y +
        #4964bugmediumVariables set using Set Suite Variable with children=True cannot be properly overwritten
        #4980bugmediumDateTime library uses deprecated datetime.utcnow() +
        #4999bugmediumXML Library: Double namespace during Element To String
        #5005bugmedium +Log Variables should not consume iterables
        #3017enhancementmediumAdd return type to Libdoc specs and HTML output
        #4103enhancementmediumProcess: Change the default stdin behavior from subprocess.PIPE to None +
        #4302enhancementmediumRemove Reserved library
        #4343enhancementmediumCollections: Support case-insensitive list and dictionary comparisons
        #4375enhancementmediumChange token type of AS (or WITH NAME) used with library imports to Token.AS +
        #4385enhancementmediumChange the parsing model object produced by Test Tags (and Force Tags) to TestTags +
        #4432enhancementmediumLoudly deprecate singular section headers
        #4501enhancementmediumLoudly deprecate old Python 2/3 compatibility layer and other deprecated utils
        #4524enhancementmediumLoudly deprecate variables used as embedded arguments not matching custom patterns
        #4545enhancementmediumSupport creating assigned variable name based on another variable like ${${var}} = Keyword +
        #4667enhancementmediumRemove deprecated constructs from Libdoc spec files
        #4685enhancementmediumDeprecate SHORTEST mode being default with FOR IN ZIP loops
        #4708enhancementmediumUse assing, not variable, with FOR and TRY/EXCEPT model objects when referring to assigned variables
        #4720enhancementmediumRequire --suite parent.suite to match the full suite name
        #4721enhancementmediumChange behavior of --test and --include so that they are cumulative
        #4747enhancementmediumSupport [Setup] with user keywords
        #4784enhancementmediumRemote: Enhance datetime, date and timedelta conversion
        #4841enhancementmediumAdd typing to all modules under robot.api +
        #4846enhancementmediumResult model: Loudly deprecate not needed attributes and remove already deprecated ones
        #4872enhancementmediumControl continue-on-failure mode by using recursive and non-recursive tags together
        #4876enhancementmediumLoudly deprecate [Return] setting
        #4877enhancementmediumXML: Support ignoring element order with Elements Should Be Equal +
        #4883enhancementmediumResult model: Add message to keywords and control structures and remove doc from controls
        #4884enhancementmediumResult model: Enhance storing keyword name
        #4896enhancementmediumSupport separator=<value> configuration option with scalar variables in Variables section
        #4903enhancementmediumSupport argument conversion and named arguments with dynamic variable files
        #4905enhancementmediumSupport creating variable name based on another variable like ${${VAR}} in Variables section
        #4910enhancementmediumMake listener v3 the default listener API
        #4912enhancementmediumParsing model: Move type and tokens from _fields to _attributes +
        #4930enhancementmediumBuiltIn: New Reset Log Level keyword for resetting the log level to the original value
        #4939enhancementmediumParsing model: Rename Return to ReturnSetting and ReturnStatement to Return +
        #4942enhancementmediumAdd public argument conversion API for libraries and other tools
        #4952enhancementmediumCollections: Make ignore_order and ignore_keys recursive
        #4960enhancementmediumSupport integer conversion with strings representing whole number floats like '1.0' and '2e10' +
        #4976enhancementmediumSupport string SELF (case-insenstive) when library registers itself as listener
        #4979enhancementmediumAdd robot.result.TestSuite.to/from_xml methods
        #4982enhancementmediumDateTime: Support datetime.date as an input format with date related keywords
        #4983enhancementmediumType conversion: Remove support for deprecated ByteString +
        #5000enhancementmediumNicer API for setting keyword call arguments programmatically
        #4934---mediumEnhance performance of visiting parsing model
        #4621buglowOperatingSystem library docs have broken link / title
        #4798buglow +--removekeywords passed doesn't remove test setup and teardown
        #4867buglowOriginal order of dictionaries is not preserved when they are pretty printed in log messages
        #4870buglowUser keyword teardown missing from running model JSON schema
        #4904buglowImporting static variable file with arguments does not fail
        #4913buglowTrace log level logs arguments twice for embedded arguments
        #4927buglowWARN level missing from the log level selector in log.html
        #4967buglowVariables are not resolved in keyword name in WUKS error message
        #4861enhancementlowRemove deprecated accept_plain_values from timestr_to_secs utility function
        #4862enhancementlowDeprecate elapsed_time_to_string accepting time as milliseconds
        #4864enhancementlowProcess: Make warning about processes hanging if output buffers get full more visible
        #4885enhancementlowAdd full_name to replace longname to suite and test objects
        #4900enhancementlowMake keywords and control structures in log look more like original data
        #4922enhancementlowChange the log level of Set Log Level message from INFO to DEBUG
        #4933enhancementlowType conversion: Ignore hyphens when matching enum members
        #4935enhancementlowUse casefold, not lower, when comparing strings case-insensitively
        #4936enhancementlowRemove bytes support from robot.utils.normalize function
        #4954enhancementlowCollections and String: Add ignore_case as alias for case_insensitive +
        #4958enhancementlowDocument robot_running and dry_run_active properties of the BuiltIn library in the User Guide
        #4975enhancementlowSupport times and x suffixes with WHILE limit to make it more compatible with Wait Until Keyword Succeeds +
        #4988enhancementlowChange paths passed to listener v3 methods to pathlib.Path instances
        +

        Altogether 88 issues. View on the issue tracker.

        \ No newline at end of file diff --git a/test/markups/README.mediawiki.html b/test/markups/README.mediawiki.html index fcc56bfe..e92accfd 100644 --- a/test/markups/README.mediawiki.html +++ b/test/markups/README.mediawiki.html @@ -15,18 +15,20 @@

        -Red Bridge (JRuby Embed)

        +Red Bridge (JRuby Embed) + +

        one-<two

        a-b
        -

        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 legacy API should still work, but we strongly recommend Red Bridge for all new projects.

        -Features of Red Bridge

        +Features of Red Bridge +

        Red Bridge consists of two layers: Embed Core on the bottom, and implementations of JSR223 and BSF 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. @@ -46,14 +48,16 @@

        -Previous Embedding JRuby Page

        +Previous Embedding JRuby Page +

        We recommend using Embed Core; however, if you're maintaining code that uses the old API, you can find its documentation on the legacy embedding[1] page.

        -References

        +References +

        1. diff --git a/test/markups/README.pod.html b/test/markups/README.pod.html index a62c65db..63caf6bc 100644 --- a/test/markups/README.pod.html +++ b/test/markups/README.pod.html @@ -10,7 +10,8 @@

          ABOUT

            -
          • Create a working compiler that understands the majority of the MATLAB/Octave programming language.

            +
          • +

            Create a working compiler that understands the majority of the MATLAB/Octave programming language.

          @@ -21,13 +22,16 @@

          IMPLEMENTATION

            -
          • The first is the parser, located in the src/parser/ directory. The parser proper is composed of three source files, grammar.pg which is a Perl6Grammar file, and actions.pm which is the associated actions file written in NQP, and grammar-oper.pm which is the operator precedence parser. In addition, several helper functions used by the parser are located in src/internals.

            +
          • +

            The first is the parser, located in the src/parser/ directory. The parser proper is composed of three source files, grammar.pg which is a Perl6Grammar file, and actions.pm which is the associated actions file written in NQP, and grammar-oper.pm which is the operator precedence parser. In addition, several helper functions used by the parser are located in src/internals.

          • -
          • The second component is the library of builtin functions in the src/builtins/ directory. These functions are, currently, written primarily in PIR. Function names prefixed with an underscore are "private" functions for use with the parser. Other functions should have names which are the same as names for regular MATLAB or Octave functions, since they will be available to the HLL. These are also separated into different namespaces depending on visibility and utility.

            +
          • +

            The second component is the library of builtin functions in the src/builtins/ directory. These functions are, currently, written primarily in PIR. Function names prefixed with an underscore are "private" functions for use with the parser. Other functions should have names which are the same as names for regular MATLAB or Octave functions, since they will be available to the HLL. These are also separated into different namespaces depending on visibility and utility.

          • -
          • A number of library functions are written in M, or mostly M with some inline PIR code in toolbox/.

            +
          • +

            A number of library functions are written in M, or mostly M with some inline PIR code in toolbox/.

          diff --git a/test/markups/README.rst.html b/test/markups/README.rst.html index 6accfdf6..f87a8065 100644 --- a/test/markups/README.rst.html +++ b/test/markups/README.rst.html @@ -2,7 +2,7 @@

          Header 1

          Subtitle

          Example text.

          -

          Table of Contents

          +

          Table of Contents

          • Header 2
          • Field list
          • @@ -102,7 +102,8 @@

            Header 2

            -Coverity Scan Build Status + +Coverity Scan Build Status Coverity Scan Build Status @@ -133,5 +134,4 @@

            Field list

            someone@somewhere.org

            Press Ctrl+C to quit

            - -

            RAW HTML!

            p {color:blue;} \ No newline at end of file +

            RAW HTML!

            p {color:blue;} \ No newline at end of file diff --git a/test/markups/README.toc.asciidoc.html b/test/markups/README.toc.asciidoc.html index e6f598cf..4e32869a 100644 --- a/test/markups/README.toc.asciidoc.html +++ b/test/markups/README.toc.asciidoc.html @@ -43,4 +43,4 @@

            Subsection B-2

          - + \ No newline at end of file diff --git a/test/markups/README.toc.rst.html b/test/markups/README.toc.rst.html index 4890e99b..c5b3ecbb 100644 --- a/test/markups/README.toc.rst.html +++ b/test/markups/README.toc.rst.html @@ -1,5 +1,5 @@
          -

          Contents

          +

          Contents

          • 1   Introduction
              @@ -29,4 +29,4 @@

              1.2   What is it good for?

            pycparser is unique in the sense that it's written in pure Python - a very high level language that's easy to experiment with and tweak. To people familiar -with Lex and Yacc, pycparser's code will be simple to understand.

            +with Lex and Yacc, pycparser's code will be simple to understand.

            \ No newline at end of file From 2e6d49d58f2bc9397dc2ebe7d2aa474353357402 Mon Sep 17 00:00:00 2001 From: Justin Kenyon Date: Mon, 17 Jun 2024 11:07:35 -0400 Subject: [PATCH 385/416] Update HISTORY.md --- HISTORY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index ace518d1..0e01f49c 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,4 +1,4 @@ -## 5.0.0 - 2024-06-12 +## 5.0.0 - 2024-06-17 * Drop support for Ruby versions < 3 * Bump nokogiri from 1.8.1 to 1.16.5 * Bump nokogiri-diff from 0.2.0 to 0.3.0 From aa09a8a8d4d8fa7752500fa063802e4aba89cda3 Mon Sep 17 00:00:00 2001 From: Justin Kenyon Date: Mon, 17 Jun 2024 11:18:26 -0400 Subject: [PATCH 386/416] Update activesupport to 7.1.3.4 --- .gitignore | 1 + github-markup.gemspec | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c93c0b18..5e84e6f2 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ Gemfile.lock .buildpath *~ vendor/ +.DS_Store diff --git a/github-markup.gemspec b/github-markup.gemspec index 4818706d..260df18c 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |s| s.require_paths = %w[lib] s.add_development_dependency 'rake', '~> 12' - s.add_development_dependency 'activesupport', '~> 4.0' + s.add_development_dependency 'activesupport', '~> 7.1.3.4' s.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3' s.add_development_dependency 'html-pipeline', '~> 1.0' s.add_development_dependency 'sanitize', '>= 4.6.3' From 26b77f5d7c86c2f6f307491e946035424ae62e9e Mon Sep 17 00:00:00 2001 From: Justin Kenyon Date: Mon, 17 Jun 2024 11:20:56 -0400 Subject: [PATCH 387/416] update version and history --- HISTORY.md | 3 +++ lib/github-markup.rb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 0e01f49c..745a9c1b 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,6 @@ +## 5.0.1 - 2024-06-17 +* Bump activesupport from 4.0 to 7.1.3.4 + ## 5.0.0 - 2024-06-17 * Drop support for Ruby versions < 3 * Bump nokogiri from 1.8.1 to 1.16.5 diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 646e341c..7c36ad17 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '5.0.0' + VERSION = '5.0.1' Version = VERSION end end From e6973dfdacfb5d124fc45fdef2a6467d91ac3aa8 Mon Sep 17 00:00:00 2001 From: jmeridth Date: Mon, 17 Jun 2024 10:44:53 -0500 Subject: [PATCH 388/416] chore: add dependabot and update github actions Closes #1756 - [x] update github actions to latest versions - [x] use SHAs instead of tags for github actions, more secure supply chain - [x] add dependabot file grouping minor/patch dependency updates to reduce PRs - [x] remove Gemfile.lock from .gitignore and add it back to source control - this will allow dependabot to detect dependency updates Signed-off-by: jmeridth Co-authored-by: Zack Koppert --- .github/dependabot.yaml | 39 +++++++++++ .github/workflows/ci.yml | 8 +-- .gitignore | 1 - Gemfile.lock | 135 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 178 insertions(+), 5 deletions(-) create mode 100644 .github/dependabot.yaml create mode 100644 Gemfile.lock diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 00000000..802b7513 --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,39 @@ +--- +version: 2 +updates: + - package-ecosystem: 'bundler' + directory: '/' + schedule: + interval: 'weekly' + commit-message: + prefix: 'chore(deps)' + groups: + dependencies: + applies-to: version-updates + update-types: + - 'minor' + - 'patch' + - package-ecosystem: 'github-actions' + directory: '/' + schedule: + interval: 'weekly' + commit-message: + prefix: 'chore(deps)' + groups: + dependencies: + applies-to: version-updates + update-types: + - 'minor' + - 'patch' + - package-ecosystem: 'docker' + directory: '/' + schedule: + interval: 'weekly' + commit-message: + prefix: 'chore(deps)' + groups: + dependencies: + applies-to: version-updates + update-types: + - 'minor' + - 'patch' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a25fdefc..e0feed3c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,21 +19,21 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 with: fetch-depth: 10 - - uses: ruby/setup-ruby@v1 + - uses: ruby/setup-ruby@ff740bc00a01b3a50fffc55a1071b1060eeae9dc # v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - uses: actions/setup-python@v2 + - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 with: # This should match lib/github/markups.rb GitHub::Markups::MARKUP_RST python-version: '3.x' - - uses: actions/cache@v2 + - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip diff --git a/.gitignore b/.gitignore index 5e84e6f2..eac4d715 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ *.pyc pkg/ .bundle -Gemfile.lock .project .buildpath *~ diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 00000000..225b59a6 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,135 @@ +GIT + remote: https://github.com/gjtorikian/commonmarker.git + revision: 2838ebaa83ee0081d481c21f3bc0e4cb3e8de9da + tag: v0.18.3 + specs: + commonmarker (0.18.3) + ruby-enum (~> 0.5) + +PATH + remote: . + specs: + github-markup (5.0.1) + +GEM + remote: http://rubygems.org/ + specs: + RedCloth (4.3.4) + activesupport (7.1.3.4) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + minitest (>= 5.1) + mutex_m + tzinfo (~> 2.0) + asciidoctor (2.0.23) + base64 (0.2.0) + bigdecimal (3.1.8) + builder (3.3.0) + cgi (0.4.1) + charlock_holmes (0.7.7) + concurrent-ruby (1.3.3) + connection_pool (2.4.1) + crass (1.0.6) + creole (0.3.8) + drb (2.2.1) + expression_parser (0.9.0) + github-linguist (7.30.0) + cgi + charlock_holmes (~> 0.7.7) + mini_mime (~> 1.0) + rugged (~> 1.0) + html-pipeline (1.11.0) + activesupport (>= 2) + nokogiri (~> 1.4) + htmlentities (4.3.4) + i18n (1.14.5) + concurrent-ruby (~> 1.0) + mini_mime (1.1.5) + minitest (5.23.1) + mutex_m (0.2.0) + nokogiri (1.16.6-aarch64-linux) + racc (~> 1.4) + nokogiri (1.16.6-arm-linux) + racc (~> 1.4) + nokogiri (1.16.6-arm64-darwin) + racc (~> 1.4) + nokogiri (1.16.6-x86-linux) + racc (~> 1.4) + nokogiri (1.16.6-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.16.6-x86_64-linux) + racc (~> 1.4) + nokogiri-diff (0.3.0) + nokogiri (~> 1.5) + tdiff (~> 0.4) + org-ruby (0.9.9) + rubypants (~> 0.2) + psych (5.1.2) + stringio + racc (1.8.0) + rake (13.2.1) + rdoc (6.7.0) + psych (>= 4.0.0) + redcarpet (3.6.0) + rexml (3.3.0) + strscan + ruby-enum (0.9.0) + i18n + rubypants (0.7.1) + rugged (1.7.2) + sanitize (6.1.1) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + stringio (3.1.1) + strscan (3.1.0) + tdiff (0.4.0) + twitter-text (1.14.7) + unf (~> 0.1.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.9.1) + wikicloth (0.8.3) + builder + expression_parser + htmlentities + nokogiri + twitter-text + +PLATFORMS + aarch64-linux + arm-linux + arm64-darwin + x86-linux + x86_64-darwin + x86_64-linux + +DEPENDENCIES + RedCloth + activesupport (~> 7.1.3.4) + asciidoctor (~> 2.0.5) + commonmarker! + creole (~> 0.3.6) + github-linguist (>= 7.1.3) + github-markup! + html-pipeline (~> 1.0) + kramdown + minitest (~> 5.4, >= 5.4.3) + nokogiri (~> 1.16.5) + nokogiri-diff (~> 0.3.0) + org-ruby (= 0.9.9) + rake + rdoc (~> 6.7.0) + redcarpet + rexml + sanitize (>= 4.6.3) + twitter-text (~> 1.14) + wikicloth (= 0.8.3) + +BUNDLED WITH + 2.5.9 From 06e35c7cd36c297d220a07118b6b89cc925d0843 Mon Sep 17 00:00:00 2001 From: Justin Kenyon Date: Wed, 19 Jun 2024 15:36:52 -0400 Subject: [PATCH 389/416] Create stale.yml --- .github/workflows/stale.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..6bf0d0b6 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,27 @@ +# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. +# +# You can adjust the behavior by modifying this file. +# For more information, see: +# https://github.com/actions/stale +name: Mark stale issues and pull requests + +on: + schedule: + - cron: '0 12 * * *' + +jobs: + stale: + + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + + steps: + - uses: actions/stale@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'Stale issue message' + stale-pr-message: 'Stale pull request message' + stale-issue-label: 'no-issue-activity' + stale-pr-label: 'no-pr-activity' From 2a0c8ddb79d66be5d03e8618896b2f1db89e82a9 Mon Sep 17 00:00:00 2001 From: jmeridth Date: Wed, 19 Jun 2024 15:33:14 -0500 Subject: [PATCH 390/416] chore: use sha instead of tag on stale workflow didn't catch this in #1821 Using SHA instead of tag ensures secure supply chain. Tags are mutable, SHAs are not Signed-off-by: jmeridth --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 6bf0d0b6..6f52b5d0 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -18,7 +18,7 @@ jobs: pull-requests: write steps: - - uses: actions/stale@v5 + - uses: actions/stale@f7176fd3007623b69d27091f9b9d4ab7995f0a06 # v5 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: 'Stale issue message' From 7e6c70341e46d0212a811a259f4706d88e9629fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 00:03:10 +0000 Subject: [PATCH 391/416] chore(deps): bump rexml from 3.3.0 to 3.3.2 in the bundler group Bumps the bundler group with 1 update: [rexml](https://github.com/ruby/rexml). Updates `rexml` from 3.3.0 to 3.3.2 - [Release notes](https://github.com/ruby/rexml/releases) - [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md) - [Commits](https://github.com/ruby/rexml/compare/v3.3.0...v3.3.2) --- updated-dependencies: - dependency-name: rexml dependency-type: direct:production dependency-group: bundler ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 225b59a6..30c4454c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -75,7 +75,7 @@ GEM rdoc (6.7.0) psych (>= 4.0.0) redcarpet (3.6.0) - rexml (3.3.0) + rexml (3.3.2) strscan ruby-enum (0.9.0) i18n From 2b0455a36cda769a2da7df1e29cb77143d1bd3f7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:46:51 +0000 Subject: [PATCH 392/416] chore(deps): bump rexml from 3.3.2 to 3.3.3 in the bundler group Bumps the bundler group with 1 update: [rexml](https://github.com/ruby/rexml). Updates `rexml` from 3.3.2 to 3.3.3 - [Release notes](https://github.com/ruby/rexml/releases) - [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md) - [Commits](https://github.com/ruby/rexml/compare/v3.3.2...v3.3.3) --- updated-dependencies: - dependency-name: rexml dependency-type: direct:production dependency-group: bundler ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 30c4454c..9a4cdb41 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -75,7 +75,7 @@ GEM rdoc (6.7.0) psych (>= 4.0.0) redcarpet (3.6.0) - rexml (3.3.2) + rexml (3.3.3) strscan ruby-enum (0.9.0) i18n From 83b09f8186a3f364c537726c3cfaa3a62924f8bc Mon Sep 17 00:00:00 2001 From: jmeridth Date: Tue, 6 Aug 2024 15:05:30 -0500 Subject: [PATCH 393/416] fix: ensure rubygems url is using https Fixes https://github.com/github/markup/security/code-scanning/1 `Dependency source URL uses the unencrypted protocol HTTP. Use HTTPS instead.` Signed-off-by: jmeridth --- Gemfile | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index fb3c1308..9b317555 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source "http://rubygems.org" +source "https://rubygems.org" gemspec gem "redcarpet", :platforms => :ruby diff --git a/Gemfile.lock b/Gemfile.lock index 30c4454c..b6d184d4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,7 +12,7 @@ PATH github-markup (5.0.1) GEM - remote: http://rubygems.org/ + remote: https://rubygems.org/ specs: RedCloth (4.3.4) activesupport (7.1.3.4) From 1e2c03935912e5cf4bfb81726f5a9bfe18a86c43 Mon Sep 17 00:00:00 2001 From: jmeridth Date: Tue, 6 Aug 2024 15:24:51 -0500 Subject: [PATCH 394/416] fix: add explicit permissions to ci github action Fixing a code scanning alert Signed-off-by: jmeridth --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0feed3c..9e8e31dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,9 @@ on: [push, pull_request] env: JRUBY_OPTS: -Xcext.enabled=true +permissions: + contents: read + jobs: build: name: "Test / Ruby ${{ matrix.ruby }}" From 6d287a98bb5a400b780bc9db191899ba442dd6ec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 20:51:15 +0000 Subject: [PATCH 395/416] chore(deps): bump rexml from 3.3.3 to 3.3.6 in the bundler group Bumps the bundler group with 1 update: [rexml](https://github.com/ruby/rexml). Updates `rexml` from 3.3.3 to 3.3.6 - [Release notes](https://github.com/ruby/rexml/releases) - [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md) - [Commits](https://github.com/ruby/rexml/compare/v3.3.3...v3.3.6) --- updated-dependencies: - dependency-name: rexml dependency-type: direct:production dependency-group: bundler ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6dc75c96..d2c84309 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -75,7 +75,7 @@ GEM rdoc (6.7.0) psych (>= 4.0.0) redcarpet (3.6.0) - rexml (3.3.3) + rexml (3.3.6) strscan ruby-enum (0.9.0) i18n From 2880c2c6d108531a8eed179b369762e0aeaec9ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 11:01:09 +0000 Subject: [PATCH 396/416] chore(deps): bump the dependencies group across 1 directory with 2 updates Bumps the dependencies group with 2 updates in the / directory: [ruby/setup-ruby](https://github.com/ruby/setup-ruby) and [actions/setup-python](https://github.com/actions/setup-python). Updates `ruby/setup-ruby` from 1.180.0 to 1.190.0 - [Release notes](https://github.com/ruby/setup-ruby/releases) - [Changelog](https://github.com/ruby/setup-ruby/blob/master/release.rb) - [Commits](https://github.com/ruby/setup-ruby/compare/ff740bc00a01b3a50fffc55a1071b1060eeae9dc...a6e6f86333f0a2523ece813039b8b4be04560854) Updates `actions/setup-python` from 5.1.0 to 5.2.0 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/82c7e631bb3cdc910f68e0081d67478d79c6982d...f677139bbe7f9c59b41e40162b753c062f5d49a3) --- updated-dependencies: - dependency-name: ruby/setup-ruby dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e8e31dc..3640b8b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,12 +26,12 @@ jobs: with: fetch-depth: 10 - - uses: ruby/setup-ruby@ff740bc00a01b3a50fffc55a1071b1060eeae9dc # v1 + - uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 + - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 with: # This should match lib/github/markups.rb GitHub::Markups::MARKUP_RST python-version: '3.x' From b4f9c54a4b4c117cb315cd0f4df09ffd5a1484b7 Mon Sep 17 00:00:00 2001 From: jmeridth Date: Wed, 4 Sep 2024 15:06:15 -0500 Subject: [PATCH 397/416] chore: add .venv/venv to .gitignore best practices with local python development is to create a virtual environment. The most common are either .venv or venv folders in the root of the repo. We currently install [docutils](https://github.com/github/markup/blob/914839fd31c93b93a8054a3c91fce0906b2d1375/script/bootstrap#L8) via pip (python). - [x] add .venv/venv folders to .gitignore - [x] update README with how to setup locally environment Signed-off-by: jmeridth --- .gitignore | 2 ++ README.md | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/.gitignore b/.gitignore index eac4d715..b0f0821c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ pkg/ *~ vendor/ .DS_Store +.venv +venv diff --git a/README.md b/README.md index b2bcc809..3aeb7110 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,15 @@ require 'github/markup' GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "* One\n* Two") ``` +Local Development +----------------- + +```sh +python3 -m venv .venv +source .venv/bin/activate +cd script +./bootstrap +``` Contributing ------------ From bc6e6e36a6cdf5e4cd73f4d3bcfafd05c3e4cb67 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 10:25:23 +0000 Subject: [PATCH 398/416] chore(deps): bump ruby/setup-ruby in the dependencies group Bumps the dependencies group with 1 update: [ruby/setup-ruby](https://github.com/ruby/setup-ruby). Updates `ruby/setup-ruby` from 1.190.0 to 1.191.0 - [Release notes](https://github.com/ruby/setup-ruby/releases) - [Changelog](https://github.com/ruby/setup-ruby/blob/master/release.rb) - [Commits](https://github.com/ruby/setup-ruby/compare/a6e6f86333f0a2523ece813039b8b4be04560854...52753b7da854d5c07df37391a986c76ab4615999) --- updated-dependencies: - dependency-name: ruby/setup-ruby dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3640b8b4..dd8812d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: with: fetch-depth: 10 - - uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1 + - uses: ruby/setup-ruby@52753b7da854d5c07df37391a986c76ab4615999 # v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true From 459fb1b32f42e005140979f007ad84ca75e0b7d2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 10:32:15 +0000 Subject: [PATCH 399/416] chore(deps): bump ruby/setup-ruby in the dependencies group Bumps the dependencies group with 1 update: [ruby/setup-ruby](https://github.com/ruby/setup-ruby). Updates `ruby/setup-ruby` from 1.191.0 to 1.193.0 - [Release notes](https://github.com/ruby/setup-ruby/releases) - [Changelog](https://github.com/ruby/setup-ruby/blob/master/release.rb) - [Commits](https://github.com/ruby/setup-ruby/compare/52753b7da854d5c07df37391a986c76ab4615999...f321cf5a4d1533575411f8752cf25b86478b0442) --- updated-dependencies: - dependency-name: ruby/setup-ruby dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd8812d5..3ed2585a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: with: fetch-depth: 10 - - uses: ruby/setup-ruby@52753b7da854d5c07df37391a986c76ab4615999 # v1 + - uses: ruby/setup-ruby@f321cf5a4d1533575411f8752cf25b86478b0442 # v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true From af6b5419e67273b90a3db2cdfaeab46f40c2d80c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 10:32:39 +0000 Subject: [PATCH 400/416] chore(deps): bump the dependencies group with 2 updates Bumps the dependencies group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [ruby/setup-ruby](https://github.com/ruby/setup-ruby). Updates `actions/checkout` from 4.1.7 to 4.2.0 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/692973e3d937129bcbf40652eb9f2f61becf3332...d632683dd7b4114ad314bca15554477dd762a938) Updates `ruby/setup-ruby` from 1.193.0 to 1.194.0 - [Release notes](https://github.com/ruby/setup-ruby/releases) - [Changelog](https://github.com/ruby/setup-ruby/blob/master/release.rb) - [Commits](https://github.com/ruby/setup-ruby/compare/f321cf5a4d1533575411f8752cf25b86478b0442...c04af2bb7258bb6a03df1d3c1865998ac9390972) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: ruby/setup-ruby dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ed2585a..effc3f2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,11 +22,11 @@ jobs: steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4 with: fetch-depth: 10 - - uses: ruby/setup-ruby@f321cf5a4d1533575411f8752cf25b86478b0442 # v1 + - uses: ruby/setup-ruby@c04af2bb7258bb6a03df1d3c1865998ac9390972 # v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true From 0a930b28d65d8d3bffec77ee3dbaafcb11032d32 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 18:49:07 +0000 Subject: [PATCH 401/416] chore(deps): bump rexml from 3.3.6 to 3.3.9 in the bundler group Bumps the bundler group with 1 update: [rexml](https://github.com/ruby/rexml). Updates `rexml` from 3.3.6 to 3.3.9 - [Release notes](https://github.com/ruby/rexml/releases) - [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md) - [Commits](https://github.com/ruby/rexml/compare/v3.3.6...v3.3.9) --- updated-dependencies: - dependency-name: rexml dependency-type: direct:production dependency-group: bundler ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d2c84309..761f6cc0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -75,8 +75,7 @@ GEM rdoc (6.7.0) psych (>= 4.0.0) redcarpet (3.6.0) - rexml (3.3.6) - strscan + rexml (3.3.9) ruby-enum (0.9.0) i18n rubypants (0.7.1) @@ -85,7 +84,6 @@ GEM crass (~> 1.0.2) nokogiri (>= 1.12.0) stringio (3.1.1) - strscan (3.1.0) tdiff (0.4.0) twitter-text (1.14.7) unf (~> 0.1.0) From 57e250f0fb775a154a0184702f310f954b3d5762 Mon Sep 17 00:00:00 2001 From: jmeridth Date: Sun, 3 Nov 2024 22:34:28 -0600 Subject: [PATCH 402/416] fix: stale issue/pr message Signed-off-by: jmeridth --- .github/workflows/stale.yml | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 6f52b5d0..fc5a93dc 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,27 +1,25 @@ -# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. -# -# You can adjust the behavior by modifying this file. -# For more information, see: -# https://github.com/actions/stale name: Mark stale issues and pull requests on: schedule: - - cron: '0 12 * * *' + - cron: "0 12 * * *" jobs: stale: - runs-on: ubuntu-latest permissions: issues: write pull-requests: write steps: - - uses: actions/stale@f7176fd3007623b69d27091f9b9d4ab7995f0a06 # v5 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'Stale issue message' - stale-pr-message: 'Stale pull request message' - stale-issue-label: 'no-issue-activity' - stale-pr-label: 'no-pr-activity' + - uses: actions/stale@f7176fd3007623b69d27091f9b9d4ab7995f0a06 # v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: > + This issue has been automatically marked as stale because it has not + had recent activity. It will be closed if no further activity occurs. + Thank you for your contributions. + stale-pr-message: > + This pull request has been automatically marked as stale because it has not + had recent activity. It will be closed if no further activity occurs. + Thank you for your contributions. From 371da086ed849e8a3b255eed932b040ef7ca2042 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:49:14 +0000 Subject: [PATCH 403/416] chore(deps): bump the dependencies group across 1 directory with 4 updates Bumps the dependencies group with 4 updates in the / directory: [actions/checkout](https://github.com/actions/checkout), [ruby/setup-ruby](https://github.com/ruby/setup-ruby), [actions/setup-python](https://github.com/actions/setup-python) and [actions/cache](https://github.com/actions/cache). Updates `actions/checkout` from 4.2.0 to 4.2.2 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/d632683dd7b4114ad314bca15554477dd762a938...11bd71901bbe5b1630ceea73d27597364c9af683) Updates `ruby/setup-ruby` from 1.194.0 to 1.199.0 - [Release notes](https://github.com/ruby/setup-ruby/releases) - [Changelog](https://github.com/ruby/setup-ruby/blob/master/release.rb) - [Commits](https://github.com/ruby/setup-ruby/compare/c04af2bb7258bb6a03df1d3c1865998ac9390972...7d3497fd78c07c0d84ebafa58d8dac60cd1f0763) Updates `actions/setup-python` from 5.2.0 to 5.3.0 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/f677139bbe7f9c59b41e40162b753c062f5d49a3...0b93645e9fea7318ecaed2b359559ac225c90a2b) Updates `actions/cache` from 4.0.2 to 4.1.2 - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/0c45773b623bea8c8e75f6c82b208c3cf94ea4f9...6849a6489940f00c2f30c0fb92c6274307ccb58a) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: ruby/setup-ruby dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index effc3f2a..0a661e9b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,21 +22,21 @@ jobs: steps: - name: Checkout - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 10 - - uses: ruby/setup-ruby@c04af2bb7258bb6a03df1d3c1865998ac9390972 # v1 + - uses: ruby/setup-ruby@7d3497fd78c07c0d84ebafa58d8dac60cd1f0763 # v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 + - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 with: # This should match lib/github/markups.rb GitHub::Markups::MARKUP_RST python-version: '3.x' - - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 + - uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip From 5767386b134d0b70634a2187001beadafaf39a3c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:49:47 +0000 Subject: [PATCH 404/416] chore(deps): bump the dependencies group across 1 directory with 6 updates Updates the requirements on [org-ruby](https://github.com/wallyqs/org-ruby), [creole](https://github.com/minad/creole), [activesupport](https://github.com/rails/rails), [minitest](https://github.com/minitest/minitest), [sanitize](https://github.com/rgrove/sanitize) and [nokogiri](https://github.com/sparklemotion/nokogiri) to permit the latest version. Updates `org-ruby` from 0.9.9 to 0.9.12 - [Changelog](https://github.com/wallyqs/org-ruby/blob/master/History.org) - [Commits](https://github.com/wallyqs/org-ruby/compare/version-0.9.9...version-0.9.12) Updates `creole` from 0.3.8 to 0.5.0 - [Changelog](https://github.com/minad/creole/blob/master/CHANGES) - [Commits](https://github.com/minad/creole/compare/0.3.8...v0.5.0) Updates `activesupport` from 7.1.3.4 to 7.1.5 - [Release notes](https://github.com/rails/rails/releases) - [Changelog](https://github.com/rails/rails/blob/v7.2.2/activesupport/CHANGELOG.md) - [Commits](https://github.com/rails/rails/compare/v7.1.3.4...v7.1.5) Updates `minitest` from 5.23.1 to 5.25.1 - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](https://github.com/minitest/minitest/compare/v5.23.1...v5.25.1) Updates `sanitize` from 6.1.1 to 6.1.3 - [Release notes](https://github.com/rgrove/sanitize/releases) - [Changelog](https://github.com/rgrove/sanitize/blob/main/HISTORY.md) - [Commits](https://github.com/rgrove/sanitize/compare/v6.1.1...v6.1.3) Updates `nokogiri` from 1.16.6 to 1.16.7 - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.16.6...v1.16.7) --- updated-dependencies: - dependency-name: org-ruby dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: creole dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: activesupport dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: minitest dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: sanitize dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: nokogiri dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dependencies ... Signed-off-by: dependabot[bot] --- Gemfile | 4 ++-- Gemfile.lock | 40 +++++++++++++++++++++++----------------- github-markup.gemspec | 2 +- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/Gemfile b/Gemfile index 9b317555..b2983b9b 100644 --- a/Gemfile +++ b/Gemfile @@ -8,8 +8,8 @@ gem "RedCloth" # however we want to bump up to this version since this has a security patch gem "commonmarker", git: "https://github.com/gjtorikian/commonmarker.git", tag: "v0.18.3" gem "rdoc", "~> 6.7.0" -gem "org-ruby", "= 0.9.9" -gem "creole", "~>0.3.6" +gem "org-ruby", "0.9.12" +gem "creole", "~>0.5.0" gem "wikicloth", "=0.8.3" gem "twitter-text", "~> 1.14" gem "asciidoctor", "~> 2.0.5" diff --git a/Gemfile.lock b/Gemfile.lock index 761f6cc0..5912d3b1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -15,26 +15,30 @@ GEM remote: https://rubygems.org/ specs: RedCloth (4.3.4) - activesupport (7.1.3.4) + activesupport (7.1.5) base64 + benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) mutex_m + securerandom (>= 0.3) tzinfo (~> 2.0) asciidoctor (2.0.23) base64 (0.2.0) + benchmark (0.3.0) bigdecimal (3.1.8) builder (3.3.0) cgi (0.4.1) charlock_holmes (0.7.7) - concurrent-ruby (1.3.3) + concurrent-ruby (1.3.4) connection_pool (2.4.1) crass (1.0.6) - creole (0.3.8) + creole (0.5.0) drb (2.2.1) expression_parser (0.9.0) github-linguist (7.30.0) @@ -46,31 +50,32 @@ GEM activesupport (>= 2) nokogiri (~> 1.4) htmlentities (4.3.4) - i18n (1.14.5) + i18n (1.14.6) concurrent-ruby (~> 1.0) + logger (1.6.1) mini_mime (1.1.5) - minitest (5.23.1) + minitest (5.25.1) mutex_m (0.2.0) - nokogiri (1.16.6-aarch64-linux) + nokogiri (1.16.7-aarch64-linux) racc (~> 1.4) - nokogiri (1.16.6-arm-linux) + nokogiri (1.16.7-arm-linux) racc (~> 1.4) - nokogiri (1.16.6-arm64-darwin) + nokogiri (1.16.7-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.6-x86-linux) + nokogiri (1.16.7-x86-linux) racc (~> 1.4) - nokogiri (1.16.6-x86_64-darwin) + nokogiri (1.16.7-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.6-x86_64-linux) + nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) nokogiri-diff (0.3.0) nokogiri (~> 1.5) tdiff (~> 0.4) - org-ruby (0.9.9) + org-ruby (0.9.12) rubypants (~> 0.2) psych (5.1.2) stringio - racc (1.8.0) + racc (1.8.1) rake (13.2.1) rdoc (6.7.0) psych (>= 4.0.0) @@ -80,9 +85,10 @@ GEM i18n rubypants (0.7.1) rugged (1.7.2) - sanitize (6.1.1) + sanitize (6.1.3) crass (~> 1.0.2) nokogiri (>= 1.12.0) + securerandom (0.3.1) stringio (3.1.1) tdiff (0.4.0) twitter-text (1.14.7) @@ -109,10 +115,10 @@ PLATFORMS DEPENDENCIES RedCloth - activesupport (~> 7.1.3.4) + activesupport (~> 7.1.5) asciidoctor (~> 2.0.5) commonmarker! - creole (~> 0.3.6) + creole (~> 0.5.0) github-linguist (>= 7.1.3) github-markup! html-pipeline (~> 1.0) @@ -120,7 +126,7 @@ DEPENDENCIES minitest (~> 5.4, >= 5.4.3) nokogiri (~> 1.16.5) nokogiri-diff (~> 0.3.0) - org-ruby (= 0.9.9) + org-ruby (= 0.9.12) rake rdoc (~> 6.7.0) redcarpet diff --git a/github-markup.gemspec b/github-markup.gemspec index 260df18c..ccf5908a 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |s| s.require_paths = %w[lib] s.add_development_dependency 'rake', '~> 12' - s.add_development_dependency 'activesupport', '~> 7.1.3.4' + s.add_development_dependency 'activesupport', '~> 7.1.5' s.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3' s.add_development_dependency 'html-pipeline', '~> 1.0' s.add_development_dependency 'sanitize', '>= 4.6.3' From cec16df50930cfd7870f6addab2e0acdaedb41f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 10:28:29 +0000 Subject: [PATCH 405/416] chore(deps): bump ruby/setup-ruby in the dependencies group Bumps the dependencies group with 1 update: [ruby/setup-ruby](https://github.com/ruby/setup-ruby). Updates `ruby/setup-ruby` from 1.199.0 to 1.202.0 - [Release notes](https://github.com/ruby/setup-ruby/releases) - [Changelog](https://github.com/ruby/setup-ruby/blob/master/release.rb) - [Commits](https://github.com/ruby/setup-ruby/compare/7d3497fd78c07c0d84ebafa58d8dac60cd1f0763...a2bbe5b1b236842c1cb7dd11e8e3b51e0a616acc) --- updated-dependencies: - dependency-name: ruby/setup-ruby dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a661e9b..b2c0469c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: with: fetch-depth: 10 - - uses: ruby/setup-ruby@7d3497fd78c07c0d84ebafa58d8dac60cd1f0763 # v1 + - uses: ruby/setup-ruby@a2bbe5b1b236842c1cb7dd11e8e3b51e0a616acc # v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true From eed8f53691db84d1788fd142c9235bb6b8379b76 Mon Sep 17 00:00:00 2001 From: jmeridth Date: Mon, 18 Nov 2024 09:10:32 -0600 Subject: [PATCH 406/416] chore: add keep label to mark issues/prs from being marked as stale - [x] added keep label to repo - [x] add `exempt-issue-labels` and `exempt-pre-labels` to stale config Signed-off-by: jmeridth --- .github/workflows/stale.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index fc5a93dc..ef40f1b0 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -23,3 +23,5 @@ jobs: This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. + exempt-issue-labels: keep + exempt-pr-labels: keep From 9362a5204fd1551e692b5d9c7a44b70b9e5d4374 Mon Sep 17 00:00:00 2001 From: jmeridth Date: Mon, 18 Nov 2024 09:31:19 -0600 Subject: [PATCH 407/416] fix: switch from shas to tags for immutable actions closes 4 security warnings Signed-off-by: jmeridth --- .github/workflows/ci.yml | 8 ++++---- .github/workflows/stale.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2c0469c..0eb7e108 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + uses: actions/checkout@v4.2.2 with: fetch-depth: 10 @@ -31,12 +31,12 @@ jobs: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 + - uses: actions/setup-python@v5.3.0 with: # This should match lib/github/markups.rb GitHub::Markups::MARKUP_RST - python-version: '3.x' + python-version: "3.x" - - uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4 + - uses: actions/cache@v4.1.2 with: path: ~/.cache/pip key: ${{ runner.os }}-pip diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index ef40f1b0..2ef91e16 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -12,7 +12,7 @@ jobs: pull-requests: write steps: - - uses: actions/stale@f7176fd3007623b69d27091f9b9d4ab7995f0a06 # v5 + - uses: actions/stale@v9.0.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: > From 70055d6c111806adef3090f1d8210c7888bcfa65 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Mar 2025 10:54:07 +0000 Subject: [PATCH 408/416] chore(deps): bump the dependencies group across 1 directory with 4 updates Bumps the dependencies group with 4 updates in the / directory: [ruby/setup-ruby](https://github.com/ruby/setup-ruby), [actions/setup-python](https://github.com/actions/setup-python), [actions/cache](https://github.com/actions/cache) and [actions/stale](https://github.com/actions/stale). Updates `ruby/setup-ruby` from 1.202.0 to 1.222.0 - [Release notes](https://github.com/ruby/setup-ruby/releases) - [Changelog](https://github.com/ruby/setup-ruby/blob/master/release.rb) - [Commits](https://github.com/ruby/setup-ruby/compare/a2bbe5b1b236842c1cb7dd11e8e3b51e0a616acc...277ba2a127aba66d45bad0fa2dc56f80dbfedffa) Updates `actions/setup-python` from 5.3.0 to 5.4.0 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v5.3.0...v5.4.0) Updates `actions/cache` from 4.1.2 to 4.2.2 - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v4.1.2...v4.2.2) Updates `actions/stale` from 9.0.0 to 9.1.0 - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/stale/compare/v9.0.0...v9.1.0) --- updated-dependencies: - dependency-name: ruby/setup-ruby dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: actions/stale dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 6 +++--- .github/workflows/stale.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0eb7e108..65a1cf08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,17 +26,17 @@ jobs: with: fetch-depth: 10 - - uses: ruby/setup-ruby@a2bbe5b1b236842c1cb7dd11e8e3b51e0a616acc # v1 + - uses: ruby/setup-ruby@277ba2a127aba66d45bad0fa2dc56f80dbfedffa # v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - uses: actions/setup-python@v5.3.0 + - uses: actions/setup-python@v5.4.0 with: # This should match lib/github/markups.rb GitHub::Markups::MARKUP_RST python-version: "3.x" - - uses: actions/cache@v4.1.2 + - uses: actions/cache@v4.2.2 with: path: ~/.cache/pip key: ${{ runner.os }}-pip diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 2ef91e16..84cbf0ed 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -12,7 +12,7 @@ jobs: pull-requests: write steps: - - uses: actions/stale@v9.0.0 + - uses: actions/stale@v9.1.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: > From 9831835518ebb07419678300f6ec01870b73d0c1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Mar 2025 21:05:33 +0000 Subject: [PATCH 409/416] chore(deps): bump the dependencies group with 5 updates Updates the requirements on [redcarpet](https://github.com/vmg/redcarpet), [rdoc](https://github.com/ruby/rdoc), [rexml](https://github.com/ruby/rexml), [minitest](https://github.com/minitest/minitest) and [nokogiri](https://github.com/sparklemotion/nokogiri) to permit the latest version. Updates `redcarpet` from 3.6.0 to 3.6.1 - [Release notes](https://github.com/vmg/redcarpet/releases) - [Changelog](https://github.com/vmg/redcarpet/blob/master/CHANGELOG.md) - [Commits](https://github.com/vmg/redcarpet/compare/v3.6.0...v3.6.1) Updates `rdoc` from 6.7.0 to 6.12.0 - [Release notes](https://github.com/ruby/rdoc/releases) - [Changelog](https://github.com/ruby/rdoc/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rdoc/compare/v6.7.0...v6.12.0) Updates `rexml` from 3.3.9 to 3.4.1 - [Release notes](https://github.com/ruby/rexml/releases) - [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md) - [Commits](https://github.com/ruby/rexml/compare/v3.3.9...v3.4.1) Updates `minitest` from 5.25.1 to 5.25.4 - [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc) - [Commits](https://github.com/minitest/minitest/compare/v5.25.1...v5.25.4) Updates `nokogiri` from 1.16.7 to 1.17.2 - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.16.7...v1.17.2) --- updated-dependencies: - dependency-name: redcarpet dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: rdoc dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: rexml dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: minitest dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: nokogiri dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 30 ++++++++++++++++-------------- github-markup.gemspec | 2 +- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/Gemfile b/Gemfile index b2983b9b..be52c0a6 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ gem "RedCloth" # using a tag version here because 0.18.3 was not published by the author to encourage users to upgrade. # however we want to bump up to this version since this has a security patch gem "commonmarker", git: "https://github.com/gjtorikian/commonmarker.git", tag: "v0.18.3" -gem "rdoc", "~> 6.7.0" +gem "rdoc", "~> 6.13.0" gem "org-ruby", "0.9.12" gem "creole", "~>0.5.0" gem "wikicloth", "=0.8.3" diff --git a/Gemfile.lock b/Gemfile.lock index 5912d3b1..ba36467a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,6 +39,7 @@ GEM connection_pool (2.4.1) crass (1.0.6) creole (0.5.0) + date (3.4.1) drb (2.2.1) expression_parser (0.9.0) github-linguist (7.30.0) @@ -54,33 +55,34 @@ GEM concurrent-ruby (~> 1.0) logger (1.6.1) mini_mime (1.1.5) - minitest (5.25.1) + minitest (5.25.5) mutex_m (0.2.0) - nokogiri (1.16.7-aarch64-linux) + nokogiri (1.17.2-aarch64-linux) racc (~> 1.4) - nokogiri (1.16.7-arm-linux) + nokogiri (1.17.2-arm-linux) racc (~> 1.4) - nokogiri (1.16.7-arm64-darwin) + nokogiri (1.17.2-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.7-x86-linux) + nokogiri (1.17.2-x86-linux) racc (~> 1.4) - nokogiri (1.16.7-x86_64-darwin) + nokogiri (1.17.2-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.7-x86_64-linux) + nokogiri (1.17.2-x86_64-linux) racc (~> 1.4) nokogiri-diff (0.3.0) nokogiri (~> 1.5) tdiff (~> 0.4) org-ruby (0.9.12) rubypants (~> 0.2) - psych (5.1.2) + psych (5.2.3) + date stringio racc (1.8.1) rake (13.2.1) - rdoc (6.7.0) + rdoc (6.13.0) psych (>= 4.0.0) - redcarpet (3.6.0) - rexml (3.3.9) + redcarpet (3.6.1) + rexml (3.4.1) ruby-enum (0.9.0) i18n rubypants (0.7.1) @@ -89,7 +91,7 @@ GEM crass (~> 1.0.2) nokogiri (>= 1.12.0) securerandom (0.3.1) - stringio (3.1.1) + stringio (3.1.6) tdiff (0.4.0) twitter-text (1.14.7) unf (~> 0.1.0) @@ -124,11 +126,11 @@ DEPENDENCIES html-pipeline (~> 1.0) kramdown minitest (~> 5.4, >= 5.4.3) - nokogiri (~> 1.16.5) + nokogiri (~> 1.17.2) nokogiri-diff (~> 0.3.0) org-ruby (= 0.9.12) rake - rdoc (~> 6.7.0) + rdoc (~> 6.13.0) redcarpet rexml sanitize (>= 4.6.3) diff --git a/github-markup.gemspec b/github-markup.gemspec index ccf5908a..ddd4635f 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3' s.add_development_dependency 'html-pipeline', '~> 1.0' s.add_development_dependency 'sanitize', '>= 4.6.3' - s.add_development_dependency 'nokogiri', '~> 1.16.5' + s.add_development_dependency 'nokogiri', '~> 1.17.2' s.add_development_dependency 'nokogiri-diff', '~> 0.3.0' s.add_development_dependency "github-linguist", ">= 7.1.3" end From b88ec4392314d5f873ea0adea9e4ff526ab2ff04 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Mar 2025 21:17:51 +0000 Subject: [PATCH 410/416] chore(deps): bump activesupport from 7.1.5 to 7.1.5.1 Bumps [activesupport](https://github.com/rails/rails) from 7.1.5 to 7.1.5.1. - [Release notes](https://github.com/rails/rails/releases) - [Changelog](https://github.com/rails/rails/blob/v8.0.1/activesupport/CHANGELOG.md) - [Commits](https://github.com/rails/rails/compare/v7.1.5...v7.1.5.1) --- updated-dependencies: - dependency-name: activesupport dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ba36467a..38813bb1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -15,7 +15,7 @@ GEM remote: https://rubygems.org/ specs: RedCloth (4.3.4) - activesupport (7.1.5) + activesupport (7.1.5.1) base64 benchmark (>= 0.3) bigdecimal @@ -30,13 +30,13 @@ GEM tzinfo (~> 2.0) asciidoctor (2.0.23) base64 (0.2.0) - benchmark (0.3.0) - bigdecimal (3.1.8) + benchmark (0.4.0) + bigdecimal (3.1.9) builder (3.3.0) cgi (0.4.1) charlock_holmes (0.7.7) - concurrent-ruby (1.3.4) - connection_pool (2.4.1) + concurrent-ruby (1.3.5) + connection_pool (2.5.0) crass (1.0.6) creole (0.5.0) date (3.4.1) @@ -51,12 +51,12 @@ GEM activesupport (>= 2) nokogiri (~> 1.4) htmlentities (4.3.4) - i18n (1.14.6) + i18n (1.14.7) concurrent-ruby (~> 1.0) - logger (1.6.1) + logger (1.7.0) mini_mime (1.1.5) minitest (5.25.5) - mutex_m (0.2.0) + mutex_m (0.3.0) nokogiri (1.17.2-aarch64-linux) racc (~> 1.4) nokogiri (1.17.2-arm-linux) @@ -90,7 +90,7 @@ GEM sanitize (6.1.3) crass (~> 1.0.2) nokogiri (>= 1.12.0) - securerandom (0.3.1) + securerandom (0.3.2) stringio (3.1.6) tdiff (0.4.0) twitter-text (1.14.7) From 0f6838c1f8110cb2ee005cb74a5392c4dbb48881 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Mar 2025 10:48:59 +0000 Subject: [PATCH 411/416] chore(deps): bump rdoc from 6.13.0 to 6.13.1 in the dependencies group Bumps the dependencies group with 1 update: [rdoc](https://github.com/ruby/rdoc). Updates `rdoc` from 6.13.0 to 6.13.1 - [Release notes](https://github.com/ruby/rdoc/releases) - [Changelog](https://github.com/ruby/rdoc/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rdoc/compare/v6.13.0...v6.13.1) --- updated-dependencies: - dependency-name: rdoc dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies ... Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index be52c0a6..e2c29f9c 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ gem "RedCloth" # using a tag version here because 0.18.3 was not published by the author to encourage users to upgrade. # however we want to bump up to this version since this has a security patch gem "commonmarker", git: "https://github.com/gjtorikian/commonmarker.git", tag: "v0.18.3" -gem "rdoc", "~> 6.13.0" +gem "rdoc", "~> 6.13.1" gem "org-ruby", "0.9.12" gem "creole", "~>0.5.0" gem "wikicloth", "=0.8.3" diff --git a/Gemfile.lock b/Gemfile.lock index ba36467a..2f72687c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -79,7 +79,7 @@ GEM stringio racc (1.8.1) rake (13.2.1) - rdoc (6.13.0) + rdoc (6.13.1) psych (>= 4.0.0) redcarpet (3.6.1) rexml (3.4.1) @@ -130,7 +130,7 @@ DEPENDENCIES nokogiri-diff (~> 0.3.0) org-ruby (= 0.9.12) rake - rdoc (~> 6.13.0) + rdoc (~> 6.13.1) redcarpet rexml sanitize (>= 4.6.3) From 1ba0b17f610f4cdf6cf33ec7bc2c618f8b0f9208 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Mar 2025 11:04:59 +0000 Subject: [PATCH 412/416] chore(deps): bump the dependencies group with 3 updates Bumps the dependencies group with 3 updates: [ruby/setup-ruby](https://github.com/ruby/setup-ruby), [actions/setup-python](https://github.com/actions/setup-python) and [actions/cache](https://github.com/actions/cache). Updates `ruby/setup-ruby` from 1.222.0 to 1.229.0 - [Release notes](https://github.com/ruby/setup-ruby/releases) - [Changelog](https://github.com/ruby/setup-ruby/blob/master/release.rb) - [Commits](https://github.com/ruby/setup-ruby/compare/277ba2a127aba66d45bad0fa2dc56f80dbfedffa...354a1ad156761f5ee2b7b13fa8e09943a5e8d252) Updates `actions/setup-python` from 5.4.0 to 5.5.0 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v5.4.0...v5.5.0) Updates `actions/cache` from 4.2.2 to 4.2.3 - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v4.2.2...v4.2.3) --- updated-dependencies: - dependency-name: ruby/setup-ruby dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 65a1cf08..f313947e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,17 +26,17 @@ jobs: with: fetch-depth: 10 - - uses: ruby/setup-ruby@277ba2a127aba66d45bad0fa2dc56f80dbfedffa # v1 + - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - uses: actions/setup-python@v5.4.0 + - uses: actions/setup-python@v5.5.0 with: # This should match lib/github/markups.rb GitHub::Markups::MARKUP_RST python-version: "3.x" - - uses: actions/cache@v4.2.2 + - uses: actions/cache@v4.2.3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip From 63895bf131f69398fab9beaa0d9839c79ceeddfd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Mar 2025 14:39:39 +0000 Subject: [PATCH 413/416] chore(deps): bump cgi from 0.4.1 to 0.4.2 in the bundler group Bumps the bundler group with 1 update: [cgi](https://github.com/ruby/cgi). Updates `cgi` from 0.4.1 to 0.4.2 - [Release notes](https://github.com/ruby/cgi/releases) - [Commits](https://github.com/ruby/cgi/compare/v0.4.1...v0.4.2) --- updated-dependencies: - dependency-name: cgi dependency-type: indirect dependency-group: bundler ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index ba36467a..84f33bdf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -33,7 +33,7 @@ GEM benchmark (0.3.0) bigdecimal (3.1.8) builder (3.3.0) - cgi (0.4.1) + cgi (0.4.2) charlock_holmes (0.7.7) concurrent-ruby (1.3.4) connection_pool (2.4.1) From ead5ff8f21d0db8d672a7283a6afec24cbfee3ea Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Mar 2025 15:05:35 +0000 Subject: [PATCH 414/416] chore(deps): bump github-linguist from 7.30.0 to 9.1.0 Bumps [github-linguist](https://github.com/github-linguist/linguist) from 7.30.0 to 9.1.0. - [Release notes](https://github.com/github-linguist/linguist/releases) - [Commits](https://github.com/github-linguist/linguist/compare/v7.30.0...v9.1.0) --- updated-dependencies: - dependency-name: github-linguist dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index c8c61181..1ebd7841 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -34,7 +34,7 @@ GEM bigdecimal (3.1.9) builder (3.3.0) cgi (0.4.2) - charlock_holmes (0.7.7) + charlock_holmes (0.7.9) concurrent-ruby (1.3.5) connection_pool (2.5.0) crass (1.0.6) @@ -42,7 +42,7 @@ GEM date (3.4.1) drb (2.2.1) expression_parser (0.9.0) - github-linguist (7.30.0) + github-linguist (9.1.0) cgi charlock_holmes (~> 0.7.7) mini_mime (~> 1.0) @@ -86,7 +86,7 @@ GEM ruby-enum (0.9.0) i18n rubypants (0.7.1) - rugged (1.7.2) + rugged (1.9.0) sanitize (6.1.3) crass (~> 1.0.2) nokogiri (>= 1.12.0) From 92a2ed2692f9b162e7008820f32d226bb99f88e8 Mon Sep 17 00:00:00 2001 From: Max Beizer Date: Tue, 1 Apr 2025 14:34:59 +0000 Subject: [PATCH 415/416] Bump nokogiri to 1.18, require at least Ruby 3.1 --- .github/workflows/ci.yml | 2 +- Gemfile | 1 + Gemfile.lock | 16 +++++++++------- github-markup.gemspec | 4 ++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f313947e..50ccc50b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,10 +14,10 @@ jobs: strategy: matrix: ruby: - - "3.0" - "3.1" - "3.2" - "3.3" + - "3.4" fail-fast: false steps: diff --git a/Gemfile b/Gemfile index e2c29f9c..bcd13f88 100644 --- a/Gemfile +++ b/Gemfile @@ -15,3 +15,4 @@ gem "twitter-text", "~> 1.14" gem "asciidoctor", "~> 2.0.5" gem "rake" gem "rexml" +gem "nokogiri", "~> 1.18.4" diff --git a/Gemfile.lock b/Gemfile.lock index 1ebd7841..7e738e4d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -55,19 +55,21 @@ GEM concurrent-ruby (~> 1.0) logger (1.7.0) mini_mime (1.1.5) + mini_portile2 (2.8.8) minitest (5.25.5) mutex_m (0.3.0) - nokogiri (1.17.2-aarch64-linux) + nokogiri (1.18.7) + mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.17.2-arm-linux) + nokogiri (1.18.7-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.17.2-arm64-darwin) + nokogiri (1.18.7-arm-linux-gnu) racc (~> 1.4) - nokogiri (1.17.2-x86-linux) + nokogiri (1.18.7-arm64-darwin) racc (~> 1.4) - nokogiri (1.17.2-x86_64-darwin) + nokogiri (1.18.7-x86_64-darwin) racc (~> 1.4) - nokogiri (1.17.2-x86_64-linux) + nokogiri (1.18.7-x86_64-linux-gnu) racc (~> 1.4) nokogiri-diff (0.3.0) nokogiri (~> 1.5) @@ -126,7 +128,7 @@ DEPENDENCIES html-pipeline (~> 1.0) kramdown minitest (~> 5.4, >= 5.4.3) - nokogiri (~> 1.17.2) + nokogiri (~> 1.18.4) nokogiri-diff (~> 0.3.0) org-ruby (= 0.9.12) rake diff --git a/github-markup.gemspec b/github-markup.gemspec index ddd4635f..4329a901 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.homepage = "https://github.com/github/markup" s.license = "MIT" - s.required_ruby_version = '>= 3.0.0' + s.required_ruby_version = '>= 3.1.0' s.files = `git ls-files`.split($\) s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) } @@ -25,7 +25,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3' s.add_development_dependency 'html-pipeline', '~> 1.0' s.add_development_dependency 'sanitize', '>= 4.6.3' - s.add_development_dependency 'nokogiri', '~> 1.17.2' + s.add_development_dependency 'nokogiri', '~> 1.18.4' s.add_development_dependency 'nokogiri-diff', '~> 0.3.0' s.add_development_dependency "github-linguist", ">= 7.1.3" end From a732c1a614333efe7b6a367238ec1c278fcb3a30 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Apr 2025 04:55:46 +0000 Subject: [PATCH 416/416] chore(deps): bump nokogiri from 1.18.7 to 1.18.8 in the bundler group Bumps the bundler group with 1 update: [nokogiri](https://github.com/sparklemotion/nokogiri). Updates `nokogiri` from 1.18.7 to 1.18.8 - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.18.7...v1.18.8) --- updated-dependencies: - dependency-name: nokogiri dependency-version: 1.18.8 dependency-type: direct:production dependency-group: bundler ... Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index bcd13f88..60920bee 100644 --- a/Gemfile +++ b/Gemfile @@ -15,4 +15,4 @@ gem "twitter-text", "~> 1.14" gem "asciidoctor", "~> 2.0.5" gem "rake" gem "rexml" -gem "nokogiri", "~> 1.18.4" +gem "nokogiri", "~> 1.18.8" diff --git a/Gemfile.lock b/Gemfile.lock index 7e738e4d..9ee4b029 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -58,18 +58,18 @@ GEM mini_portile2 (2.8.8) minitest (5.25.5) mutex_m (0.3.0) - nokogiri (1.18.7) + nokogiri (1.18.8) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.18.7-aarch64-linux-gnu) + nokogiri (1.18.8-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.18.7-arm-linux-gnu) + nokogiri (1.18.8-arm-linux-gnu) racc (~> 1.4) - nokogiri (1.18.7-arm64-darwin) + nokogiri (1.18.8-arm64-darwin) racc (~> 1.4) - nokogiri (1.18.7-x86_64-darwin) + nokogiri (1.18.8-x86_64-darwin) racc (~> 1.4) - nokogiri (1.18.7-x86_64-linux-gnu) + nokogiri (1.18.8-x86_64-linux-gnu) racc (~> 1.4) nokogiri-diff (0.3.0) nokogiri (~> 1.5) @@ -128,7 +128,7 @@ DEPENDENCIES html-pipeline (~> 1.0) kramdown minitest (~> 5.4, >= 5.4.3) - nokogiri (~> 1.18.4) + nokogiri (~> 1.18.8) nokogiri-diff (~> 0.3.0) org-ruby (= 0.9.12) rake