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:
Jacques Distler 2008-07-26 04:14:41 -05:00
parent 4e3aefd9d3
commit c427807274
33 changed files with 610 additions and 101 deletions

View file

@ -303,7 +303,7 @@ class WikiController < ApplicationController
end
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
else
@tex_content = 'TeX export only supported with the Markdown text filters.'
@ -311,7 +311,7 @@ class WikiController < ApplicationController
end
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)
@s5_content = my_rendered.display_s5
@s5_theme = my_rendered.s5_theme
@ -343,7 +343,7 @@ class WikiController < ApplicationController
# end
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
else
@tex_content = 'TeX export only supported with the Markdown text filters.'
@ -423,7 +423,7 @@ class WikiController < ApplicationController
def render_tex_web
@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
else
tex_web[page.name] = 'TeX export only supported with the Markdown text filters.'

View file

@ -35,7 +35,7 @@
<%= link_to('Print',
{ :web => @web.address, :action => 'print', :id => @page.name },
{ :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},
{:id => 'view_tex', :rel => 'nofollow' } %>

View file

@ -75,6 +75,37 @@ module Engines
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
def mask
redcloth = RedCloth.new(@content, @content.options[:engine_opts])
@ -90,6 +121,6 @@ module Engines
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
end

View file

@ -174,7 +174,7 @@ module Sanitizer
style = style.to_s.gsub(/url\s*\(\s*[^\s)]+?\s*\)\s*/, ' ')
# 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*[^:;]*(;|$))*$/
clean = []

View file

@ -89,11 +89,12 @@ end
# WikiContent.new
class WikiContentStub < String
attr_reader :options
attr_reader :web, :options
include ChunkManager
def initialize(content, options)
def initialize(content, web, options)
super(content)
@web = web
@options = options
init_chunk_manager
end
@ -164,7 +165,7 @@ class WikiContent < String
# The copy is rendered and used to detect the chunks that are inside protecting context
# 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)
copy.inside_chunks(HIDE_CHUNKS) do |id|

View file

@ -167,7 +167,7 @@ module HTML5
style = style.to_s.gsub(/url\s*\(\s*[^\s)]+?\s*\)\s*/, ' ')
# 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*[^:;]*(;|$))*$/
clean = []

View file

@ -3,6 +3,11 @@
require 'maruku'
require 'optparse'
def cli_puts(s)
$stderr.puts(s) if MaRuKu::Globals[:verbose]
end
export = :html
break_on_error = 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_mathml] = false
MaRuKu::Globals[:html_png_engine] = s
$stderr.puts "Using png engine #{s}."
cli_puts "Using png engine #{s}."
end
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("--version", "Show version") do
puts OptionParser::Version.join('.')
exit
puts "Maruku #{MaRuKu::Version}"; exit
end
opts.on_tail("-h", "--help", "Show this message") do
@ -68,27 +72,29 @@ rescue OptionParser::InvalidOption=>e
exit
end
if using_math
$stderr.puts "Using Math extensions."
cli_puts "Using Math extensions."
require 'maruku/ext/math'
end
#p ARGV
#p MaRuKu::Globals
inputs =
# If we are given filenames, convert each file
if not ARGV.empty?
ARGV.map do |f|
# read file content
$stderr.puts "Reading from #{f}."
cli_puts "Reading from file #{f.inspect}."
[f, File.open(f,'r').read]
end
else
export = :html_frag if export == :html
export = :tex_frag if export == :tex
$stderr.puts "Reading from standard input."
cli_puts "Reading from standard input."
[[nil, $stdin.read]]
end
@ -100,7 +106,8 @@ inputs.each do |f, input|
t = Time.now
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 = "?"
t = Time.now
@ -124,11 +131,12 @@ inputs.each do |f, input|
suffix='.pretty_md'
out = doc.to_markdown
when :s5
suffix='_s5slides.xhtml'
suffix='_s5slides.html'
out = doc.to_s5({:content_only => false})
end
$stderr.puts "Rendering in %.2f seconds." % (Time.now-t)
cli_puts("Rendering in %.2f seconds." % (Time.now-t))
# write to file or stdout
if f
@ -141,19 +149,19 @@ inputs.each do |f, input|
end
if output_file == "-"
$stderr.puts "Writing to standard output"
cli_puts "Writing to standard output"
$stdout.puts out
else
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
else
$stderr.puts "Writing to #{job}.tex"
cli_puts "Writing to #{job}.tex"
File.open("#{job}.tex",'w') do |f| f.puts out end
cmd = "pdflatex '#{job}.tex' -interaction=nonstopmode "+
"'-output-directory=#{dir}' "
$stderr.puts "maruku: executing $ #{cmd}"
cli_puts "maruku: executing $ #{cmd}"
# run twice for cross references
system cmd
system cmd
@ -161,7 +169,7 @@ inputs.each do |f, input|
end
else # write to stdout
$stderr.puts "Writing to standard output"
cli_puts "Writing to standard output"
$stdout.puts out
end
end

