Sync with latest Maruku.

Finally able to ditch BlueCloth completely.
This commit is contained in:
Jacques Distler 2007-02-14 20:32:24 -06:00
parent 0556f43180
commit ff63e894b2
18 changed files with 393 additions and 1249 deletions

View file

@ -1,12 +1,14 @@
<h3>Markdown formatting tips (<a target="_new" href="http://daringfireball.net/projects/markdown/syntax">advanced</a>)</h3>
<h3>Markdown formatting tips (<a target="_new" href="http://daringfireball.net/projects/markdown/syntax">basics</a>, <a target="_new" href="http://maruku.rubyforge.org/#extra">extended syntax</a>, <a target="_new" href="http://maruku.rubyforge.org/proposal.html">metadata</a>)</h3>
<table cellspacing="0" cellpadding="0">
<tr><td>_your text_</td><td class="arrow">&rarr;</td><td><em>your text</em></td></tr>
<tr><td>**your text**</td><td class="arrow">&rarr;</td><td><strong>your text</strong></td></tr>
<tr><td>`my code`</td><td class="arrow">&rarr;</td><td><code>my code</code></td></tr>
<tr><td>* Bulleted list<br />* Second item</td><td class="arrow">&rarr;</td><td>&#8226; Bulleted list<br />&#8226; Second item</td></tr>
<tr><td>1. Numbered list<br />1. Second item</td><td class="arrow">&rarr;</td><td>1. Numbered list<br />2. Second item</td></tr>
<tr><td>Definition list<br />: is useful</td><td class="arrow">&rarr;</td><td><dl style="display:inline"><dt>Definition list</dt><dd>is useful</dd></dl></td></tr>
<tr><td>[link name](URL)</td><td class="arrow">&rarr;</td><td><a href="URL">link name</a></td></tr>
<tr><td>![Alt text](URL)</td><td class="arrow">&rarr;</td><td>Image</td></tr>
<tr><td>## Header ##<br />### Subheader ###<br />#### Etc. ####</td><td class="arrow">&rarr;</td><td><b><span style="font-size:1.2em">Header</span><br /><span style="font-size:1.1em">Subheader</span><br /><span style="font-size:1em">Etc.</span></b></td></tr>
<tr><td>***</td><td class="arrow">&rarr;</td><td>Horizontal ruler</td></tr>
<tr><td>&lt;http://url><br />&lt;email@add.com></td><td class="arrow">&rarr;</td><td>Auto-linked</td></tr>
<tr><td>![Alt text](URL)</td><td class="arrow">&rarr;</td><td>Image</td></tr>
</table>

File diff suppressed because it is too large Load diff

View file

@ -35,8 +35,8 @@ module Engines
class Markdown < AbstractEngine
def mask
require_dependency 'bluecloth_tweaked'
BlueCloth.new(@content, @content.options[:engine_opts]).to_html
require_dependency 'maruku'
Maruku.new(@content.delete("\r"), {:math_enabled => false}).to_html
end
end
@ -44,7 +44,7 @@ module Engines
def mask
require_dependency 'maruku'
require_dependency 'maruku/ext/math'
Maruku.new(@content.delete("\r")).to_html
Maruku.new(@content.delete("\r"), {:math_enabled => true}).to_html
end
end

View file

@ -192,9 +192,10 @@ module MaRuKu; module In; module Markdown; module SpanLevelParser
end
# We need a helper
def is_ial(e); e.kind_of? MDElement and e.node_type == :ial end
def merge_ial(elements, src, con)
# We need a helper
def is_ial(e); e.kind_of? MDElement and e.node_type == :ial end
# Apply each IAL to the element before
elements.each_with_index do |e, i|

View file

@ -9,3 +9,33 @@ require 'maruku/ext/math/mathml_engines/none'
require 'maruku/ext/math/mathml_engines/ritex'
require 'maruku/ext/math/mathml_engines/itex2mml'
require 'maruku/ext/math/mathml_engines/blahtex'
=begin maruku_doc
Attribute: math_enabled
Scope: global, document
Summary: Enables parsing of LaTeX math
To explicitly disable the math parsing:
Maruku.new(string, {:math_enabled => false})
{:ruby}
=end
MaRuKu::Globals[:math_enabled] = true
=begin maruku_doc
Attribute: math_numbered
Scope: global, document
Summary: Math openings which should be numerated
Array containing any of `'\\['`, `'\\begin{equation}'`, `'$$'`.
MaRuKu::Globals[math_numbered] = ['\\[']
=end
MaRuKu::Globals[:math_numbered] = []

