Hello community, here is the log from the commit of package rubygem-tilt for openSUSE:Factory checked in at 2016-06-19 10:48:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-tilt (Old) and /work/SRC/openSUSE:Factory/.rubygem-tilt.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-tilt" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-tilt/rubygem-tilt.changes 2016-05-29 03:13:12.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-tilt.new/rubygem-tilt.changes 2016-06-19 10:48:21.000000000 +0200 @@ -1,0 +2,11 @@ +Fri Jun 3 04:31:53 UTC 2016 - [email protected] + +- updated to version 2.0.5 + see installed CHANGELOG.md + + ## 2.0.5 (2016-06-02) + + * Add support for reST using Pandoc (#284, mfenner) + * Make lazy loading thread-safe; remove warning (judofyr) + +------------------------------------------------------------------- Old: ---- tilt-2.0.4.gem New: ---- tilt-2.0.5.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-tilt.spec ++++++ --- /var/tmp/diff_new_pack.iwvzLt/_old 2016-06-19 10:48:22.000000000 +0200 +++ /var/tmp/diff_new_pack.iwvzLt/_new 2016-06-19 10:48:22.000000000 +0200 @@ -24,7 +24,7 @@ # Name: rubygem-tilt -Version: 2.0.4 +Version: 2.0.5 Release: 0 %define mod_name tilt %define mod_full_name %{mod_name}-%{version} ++++++ tilt-2.0.4.gem -> tilt-2.0.5.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md --- old/CHANGELOG.md 2016-05-16 10:25:06.000000000 +0200 +++ new/CHANGELOG.md 2016-06-02 21:20:05.000000000 +0200 @@ -1,3 +1,8 @@ +## 2.0.5 (2016-06-02) + +* Add support for reST using Pandoc (#284, mfenner) +* Make lazy loading thread-safe; remove warning (judofyr) + ## 2.0.4 (2016-05-16) * Fix regression in BuilderTemplate (#283, judofyr) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/COPYING new/COPYING --- old/COPYING 2016-05-16 10:25:06.000000000 +0200 +++ new/COPYING 2016-06-02 21:20:05.000000000 +0200 @@ -1,4 +1,4 @@ -Copyright (c) 2010 Ryan Tomayko <http://tomayko.com/about> +Copyright (c) 2010-2016 Ryan Tomayko <http://tomayko.com/about> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2016-05-16 10:25:06.000000000 +0200 +++ new/README.md 2016-06-02 21:20:05.000000000 +0200 @@ -41,6 +41,7 @@ | BlueCloth | .markdown, .mkd, .md | bluecloth | Community | | Kramdown | .markdown, .mkd, .md | kramdown | Community | | Pandoc | .markdown, .mkd, .md | pandoc | Community | +| reStructuredText | .rst | pandoc | Community | | Maruku | .markdown, .mkd, .md | maruku | Community | | CommonMarker | .markdown, .mkd, .md | commonmarker | Community | | RedCloth | .textile | redcloth | Community | Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/docs/TEMPLATES.md new/docs/TEMPLATES.md --- old/docs/TEMPLATES.md 2016-05-16 10:25:06.000000000 +0200 +++ new/docs/TEMPLATES.md 2016-06-02 21:20:05.000000000 +0200 @@ -33,10 +33,11 @@ * CoffeeScript - `Tilt::CoffeeScriptTemplate` * Literate CoffeeScript - `Tilt::CoffeeScriptLiterateTemplate` * [Textile](#redcloth) - `Tilt::RedClothTemplate` + * reStructuredText - `Tilt::RstPandocTemplate` * Creole - `Tilt::CreoleTemplate` * [RDoc](#rdoc) - `Tilt::RDocTemplate` -Tilt has extensive support for Markdown, backed by one of four different +Tilt has extensive support for Markdown, backed by one of seven different implementations (depending on which are available on your system): * [Markdown](#markdown) - Generic Markdown implementation @@ -45,6 +46,7 @@ * BlueCloth - `Tilt::BlueClothTemplate` * Kramdown - `Tilt::KramdownTemplate` * Pandoc - `Tilt::PandocTemplate` + * CommonMarker - `Tilt::CommonMarkerTemplate` * Maruku - `Tilt::MarukuTemplate` <a name='erb'></a> @@ -393,6 +395,31 @@ * [RedCloth][redcloth] +<a name='rst'></a> +reStructuredText (`rst`) +------------------- + +reStructuredText is a lightweight markup language originally developed by David Goodger, +based on StructuredText and Setext. reStructuredText is primarily used for technical +documentation in the Python programming language community, e.g. by the +[Sphinx](http://www.sphinx-doc.org/en/stable/rest.html) Python documentation generator. + +reStructuredText formatted texts are converted to HTML with [Pandoc][pandoc], which +is an application written in Haskell, with a Ruby wrapper provided by the +[pandoc-ruby][pandoc-ruby] gem. + +### Example + + Hello Rst Templates + =================== + + Hello World. This is a paragraph. + +### See Also + + * [Pandoc][pandoc] + * [pandoc-ruby][pandoc-ruby] + <a name='rdoc'></a> RDoc (`rdoc`) @@ -523,3 +550,5 @@ [rdiscount]: http://github.com/rtomayko/rdiscount/ "RDiscount" [smartypants]: http://daringfireball.net/projects/smartypants/ "Smarty Pants" [markdown]: http://en.wikipedia.org/wiki/Markdown "Markdown" +[pandoc]: http://pandoc.org/ "Pandoc" +[pandoc-ruby]: https://github.com/alphabetum/pandoc-ruby "pandoc-ruby" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tilt/mapping.rb new/lib/tilt/mapping.rb --- old/lib/tilt/mapping.rb 2016-05-16 10:25:06.000000000 +0200 +++ new/lib/tilt/mapping.rb 2016-06-02 21:20:05.000000000 +0200 @@ -1,3 +1,5 @@ +require 'monitor' + module Tilt # Tilt::Mapping associates file extensions with template implementations. # @@ -214,9 +216,14 @@ @template_map[ext] || lazy_load(ext) end + LOCK = Monitor.new + def lazy_load(pattern) return unless @lazy_map.has_key?(pattern) + LOCK.enter + entered = true + choices = @lazy_map[pattern] # Check if a template class is already present @@ -234,12 +241,6 @@ choices.each do |class_name, file| begin require file - - if Thread.list.size > 1 - warn "WARN: tilt autoloading '#{file}' in a non thread-safe way; " + - "explicit require '#{file}' suggested." - end - # It's safe to eval() here because constant_defined? will # raise NameError on invalid constant names template_class = eval(class_name) @@ -252,6 +253,8 @@ end raise first_failure if first_failure + ensure + LOCK.exit if entered end # This is due to a bug in JRuby (see GH issue jruby/jruby#3585) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tilt/pandoc.rb new/lib/tilt/pandoc.rb --- old/lib/tilt/pandoc.rb 2016-05-16 10:25:06.000000000 +0200 +++ new/lib/tilt/pandoc.rb 2016-06-02 21:20:05.000000000 +0200 @@ -5,45 +5,41 @@ # Pandoc markdown implementation. See: # http://pandoc.org/ class PandocTemplate < Template - def prepare - @output = PandocRuby.convert(data, options_hash, *options_array).strip - end + self.default_mime_type = 'text/html' def tilt_to_pandoc_mapping - { :smartypants => [:smart, true], - :escape_html => [:f, 'markdown-raw_html'] + { :smartypants => :smart, + :escape_html => { :f => 'markdown-raw_html' }, + :commonmark => { :f => 'commonmark' }, + :markdown_strict => { :f => 'markdown_strict' } } end - def pandoc_optimised_options - options.inject({}) do |hash, option| - if tilt_to_pandoc_mapping.has_key?(option[0]) && option[1] === true - hash[tilt_to_pandoc_mapping[option[0]][0]] = tilt_to_pandoc_mapping[option[0]][1] + # turn options hash into an array + # Map tilt options to pandoc options + # Replace hash keys with value true with symbol for key + # Remove hash keys with value false + # Leave other hash keys untouched + def pandoc_options + options.reduce([]) do |sum, (k,v)| + case v + when true + sum << (tilt_to_pandoc_mapping[k] || k) + when false + sum else - hash[option[0]] = option[1] + sum << { k => v } end - - hash - end.merge({:to => :html}) - end - - def options_array - pandoc_optimised_options.map do |option| - option[0] if option[1] === true - end.compact + end end - def options_hash - pandoc_optimised_options.inject({}) do |hash, option| - # next if option[1] === true - # next if option[1] === false - hash[option[0]] = option[1] unless option[1] === true or option[1] === false - hash - end + def prepare + @engine = PandocRuby.new(data, *pandoc_options) + @output = nil end def evaluate(scope, locals, &block) - @output + @output ||= @engine.to_html.strip end def allows_script? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tilt/rst-pandoc.rb new/lib/tilt/rst-pandoc.rb --- old/lib/tilt/rst-pandoc.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/tilt/rst-pandoc.rb 2016-06-02 21:20:05.000000000 +0200 @@ -0,0 +1,18 @@ +require 'tilt/template' +require 'tilt/pandoc' + +module Tilt + # Pandoc reStructuredText implementation. See: + # http://pandoc.org/ + # Use PandocTemplate and specify input format + class RstPandocTemplate < PandocTemplate + def tilt_to_pandoc_mapping + { :smartypants => :smart } + end + + def pandoc_options + options.merge!(f: 'rst') + super + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tilt.rb new/lib/tilt.rb --- old/lib/tilt.rb 2016-05-16 10:25:06.000000000 +0200 +++ new/lib/tilt.rb 2016-06-02 21:20:05.000000000 +0200 @@ -4,7 +4,7 @@ # Namespace for Tilt. This module is not intended to be included anywhere. module Tilt # Current version. - VERSION = '2.0.4' + VERSION = '2.0.5' @default_mapping = Mapping.new @@ -146,6 +146,7 @@ register_lazy :RDocTemplate, 'tilt/rdoc', 'rdoc' register_lazy :RadiusTemplate, 'tilt/radius', 'radius' register_lazy :RedClothTemplate, 'tilt/redcloth', 'textile' + register_lazy :RstPandocTemplate, 'tilt/rst-pandoc', 'rst' register_lazy :SassTemplate, 'tilt/sass', 'sass' register_lazy :ScssTemplate, 'tilt/sass', 'scss' register_lazy :StringTemplate, 'tilt/string', 'str' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2016-05-16 10:25:06.000000000 +0200 +++ new/metadata 2016-06-02 21:20:05.000000000 +0200 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: tilt version: !ruby/object:Gem::Version - version: 2.0.4 + version: 2.0.5 platform: ruby authors: - Ryan Tomayko autorequire: bindir: bin cert_chain: [] -date: 2016-05-16 00:00:00.000000000 Z +date: 2016-06-02 00:00:00.000000000 Z dependencies: [] description: Generic interface to multiple Ruby template engines email: [email protected] @@ -55,6 +55,7 @@ - lib/tilt/rdoc.rb - lib/tilt/redcarpet.rb - lib/tilt/redcloth.rb +- lib/tilt/rst-pandoc.rb - lib/tilt/sass.rb - lib/tilt/string.rb - lib/tilt/template.rb @@ -103,6 +104,7 @@ - test/tilt_rdoctemplate_test.rb - test/tilt_redcarpettemplate_test.rb - test/tilt_redclothtemplate_test.rb +- test/tilt_rstpandoctemplate_test.rb - test/tilt_sasstemplate_test.rb - test/tilt_stringtemplate_test.rb - test/tilt_template_test.rb @@ -137,7 +139,7 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.2.2 +rubygems_version: 2.5.1 signing_key: specification_version: 2 summary: Generic interface to multiple Ruby template engines @@ -171,6 +173,7 @@ - test/tilt_rdoctemplate_test.rb - test/tilt_redcarpettemplate_test.rb - test/tilt_redclothtemplate_test.rb +- test/tilt_rstpandoctemplate_test.rb - test/tilt_sasstemplate_test.rb - test/tilt_stringtemplate_test.rb - test/tilt_template_test.rb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_mapping_test.rb new/test/tilt_mapping_test.rb --- old/test/tilt_mapping_test.rb 2016-05-16 10:25:06.000000000 +0200 +++ new/test/tilt_mapping_test.rb 2016-06-02 21:20:05.000000000 +0200 @@ -125,20 +125,6 @@ end end end - - test "warns when there's multiple threads" do - Thread.new do - req = proc do |file| - class ::MyTemplate; end - end - - @mapping.stub :require, req do - assert_output '', /autoloading 'my_template'/ do - @mapping['hello.mt'] - end - end - end.join - end end context "lazy with two template classes" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_markdown_test.rb new/test/tilt_markdown_test.rb --- old/test/tilt_markdown_test.rb 2016-05-16 10:25:06.000000000 +0200 +++ new/test/tilt_markdown_test.rb 2016-06-02 21:20:05.000000000 +0200 @@ -180,9 +180,6 @@ class MarkdownPandocTest < Minitest::Test include MarkdownTests template Tilt::PandocTemplate - - # Doesn't support escaping - undef test_escape_html_true end rescue LoadError => boom # It should already be warned in the main tests diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_pandoctemplate_test.rb new/test/tilt_pandoctemplate_test.rb --- old/test/tilt_pandoctemplate_test.rb 2016-05-16 10:25:06.000000000 +0200 +++ new/test/tilt_pandoctemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 @@ -9,12 +9,12 @@ class PandocTemplateTest < Minitest::Test test "preparing and evaluating templates on #render" do template = Tilt::PandocTemplate.new { |t| "# Hello World!" } - assert_equal "<h1 id=\"hello-world\">Hello World!</h1>", template.render.strip + assert_equal "<h1 id=\"hello-world\">Hello World!</h1>", template.render end test "can be rendered more than once" do template = Tilt::PandocTemplate.new { |t| "# Hello World!" } - 3.times { assert_equal "<h1 id=\"hello-world\">Hello World!</h1>", template.render.strip } + 3.times { assert_equal "<h1 id=\"hello-world\">Hello World!</h1>", template.render } end test "smartypants when :smartypants is set" do @@ -29,12 +29,23 @@ # Pandoc has tons of additional markdown features (see http://pandoc.org/README.html#pandocs-markdown). # The test for footnotes should be seen as a general representation for all of them. - test "generates footnotes" do - template = Tilt::PandocTemplate.new { |t| "Here is an inline note.^[Inlines notes are cool!]" } - assert_equal "<p>Here is an inline note.<a href=\"#fn1\" class=\"footnoteRef\" id=\"fnref1\"><sup>1</sup></a></p>\n<div class=\"footnotes\">\n<hr />\n<ol>\n<li id=\"fn1\"><p>Inlines notes are cool!<a href=\"#fnref1\">↩</a></p></li>\n</ol>\n</div>", template.render.strip - end - + # use markdown_strict => true to disable additional markdown features describe "passing in Pandoc options" do + test "generates footnotes" do + template = Tilt::PandocTemplate.new { |t| "Here is an inline note.^[Inlines notes are cool!]" } + assert_equal "<p>Here is an inline note.<a href=\"#fn1\" class=\"footnoteRef\" id=\"fnref1\"><sup>1</sup></a></p>\n<div class=\"footnotes\">\n<hr />\n<ol>\n<li id=\"fn1\"><p>Inlines notes are cool!<a href=\"#fnref1\">↩</a></p></li>\n</ol>\n</div>", template.render + end + + test "doesn't generate footnotes with markdown_strict option" do + template = Tilt::PandocTemplate.new(:markdown_strict => true) { |t| "Here is an inline note.^[Inlines notes are cool!]" } + assert_equal "<p>Here is an inline note.^[Inlines notes are cool!]</p>", template.render + end + + test "doesn't generate footnotes with commonmark option" do + template = Tilt::PandocTemplate.new(:commonmark => true) { |t| "Here is an inline note.^[Inlines notes are cool!]" } + assert_equal "<p>Here is an inline note.^[Inlines notes are cool!]</p>", template.render + end + test "accepts arguments with values (e.g. :id_prefix => 'xyz')" do # Table of contents isn't on by default template = Tilt::PandocTemplate.new { |t| "# This is a heading" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/tilt_rstpandoctemplate_test.rb new/test/tilt_rstpandoctemplate_test.rb --- old/test/tilt_rstpandoctemplate_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/tilt_rstpandoctemplate_test.rb 2016-06-02 21:20:05.000000000 +0200 @@ -0,0 +1,32 @@ +require 'test_helper' +require 'tilt' + +begin + require 'tilt/rst-pandoc' + + class RstPandocTemplateTest < Minitest::Test + test "is registered for '.rst' files" do + assert_equal Tilt::RstPandocTemplate, Tilt['test.rst'] + end + + test "compiles and evaluates the template on #render" do + template = Tilt::RstPandocTemplate.new { |t| "Hello World!\n============" } + assert_equal "<h1 id=\"hello-world\">Hello World!</h1>", template.render + end + + test "can be rendered more than once" do + template = Tilt::RstPandocTemplate.new { |t| "Hello World!\n============" } + 3.times do + assert_equal "<h1 id=\"hello-world\">Hello World!</h1>", template.render + end + end + + test "doens't use markdown options" do + template = Tilt::RstPandocTemplate.new(:escape_html => true) { |t| "HELLO <blink>WORLD</blink>" } + err = assert_raises(RuntimeError) { template.render } + assert_match /pandoc: unrecognized option `--escape-html/, err.message + end + end +rescue LoadError => boom + warn "Tilt::RstPandocTemplate (disabled) [#{boom}]" +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tilt.gemspec new/tilt.gemspec --- old/tilt.gemspec 2016-05-16 10:25:06.000000000 +0200 +++ new/tilt.gemspec 2016-06-02 21:20:05.000000000 +0200 @@ -3,8 +3,8 @@ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.name = 'tilt' - s.version = '2.0.4' - s.date = '2016-05-16' + s.version = '2.0.5' + s.date = '2016-06-02' s.description = "Generic interface to multiple Ruby template engines" s.summary = s.description @@ -53,6 +53,7 @@ lib/tilt/rdoc.rb lib/tilt/redcarpet.rb lib/tilt/redcloth.rb + lib/tilt/rst-pandoc.rb lib/tilt/sass.rb lib/tilt/string.rb lib/tilt/template.rb @@ -101,6 +102,7 @@ test/tilt_rdoctemplate_test.rb test/tilt_redcarpettemplate_test.rb test/tilt_redclothtemplate_test.rb + test/tilt_rstpandoctemplate_test.rb test/tilt_sasstemplate_test.rb test/tilt_stringtemplate_test.rb test/tilt_template_test.rb