View file

@ -47,6 +47,7 @@ Globals = {
:latex_use_listings => false,
:latex_cjk => false,
:latex_cache_file => "blahtex_cache.pstore", # cache file for blahtex filter
:debug_keep_ials => false,
:doc_prefix => ''

View file

@ -15,36 +15,34 @@ module MaRuKu; module Out; module HTML
# first, we check whether this image has already been processed
md5sum = Digest::MD5.hexdigest(tex+" params: ")
result_file = File.join(MaRuKu::Globals[:html_png_dir], md5sum+".txt")
if not File.exists?(result_file)
tmp_in = Tempfile.new('maruku_blahtex')
f = tmp_in.open
f = tmp_in.open
f.write tex
f.close
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])
cmd = "blahtex #{options} < #{tmp_in.path} > #{result_file}"
$stderr.puts "$ #{cmd}"
system cmd
#$stderr.puts "$ #{cmd}"
system cmd
tmp_in.delete
end
result = nil
f = File.open(result_file)
result = f.read
f.close
result = File.read(result_file)
if result.nil? || result.empty?
raise "Blahtex error: empty output"
end
doc = Document.new(result, {:respect_whitespace =>:all})
png = doc.root.elements[1]
if png.name != 'png'
maruku_error "Blahtex error: \n#{doc}"
return nil
raise "Blahtex error: \n#{doc}"
end
depth = png.elements['depth'] || (raise "No depth 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]
return PNG.new("#{dir_url}#{md5}.png", depth, height)
rescue Exception => e
maruku_error "Error: #{e}"
end
nil
end
BlahtexCache = PStore.new("blahtex_cache.pstore")
def convert_to_mathml_blahtex(kind, tex)
@@BlahtexCache = PStore.new(MaRuKu::Globals[:latex_cache_file])
begin
BlahtexCache.transaction do
if BlahtexCache[tex].nil?
@@BlahtexCache.transaction do
if @@BlahtexCache[tex].nil?
tmp_in = Tempfile.new('maruku_blahtex')
f = tmp_in.open
f.write tex
@ -77,7 +75,7 @@ module MaRuKu; module Out; module HTML
options = "--mathml"
cmd = "blahtex #{options} < #{tmp_in.path} > #{tmp_out.path}"
$stderr.puts "$ #{cmd}"
#$stderr.puts "$ #{cmd}"
system cmd
tmp_in.delete
@ -85,10 +83,10 @@ module MaRuKu; module Out; module HTML
File.open(tmp_out.path) do |f| result=f.read end
puts result
BlahtexCache[tex] = result
@@BlahtexCache[tex] = result
end
blahtex = BlahtexCache[tex]
blahtex = @@BlahtexCache[tex]
doc = Document.new(blahtex, {:respect_whitespace =>:all})
mathml = doc.root.elements['mathml']
if not mathml

View file

@ -337,7 +337,7 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
# puts "id =_#{id}_; text=_#{text}_ indent=#{indentation}"
break_list = [:footnote_text]
break_list = [:footnote_text, :ref_definition, :definition, :abbreviation]
item_type = :footnote_text
lines, want_my_paragraph =
read_indented_content(src,indentation, break_list, item_type)
@ -471,9 +471,10 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
def read_ref_definition(src, out)
line = src.shift_line
# if link is incomplete, shift next line
if src.cur_line && (src.cur_line.md_type != :ref_definition) &&
([1,2,3].include? number_of_leading_spaces(src.cur_line) )
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) )
line += " "+ src.shift_line
end

View file

