Blahtex
Sync with latest Maruku. Pave the way for Blahtex (PNG-based math) support (from Ari Stern). (no visible functionality, yet, but that will come)
This commit is contained in:
parent
4e3aefd9d3
commit
c427807274
|
@ -303,7 +303,7 @@ class WikiController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def tex
|
def tex
|
||||||
if @web.markup == :markdownMML or @web.markup == :markdown
|
if @web.markup == :markdownMML or @web.markup == :markdownPNG or @web.markup == :markdown
|
||||||
@tex_content = Maruku.new(@page.content).to_latex
|
@tex_content = Maruku.new(@page.content).to_latex
|
||||||
else
|
else
|
||||||
@tex_content = 'TeX export only supported with the Markdown text filters.'
|
@tex_content = 'TeX export only supported with the Markdown text filters.'
|
||||||
|
@ -311,7 +311,7 @@ class WikiController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def s5
|
def s5
|
||||||
if @web.markup == :markdownMML || @web.markup == :markdown
|
if @web.markup == :markdownMML || @web.markup == :markdownPNG || @web.markup == :markdown
|
||||||
my_rendered = PageRenderer.new(@page.revisions.last)
|
my_rendered = PageRenderer.new(@page.revisions.last)
|
||||||
@s5_content = my_rendered.display_s5
|
@s5_content = my_rendered.display_s5
|
||||||
@s5_theme = my_rendered.s5_theme
|
@s5_theme = my_rendered.s5_theme
|
||||||
|
@ -343,7 +343,7 @@ class WikiController < ApplicationController
|
||||||
# end
|
# end
|
||||||
|
|
||||||
def export_page_to_tex(file_path)
|
def export_page_to_tex(file_path)
|
||||||
if @web.markup == :markdownMML
|
if @web.markup == :markdownMML || @web.markup == :markdownPNG
|
||||||
@tex_content = Maruku.new(@page.content).to_latex
|
@tex_content = Maruku.new(@page.content).to_latex
|
||||||
else
|
else
|
||||||
@tex_content = 'TeX export only supported with the Markdown text filters.'
|
@tex_content = 'TeX export only supported with the Markdown text filters.'
|
||||||
|
@ -423,7 +423,7 @@ class WikiController < ApplicationController
|
||||||
|
|
||||||
def render_tex_web
|
def render_tex_web
|
||||||
@web.select.by_name.inject({}) do |tex_web, page|
|
@web.select.by_name.inject({}) do |tex_web, page|
|
||||||
if @web.markup == :markdownMML
|
if @web.markup == :markdownMML || @web.markup == :markdownPNG
|
||||||
tex_web[page.name] = Maruku.new(page.content).to_latex
|
tex_web[page.name] = Maruku.new(page.content).to_latex
|
||||||
else
|
else
|
||||||
tex_web[page.name] = 'TeX export only supported with the Markdown text filters.'
|
tex_web[page.name] = 'TeX export only supported with the Markdown text filters.'
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
<%= link_to('Print',
|
<%= link_to('Print',
|
||||||
{ :web => @web.address, :action => 'print', :id => @page.name },
|
{ :web => @web.address, :action => 'print', :id => @page.name },
|
||||||
{ :accesskey => 'p', :id => 'view_print', :rel => 'nofollow' }) %>
|
{ :accesskey => 'p', :id => 'view_print', :rel => 'nofollow' }) %>
|
||||||
<% if @web.markup == :markdownMML or @web.markup == :markdown %>
|
<% if @web.markup == :markdownMML or @web.markup == :markdown or @web.markup == :markdownPNG %>
|
||||||
|
|
|
|
||||||
<%= link_to 'TeX', {:web => @web.address, :action => 'tex', :id => @page.name},
|
<%= link_to 'TeX', {:web => @web.address, :action => 'tex', :id => @page.name},
|
||||||
{:id => 'view_tex', :rel => 'nofollow' } %>
|
{:id => 'view_tex', :rel => 'nofollow' } %>
|
||||||
|
|
|
@ -75,6 +75,37 @@ module Engines
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class MarkdownPNG < AbstractEngine
|
||||||
|
def mask
|
||||||
|
# If the request is for S5, call Maruku accordingly
|
||||||
|
if @content.options[:mode] == :s5
|
||||||
|
my_content = Maruku.new(@content.delete("\r").to_utf8,
|
||||||
|
{:math_enabled => true,
|
||||||
|
:math_numbered => ['\\[','\\begin{equation}'],
|
||||||
|
:html_math_output_mathml => false,
|
||||||
|
:html_math_output_png => true,
|
||||||
|
:html_png_engine => 'blahtex',
|
||||||
|
:html_png_dir => @content.web.files_path + '/pngs',
|
||||||
|
:html_png_url => '../files/pngs/',
|
||||||
|
:content_only => true,
|
||||||
|
:author => @content.options[:engine_opts][:author],
|
||||||
|
:title => @content.options[:engine_opts][:title]})
|
||||||
|
@content.options[:renderer].s5_theme = my_content.s5_theme
|
||||||
|
my_content.to_s5
|
||||||
|
else
|
||||||
|
html = Maruku.new(@content.delete("\r").to_utf8,
|
||||||
|
{:math_enabled => true,
|
||||||
|
:math_numbered => ['\\[','\\begin{equation}'],
|
||||||
|
:html_math_output_mathml => false,
|
||||||
|
:html_math_output_png => true,
|
||||||
|
:html_png_engine => 'blahtex',
|
||||||
|
:html_png_dir => @content.web.files_path + '/pngs',
|
||||||
|
:html_png_url => '../files/pngs/'}).to_html
|
||||||
|
html.gsub(/\A<div class="maruku_wrapper_div">\n?(.*?)\n?<\/div>\Z/m, '\1')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class Mixed < AbstractEngine
|
class Mixed < AbstractEngine
|
||||||
def mask
|
def mask
|
||||||
redcloth = RedCloth.new(@content, @content.options[:engine_opts])
|
redcloth = RedCloth.new(@content, @content.options[:engine_opts])
|
||||||
|
@ -90,6 +121,6 @@ module Engines
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
MAP = { :textile => Textile, :markdown => Markdown, :markdownMML => MarkdownMML, :mixed => Mixed, :rdoc => RDoc }
|
MAP = { :textile => Textile, :markdown => Markdown, :markdownMML => MarkdownMML, :markdownPNG => MarkdownPNG, :mixed => Mixed, :rdoc => RDoc }
|
||||||
MAP.default = MarkdownMML
|
MAP.default = MarkdownMML
|
||||||
end
|
end
|
||||||
|
|
|
@ -174,7 +174,7 @@ module Sanitizer
|
||||||
style = style.to_s.gsub(/url\s*\(\s*[^\s)]+?\s*\)\s*/, ' ')
|
style = style.to_s.gsub(/url\s*\(\s*[^\s)]+?\s*\)\s*/, ' ')
|
||||||
|
|
||||||
# gauntlet
|
# gauntlet
|
||||||
return '' unless style =~ /^([:,;#%.\sa-zA-Z0-9!]|\w-\w|\'[\s\w]+\'|\"[\s\w]+\"|\([\d,\s]+\))*$/
|
return '' unless style =~ /^([-:,;#%.\sa-zA-Z0-9!]|\w-\w|\'[\s\w]+\'|\"[\s\w]+\"|\([\d,\s]+\))*$/
|
||||||
return '' unless style =~ /^(\s*[-\w]+\s*:\s*[^:;]*(;|$))*$/
|
return '' unless style =~ /^(\s*[-\w]+\s*:\s*[^:;]*(;|$))*$/
|
||||||
|
|
||||||
clean = []
|
clean = []
|
||||||
|
|
|
@ -89,11 +89,12 @@ end
|
||||||
# WikiContent.new
|
# WikiContent.new
|
||||||
class WikiContentStub < String
|
class WikiContentStub < String
|
||||||
|
|
||||||
attr_reader :options
|
attr_reader :web, :options
|
||||||
include ChunkManager
|
include ChunkManager
|
||||||
|
|
||||||
def initialize(content, options)
|
def initialize(content, web, options)
|
||||||
super(content)
|
super(content)
|
||||||
|
@web = web
|
||||||
@options = options
|
@options = options
|
||||||
init_chunk_manager
|
init_chunk_manager
|
||||||
end
|
end
|
||||||
|
@ -164,7 +165,7 @@ class WikiContent < String
|
||||||
# The copy is rendered and used to detect the chunks that are inside protecting context
|
# The copy is rendered and used to detect the chunks that are inside protecting context
|
||||||
# These chunks are reverted on the original content string.
|
# These chunks are reverted on the original content string.
|
||||||
|
|
||||||
copy = WikiContentStub.new(self, @options)
|
copy = WikiContentStub.new(self, @web, @options)
|
||||||
@options[:engine].apply_to(copy)
|
@options[:engine].apply_to(copy)
|
||||||
|
|
||||||
copy.inside_chunks(HIDE_CHUNKS) do |id|
|
copy.inside_chunks(HIDE_CHUNKS) do |id|
|
||||||
|
|
|
@ -167,7 +167,7 @@ module HTML5
|
||||||
style = style.to_s.gsub(/url\s*\(\s*[^\s)]+?\s*\)\s*/, ' ')
|
style = style.to_s.gsub(/url\s*\(\s*[^\s)]+?\s*\)\s*/, ' ')
|
||||||
|
|
||||||
# gauntlet
|
# gauntlet
|
||||||
return '' unless style =~ /^([:,;#%.\sa-zA-Z0-9!]|\w-\w|\'[\s\w]+\'|\"[\s\w]+\"|\([\d,\s]+\))*$/
|
return '' unless style =~ /^([-:,;#%.\sa-zA-Z0-9!]|\w-\w|\'[\s\w]+\'|\"[\s\w]+\"|\([\d,\s]+\))*$/
|
||||||
return '' unless style =~ /^(\s*[-\w]+\s*:\s*[^:;]*(;|$))*$/
|
return '' unless style =~ /^(\s*[-\w]+\s*:\s*[^:;]*(;|$))*$/
|
||||||
|
|
||||||
clean = []
|
clean = []
|
||||||
|
|
36
vendor/plugins/maruku/bin/maruku
vendored
36
vendor/plugins/maruku/bin/maruku
vendored
|
@ -3,6 +3,11 @@
|
||||||
require 'maruku'
|
require 'maruku'
|
||||||
require 'optparse'
|
require 'optparse'
|
||||||
|
|
||||||
|
def cli_puts(s)
|
||||||
|
$stderr.puts(s) if MaRuKu::Globals[:verbose]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
export = :html
|
export = :html
|
||||||
break_on_error = false
|
break_on_error = false
|
||||||
using_math = false
|
using_math = false
|
||||||
|
@ -26,7 +31,7 @@ opt = OptionParser.new do |opts|
|
||||||
MaRuKu::Globals[:html_math_output_png] = true
|
MaRuKu::Globals[:html_math_output_png] = true
|
||||||
MaRuKu::Globals[:html_math_output_mathml] = false
|
MaRuKu::Globals[:html_math_output_mathml] = false
|
||||||
MaRuKu::Globals[:html_png_engine] = s
|
MaRuKu::Globals[:html_png_engine] = s
|
||||||
$stderr.puts "Using png engine #{s}."
|
cli_puts "Using png engine #{s}."
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on("-m", "--math-engine ENGINE", "Uses ENGINE to render MathML") do |s|
|
opts.on("-m", "--math-engine ENGINE", "Uses ENGINE to render MathML") do |s|
|
||||||
|
@ -49,8 +54,7 @@ opt = OptionParser.new do |opts|
|
||||||
opts.on_tail("--inspect", "Shows the parsing result" ) do export = :inspect end
|
opts.on_tail("--inspect", "Shows the parsing result" ) do export = :inspect end
|
||||||
|
|
||||||
opts.on_tail("--version", "Show version") do
|
opts.on_tail("--version", "Show version") do
|
||||||
puts OptionParser::Version.join('.')
|
puts "Maruku #{MaRuKu::Version}"; exit
|
||||||
exit
|
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on_tail("-h", "--help", "Show this message") do
|
opts.on_tail("-h", "--help", "Show this message") do
|
||||||
|
@ -68,27 +72,29 @@ rescue OptionParser::InvalidOption=>e
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if using_math
|
if using_math
|
||||||
$stderr.puts "Using Math extensions."
|
cli_puts "Using Math extensions."
|
||||||
require 'maruku/ext/math'
|
require 'maruku/ext/math'
|
||||||
end
|
end
|
||||||
|
|
||||||
#p ARGV
|
#p ARGV
|
||||||
#p MaRuKu::Globals
|
#p MaRuKu::Globals
|
||||||
|
|
||||||
|
|
||||||
inputs =
|
inputs =
|
||||||
# If we are given filenames, convert each file
|
# If we are given filenames, convert each file
|
||||||
if not ARGV.empty?
|
if not ARGV.empty?
|
||||||
ARGV.map do |f|
|
ARGV.map do |f|
|
||||||
# read file content
|
# read file content
|
||||||
$stderr.puts "Reading from #{f}."
|
cli_puts "Reading from file #{f.inspect}."
|
||||||
[f, File.open(f,'r').read]
|
[f, File.open(f,'r').read]
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
export = :html_frag if export == :html
|
export = :html_frag if export == :html
|
||||||
export = :tex_frag if export == :tex
|
export = :tex_frag if export == :tex
|
||||||
|
|
||||||
$stderr.puts "Reading from standard input."
|
cli_puts "Reading from standard input."
|
||||||
[[nil, $stdin.read]]
|
[[nil, $stdin.read]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -100,7 +106,8 @@ inputs.each do |f, input|
|
||||||
|
|
||||||
t = Time.now
|
t = Time.now
|
||||||
doc = Maruku.new(input, params)
|
doc = Maruku.new(input, params)
|
||||||
$stderr.puts "Parsing in %.2f seconds." % (Time.now-t)
|
|
||||||
|
cli_puts ("Parsing in %.2f seconds." % (Time.now-t))
|
||||||
|
|
||||||
out=""; suffix = "?"
|
out=""; suffix = "?"
|
||||||
t = Time.now
|
t = Time.now
|
||||||
|
@ -124,10 +131,11 @@ inputs.each do |f, input|
|
||||||
suffix='.pretty_md'
|
suffix='.pretty_md'
|
||||||
out = doc.to_markdown
|
out = doc.to_markdown
|
||||||
when :s5
|
when :s5
|
||||||
suffix='_s5slides.xhtml'
|
suffix='_s5slides.html'
|
||||||
out = doc.to_s5({:content_only => false})
|
out = doc.to_s5({:content_only => false})
|
||||||
end
|
end
|
||||||
$stderr.puts "Rendering in %.2f seconds." % (Time.now-t)
|
|
||||||
|
cli_puts("Rendering in %.2f seconds." % (Time.now-t))
|
||||||
|
|
||||||
# write to file or stdout
|
# write to file or stdout
|
||||||
if f
|
if f
|
||||||
|
@ -141,19 +149,19 @@ inputs.each do |f, input|
|
||||||
end
|
end
|
||||||
|
|
||||||
if output_file == "-"
|
if output_file == "-"
|
||||||
$stderr.puts "Writing to standard output"
|
cli_puts "Writing to standard output"
|
||||||
$stdout.puts out
|
$stdout.puts out
|
||||||
else
|
else
|
||||||
|
|
||||||
if not (export == :pdf)
|
if not (export == :pdf)
|
||||||
$stderr.puts "Writing to #{output_file}"
|
cli_puts "Writing to #{output_file}"
|
||||||
File.open(output_file,'w') do |f| f.puts out end
|
File.open(output_file,'w') do |f| f.puts out end
|
||||||
else
|
else
|
||||||
$stderr.puts "Writing to #{job}.tex"
|
cli_puts "Writing to #{job}.tex"
|
||||||
File.open("#{job}.tex",'w') do |f| f.puts out end
|
File.open("#{job}.tex",'w') do |f| f.puts out end
|
||||||
cmd = "pdflatex '#{job}.tex' -interaction=nonstopmode "+
|
cmd = "pdflatex '#{job}.tex' -interaction=nonstopmode "+
|
||||||
"'-output-directory=#{dir}' "
|
"'-output-directory=#{dir}' "
|
||||||
$stderr.puts "maruku: executing $ #{cmd}"
|
cli_puts "maruku: executing $ #{cmd}"
|
||||||
# run twice for cross references
|
# run twice for cross references
|
||||||
system cmd
|
system cmd
|
||||||
system cmd
|
system cmd
|
||||||
|
@ -161,7 +169,7 @@ inputs.each do |f, input|
|
||||||
|
|
||||||
end
|
end
|
||||||
else # write to stdout
|
else # write to stdout
|
||||||
$stderr.puts "Writing to standard output"
|
cli_puts "Writing to standard output"
|
||||||
$stdout.puts out
|
$stdout.puts out
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
1
vendor/plugins/maruku/lib/maruku/defaults.rb
vendored
1
vendor/plugins/maruku/lib/maruku/defaults.rb
vendored
|
@ -47,6 +47,7 @@ Globals = {
|
||||||
|
|
||||||
:latex_use_listings => false,
|
:latex_use_listings => false,
|
||||||
:latex_cjk => false,
|
:latex_cjk => false,
|
||||||
|
:latex_cache_file => "blahtex_cache.pstore", # cache file for blahtex filter
|
||||||
|
|
||||||
:debug_keep_ials => false,
|
:debug_keep_ials => false,
|
||||||
:doc_prefix => ''
|
:doc_prefix => ''
|
||||||
|
|
|
@ -24,27 +24,25 @@ module MaRuKu; module Out; module HTML
|
||||||
|
|
||||||
resolution = get_setting(:html_png_resolution)
|
resolution = get_setting(:html_png_resolution)
|
||||||
|
|
||||||
options = "--png --use-preview-package --shell-dvipng 'dvipng -D #{resolution}' "
|
options = "--png --use-preview-package --shell-dvipng '/usr/bin/dvipng -D #{resolution}' "
|
||||||
|
options += ("--temp-directory '%s' " % MaRuKu::Globals[:html_png_dir])
|
||||||
options += ("--png-directory '%s'" % MaRuKu::Globals[:html_png_dir])
|
options += ("--png-directory '%s'" % MaRuKu::Globals[:html_png_dir])
|
||||||
|
|
||||||
cmd = "blahtex #{options} < #{tmp_in.path} > #{result_file}"
|
cmd = "blahtex #{options} < #{tmp_in.path} > #{result_file}"
|
||||||
$stderr.puts "$ #{cmd}"
|
#$stderr.puts "$ #{cmd}"
|
||||||
system cmd
|
system cmd
|
||||||
tmp_in.delete
|
tmp_in.delete
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
result = nil
|
result = File.read(result_file)
|
||||||
f = File.open(result_file)
|
if result.nil? || result.empty?
|
||||||
result = f.read
|
raise "Blahtex error: empty output"
|
||||||
f.close
|
end
|
||||||
|
|
||||||
|
|
||||||
doc = Document.new(result, {:respect_whitespace =>:all})
|
doc = Document.new(result, {:respect_whitespace =>:all})
|
||||||
png = doc.root.elements[1]
|
png = doc.root.elements[1]
|
||||||
if png.name != 'png'
|
if png.name != 'png'
|
||||||
maruku_error "Blahtex error: \n#{doc}"
|
raise "Blahtex error: \n#{doc}"
|
||||||
return nil
|
|
||||||
end
|
end
|
||||||
depth = png.elements['depth'] || (raise "No depth element in:\n #{doc}")
|
depth = png.elements['depth'] || (raise "No depth element in:\n #{doc}")
|
||||||
height = png.elements['height'] || (raise "No height element in:\n #{doc}")
|
height = png.elements['height'] || (raise "No height element in:\n #{doc}")
|
||||||
|
@ -56,19 +54,19 @@ module MaRuKu; module Out; module HTML
|
||||||
|
|
||||||
dir_url = MaRuKu::Globals[:html_png_url]
|
dir_url = MaRuKu::Globals[:html_png_url]
|
||||||
return PNG.new("#{dir_url}#{md5}.png", depth, height)
|
return PNG.new("#{dir_url}#{md5}.png", depth, height)
|
||||||
|
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
maruku_error "Error: #{e}"
|
maruku_error "Error: #{e}"
|
||||||
end
|
end
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
BlahtexCache = PStore.new("blahtex_cache.pstore")
|
|
||||||
|
|
||||||
def convert_to_mathml_blahtex(kind, tex)
|
def convert_to_mathml_blahtex(kind, tex)
|
||||||
|
@@BlahtexCache = PStore.new(MaRuKu::Globals[:latex_cache_file])
|
||||||
|
|
||||||
begin
|
begin
|
||||||
BlahtexCache.transaction do
|
@@BlahtexCache.transaction do
|
||||||
if BlahtexCache[tex].nil?
|
if @@BlahtexCache[tex].nil?
|
||||||
tmp_in = Tempfile.new('maruku_blahtex')
|
tmp_in = Tempfile.new('maruku_blahtex')
|
||||||
f = tmp_in.open
|
f = tmp_in.open
|
||||||
f.write tex
|
f.write tex
|
||||||
|
@ -77,7 +75,7 @@ module MaRuKu; module Out; module HTML
|
||||||
|
|
||||||
options = "--mathml"
|
options = "--mathml"
|
||||||
cmd = "blahtex #{options} < #{tmp_in.path} > #{tmp_out.path}"
|
cmd = "blahtex #{options} < #{tmp_in.path} > #{tmp_out.path}"
|
||||||
$stderr.puts "$ #{cmd}"
|
#$stderr.puts "$ #{cmd}"
|
||||||
system cmd
|
system cmd
|
||||||
tmp_in.delete
|
tmp_in.delete
|
||||||
|
|
||||||
|
@ -85,10 +83,10 @@ module MaRuKu; module Out; module HTML
|
||||||
File.open(tmp_out.path) do |f| result=f.read end
|
File.open(tmp_out.path) do |f| result=f.read end
|
||||||
puts result
|
puts result
|
||||||
|
|
||||||
BlahtexCache[tex] = result
|
@@BlahtexCache[tex] = result
|
||||||
end
|
end
|
||||||
|
|
||||||
blahtex = BlahtexCache[tex]
|
blahtex = @@BlahtexCache[tex]
|
||||||
doc = Document.new(blahtex, {:respect_whitespace =>:all})
|
doc = Document.new(blahtex, {:respect_whitespace =>:all})
|
||||||
mathml = doc.root.elements['mathml']
|
mathml = doc.root.elements['mathml']
|
||||||
if not mathml
|
if not mathml
|
||||||
|
|
|
@ -337,7 +337,7 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
|
||||||
|
|
||||||
# puts "id =_#{id}_; text=_#{text}_ indent=#{indentation}"
|
# puts "id =_#{id}_; text=_#{text}_ indent=#{indentation}"
|
||||||
|
|
||||||
break_list = [:footnote_text]
|
break_list = [:footnote_text, :ref_definition, :definition, :abbreviation]
|
||||||
item_type = :footnote_text
|
item_type = :footnote_text
|
||||||
lines, want_my_paragraph =
|
lines, want_my_paragraph =
|
||||||
read_indented_content(src,indentation, break_list, item_type)
|
read_indented_content(src,indentation, break_list, item_type)
|
||||||
|
@ -471,8 +471,9 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
|
||||||
def read_ref_definition(src, out)
|
def read_ref_definition(src, out)
|
||||||
line = src.shift_line
|
line = src.shift_line
|
||||||
|
|
||||||
|
|
||||||
# if link is incomplete, shift next line
|
# if link is incomplete, shift next line
|
||||||
if src.cur_line && (src.cur_line.md_type != :ref_definition) &&
|
if src.cur_line && !([:footnote_text, :ref_definition, :definition, :abbreviation].include? src.cur_line.md_type) &&
|
||||||
([1,2,3].include? number_of_leading_spaces(src.cur_line) )
|
([1,2,3].include? number_of_leading_spaces(src.cur_line) )
|
||||||
line += " "+ src.shift_line
|
line += " "+ src.shift_line
|
||||||
end
|
end
|
||||||
|
|
|
@ -94,6 +94,7 @@ module MaRuKu; module Strings
|
||||||
# *[HTML]: Hyper Text Markup Language
|
# *[HTML]: Hyper Text Markup Language
|
||||||
Abbreviation = %r{
|
Abbreviation = %r{
|
||||||
^ # begin of line
|
^ # begin of line
|
||||||
|
[ ]{0,3} # up to 3 spaces
|
||||||
\* # one asterisk
|
\* # one asterisk
|
||||||
\[ # opening bracket
|
\[ # opening bracket
|
||||||
([^\]]+) # any non-closing bracket: id = $1
|
([^\]]+) # any non-closing bracket: id = $1
|
||||||
|
@ -106,7 +107,9 @@ module MaRuKu; module Strings
|
||||||
}x
|
}x
|
||||||
|
|
||||||
FootnoteText = %r{
|
FootnoteText = %r{
|
||||||
^\s*\[(\^.+)\]: # id = $1 (including '^')
|
^ # begin of line
|
||||||
|
[ ]{0,3} # up to 3 spaces
|
||||||
|
\[(\^.+)\]: # id = $1 (including '^')
|
||||||
\s*(\S.*)?$ # text = $2 (not obb.)
|
\s*(\S.*)?$ # text = $2 (not obb.)
|
||||||
}x
|
}x
|
||||||
|
|
||||||
|
@ -115,7 +118,7 @@ module MaRuKu; module Strings
|
||||||
LinkRegex = %r{
|
LinkRegex = %r{
|
||||||
^[ ]{0,3}\[([^\[\]]+)\]: # id = $1
|
^[ ]{0,3}\[([^\[\]]+)\]: # id = $1
|
||||||
[ ]*
|
[ ]*
|
||||||
<?(\S+)>? # url = $2
|
<?([^>\s]+)>? # url = $2
|
||||||
[ ]*
|
[ ]*
|
||||||
(?:# Titles are delimited by "quotes" or (parens).
|
(?:# Titles are delimited by "quotes" or (parens).
|
||||||
["(']
|
["(']
|
||||||
|
|
|
@ -188,6 +188,7 @@ Example:
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
|
METAS = %w{description keywords author revised}
|
||||||
|
|
||||||
# Render to a complete HTML document (returns a REXML document tree)
|
# Render to a complete HTML document (returns a REXML document tree)
|
||||||
def to_html_document_tree
|
def to_html_document_tree
|
||||||
|
@ -209,6 +210,24 @@ Example:
|
||||||
# me.attributes['content'] = 'text/html;charset=utf-8'
|
# me.attributes['content'] = 'text/html;charset=utf-8'
|
||||||
me.attributes['content'] = 'application/xhtml+xml;charset=utf-8'
|
me.attributes['content'] = 'application/xhtml+xml;charset=utf-8'
|
||||||
|
|
||||||
|
METAS.each do |m|
|
||||||
|
if value = self.attributes[m.to_sym]
|
||||||
|
meta = Element.new 'meta', head
|
||||||
|
meta.attributes['name'] = m
|
||||||
|
meta.attributes['content'] = value.to_s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
self.attributes.each do |k,v|
|
||||||
|
if k.to_s =~ /\Ameta-(.*)\Z/
|
||||||
|
meta = Element.new 'meta', head
|
||||||
|
meta.attributes['name'] = $1
|
||||||
|
meta.attributes['content'] = v.to_s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Create title element
|
# Create title element
|
||||||
doc_title = self.attributes[:title] || self.attributes[:subject] || ""
|
doc_title = self.attributes[:title] || self.attributes[:subject] || ""
|
||||||
|
@ -312,7 +331,8 @@ Example:
|
||||||
li.insert_after(li.children.last, a)
|
li.insert_after(li.children.last, a)
|
||||||
ol << li
|
ol << li
|
||||||
else
|
else
|
||||||
maruku_error"Could not find footnote '#{fid}'"
|
maruku_error "Could not find footnote id '#{fid}' among ["+
|
||||||
|
self.footnotes.keys.map{|s|"'"+s+"'"}.join(', ')+"]."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
div << ol
|
div << ol
|
||||||
|
@ -827,9 +847,20 @@ If true, raw HTML is discarded from the output.
|
||||||
# save the order of used footnotes
|
# save the order of used footnotes
|
||||||
order = @doc.footnotes_order
|
order = @doc.footnotes_order
|
||||||
|
|
||||||
|
if order.include? id
|
||||||
|
# footnote has already been used
|
||||||
|
return []
|
||||||
|
end
|
||||||
|
|
||||||
|
if not @doc.footnotes[id]
|
||||||
|
return []
|
||||||
|
end
|
||||||
|
|
||||||
# take next number
|
# take next number
|
||||||
order << id
|
order << id
|
||||||
num = order.size;
|
|
||||||
|
#num = order.size;
|
||||||
|
num = order.index(id) + 1
|
||||||
|
|
||||||
sup = Element.new 'sup'
|
sup = Element.new 'sup'
|
||||||
sup.attributes['id'] = "#{get_setting(:doc_prefix)}fnref:#{num}"
|
sup.attributes['id'] = "#{get_setting(:doc_prefix)}fnref:#{num}"
|
||||||
|
|
|
@ -46,7 +46,7 @@ module MaRuKu; module Strings
|
||||||
#
|
#
|
||||||
def parse_email_headers(s)
|
def parse_email_headers(s)
|
||||||
keys={}
|
keys={}
|
||||||
match = (s =~ /((\w[\w\s]+: .*\n)+)\n/)
|
match = (s =~ /\A((\w[\w\s\_\-]+: .*\n)+)\s*\n/)
|
||||||
if match != 0
|
if match != 0
|
||||||
keys[:data] = s
|
keys[:data] = s
|
||||||
else
|
else
|
||||||
|
|
2
vendor/plugins/maruku/lib/maruku/version.rb
vendored
2
vendor/plugins/maruku/lib/maruku/version.rb
vendored
|
@ -19,7 +19,7 @@
|
||||||
#++
|
#++
|
||||||
|
|
||||||
module MaRuKu
|
module MaRuKu
|
||||||
Version = '0.5.8'
|
Version = '0.5.9'
|
||||||
|
|
||||||
MarukuURL = 'http://maruku.rubyforge.org/'
|
MarukuURL = 'http://maruku.rubyforge.org/'
|
||||||
|
|
||||||
|
|
55
vendor/plugins/maruku/tests/unittest/divs/div1.html
vendored
Normal file
55
vendor/plugins/maruku/tests/unittest/divs/div1.html
vendored
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC
|
||||||
|
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
|
||||||
|
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
|
||||||
|
<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
||||||
|
<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title></title></head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<p>text</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p>text</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p>text</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p>text</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p>text</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p>text</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p>text</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p>text</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p>text</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p>text</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p>text</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p>text</p>
|
||||||
|
</div>
|
||||||
|
</body></html>
|
|
@ -201,4 +201,53 @@ texttexttexttexttexttexttexttexttexttexttexttext
|
||||||
<p>=--</p>
|
<p>=--</p>
|
||||||
|
|
||||||
*** Output of Markdown.pl (parsed) ***
|
*** Output of Markdown.pl (parsed) ***
|
||||||
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element>
|
<div>
|
||||||
|
<p>
|
||||||
|
+--------- | text +----------
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
+--------- |text
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
+-- text
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
=--
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
+--------- | text +----------
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
+--------- |text
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
+-- text
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
=--
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
+--------- | text +----------
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
+--------- |text
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
+-- text
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
=--
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
+--------- | text +----------
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
+--------- |text
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
+-- text
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
=--
|
||||||
|
</p>
|
||||||
|
</div>
|
11
vendor/plugins/maruku/tests/unittest/divs/div2.html
vendored
Normal file
11
vendor/plugins/maruku/tests/unittest/divs/div2.html
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC
|
||||||
|
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
|
||||||
|
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
|
||||||
|
<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
||||||
|
<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title></title></head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<p>ciao</p>
|
||||||
|
</div>
|
||||||
|
</body></html>
|
|
@ -31,4 +31,8 @@ ciao
|
||||||
=--</p>
|
=--</p>
|
||||||
|
|
||||||
*** Output of Markdown.pl (parsed) ***
|
*** Output of Markdown.pl (parsed) ***
|
||||||
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element>
|
<div>
|
||||||
|
<p>
|
||||||
|
+-- ciao =--
|
||||||
|
</p>
|
||||||
|
</div>
|
17
vendor/plugins/maruku/tests/unittest/divs/div3_nest.html
vendored
Normal file
17
vendor/plugins/maruku/tests/unittest/divs/div3_nest.html
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC
|
||||||
|
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
|
||||||
|
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
|
||||||
|
<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
||||||
|
<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title></title></head>
|
||||||
|
<body>
|
||||||
|
<div class='warning'>
|
||||||
|
<p>this is the last warning!</p>
|
||||||
|
|
||||||
|
<p>please, go away!</p>
|
||||||
|
|
||||||
|
<div class='menace'>
|
||||||
|
<p>or else terrible things will happen</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body></html>
|
|
@ -59,4 +59,12 @@ this is the last warning!please, go away!or else terrible things will happen
|
||||||
+---------------------------------------------------</p>
|
+---------------------------------------------------</p>
|
||||||
|
|
||||||
*** Output of Markdown.pl (parsed) ***
|
*** Output of Markdown.pl (parsed) ***
|
||||||
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element>
|
<div>
|
||||||
|
<p>
|
||||||
|
+-----------------------------------{.warning}------ | this is the last
|
||||||
|
warning! | | please, go away! | | +-------------------------------------
|
||||||
|
{.menace} -- | | or else terrible things will happen |
|
||||||
|
+--------------------------------------------------
|
||||||
|
+---------------------------------------------------
|
||||||
|
</p>
|
||||||
|
</div>
|
|
@ -27,7 +27,7 @@ This is an email address:
|
||||||
|
|
||||||
|
|
||||||
*** Output of Markdown.pl ***
|
*** Output of Markdown.pl ***
|
||||||
<p>This is an email address: <a href="mailto:andrea@invalid.it">andrea@invalid.it</a></p>
|
<p>This is an email address: <a href="mailto:andrea@invalid.it">andrea@invalid.it</a></p>
|
||||||
|
|
||||||
*** Output of Markdown.pl (parsed) ***
|
*** Output of Markdown.pl (parsed) ***
|
||||||
Error: #<TypeError: no implicit conversion from nil to integer>
|
Error: #<TypeError: no implicit conversion from nil to integer>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
||||||
<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title></title></head>
|
<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title></title></head>
|
||||||
<body>
|
<body>
|
||||||
<p>That’s some text with a footnote <sup id='fnref:4'><a href='#fn:4' rel='footnote'>4</a></sup> and another <sup id='fnref:5'><a href='#fn:5' rel='footnote'>5</a></sup> and another <sup id='fnref:6'><a href='#fn:6' rel='footnote'>6</a></sup>.</p>
|
<p>That’s some text with a footnote and another and another .</p>
|
||||||
|
|
||||||
<p>This is not a footnote.</p>
|
<p>This is not a footnote.</p>
|
||||||
<div class='footnotes'><hr /><ol><li id='fn:1'>
|
<div class='footnotes'><hr /><ol><li id='fn:1'>
|
||||||
|
@ -18,14 +18,4 @@
|
||||||
<p>And that’s the footnote.</p>
|
<p>And that’s the footnote.</p>
|
||||||
|
|
||||||
<p>That’s the second paragraph of the footnote.</p>
|
<p>That’s the second paragraph of the footnote.</p>
|
||||||
<a href='#fnref:3' rev='footnote'>↩</a></li><li id='fn:4'>
|
<a href='#fnref:3' rev='footnote'>↩</a></li></ol></div></body></html>
|
||||||
<p>And that’s the footnote. This is second sentence (same paragraph).</p>
|
|
||||||
<a href='#fnref:4' rev='footnote'>↩</a></li><li id='fn:5'>
|
|
||||||
<p>This is the very long one.</p>
|
|
||||||
|
|
||||||
<p>That’s the second paragraph.</p>
|
|
||||||
<a href='#fnref:5' rev='footnote'>↩</a></li><li id='fn:6'>
|
|
||||||
<p>And that’s the footnote.</p>
|
|
||||||
|
|
||||||
<p>That’s the second paragraph of the footnote.</p>
|
|
||||||
<a href='#fnref:6' rev='footnote'>↩</a></li></ol></div></body></html>
|
|
|
@ -238,9 +238,9 @@ Line:
|
||||||
Position:
|
Position:
|
||||||
Last 80 unconsumed characters:
|
Last 80 unconsumed characters:
|
||||||
<div markdown="1"> This is *true* markdown text (paragraph) <p markdow>
|
<div markdown="1"> This is *true* markdown text (paragraph) <p markdow>
|
||||||
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/baseparser.rb:320:in `pull'
|
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/baseparser.rb:330:in `pull'
|
||||||
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/treeparser.rb:21:in `parse'
|
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/treeparser.rb:22:in `parse'
|
||||||
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:204:in `build'
|
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:205:in `build'
|
||||||
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:42:in `initialize'
|
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:42:in `initialize'
|
||||||
bin/marutest:200:in `new'
|
bin/marutest:200:in `new'
|
||||||
bin/marutest:200:in `run_test'
|
bin/marutest:200:in `run_test'
|
||||||
|
|
|
@ -162,7 +162,7 @@ Search on GoogleSearch on GoogleSearch on GoogleSearch on GoogleSearch on Google
|
||||||
|
|
||||||
<p>Inline with title: <a href="http://google.com "Title"">Google images</a></p>
|
<p>Inline with title: <a href="http://google.com "Title"">Google images</a></p>
|
||||||
|
|
||||||
<p>Search on <a href="http://www.gogole.com">http://www.gogole.com</a> or <a href="http://Here.com">http://Here.com</a> or ask <a href="mailto:bill@google.com">bill@google.com</a>
|
<p>Search on <a href="http://www.gogole.com">http://www.gogole.com</a> or <a href="http://Here.com">http://Here.com</a> or ask <a href="mailto:bill@google.com">bill@google.com</a>
|
||||||
or you might ask bill@google.com.</p>
|
or you might ask bill@google.com.</p>
|
||||||
|
|
||||||
<p>If all else fails, ask <a href="http://www.google.com">Google</a></p>
|
<p>If all else fails, ask <a href="http://www.google.com">Google</a></p>
|
||||||
|
@ -175,9 +175,9 @@ Line:
|
||||||
Position:
|
Position:
|
||||||
Last 80 unconsumed characters:
|
Last 80 unconsumed characters:
|
||||||
>
|
>
|
||||||
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/baseparser.rb:320:in `pull'
|
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/baseparser.rb:330:in `pull'
|
||||||
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/treeparser.rb:21:in `parse'
|
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/treeparser.rb:22:in `parse'
|
||||||
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:204:in `build'
|
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:205:in `build'
|
||||||
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:42:in `initialize'
|
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:42:in `initialize'
|
||||||
bin/marutest:200:in `new'
|
bin/marutest:200:in `new'
|
||||||
bin/marutest:200:in `run_test'
|
bin/marutest:200:in `run_test'
|
||||||
|
|
9
vendor/plugins/maruku/tests/unittest/pending/amps.html
vendored
Normal file
9
vendor/plugins/maruku/tests/unittest/pending/amps.html
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC
|
||||||
|
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
|
||||||
|
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
|
||||||
|
<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
||||||
|
<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title></title></head>
|
||||||
|
<body>
|
||||||
|
<pre><code>@articles.map(&:title)</code></pre>
|
||||||
|
</body></html>
|
35
vendor/plugins/maruku/tests/unittest/pending/amps.md
vendored
Normal file
35
vendor/plugins/maruku/tests/unittest/pending/amps.md
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
Write a comment here
|
||||||
|
*** Parameters: ***
|
||||||
|
{} # params
|
||||||
|
*** Markdown input: ***
|
||||||
|
@articles.map(&:title)
|
||||||
|
*** Output of inspect ***
|
||||||
|
md_el(:document,[md_el(:code,[],{:raw_code=>"@articles.map(&:title)"},[])],{},[])
|
||||||
|
*** Output of to_html ***
|
||||||
|
<pre><code>@articles.map(&:title)</code></pre>
|
||||||
|
*** Output of to_latex ***
|
||||||
|
\begin{verbatim}@articles.map(&:title)\end{verbatim}
|
||||||
|
*** Output of to_md ***
|
||||||
|
|
||||||
|
*** Output of to_s ***
|
||||||
|
|
||||||
|
*** EOF ***
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
OK!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** Output of Markdown.pl ***
|
||||||
|
<pre><code>@articles.map(&:title)
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
*** Output of Markdown.pl (parsed) ***
|
||||||
|
<div>
|
||||||
|
<pre>
|
||||||
|
<code>
|
||||||
|
@articles.map(&:title)
|
||||||
|
</code>
|
||||||
|
</pre>
|
||||||
|
</div>
|
9
vendor/plugins/maruku/tests/unittest/pending/empty_cells.html
vendored
Normal file
9
vendor/plugins/maruku/tests/unittest/pending/empty_cells.html
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC
|
||||||
|
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
|
||||||
|
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
|
||||||
|
<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
||||||
|
<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title></title></head>
|
||||||
|
<body><table><thead><tr><th /><th>1</th><th>2</th></tr></thead><tbody><tr><td style='text-align: left;'>A</td><td style='text-align: left;'>X</td><td style='text-align: left;' />
|
||||||
|
</tr><tr><td style='text-align: left;'>B</td><td style='text-align: left;' /><td style='text-align: left;'>X</td>
|
||||||
|
</tr></tbody></table></body></html>
|
57
vendor/plugins/maruku/tests/unittest/pending/empty_cells.md
vendored
Normal file
57
vendor/plugins/maruku/tests/unittest/pending/empty_cells.md
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
Write a comment here
|
||||||
|
*** Parameters: ***
|
||||||
|
{} # params
|
||||||
|
*** Markdown input: ***
|
||||||
|
| | 1 | 2 |
|
||||||
|
|----|----|----|
|
||||||
|
| A | X | |
|
||||||
|
| B | | X |
|
||||||
|
*** Output of inspect ***
|
||||||
|
md_el(:document,[
|
||||||
|
md_el(:table,[
|
||||||
|
md_el(:head_cell,[],{},[]),
|
||||||
|
md_el(:head_cell,["1"],{},[]),
|
||||||
|
md_el(:head_cell,["2"],{},[]),
|
||||||
|
md_el(:cell,["A"],{},[]),
|
||||||
|
md_el(:cell,["X"],{},[]),
|
||||||
|
md_el(:cell,[],{},[]),
|
||||||
|
md_el(:cell,["B"],{},[]),
|
||||||
|
md_el(:cell,[],{},[]),
|
||||||
|
md_el(:cell,["X"],{},[])
|
||||||
|
],{:align=>[:left, :left, :left]},[])
|
||||||
|
],{},[])
|
||||||
|
*** Output of to_html ***
|
||||||
|
<table><thead><tr><th /><th>1</th><th>2</th></tr></thead><tbody><tr><td style='text-align: left;'>A</td><td style='text-align: left;'>X</td><td style='text-align: left;' />
|
||||||
|
</tr><tr><td style='text-align: left;'>B</td><td style='text-align: left;' /><td style='text-align: left;'>X</td>
|
||||||
|
</tr></tbody></table>
|
||||||
|
*** Output of to_latex ***
|
||||||
|
\begin{tabular}{l|l|l}
|
||||||
|
&1&2\\
|
||||||
|
\hline
|
||||||
|
A&X&\\
|
||||||
|
B&&X\\
|
||||||
|
\end{tabular}
|
||||||
|
*** Output of to_md ***
|
||||||
|
12AXBX
|
||||||
|
*** Output of to_s ***
|
||||||
|
12AXBX
|
||||||
|
*** EOF ***
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
OK!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** Output of Markdown.pl ***
|
||||||
|
<p>| | 1 | 2 |
|
||||||
|
|----|----|----|
|
||||||
|
| A | X | |
|
||||||
|
| B | | X |</p>
|
||||||
|
|
||||||
|
*** Output of Markdown.pl (parsed) ***
|
||||||
|
<div>
|
||||||
|
<p>
|
||||||
|
| | 1 | 2 | |----|----|----| | A | X | | | B | | X |
|
||||||
|
</p>
|
||||||
|
</div>
|
25
vendor/plugins/maruku/tests/unittest/pending/link.html
vendored
Normal file
25
vendor/plugins/maruku/tests/unittest/pending/link.html
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC
|
||||||
|
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
|
||||||
|
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
|
||||||
|
<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
||||||
|
<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title></title></head>
|
||||||
|
<body>
|
||||||
|
<p><a href='http://www.aa.com'>http://www.aa.com</a></p>
|
||||||
|
|
||||||
|
<p><a href='http://www.bb.com'>http://www.bb.com</a></p>
|
||||||
|
|
||||||
|
<p><a href='http://www.cc.com'>http://www.cc.com</a></p>
|
||||||
|
|
||||||
|
<p><a href='http://www.dd.com'>http://www.dd.com</a></p>
|
||||||
|
|
||||||
|
<pre><code><http://www.dd.com></code></pre>
|
||||||
|
|
||||||
|
<p><a href='mailto:a@invalid.it'>a@invalid.it</a></p>
|
||||||
|
|
||||||
|
<p><a href='mailto:a@invalid.it'>a@invalid.it</a></p>
|
||||||
|
|
||||||
|
<p><a href='mailto:a@invalid.it'>a@invalid.it</a></p>
|
||||||
|
|
||||||
|
<pre><code><a@invalid.it></code></pre>
|
||||||
|
</body></html>
|
149
vendor/plugins/maruku/tests/unittest/pending/link.md
vendored
Normal file
149
vendor/plugins/maruku/tests/unittest/pending/link.md
vendored
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
Write a comment here
|
||||||
|
*** Parameters: ***
|
||||||
|
{} # params
|
||||||
|
*** Markdown input: ***
|
||||||
|
<http://www.aa.com>
|
||||||
|
|
||||||
|
<http://www.bb.com>
|
||||||
|
|
||||||
|
<http://www.cc.com>
|
||||||
|
|
||||||
|
<http://www.dd.com>
|
||||||
|
|
||||||
|
<http://www.dd.com>
|
||||||
|
|
||||||
|
<a@invalid.it>
|
||||||
|
|
||||||
|
<a@invalid.it>
|
||||||
|
|
||||||
|
<a@invalid.it>
|
||||||
|
|
||||||
|
<a@invalid.it>
|
||||||
|
*** Output of inspect ***
|
||||||
|
md_el(:document,[
|
||||||
|
md_par([md_url("http://www.aa.com")]),
|
||||||
|
md_par([md_url("http://www.bb.com")]),
|
||||||
|
md_par([md_url("http://www.cc.com")]),
|
||||||
|
md_par([md_url("http://www.dd.com")]),
|
||||||
|
md_el(:code,[],{:raw_code=>"<http://www.dd.com>"},[]),
|
||||||
|
md_par([md_email("a@invalid.it")]),
|
||||||
|
md_par([md_email("a@invalid.it")]),
|
||||||
|
md_par([md_email("a@invalid.it")]),
|
||||||
|
md_el(:code,[],{:raw_code=>"<a@invalid.it>"},[])
|
||||||
|
],{},[])
|
||||||
|
*** Output of to_html ***
|
||||||
|
<p><a href='http://www.aa.com'>http://www.aa.com</a></p>
|
||||||
|
|
||||||
|
<p><a href='http://www.bb.com'>http://www.bb.com</a></p>
|
||||||
|
|
||||||
|
<p><a href='http://www.cc.com'>http://www.cc.com</a></p>
|
||||||
|
|
||||||
|
<p><a href='http://www.dd.com'>http://www.dd.com</a></p>
|
||||||
|
|
||||||
|
<pre><code><http://www.dd.com></code></pre>
|
||||||
|
|
||||||
|
<p><a href='mailto:a@invalid.it'>a@invalid.it</a></p>
|
||||||
|
|
||||||
|
<p><a href='mailto:a@invalid.it'>a@invalid.it</a></p>
|
||||||
|
|
||||||
|
<p><a href='mailto:a@invalid.it'>a@invalid.it</a></p>
|
||||||
|
|
||||||
|
<pre><code><a@invalid.it></code></pre>
|
||||||
|
*** Output of to_latex ***
|
||||||
|
\href{http://www.aa.com}{http\char58\char47\char47www\char46aa\char46com}
|
||||||
|
|
||||||
|
\href{http://www.bb.com}{http\char58\char47\char47www\char46bb\char46com}
|
||||||
|
|
||||||
|
\href{http://www.cc.com}{http\char58\char47\char47www\char46cc\char46com}
|
||||||
|
|
||||||
|
\href{http://www.dd.com}{http\char58\char47\char47www\char46dd\char46com}
|
||||||
|
|
||||||
|
\begin{verbatim}<http://www.dd.com>\end{verbatim}
|
||||||
|
\href{mailto:a@invalid.it}{a\char64invalid\char46it}
|
||||||
|
|
||||||
|
\href{mailto:a@invalid.it}{a\char64invalid\char46it}
|
||||||
|
|
||||||
|
\href{mailto:a@invalid.it}{a\char64invalid\char46it}
|
||||||
|
|
||||||
|
\begin{verbatim}<a@invalid.it>\end{verbatim}
|
||||||
|
*** Output of to_md ***
|
||||||
|
|
||||||
|
*** Output of to_s ***
|
||||||
|
|
||||||
|
*** EOF ***
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
OK!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*** Output of Markdown.pl ***
|
||||||
|
<p><a href="http://www.aa.com">http://www.aa.com</a></p>
|
||||||
|
|
||||||
|
<p><a href="http://www.bb.com">http://www.bb.com</a></p>
|
||||||
|
|
||||||
|
<p><a href="http://www.cc.com">http://www.cc.com</a></p>
|
||||||
|
|
||||||
|
<p><a href="http://www.dd.com">http://www.dd.com</a></p>
|
||||||
|
|
||||||
|
<pre><code><http://www.dd.com>
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p><a href="mailto:a@invalid.it">a@invalid.it</a></p>
|
||||||
|
|
||||||
|
<p><a href="mailto:a@invalid.it">a@invalid.it</a></p>
|
||||||
|
|
||||||
|
<p><a href="mailto:a@invalid.it">a@invalid.it</a></p>
|
||||||
|
|
||||||
|
<pre><code><a@invalid.it>
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
*** Output of Markdown.pl (parsed) ***
|
||||||
|
<div>
|
||||||
|
<p>
|
||||||
|
<a href='http://www.aa.com'>
|
||||||
|
http://www.aa.com
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a href='http://www.bb.com'>
|
||||||
|
http://www.bb.com
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a href='http://www.cc.com'>
|
||||||
|
http://www.cc.com
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a href='http://www.dd.com'>
|
||||||
|
http://www.dd.com
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<pre>
|
||||||
|
<code>
|
||||||
|
<http://www.dd.com>
|
||||||
|
</code>
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
<a href='mailto:a@invalid.it'>
|
||||||
|
a@invalid.it
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a href='mailto:a@invalid.it'>
|
||||||
|
a@invalid.it
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a href='mailto:a@invalid.it'>
|
||||||
|
a@invalid.it
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<pre>
|
||||||
|
<code>
|
||||||
|
<a@invalid.it>
|
||||||
|
</code>
|
||||||
|
</pre>
|
||||||
|
</div>
|
|
@ -149,9 +149,9 @@ Line:
|
||||||
Position:
|
Position:
|
||||||
Last 80 unconsumed characters:
|
Last 80 unconsumed characters:
|
||||||
<pre><code>She was 6\"12\'. </code></pre> <blockquote> <p>She was 6\"12\'.</>
|
<pre><code>She was 6\"12\'. </code></pre> <blockquote> <p>She was 6\"12\'.</>
|
||||||
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/baseparser.rb:320:in `pull'
|
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/baseparser.rb:330:in `pull'
|
||||||
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/treeparser.rb:21:in `parse'
|
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/parsers/treeparser.rb:22:in `parse'
|
||||||
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:204:in `build'
|
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:205:in `build'
|
||||||
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:42:in `initialize'
|
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:42:in `initialize'
|
||||||
bin/marutest:200:in `new'
|
bin/marutest:200:in `new'
|
||||||
bin/marutest:200:in `run_test'
|
bin/marutest:200:in `run_test'
|
||||||
|
|
10
vendor/plugins/maruku/tests/unittest/xml.html
vendored
10
vendor/plugins/maruku/tests/unittest/xml.html
vendored
|
@ -4,4 +4,12 @@
|
||||||
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
|
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
|
||||||
<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
||||||
<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title></title></head>
|
<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title></title></head>
|
||||||
<body /></html>
|
<body><pre class='markdown-html-error' style='border: solid 3px red; background-color: pink'>HTML parse error:
|
||||||
|
<svg:svg/></pre><pre class='markdown-html-error' style='border: solid 3px red; background-color: pink'>HTML parse error:
|
||||||
|
<svg:svg
|
||||||
|
width="600px" height="400px">
|
||||||
|
<svg:g id="group">
|
||||||
|
<svg:circle id="circ1" r="1cm" cx="3cm" cy="3cm" style="fill:red;"></svg:circle>
|
||||||
|
<svg:circle id="circ2" r="1cm" cx="7cm" cy="3cm" style="fill:red;" />
|
||||||
|
</svg:g>
|
||||||
|
</svg:svg></pre></body></html>
|
37
vendor/plugins/maruku/tests/unittest/xml.md
vendored
37
vendor/plugins/maruku/tests/unittest/xml.md
vendored
|
@ -35,9 +35,30 @@ md_el(:document,[
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OK!
|
|
||||||
|
|
||||||
|
Failed tests: [:to_html]
|
||||||
|
|
||||||
|
*** Output of inspect ***
|
||||||
|
md_el(:document,[
|
||||||
|
md_html("<svg:svg/>"),
|
||||||
|
md_html("<svg:svg \nwidth=\"600px\" height=\"400px\">\n <svg:g id=\"group\">\n\t<svg:circle id=\"circ1\" r=\"1cm\" cx=\"3cm\" cy=\"3cm\" style=\"fill:red;\"></svg:circle>\n\t<svg:circle id=\"circ2\" r=\"1cm\" cx=\"7cm\" cy=\"3cm\" style=\"fill:red;\" />\n </svg:g>\n</svg:svg>")
|
||||||
|
],{},[])
|
||||||
|
*** Output of to_html ***
|
||||||
|
-----| WARNING | -----
|
||||||
|
<pre class='markdown-html-error' style='border: solid 3px red; background-color: pink'>HTML parse error:
|
||||||
|
<svg:svg/></pre><pre class='markdown-html-error' style='border: solid 3px red; background-color: pink'>HTML parse error:
|
||||||
|
<svg:svg
|
||||||
|
width="600px" height="400px">
|
||||||
|
<svg:g id="group">
|
||||||
|
<svg:circle id="circ1" r="1cm" cx="3cm" cy="3cm" style="fill:red;"></svg:circle>
|
||||||
|
<svg:circle id="circ2" r="1cm" cx="7cm" cy="3cm" style="fill:red;" />
|
||||||
|
</svg:g>
|
||||||
|
</svg:svg></pre>
|
||||||
|
*** Output of to_latex ***
|
||||||
|
|
||||||
|
*** Output of to_md ***
|
||||||
|
|
||||||
|
*** Output of to_s ***
|
||||||
|
|
||||||
*** Output of Markdown.pl ***
|
*** Output of Markdown.pl ***
|
||||||
<p><svg:svg/></p>
|
<p><svg:svg/></p>
|
||||||
|
@ -51,16 +72,4 @@ width="600px" height="400px">
|
||||||
</svg:svg></p>
|
</svg:svg></p>
|
||||||
|
|
||||||
*** Output of Markdown.pl (parsed) ***
|
*** Output of Markdown.pl (parsed) ***
|
||||||
<div>
|
Error: #<REXML::UndefinedNamespaceException: Undefined prefix svg found>
|
||||||
<p>
|
|
||||||
<svg:svg/>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<svg:svg height='400px' width='600px'>
|
|
||||||
<svg:g id='group'>
|
|
||||||
<svg:circle cy='3cm' id='circ1' r='1cm' cx='3cm' style='fill:red;'/>
|
|
||||||
<svg:circle cy='3cm' id='circ2' r='1cm' cx='7cm' style='fill:red;'/>
|
|
||||||
</svg:g>
|
|
||||||
</svg:svg>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
Loading…
Reference in a new issue