View file

@ -4,7 +4,7 @@ module MaRuKu; class MDElement
self.md_el(:inline_math, [], meta={:math=>math})
end
def md_equation(math, label=nil)
def md_equation(math, label, numerate)
reglabel= /\\label\{(\w+)\}/
if math =~ reglabel
label = $1
@ -12,9 +12,10 @@ module MaRuKu; class MDElement
end
# puts "Found label = #{label} math #{math.inspect} "
num = nil
if label && @doc #take number
if (label || numerate) && @doc #take number
@doc.eqid2eq ||= {}
num = @doc.eqid2eq.size + 1
label = "eq#{num}" if not label # FIXME do id for document
end
e = self.md_el(:equation, [], meta={:math=>math, :label=>label,:num=>num})
if label && @doc #take number

View file

@ -1,70 +1,90 @@
module MaRuKu
class MDDocument
# Hash equation id (String) to equation element (MDElement)
attr_accessor :eqid2eq
def is_math_enabled?
get_setting :math_enabled
end
end
end
# At least one slash inside
#RegInlineMath1 = /\$([^\$]*[\\][^\$]*)\$/
# No spaces around the delimiters
#RegInlineMath2 = /\$([^\s\$](?:[^\$]*[^\s\$])?)\$/
#RegInlineMath = Regexp::union(RegInlineMath1,RegInlineMath2)
# Everything goes; takes care of escaping the "\$" inside the expression
RegInlineMath = /\${1}((?:[^\$]|\\\$)+)\$/
MaRuKu::In::Markdown::
register_span_extension(:chars => ?$, :regexp => RegInlineMath) do
|doc, src, con|
if m = src.read_regexp(RegInlineMath)
math = m.captures.compact.first
con.push doc.md_inline_math(math)
true
else
#puts "not math: #{src.cur_chars 10}"
false
end
end
MaRuKu::In::Markdown::register_span_extension(
:chars => ?$,
:regexp => RegInlineMath,
:handler => lambda { |doc, src, con|
return false if not doc.is_math_enabled?
if m = src.read_regexp(RegInlineMath)
math = m.captures.compact.first
con.push doc.md_inline_math(math)
true
else
#puts "not math: #{src.cur_chars 10}"
false
end
}
)
EquationStart = /^[ ]{0,3}(?:\\\[|\$\$)(.*)$/
MathOpen1 = Regexp.escape('\\begin{equation}')
MathClose1 = Regexp.escape('\\end{equation}')
MathOpen2 = Regexp.escape('\\[')
MathClose2 = Regexp.escape('\\]')
MathOpen3 = Regexp.escape('$$')
MathClose3 = Regexp.escape('$$')
EqLabel = /(?:\((\w+)\))/
OneLineEquation = /^[ ]{0,3}(?:\\\[|\$\$)(.*)(?:\\\]|\$\$)\s*#{EqLabel}?\s*$/
EquationEnd = /^(.*)(?:\\\]|\$\$)\s*#{EqLabel}?\s*$/
EquationOpen = /#{MathOpen1}|#{MathOpen2}|#{MathOpen3}/
EquationClose = /#{MathClose1}|#{MathClose2}|#{MathClose3}/
# $1 is opening, $2 is tex
EquationStart = /^[ ]{0,3}(#{EquationOpen})(.*)$/
# $1 is tex, $2 is closing, $3 is tex
EquationEnd = /^(.*)(#{EquationClose})\s*#{EqLabel}?\s*$/
# $1 is opening, $2 is tex, $3 is closing, $4 is label
OneLineEquation = /^[ ]{0,3}(#{EquationOpen})(.*)(#{EquationClose})\s*#{EqLabel}?\s*$/
MaRuKu::In::Markdown::
register_block_extension(:regexp => EquationStart) do |doc, src, con|
# puts "Equation :#{self}"
first = src.shift_line
if first =~ OneLineEquation
math = $1
label = $2
con.push doc.md_equation($1, $2)
else
first =~ EquationStart
math = $1
label = nil
while true
if not src.cur_line
maruku_error "Stream finished while reading equation\n\n"+
add_tabs(math,1,'$> '), src, con
break
end
line = src.shift_line
if line =~ EquationEnd
math += $1 + "\n"
label = $2 if $2
break
else
math += line + "\n"
MaRuKu::In::Markdown::register_block_extension(
:regexp => EquationStart,
:handler => lambda { |doc, src, con|
return false if not doc.is_math_enabled?
first = src.shift_line
if first =~ OneLineEquation
opening, tex, closing, label = $1, $2, $3, $4
numerate = doc.get_setting(:math_numbered).include?(opening)
con.push doc.md_equation(tex, label, numerate)
else
first =~ EquationStart
opening, tex = $1, $2
numerate = doc.get_setting(:math_numbered).include?(opening)
label = nil
while true
if not src.cur_line
doc.maruku_error("Stream finished while reading equation\n\n"+
doc.add_tabs(tex,1,'$> '), src, con)
break
end
line = src.shift_line
if line =~ EquationEnd
tex_line, closing = $1, $2
label = $3 if $3
tex += tex_line + "\n"
break
else
tex += line + "\n"
end
end
con.push doc.md_equation(tex, label, numerate)
end
con.push doc.md_equation(math, label)
end
true
end
true
})
# This adds support for \eqref
@ -72,11 +92,14 @@ end
RegEqPar = /\(eq:(\w+)\)/
RegEqref = Regexp::union(RegEqrefLatex, RegEqPar)
MaRuKu::In::Markdown::
register_span_extension(:chars => [?\\, ?(], :regexp => RegEqref) do
|doc, src, con|
eqid = src.read_regexp(RegEqref).captures.compact.first
r = doc.md_el(:eqref, [], meta={:eqid=>eqid})
con.push r
true
end
MaRuKu::In::Markdown::register_span_extension(
:chars => [?\\, ?(],
:regexp => RegEqref,
:handler => lambda { |doc, src, con|
return false if not doc.is_math_enabled?
eqid = src.read_regexp(RegEqref).captures.compact.first
r = doc.md_el(:eqref, [], meta={:eqid=>eqid})
con.push r
true
}
)

View file

@ -121,7 +121,7 @@ module MaRuKu; module Out; module HTML
div = create_html_element 'div'
add_class_to(div, 'maruku-equation')
if self.label # then numerate
if self.label # then numerate
span = Element.new 'span'
span.attributes['class'] = 'maruku-eq-number'
num = self.num

View file

@ -92,6 +92,8 @@ module Helpers
e.instance_variable_set :@parsed_html,
REXML::Document.new(raw_html)
rescue
e.instance_variable_set :@parsed_html, nil
# tell_user "Malformed block of HTML:\n"+
# add_tabs(raw_html,1,'|')
# " #{raw_html.inspect}\n\n"+ex.inspect

View file

@ -262,7 +262,7 @@ class CharSourceStrscan
end
def consume_whitespace
@s.scan /\s+/
@s.scan(/\s+/)
nil
end

View file

@ -29,19 +29,19 @@ module MaRuKu; module In; module Markdown
return false # not special
end
def self.register_span_extension(args, &block)
def self.register_span_extension(args)
e = SpanExtension.new
e.chars = [*args[:chars]]
e.regexp = args[:regexp]
e.block = block
e.block = args[:handler] || raise("No blocks passed")
e.chars.each do |c|
(SpanExtensionsTrigger[c] ||= []).push e
end
end
def self.register_block_extension(args, &block)
def self.register_block_extension(args)
regexp = args[:regexp]
BlockExtensions[regexp] = block
BlockExtensions[regexp] = (args[:handler] || raise("No blocks passed"))
end
# Hash Regexp -> Block
@ -50,8 +50,10 @@ module MaRuKu; module In; module Markdown
def check_block_extensions(src, con, line)
BlockExtensions.each do |reg, block|
if m = reg.match(line)
p m
block = BlockExtensions[reg]
return true if block.call(doc, src, con)
accepted = block.call(doc, src, con)
return true if accepted
end
end
return false # not special

View file

@ -215,7 +215,7 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
if result.kind_of? String
raise "Not expected"
else
output.push *result
output.push(*result)
end
end
else
@ -242,7 +242,7 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
end
def read_paragraph(src)
lines = []
lines = [src.shift_line]
while src.cur_line
# :olist does not break
case t = src.cur_line.md_type
@ -253,7 +253,7 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
end
break if src.cur_line.strip.size == 0
break if [:header1,:header2].include? src.next_line.md_type
break if any_matching_block_extension?(src.cur_line)
break if any_matching_block_extension?(src.cur_line)
lines << src.shift_line
end
@ -491,12 +491,11 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser
out.push md_ref_def(id, url, meta={:title=>title})
end
def split_cells(s)
s.strip.split('|').select{|x|x.strip.size>0}.map{|x|x.strip}
end
def read_table(src)
def split_cells(s)
s.strip.split('|').select{|x|x.strip.size>0}.map{|x|x.strip}
end
head = split_cells(src.shift_line).map{|s| md_el(:head_cell, parse_lines_as_span([s])) }
separator=split_cells(src.shift_line)

View file

@ -196,10 +196,10 @@ module MaRuKu; module In; module Markdown; module SpanLevelParser
interpret_extension(src, con, [?}])
src.ignore_char # }
when nil
maruku_error ("Unclosed span (waiting for %s"+
maruku_error( ("Unclosed span (waiting for %s"+
"#{exit_on_strings.inspect})") % [
exit_on_chars ? "#{exit_on_chars.inspect} or" : ""],
src,con
src,con)
break
else # normal text
con.push_char src.shift_char
@ -618,8 +618,8 @@ module MaRuKu; module In; module Markdown; module SpanLevelParser
src.consume_whitespace
closing = src.shift_char # closing )
if closing != ?)
error ("Unclosed link: '"<<closing<<"'")+
" Read url=#{url.inspect} title=#{title.inspect}",src,con
error( ("Unclosed link: '"<<closing<<"'")+
" Read url=#{url.inspect} title=#{title.inspect}",src,con)
end
con.push_element md_im_image(alt_text, url, title)
when ?[ # link ref

View file

@ -0,0 +1,163 @@
class String
Textile2_EmptyLine = /^\s*$/
Textile2_Signature = /^(\S+\.?)\.\s(.*)/
def t2_empty?
self =~ Textile2_EmptyLine
end
def t2_contains_signature?
self =~ Textile2_Signature
end
# sig, rest = t2_get_signature
def t2_get_signature
self =~ Textile2_Signature
return Textile2Signature.new($1), $2
end
end
class Textile2Signature
Reg = %r{
^
# block name is 1
([A-Za-z0-9]+)?
# style is 2
(
\{ # open bracket
([^\}]+) # style spec is 3
\} # close bracket
)?
# language is 4
(\[(\w+)\])? # value is 5
# class and id
(?:
\( # open par
(\w+)? # optional class specification is 6
(?:\#(\w+))? # optional id is 7
\) # close par
)?
# alignment is 8
(\<|\>|\<\>|\=)?
# padding
(\(+)? # left is 9
(\)+)? # right is 10
# filters is 11
(\|
(?:(?:\w+)\|)+
)?
# optional final dot is 12
(\.)?
$
}x
def initialize(s)
if m = Reg.match(s)
self.block_name = m[1]
self.style = m[3]
self.lang = m[4]
self.css_class = m[6]
self.css_id = m[7]
self.text_align = {nil=>nil,'>'=>'right','<'=>'left',
'<>'=>'center','='=>'justified'}[m[8]]
self.num_left_pad = m[9] && m[9].size
self.num_right_pad = m[10] && m[10].size
self.filters = m[11] && m[11].split('|')
self.double_dot = m[12] && true
end
end
attr_accessor :block_name # or nil
attr_accessor :style # or nil
attr_accessor :lang # or nil
attr_accessor :css_class # or nil
attr_accessor :css_id # or nil
attr_accessor :text_align # {nil, 'left', 'right', 'center', 'justified'}
attr_accessor :num_left_pad # nil or 1..
attr_accessor :num_right_pad # nil or 1..
attr_accessor :filters # nil [], array of strings
attr_accessor :double_dot # nil or true
end
module MaRuKu
def self.textile2(source, params)
m = Maruku.new
m.t2_parse(source, params)
end
class MDDocument
def t2_parse(source, params)
src = LineSource.new(source)
output = BlockContext.new
t2_parse_blocks(src, output)
self.children = output.elements
end
Handling = Struct.new(:method, :parse_lines)
T2_Handling = {
nil => Handling.new(:t2_block_paragraph, true),
'p' => Handling.new(:t2_block_paragraph, true)
}
# Input is a LineSource
def t2_parse_blocks(src, output)
while src.cur_line
# ignore empty line
if l.t2_empty? then
src.shift_line
next
end
l = src.shift_line
# TODO: lists
# TODO: xml
# TODO: `==`
signature, l =
if l.t2_contains_signature?
l.t2_get_signature
else
[Textile2Signature.new, l]
end
if handling = T2_Handling.has_key?(signature.block_name)
if self.responds_to? handling.method
# read as many non-empty lines that you can
lines = [l]
if handling.parse_lines
while not src.cur_line.t2_empty?
lines.push src.shift_line
end
end
self.send(handling.method, src, output, signature, lines)
else
maruku_error("We don't know about method #{handling.method.inspect}")
next
end
end
end
end
def t2_block_paragraph(src, output, signature, lines)
paragraph = lines.join("\n")
src2 = CharSource.new(paragraph, src)
# output =
end
def t2_parse_span(src, output)
end
end # MDDocument
end

View file

@ -20,9 +20,9 @@
# The Maruku class is the public interface
#
class Maruku
def initialize(s=nil, meta={})
super(nil)
self.attributes.merge! meta

View file

@ -316,11 +316,55 @@ Output: HTML
It is copied as a standard HTML attribute.
=end
StandardAttributes = [:id, :style, :class]
HTML4Attributes = {}
coreattrs = [:id, :class, :style, :title]
i18n = [:lang, 'xml:lang'.to_sym]
events = [
:onclick, :ondblclick, :onmousedown, :onmouseup, :onmouseover,
:onmousemove, :onmouseout,
:onkeypress, :onkeydown, :onkeyup]
attrs = coreattrs + i18n + events
cellhalign = [:align, :char, :charoff]
cellvalign = [:valign]
[
['body', attrs + [:onload, :onunload]],
['address', attrs],
['div', attrs],
['a', attrs+[:charset, :type, :name, :rel, :rev, :accesskey, :shape, :coords, :tabindex,
:onfocus,:onblur]],
['img', attrs + [:longdesc, :name, :height, :width, :alt] ],
['p', attrs],
[['h1','h2','h3','h4','h5','h6'], attrs],
[['pre'], attrs],
[['q', 'blockquote'], attrs+[:cite]],
[['ins','del'], attrs+[:cite,:datetime]],
[['ol','ul','li'], attrs],
['table',attrs+[:summary, :width, :frame, :rules, :border, :cellspacing, :cellpadding]],
['caption',attrs],
[['colgroup','col'],attrs+[:span, :width]+cellhalign+cellvalign],
[['thead','tbody','tfoot'], attrs+cellhalign+cellvalign],
[['td','td','th'], attrs+[:abbr, :axis, :headers, :scope, :rowspan, :colspan, :cellvalign, :cellhalign]],
# altri
[['em','code','strong','hr','span','dl','dd','dt'], attrs]
].each do |el, a| [*el].each do |e| HTML4Attributes[e] = a end end
def create_html_element(name, attributes_to_copy=[])
m = Element.new name
(StandardAttributes+attributes_to_copy).each do |a|
if v = @attributes[a] then m.attributes[a.to_s] = v.to_s end
if atts = HTML4Attributes[name] then
atts.each do |att|
if v = @attributes[att] then
m.attributes[att.to_s] = v.to_s
end
end
else
# puts "not atts for #{name.inspect}"
end
m
end
@ -337,11 +381,11 @@ It is copied as a standard HTML attribute.
end
def to_html_paragraph; add_ws wrap_as_element('p', [:'xml:lang']) end
def to_html_paragraph; add_ws wrap_as_element('p') end
def to_html_ol; add_ws wrap_as_element('ol') end
def to_html_li; add_ws wrap_as_element('li') end
def to_html_li_span; add_ws wrap_as_element('li') end
def to_html_quote; add_ws wrap_as_element('blockquote', [:cite, :'xml:lang']) end
def to_html_quote; add_ws wrap_as_element('blockquote') end
def to_html_strong; wrap_as_element('strong') end
def to_html_emphasis; wrap_as_element('em') end
@ -383,7 +427,7 @@ by Maruku, to have the same results in both HTML and LaTeX.
def to_html_header
element_name = "h#{self.level}"
h = wrap_as_element(element_name, [:title, :'xml:lang'])
h = wrap_as_element element_name
if span = render_section_number
h.insert_before(h.children.first, span)
@ -432,6 +476,7 @@ and
=end
$syntax_loaded = false
def to_html_code;
source = self.raw_code
@ -547,7 +592,7 @@ of the form `#ff00ff`.
color = get_setting(:code_background_color)
if color != Globals[:code_background_color]
pre.attributes['style'] = "background-color: #{color};"
pre.attributes['style'] = "background-color: #{color};"+(pre.attributes['style']||"")
end
pre
@ -565,17 +610,17 @@ of the form `#ff00ff`.
def add_class_to_link(a)
return # not ready yet
url = a.attributes['href']
return if not url
if url =~ /^#/
add_class_to(a, 'maruku-link-samedoc')
elsif url =~ /^http:/
add_class_to(a, 'maruku-link-external')
else
add_class_to(a, 'maruku-link-local')
end
# url = a.attributes['href']
# return if not url
#
# if url =~ /^#/
# add_class_to(a, 'maruku-link-samedoc')
# elsif url =~ /^http:/
# add_class_to(a, 'maruku-link-external')
# else
# add_class_to(a, 'maruku-link-local')
# end
#
# puts a.attributes['class']
end
@ -659,10 +704,7 @@ of the form `#ff00ff`.
url = ref[:url]
title = ref[:title]
a.attributes['src'] = url.to_s
a.attributes['alt'] = title.to_s
[:title, :class, :style].each do |s|
a.attributes[s.to_s] = ref[s] if ref[s]
end
a.attributes['alt'] = title.to_s if not a.attributes['alt']
else
maruku_error"Could not find id = #{id.inspect} for\n #{self.inspect}"
tell_user "Could not create image with ref_id = #{id.inspect};"+
@ -674,15 +716,15 @@ of the form `#ff00ff`.
def to_html_im_image
if not url = self.url
maruku_error"Image with no url: #{self.inspect}"
maruku_error "Image with no url: #{self.inspect}"
tell_user "Could not create image with ref_id = #{id.inspect};"+
+" Using SPAN element as replacement."
" Using SPAN element as replacement."
return wrap_as_element('span')
end
title = self.title
a = create_html_element 'img'
a.attributes['src'] = url
a.attributes['alt'] = title.to_s
a.attributes['src'] = url.to_s
a.attributes['alt'] = title.to_s if not a.attributes['alt']
return a
end
@ -762,8 +804,7 @@ of the form `#ff00ff`.
i += num_columns
end
table = create_html_element 'table',
[:summary, :width, :frame, :rules, :border, :cellspacing, :cellpadding]
table = create_html_element 'table'
thead = Element.new 'thead'
tr = Element.new 'tr'
array_to_html(head).each do |x| tr<<x end

View file

@ -266,8 +266,8 @@ module MaRuKu; module Tests
# ['$ 20,000$', ['$ 20,000$']],
# ['$20,000 $ $20,000$', ['$20,000 $ ', md_inline_math('20,000')]],
["#{Maruku8}", [Maruku8], "Reading UTF-8"],
["#{AccIta1}", [AccIta8], "Converting ISO-8859-1 to UTF-8",
{:encoding => 'iso-8859-1'}],
# ["#{AccIta1}", [AccIta8], "Converting ISO-8859-1 to UTF-8",
# {:encoding => 'iso-8859-1'}],
]
@ -294,6 +294,7 @@ module MaRuKu; module Tests
m.attributes[:on_error] = :raise
Globals[:debug_keep_ials] = true
num_ok = 0
good_cases.each do |input, expected, comment|
output = nil
begin
@ -309,6 +310,7 @@ module MaRuKu; module Tests
raise e if @break_on_first_error
else
quiet || print_status(comment,'OK')
num_ok += 1
end
end
@ -318,6 +320,7 @@ module MaRuKu; module Tests
print_status(comment, 'FAILED', s)
break if break_on_first_error
else
num_ok += 1
quiet || print_status(comment, 'OK')
end
else # I expected a raise
@ -327,8 +330,12 @@ module MaRuKu; module Tests
print_status(comment, 'FAILED (no throw)', s)
break if break_on_first_error
end
end
end
end # do
if num_ok != good_cases.size
return false
else
return true
end
end
@ -358,6 +365,6 @@ end
verbose = ARGV.include? 'v'
break_on_first = ARGV.include? 'b'
quiet = ARGV.include? 'q'
Maruku.new.test_span_parser(verbose, break_on_first, quiet)
ok = Maruku.new.test_span_parser(verbose, break_on_first, quiet)
exit (ok ? 0 : 1)

View file

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