@ -94,6 +94,7 @@ module MaRuKu; module Strings
# *[HTML]: Hyper Text Markup Language
Abbreviation = %r{
^ # begin of line
[ ]{0,3} # up to 3 spaces
\* # one asterisk
\[ # opening bracket
([^\]]+) # any non-closing bracket: id = $1
@ -106,7 +107,9 @@ module MaRuKu; module Strings
}x
FootnoteText = %r{
^\s*\[(\^.+)\]: # id = $1 (including '^')
^ # begin of line
[ ]{0,3} # up to 3 spaces
\[(\^.+)\]: # id = $1 (including '^')
\s*(\S.*)?$ # text = $2 (not obb.)
}x
@ -115,7 +118,7 @@ module MaRuKu; module Strings
LinkRegex = %r{
^[ ]{0,3}\[([^\[\]]+)\]: # id = $1
[ ]*
<?(\S+)>? # url = $2
<?([^>\s]+)>? # url = $2
[ ]*
(?:# Titles are delimited by "quotes" or (parens).
["(']

View file

@ -188,6 +188,7 @@ Example:
=end
METAS = %w{description keywords author revised}
# Render to a complete HTML document (returns a REXML document tree)
def to_html_document_tree
@ -209,7 +210,25 @@ Example:
# me.attributes['content'] = 'text/html;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
doc_title = self.attributes[:title] || self.attributes[:subject] || ""
title = Element.new 'title', head
@ -312,7 +331,8 @@ Example:
li.insert_after(li.children.last, a)
ol << li
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
div << ol
@ -827,10 +847,21 @@ If true, raw HTML is discarded from the output.
# save the order of used footnotes
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
order << id
num = order.size;
#num = order.size;
num = order.index(id) + 1
sup = Element.new 'sup'
sup.attributes['id'] = "#{get_setting(:doc_prefix)}fnref:#{num}"
a = Element.new 'a'

View file

@ -46,7 +46,7 @@ module MaRuKu; module Strings
#
def parse_email_headers(s)
keys={}
match = (s =~ /((\w[\w\s]+: .*\n)+)\n/)
match = (s =~ /\A((\w[\w\s\_\-]+: .*\n)+)\s*\n/)
if match != 0
keys[:data] = s
else

View file

@ -19,7 +19,7 @@
#++
module MaRuKu
Version = '0.5.8'
Version = '0.5.9'
MarukuURL = 'http://maruku.rubyforge.org/'

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

View file

@ -201,4 +201,53 @@ texttexttexttexttexttexttexttexttexttexttexttext
<p>=--</p>
*** 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>

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

View file

@ -31,4 +31,8 @@ ciao
=--</p>
*** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element>
<div>
<p>
+-- ciao =--
</p>
</div>

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

View file

@ -59,4 +59,12 @@ this is the last warning!please, go away!or else terrible things will happen
+---------------------------------------------------</p>
*** 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>

View file

@ -27,7 +27,7 @@ This is an email address:
*** Output of Markdown.pl ***
<p>This is an email address: <a href="&#x6D;&#97;i&#x6C;&#x74;o:&#x61;n&#100;r&#101;&#x61;&#64;&#x69;&#x6E;&#x76;&#97;&#108;&#105;&#100;&#46;&#105;&#x74;">&#x61;n&#100;r&#101;&#x61;&#64;&#x69;&#x6E;&#x76;&#97;&#108;&#105;&#100;&#46;&#105;&#x74;</a></p>
<p>This is an email address: <a href="&#109;&#x61;&#x69;&#x6C;&#x74;&#x6F;:&#x61;&#110;&#100;&#114;&#101;&#x61;&#64;&#x69;&#110;&#118;&#97;&#x6C;&#105;&#x64;&#x2E;&#105;&#116;">&#x61;&#110;&#100;&#114;&#101;&#x61;&#64;&#x69;&#110;&#118;&#97;&#x6C;&#105;&#x64;&#x2E;&#105;&#116;</a></p>
*** Output of Markdown.pl (parsed) ***
Error: #<TypeError: no implicit conversion from nil to integer>

View file

@ -5,7 +5,7 @@
<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>That&#8217;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&#8217;s some text with a footnote and another and another .</p>
<p>This is not a footnote.</p>
<div class='footnotes'><hr /><ol><li id='fn:1'>
@ -18,14 +18,4 @@
<p>And that&#8217;s the footnote.</p>
<p>That&#8217;s the second paragraph of the footnote.</p>
<a href='#fnref:3' rev='footnote'>&#8617;</a></li><li id='fn:4'>
<p>And that&#8217;s the footnote. This is second sentence (same paragraph).</p>
<a href='#fnref:4' rev='footnote'>&#8617;</a></li><li id='fn:5'>
<p>This is the very long one.</p>
<p>That&#8217;s the second paragraph.</p>
<a href='#fnref:5' rev='footnote'>&#8617;</a></li><li id='fn:6'>
<p>And that&#8217;s the footnote.</p>
<p>That&#8217;s the second paragraph of the footnote.</p>
<a href='#fnref:6' rev='footnote'>&#8617;</a></li></ol></div></body></html>
<a href='#fnref:3' rev='footnote'>&#8617;</a></li></ol></div></body></html>

View file

@ -238,9 +238,9 @@ Line:
Position:
Last 80 unconsumed characters:
<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/treeparser.rb:21: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/parsers/baseparser.rb:330:in `pull'
/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:205:in `build'
/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 `run_test'

View file

@ -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>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="&#109;&#x61;&#105;l&#116;o:&#x62;&#x69;&#108;l&#64;&#x67;&#111;&#111;&#103;&#x6C;&#x65;&#46;&#99;&#x6F;&#x6D;">&#x62;&#x69;&#108;l&#64;&#x67;&#111;&#111;&#103;&#x6C;&#x65;&#46;&#99;&#x6F;&#x6D;</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="&#109;&#x61;&#105;&#108;&#x74;&#111;:&#x62;&#105;&#108;&#x6C;&#64;&#103;&#111;&#111;&#103;&#108;&#x65;&#46;c&#x6F;&#x6D;">&#x62;&#105;&#108;&#x6C;&#64;&#103;&#111;&#111;&#103;&#108;&#x65;&#46;c&#x6F;&#x6D;</a>
or you might ask bill@google.com.</p>
<p>If all else fails, ask <a href="http://www.google.com">Google</a></p>
@ -175,9 +175,9 @@ Line:
Position:
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/treeparser.rb:21: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/parsers/baseparser.rb:330:in `pull'
/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:205:in `build'
/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 `run_test'

View 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(&amp;:title)</code></pre>
</body></html>

View 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(&amp;: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(&amp;:title)
</code></pre>
*** Output of Markdown.pl (parsed) ***
<div>
<pre>
<code>
@articles.map(&amp;:title)
</code>
</pre>
</div>

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

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

View 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>&lt;http://www.dd.com&gt;</code></pre>
<p><a href='mailto:a@invalid.it'>&#097;&#064;&#105;&#110;&#118;&#097;&#108;&#105;&#100;&#046;&#105;&#116;</a></p>
<p><a href='mailto:a@invalid.it'>&#097;&#064;&#105;&#110;&#118;&#097;&#108;&#105;&#100;&#046;&#105;&#116;</a></p>
<p><a href='mailto:a@invalid.it'>&#097;&#064;&#105;&#110;&#118;&#097;&#108;&#105;&#100;&#046;&#105;&#116;</a></p>
<pre><code>&lt;a@invalid.it&gt;</code></pre>
</body></html>

View 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>&lt;http://www.dd.com&gt;</code></pre>
<p><a href='mailto:a@invalid.it'>&#097;&#064;&#105;&#110;&#118;&#097;&#108;&#105;&#100;&#046;&#105;&#116;</a></p>
<p><a href='mailto:a@invalid.it'>&#097;&#064;&#105;&#110;&#118;&#097;&#108;&#105;&#100;&#046;&#105;&#116;</a></p>
<p><a href='mailto:a@invalid.it'>&#097;&#064;&#105;&#110;&#118;&#097;&#108;&#105;&#100;&#046;&#105;&#116;</a></p>
<pre><code>&lt;a@invalid.it&gt;</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>&lt;http://www.dd.com&gt;
</code></pre>
<p><a href="&#109;&#97;&#105;&#108;&#116;&#x6F;:&#97;&#64;i&#x6E;&#x76;&#x61;&#108;&#x69;&#100;.&#x69;&#x74;">&#97;&#64;i&#x6E;&#x76;&#x61;&#108;&#x69;&#100;.&#x69;&#x74;</a></p>
<p><a href="&#109;&#97;&#105;&#x6C;&#116;&#x6F;:&#x61;&#64;&#105;&#110;&#x76;&#97;&#108;i&#x64;&#46;&#105;t">&#x61;&#64;&#105;&#110;&#x76;&#97;&#108;i&#x64;&#46;&#105;t</a></p>
<p><a href="&#x6D;&#97;&#x69;&#x6C;&#x74;&#111;:&#x61;&#64;&#105;&#x6E;&#118;&#x61;&#x6C;&#x69;&#100;&#x2E;&#x69;&#116;">&#x61;&#64;&#105;&#x6E;&#118;&#x61;&#x6C;&#x69;&#100;&#x2E;&#x69;&#116;</a></p>
<pre><code>&lt;a@invalid.it&gt;
</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>
&lt;http://www.dd.com&gt;
</code>
</pre>
<p>
<a href='&#109;&#97;&#105;&#108;&#116;&#x6F;:&#97;&#64;i&#x6E;&#x76;&#x61;&#108;&#x69;&#100;.&#x69;&#x74;'>
&#97;&#64;i&#x6E;&#x76;&#x61;&#108;&#x69;&#100;.&#x69;&#x74;
</a>
</p>
<p>
<a href='&#109;&#97;&#105;&#x6C;&#116;&#x6F;:&#x61;&#64;&#105;&#110;&#x76;&#97;&#108;i&#x64;&#46;&#105;t'>
&#x61;&#64;&#105;&#110;&#x76;&#97;&#108;i&#x64;&#46;&#105;t
</a>
</p>
<p>
<a href='&#x6D;&#97;&#x69;&#x6C;&#x74;&#111;:&#x61;&#64;&#105;&#x6E;&#118;&#x61;&#x6C;&#x69;&#100;&#x2E;&#x69;&#116;'>
&#x61;&#64;&#105;&#x6E;&#118;&#x61;&#x6C;&#x69;&#100;&#x2E;&#x69;&#116;
</a>
</p>
<pre>
<code>
&lt;a@invalid.it&gt;
</code>
</pre>
</div>

View file

@ -149,9 +149,9 @@ Line:
Position:
Last 80 unconsumed characters:
<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/treeparser.rb:21: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/parsers/baseparser.rb:330:in `pull'
/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:205:in `build'
/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 `run_test'

View file

@ -4,4 +4,12 @@
"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 /></html>
<body><pre class='markdown-html-error' style='border: solid 3px red; background-color: pink'>HTML parse error:
&lt;svg:svg/&gt;</pre><pre class='markdown-html-error' style='border: solid 3px red; background-color: pink'>HTML parse error:
&lt;svg:svg
width=&quot;600px&quot; height=&quot;400px&quot;&gt;
&lt;svg:g id=&quot;group&quot;&gt;
&lt;svg:circle id=&quot;circ1&quot; r=&quot;1cm&quot; cx=&quot;3cm&quot; cy=&quot;3cm&quot; style=&quot;fill:red;&quot;&gt;&lt;/svg:circle&gt;
&lt;svg:circle id=&quot;circ2&quot; r=&quot;1cm&quot; cx=&quot;7cm&quot; cy=&quot;3cm&quot; style=&quot;fill:red;&quot; /&gt;
&lt;/svg:g&gt;
&lt;/svg:svg&gt;</pre></body></html>

View file

@ -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:
&lt;svg:svg/&gt;</pre><pre class='markdown-html-error' style='border: solid 3px red; background-color: pink'>HTML parse error:
&lt;svg:svg
width=&quot;600px&quot; height=&quot;400px&quot;&gt;
&lt;svg:g id=&quot;group&quot;&gt;
&lt;svg:circle id=&quot;circ1&quot; r=&quot;1cm&quot; cx=&quot;3cm&quot; cy=&quot;3cm&quot; style=&quot;fill:red;&quot;&gt;&lt;/svg:circle&gt;
&lt;svg:circle id=&quot;circ2&quot; r=&quot;1cm&quot; cx=&quot;7cm&quot; cy=&quot;3cm&quot; style=&quot;fill:red;&quot; /&gt;
&lt;/svg:g&gt;
&lt;/svg:svg&gt;</pre>
*** Output of to_latex ***
*** Output of to_md ***
*** Output of to_s ***
*** Output of Markdown.pl ***
<p><svg:svg/></p>
@ -51,16 +72,4 @@ width="600px" height="400px">
</svg:svg></p>
*** Output of Markdown.pl (parsed) ***
<div>
<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>
Error: #<REXML::UndefinedNamespaceException: Undefined prefix svg found>