Bundle Latest REXML

Sam Ruby has been doing a bang-up job fixing the bugs in REXML.
Who knows when these improvements will trickle down to vendor distributions of Ruby.
In the meantime, let's bundle the latest version of REXML with Instiki.
We check the version number of the bundled REXML against that of the System REXML, and use whichever is later.
This commit is contained in:
Jacques Distler 2008-01-11 23:53:29 -06:00
parent 1085168bbf
commit 38ae064b8a
146 changed files with 11105 additions and 136 deletions

View file

@ -1,5 +1,14 @@
#####
# Bootstrap the Rails environment, frameworks, and default configuration # Bootstrap the Rails environment, frameworks, and default configuration
####
# Make sure we are using the latest rexml
system_rexml_version = `ruby -r 'rexml/rexml' -e 'p REXML::VERSION'`.split('.').collect {|n| n.to_i}
bundled_rexml_version = `ruby -r 'vendor/plugins/rexml/lib/rexml/rexml' -e 'p REXML::VERSION'`.split('.').collect {|n| n.to_i}
$:.unshift('vendor/plugins/rexml/lib') if (system_rexml_version <=> bundled_rexml_version) == -1
require File.join(File.dirname(__FILE__), 'boot') require File.join(File.dirname(__FILE__), 'boot')
require 'rails_generator/secret_key_generator' require 'rails_generator/secret_key_generator'
Rails::Initializer.run do |config| Rails::Initializer.run do |config|

View file

@ -420,7 +420,7 @@ class PageRendererTest < Test::Unit::TestCase
def test_textile_image_in_mixed_wiki def test_textile_image_in_mixed_wiki
set_web_property :markup, :mixed set_web_property :markup, :mixed
assert_markup_parsed_as( assert_markup_parsed_as(
"<p><img src='http://google.com' alt=''/>\nss</p>", "<p><img alt='' src='http://google.com'/>\nss</p>",
"!http://google.com!\r\nss") "!http://google.com!\r\nss")
end end

View file

@ -204,7 +204,18 @@ def run_test(filename, its_ok, verbose=true)
}) })
div = doc.root div = doc.root
xml ="" xml =""
div.write_children(xml,indent=1,transitive=true,ie_hack=false) indent=1
if $rexml_new_version
formatter = if indent > -1
REXML::Formatters::Pretty.new( indent, ie_hack=false )
else
REXML::Formatters::Default.new( ie_hack=false )
end
formatter.write( div, xml)
else
div.write(xml,indent,transitive=true,ie_hack=false)
end
xml.gsub!("\A<div>(.*)</div>\Z", "\1")
f.write xml f.write xml
rescue Exception=>e rescue Exception=>e
f.puts "Error: #{e.inspect}" f.puts "Error: #{e.inspect}"

View file

@ -215,7 +215,7 @@ module MaRuKu; module Out; module Latex
<char num='8835' name='sup' convertTo='$\\supset$' /> <char num='8835' name='sup' convertTo='$\\supset$' />
<!-- <char num='8838' name='sube' convertTo='$\\subseteq$' />--> <!-- <char num='8838' name='sube' convertTo='$\\subseteq$' />-->
<char num='8839' name='supe' convertTo='$\\supseteq$' /> <char num='8839' name='supe' convertTo='$\\supseteq$' />
<!-- <char num='8836' name='nsub' convertTo='$\\nsubset$' /> <!-- only AMS --> <!-- <char num='8836' name='nsub' convertTo='$\\nsubset$' /> --><!-- only AMS -->
<char num='8853' name='oplus' convertTo='$\\oplus$' /> <char num='8853' name='oplus' convertTo='$\\oplus$' />
<char num='8855' name='otimes' convertTo='$\\otimes$' /> <char num='8855' name='otimes' convertTo='$\\otimes$' />
@ -276,7 +276,7 @@ module MaRuKu; module Out; module Latex
<char num='174' name='reg' convertTo='\\textregistered' /> <char num='174' name='reg' convertTo='\\textregistered' />
<char num='170' name='ordf' convertTo='\\textordfeminine' /> <char num='170' name='ordf' convertTo='\\textordfeminine' />
<char num='172' name='not' convertTo='$\\neg$' /> <char num='172' name='not' convertTo='$\\neg$' />
<!-- <char num='176' name='deg' convertTo='$\\degree$' /> <!-- mathabx --> <!-- <char num='176' name='deg' convertTo='$\\degree$' /> --><!-- mathabx -->
<char num='176' name='deg' convertTo='\\textdegree' package='textcomp'/> <char num='176' name='deg' convertTo='\\textdegree' package='textcomp'/>
<char num='177' name='plusmn' convertTo='$\\pm$' /> <char num='177' name='plusmn' convertTo='$\\pm$' />

View file

@ -69,4 +69,17 @@ The HTML specification is maintained by the W3C.Operation Tigra Genesis is going
<p>*[Tigra Genesis]:</p> <p>*[Tigra Genesis]:</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
The HTML specification is maintained by the W3C.
</p>
<p>
*[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium
</p>
<p>
Operation Tigra Genesis is going well.
</p>
<p>
*[Tigra Genesis]:
</p>
</div>

View file

@ -27,4 +27,8 @@ bar
<p><img src="/foo.jpg" alt="bar" title="" /></p> <p><img src="/foo.jpg" alt="bar" title="" /></p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
<img title='' src='/foo.jpg' alt='bar'/>
</p>
</div>

View file

@ -31,4 +31,8 @@ md_el(:document,[
{:b: a}</p> {:b: a}</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
{a}: a {:b: a}
</p>
</div>

View file

@ -42,4 +42,11 @@ Paragraph1Paragraph2
Paragraph2</p> Paragraph2</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Paragraph1 {:#par1}
</p>
<p>
{:#par2} Paragraph2
</p>
</div>

View file

@ -79,4 +79,27 @@ Header with attributesHeader with attributesHeader no attributesParagraph with a
<p>{:hello: .chello}</p> <p>{:hello: .chello}</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<h2>
Header with attributes {#header1}
</h2>
<h3>
Header with attributes ### {#header2}
</h3>
<h3>
Header no attributes
</h3>
<p>
{:warn2}Paragraph with a. {#par1}
</p>
<p>
Paragraph with
<em>
emphasis
</em>
{:hello notfound} {#par2}
</p>
<p>
{:hello: .chello}
</p>
</div>

View file

@ -40,4 +40,11 @@ Paragraph
{:b: a}</p> {:b: a}</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Paragraph {:a}
</p>
<p>
{:a: b} {:b: a}
</p>
</div>

View file

@ -35,4 +35,11 @@ Paragraph2
<p>{paragraph}: .maruku-par</p> <p>{paragraph}: .maruku-par</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Paragraph2 {#2}
</p>
<p>
{paragraph}: .maruku-par
</p>
</div>

View file

@ -36,4 +36,11 @@ Linea 1Linea 2
<p>Linea 2</p> <p>Linea 2</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Linea 1
</p>
<p>
Linea 2
</p>
</div>

View file

@ -103,4 +103,29 @@ four
</code></pre> </code></pre>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
This block is composed of three lines:
</p>
<pre>
<code>
one three
</code>
</pre>
<p>
This block is composed of 5
</p>
<pre>
<code>
one four
</code>
</pre>
<p>
This block is composed of 2
</p>
<pre>
<code>
two
</code>
</pre>
</div>

View file

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

View file

@ -64,4 +64,15 @@ hellohh c1c2
<p>{:t: scope="row"}</p> <p>{:t: scope="row"}</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
hello {: summary="Table summary" .class1 style="color:red"}
</p>
<p>
h | h ----------|-- {:t} c1 | c2 {: summary="Table summary" .class1
style="color:red"}
</p>
<p>
{:t: scope="row"}
</p>
</div>

View file

@ -50,4 +50,13 @@ end tell
</code></pre> </code></pre>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Here is an example of AppleScript:
</p>
<pre>
<code>
tell application "Foo" beep end tell tab
</code>
</pre>
</div>

View file

@ -43,4 +43,15 @@ Code
</blockquote> </blockquote>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<blockquote>
<p>
Code
</p>
<pre>
<code>
Ciao
</code>
</pre>
</blockquote>
</div>

View file

@ -99,4 +99,37 @@ This is code (4 spaces):This is not codeThis is code (1 tab):This is not code
</code></pre> </code></pre>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
This is code (4 spaces):
</p>
<pre>
<code>
Code
</code>
</pre>
<p>
This is not code
</p>
<pre>
<code>
Code
</code>
</pre>
<p>
This is code (1 tab):
</p>
<pre>
<code>
Code
</code>
</pre>
<p>
This is not code
</p>
<pre>
<code>
Code
</code>
</pre>
</div>

View file

@ -39,4 +39,10 @@ ijkl</li>
</ol> </ol>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<ol>
<li>
abcd efgh ijkl
</li>
</ol>
</div>

View file

@ -25,4 +25,15 @@ Hello! how are you?
<p><em>Hello!</em> how are <strong>you</strong>?</p> <p><em>Hello!</em> how are <strong>you</strong>?</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
<em>
Hello!
</em>
how are
<strong>
you
</strong>
?
</p>
</div>

View file

@ -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="&#x6D;&#97;&#x69;&#x6C;&#116;&#x6F;:&#97;&#x6E;&#x64;&#114;&#x65;&#97;&#64;&#105;&#110;&#118;&#97;li&#100;&#46;&#x69;&#116;">&#97;&#x6E;&#x64;&#114;&#x65;&#97;&#64;&#105;&#110;&#118;&#97;li&#100;&#46;&#x69;&#116;</a></p> <p>This is an email address: <a href="&#109;&#x61;&#x69;&#108;&#116;&#111;:&#97;&#x6E;&#100;&#114;&#x65;&#x61;&#64;&#105;&#110;&#x76;&#97;&#x6C;&#x69;&#100;&#46;&#x69;&#x74;">&#97;&#x6E;&#100;&#114;&#x65;&#x61;&#64;&#105;&#110;&#x76;&#97;&#x6C;&#x69;&#100;&#46;&#x69;&#x74;</a></p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> Error: #<TypeError: no implicit conversion from nil to integer>

View file

@ -35,4 +35,11 @@ This is iso-8859-1: àèìàù.
<p>This is iso-8859-1: àèìàù.</p> <p>This is iso-8859-1: àèìàù.</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Encoding: iso-8859-1
</p>
<p>
This is iso-8859-1: àèìàù.
</p>
</div>

View file

@ -30,4 +30,11 @@ Japanese: マルク
<p>Japanese: マルク</p> <p>Japanese: マルク</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Italian: àèìòù.
</p>
<p>
Japanese: マルク
</p>
</div>

View file

@ -121,4 +121,49 @@ Maruku translates HTML entities to the equivalent in LaTeX:EntityResultabEntity-
<p>It should read just like this: <code>&amp;copy;</code>.</p> <p>It should read just like this: <code>&amp;copy;</code>.</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Maruku translates HTML entities to the equivalent in LaTeX:
</p>
<p>
Entity | Result ------------|----------
<code>
&amp;copy;
</code>
| &copy;
<code>
&amp;pound;
</code>
| &pound;
<code>
a&amp;nbsp;b
</code>
| a&nbsp;b
<code>
&amp;lambda;
</code>
| &lambda;
<code>
&amp;mdash;
</code>
| &mdash;
</p>
<p>
Entity-substitution does not happen in code blocks or inline code.
</p>
<p>
The following should not be translated:
</p>
<pre>
<code>
&amp;copy;
</code>
</pre>
<p>
It should read just like this:
<code>
&amp;copy;
</code>
.
</p>
</div>

View file

@ -74,7 +74,7 @@ Hello: ! ! ` { } [ ] ( ) # . ! * * *Ora, emphasis, bold, * <- due asterischi-> *
*** Output of Markdown.pl *** *** Output of Markdown.pl ***
<p>Hello: ! ! ` { } [ ] ( ) # . ! * * *</p> <p>Hello: ! ! ` { } <math xmlns='http://www.w3.org/1998/Math/MathML' display='block'><merror><mtext></mtext></merror></math> ( ) # . ! * * *</p>
<p>Ora, <em>emphasis</em>, <strong>bold</strong>, * &lt;- due asterischi-> * , un underscore-> _ , <em>emphasis</em>, <p>Ora, <em>emphasis</em>, <strong>bold</strong>, * &lt;- due asterischi-> * , un underscore-> _ , <em>emphasis</em>,
incre<em>dible</em>e!</p> incre<em>dible</em>e!</p>
@ -86,4 +86,52 @@ Hello: ! ! ` { } [ ] ( ) # . ! * * *Ora, emphasis, bold, * <- due asterischi-> *
<p>End of <code>paragraph</code></p> <p>End of <code>paragraph</code></p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Hello: ! ! ` { }
<math display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
<merror>
<mtext/>
</merror>
</math>
( ) # . ! * * *
</p>
<p>
Ora,
<em>
emphasis
</em>
,
<strong>
bold
</strong>
, * &lt;- due asterischi-> * , un underscore-> _ ,
<em>
emphasis
</em>
, incre
<em>
dible
</em>
e!
</p>
<p>
This is
<code>
Code with a special: -&gt; ` &lt;-
</code>
(after)
</p>
<p>
<code>
Start
</code>
of paragraph
</p>
<p>
End of
<code>
paragraph
</code>
</p>
</div>

View file

@ -69,4 +69,14 @@ ApplePomaceous fruit of plants of the genus Malus in the family Rosaceae.OrangeT
: The fruit of an evergreen tree of the genus Citrus.</p> : The fruit of an evergreen tree of the genus Citrus.</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
CSS: style.css
</p>
<p>
Apple : Pomaceous fruit of plants of the genus Malus in the family Rosaceae.
</p>
<p>
Orange : The fruit of an evergreen tree of the genus Citrus.
</p>
</div>

View file

@ -83,4 +83,30 @@ Header 1Header 2Header 3Then you can create links to different parts of the same
<a href="#header3">Link back to header 3</a></p> <a href="#header3">Link back to header 3</a></p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<h1>
Header 1 {#header1}
</h1>
<h2>
Header 2 {#header2}
</h2>
<h3>
Header 3 ### {#header3}
</h3>
<p>
Then you can create links to different parts of the same document like this:
</p>
<p>
<a href='#header1'>
Link back to header 1
</a>
,
<a href='#header2'>
Link back to header 2
</a>
,
<a href='#header3'>
Link back to header 3
</a>
</p>
</div>

View file

@ -52,4 +52,12 @@ Content Cell | Content Cell
Content Cell | Content Cell</p> Content Cell | Content Cell</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
CSS: style.css
</p>
<p>
First Header | Second Header ------------- | ------------- Content Cell |
Content Cell Content Cell | Content Cell
</p>
</div>

View file

@ -123,4 +123,30 @@ This is second sentence (same paragraph).</p>
<p>This is not a footnote.</p> <p>This is not a footnote.</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
That's some text with a footnote [^b] and another [^c] and another [^a].
</p>
<p>
[^a]: And that's the footnote.
</p>
<pre>
<code>
That's the second paragraph of the footnote.
</code>
</pre>
<p>
[^b]: And that's the footnote. This is second sentence (same paragraph).
</p>
<p>
[^c]: This is the very long one.
</p>
<pre>
<code>
That's the second paragraph.
</code>
</pre>
<p>
This is not a footnote.
</p>
</div>

View file

@ -51,4 +51,23 @@ A title with emphasisA title with emphasisA title with emphasis
<h4>A title with <em>emphasis</em></h4> <h4>A title with <em>emphasis</em></h4>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<h1>
A title with
<em>
emphasis
</em>
</h1>
<h2>
A title with
<em>
emphasis
</em>
</h2>
<h4>
A title with
<em>
emphasis
</em>
</h4>
</div>

View file

@ -47,4 +47,10 @@ Examples of numeric character references include or for the copyright symbol,
<p>Examples of numeric character references include &#169; or &#xA9; for the copyright symbol, &#913; or &#x391; for the Greek capital letter alpha, and &#1575; or &#x627; for the Arabic letter alef.</p> <p>Examples of numeric character references include &#169; or &#xA9; for the copyright symbol, &#913; or &#x391; for the Greek capital letter alpha, and &#1575; or &#x627; for the Arabic letter alef.</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Examples of numeric character references include &#169; or &#xA9; for the
copyright symbol, &#913; or &#x391; for the Greek capital letter alpha, and
&#1575; or &#x627; for the Arabic letter alef.
</p>
</div>

View file

@ -57,4 +57,10 @@ md_el(:document,[
<hr /> <hr />
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<hr/>
<hr/>
<hr/>
<hr/>
<hr/>
</div>

View file

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

View file

@ -44,4 +44,24 @@ involve <b href="http://www.flickr.com/photos/censi/70893277/">coffee</b>,
<a href="http://www.flickr.com/photos/censi/42775888/in/set-936677/">sushi</a>,</p> <a href="http://www.flickr.com/photos/censi/42775888/in/set-936677/">sushi</a>,</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
taking part in
<a href='http://sied.dis.uniroma1.it/'>
some arcane conspirations
</a>
which involve
<b href='http://www.flickr.com/photos/censi/70893277/'>
coffee
</b>
,
<a href='http://flickr.com/photos/censi/42775664/in/set-936677/'>
robots
</a>
,
<a href='http://www.flickr.com/photos/censi/42775888/in/set-936677/'>
sushi
</a>
,
</p>
</div>

View file

@ -39,4 +39,10 @@ md_el(:document,[
</div> </div>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<div class='frame'>
<a href='http://www.flickr.com/photos/censi/54757256/' class='photo'>
<img src='http://static.flickr.com/27/54757256_1a2c1d2a95_m.jpg' moz-do-not-send='true' alt=''/>
</a>
</div>
</div>

View file

@ -35,4 +35,12 @@ md_el(:document,[
</div></p> </div></p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
<div class='frame'>
<a href='http://www.flickr.com/photos/censi/88561568/' class='photo'>
<img src='http://static.flickr.com/28/88561568_ab84d28245_m.jpg' height='180' moz-do-not-send='true' alt='Aperitif' width='240'/>
</a>
</div>
</p>
</div>

View file

@ -79,4 +79,50 @@ md_el(:document,[
<p>{:html<em>use</em>syntax=true lang=xml}</p> <p>{:html<em>use</em>syntax=true lang=xml}</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
<code>
&lt;p&gt;here's an apostrophe &amp; a quote "&lt;/p&gt;
</code>
</p>
<pre>
<code>
&lt;p&gt;here's an apostrophe &amp; a quote "&lt;/p&gt;
</code>
</pre>
<p>
{:}
</p>
<pre>
<code>
&lt;p&gt;here's an apostrophe &amp; a quote "&lt;/p&gt;
</code>
</pre>
<p>
{:lang=xml}
</p>
<pre>
<code>
&lt;p&gt;here's an apostrophe &amp; a quote "&lt;/p&gt;
</code>
</pre>
<p>
{:html
<em>
use
</em>
syntax=true lang=not_supported}
</p>
<pre>
<code>
&lt;p&gt;here's an apostrophe &amp; a quote "&lt;/p&gt;
</code>
</pre>
<p>
{:html
<em>
use
</em>
syntax=true lang=xml}
</p>
</div>

View file

@ -111,4 +111,28 @@ This page does not uilizes Cascading Style SheetsPlease mouseover to see the tit
style="border:0;width:188px;height:131px"</p> style="border:0;width:188px;height:131px"</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
This page does not uilizes
<img title='' src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Cascading Style Sheets'/>
</p>
<p>
Please mouseover to see the title:
<img title='Title ok!' src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Cascading Style Sheets'/>
</p>
<p>
Please mouseover to see the title:
<img title='Title ok!' src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Cascading Style Sheets'/>
</p>
<p>
I'll say it one more time: this page does not use
<img title='Optional title attribute' src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Cascading Style Sheets'/>
</p>
<p>
This is double size: ![Cascading Style Sheets] [css2]
</p>
<p>
[css2]: http://jigsaw.w3.org/css-validator/images/vcss "Optional title
attribute" class=external style="border:0;width:188px;height:131px"
</p>
</div>

View file

@ -43,4 +43,13 @@ This is an image.This is an image.
<p>This is an ![image].</p> <p>This is an ![image].</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
This is an
<img src='image.jpg' alt='image'/>
.
</p>
<p>
This is an ![image].
</p>
</div>

View file

@ -238,16 +238,16 @@ 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>
/sw/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:320:in `pull'
/sw/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:21:in `parse'
/sw/lib/ruby/1.8/rexml/document.rb:190:in `build' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:204:in `build'
/sw/lib/ruby/1.8/rexml/document.rb:45: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'
bin/marutest:263:in `marutest' bin/marutest:275:in `marutest'
bin/marutest:260:in `each' bin/marutest:272:in `each'
bin/marutest:260:in `marutest' bin/marutest:272:in `marutest'
bin/marutest:335 bin/marutest:347
... ...
Missing end tag for 'img' (got "p") Missing end tag for 'img' (got "p")
Line: Line:

View file

@ -33,4 +33,11 @@ md_el(:document,[
<p markdown="1">Test **bold**</p> <p markdown="1">Test **bold**</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<div markdown='1'>
Test **bold**
</div>
<p markdown='1'>
Test **bold**
</p>
</div>

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>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="&#x6D;&#97;&#x69;&#x6C;&#x74;&#x6F;:&#x62;&#105;&#x6C;&#x6C;&#64;&#x67;&#111;&#x6F;&#103;&#108;&#101;&#x2E;&#x63;&#111;&#109;">&#x62;&#105;&#x6C;&#x6C;&#64;&#x67;&#111;&#x6F;&#103;&#108;&#101;&#x2E;&#x63;&#111;&#109;</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="&#x6D;&#x61;i&#108;&#x74;o:&#x62;&#x69;l&#108;&#64;&#x67;&#111;o&#x67;&#108;&#x65;&#46;&#x63;&#111;&#x6D;">&#x62;&#x69;l&#108;&#64;&#x67;&#111;o&#x67;&#108;&#x65;&#46;&#x63;&#111;&#x6D;</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,16 +175,16 @@ Line:
Position: Position:
Last 80 unconsumed characters: Last 80 unconsumed characters:
> >
/sw/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:320:in `pull'
/sw/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:21:in `parse'
/sw/lib/ruby/1.8/rexml/document.rb:190:in `build' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:204:in `build'
/sw/lib/ruby/1.8/rexml/document.rb:45: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'
bin/marutest:263:in `marutest' bin/marutest:275:in `marutest'
bin/marutest:260:in `each' bin/marutest:272:in `each'
bin/marutest:260:in `marutest' bin/marutest:272:in `marutest'
bin/marutest:335 bin/marutest:347
... ...
Missing end tag for 'p' (got "div") Missing end tag for 'p' (got "div")
Line: Line:

View file

@ -63,4 +63,17 @@ A list item with a blockquote:This is a blockquote inside a list item.
</ul> </ul>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<ul>
<li>
<p>
A list item with a blockquote:
</p>
<blockquote>
<p>
This is a blockquote inside a list item.
</p>
</blockquote>
</li>
</ul>
</div>

View file

@ -73,4 +73,22 @@ sit amet, consectetuer adipiscing elit.</p></li>
</ul> </ul>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<ul>
<li>
<p>
This is a list item with two paragraphs.
</p>
<p>
This is the second paragraph in the list item. You're only required to
indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing
elit.
</p>
</li>
<li>
<p>
other
</p>
</li>
</ul>
</div>

View file

@ -85,4 +85,27 @@ A list item with a blockquote:This is a blockquote inside a list item.A list ite
</ul> </ul>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<ul>
<li>
<p>
A list item with a blockquote:
</p>
<blockquote>
<p>
This is a blockquote inside a list item.
</p>
</blockquote>
</li>
<li>
<p>
A list item with a code block:
</p>
<pre>
<code>
&lt;code goes here&gt;
</code>
</pre>
</li>
</ul>
</div>

View file

@ -113,4 +113,17 @@ ciao</p>
ciao</p> ciao</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
This is a list: * one * two
</p>
<p>
This is not a list: * one ciao
</p>
<p>
This is a list: 1. one 1. two
</p>
<p>
This is not a list: 1987. one ciao
</p>
</div>

View file

@ -238,4 +238,69 @@ sit amet, consectetuer adipiscing elit.</p></li>
</ul> </ul>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<ul>
<li>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit
mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet
vitae, risus.
</li>
<li>
Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem
consectetuer libero luctus adipiscing.
</li>
<li>
Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem
consectetuer libero luctus adipiscing.
<ul>
<li>
Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id
sem consectetuer libero luctus adipiscing.
</li>
<li>
Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id
sem consectetuer libero luctus adipiscing.
</li>
</ul>
</li>
</ul>
<p>
Ancora
</p>
<ul>
<li>
<p>
This is a list item with two paragraphs. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
</p>
<p>
ATTENZIONE!
</p>
</li>
<li>
<p>
Suspendisse id sem consectetuer libero luctus adipiscing.
</p>
</li>
</ul>
<p>
Ancora
</p>
<ul>
<li>
<p>
This is a list item with two paragraphs.
</p>
<p>
This is the second paragraph in the list item. You're only required to
indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing
elit.
</p>
</li>
<li>
<p>
Another item in the same list.
</p>
</li>
</ul>
</div>

View file

@ -28,4 +28,10 @@ md_el(:document,[md_par(["- \316\255\316\275\316\261"])],{},[])
</ul> </ul>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<ul>
<li>
ένα
</li>
</ul>
</div>

View file

@ -51,4 +51,4 @@ md_el(:document,[],{},[])
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div/>:REXML::Element> <div/>

View file

@ -76,4 +76,23 @@ CiaoTab * Tab * Tab
</ul> </ul>
*** 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>
<ul>
<li>
Tab
<ul>
<li>
Tab
<ul>
<li>
Tab
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>

View file

@ -133,4 +133,21 @@ aa1a2b
</ul> </ul>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<ul>
<li>
a
<ul>
<li>
a1
</li>
<li>
a2
</li>
</ul>
</li>
<li>
b
</li>
</ul>
</div>

View file

@ -80,4 +80,19 @@ Here is a paragraph.* Item 1 * Item 2 * Item 3
</ul> </ul>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Here is a paragraph.
</p>
<ul>
<li>
Item 1
</li>
<li>
Item 2
</li>
<li>
Item 3
</li>
</ul>
</div>

View file

@ -82,4 +82,24 @@ DuetretretreDue
</ul> </ul>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<ul>
<li>
Due
<ol>
<li>
tre
</li>
<li>
tre
</li>
<li>
tre
</li>
</ol>
</li>
<li>
Due
</li>
</ul>
</div>

View file

@ -265,4 +265,85 @@ Paragraph, list with no space: * ciaoParagraph, list with 1 space: * ciaoParagra
<p>Paragraph with html after, indented: <em>Emphasis <em>tralla</em> Emph</em></p> <p>Paragraph with html after, indented: <em>Emphasis <em>tralla</em> Emph</em></p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Paragraph, list with no space: * ciao
</p>
<p>
Paragraph, list with 1 space: * ciao
</p>
<p>
Paragraph, list with 3 space: * ciao
</p>
<p>
Paragraph, list with 4 spaces: * ciao
</p>
<p>
Paragraph, list with 1 tab: * ciao
</p>
<p>
Paragraph (1 space after), list with no space: * ciao
</p>
<p>
Paragraph (2 spaces after), list with no space:
<br/>
* ciao
</p>
<p>
Paragraph (3 spaces after), list with no space:
<br/>
* ciao
</p>
<p>
Paragraph with block quote:
</p>
<blockquote>
<p>
Quoted
</p>
</blockquote>
<p>
Paragraph with header:
</p>
<h3>
header
</h3>
<p>
Paragraph with header on two lines:
</p>
<h2>
header
</h2>
<p>
Paragraph with html after
</p>
<div/>
<p>
Paragraph with html after, indented:
<em>
Emphasis
</em>
</p>
<p>
Paragraph with html after, indented:
<em>
Emphasis
</em>
<em>
tralla
</em>
<em>
Emph
</em>
</p>
<p>
Paragraph with html after, indented:
<em>
Emphasis
<em>
tralla
</em>
Emph
</em>
</p>
</div>

View file

@ -321,4 +321,93 @@ sit amet, consectetuer adipiscing elit.</p></li>
</ul> </ul>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<ol>
<li>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit
mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet
vitae, risus.
<ol>
<li>
Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id
sem consectetuer libero luctus adipiscing.
</li>
</ol>
</li>
<li>
Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem
consectetuer libero luctus adipiscing.
<ol>
<li>
Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id
sem consectetuer libero luctus adipiscing.
</li>
<li>
Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id
sem consectetuer libero luctus adipiscing.
</li>
</ol>
</li>
</ol>
<p>
Ancora
</p>
<ol>
<li>
<p>
This is a list item with two paragraphs. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
</p>
<p>
ATTENZIONE!
</p>
<ul>
<li>
Uno
</li>
<li>
Due
<ol>
<li>
tre
</li>
<li>
tre
</li>
<li>
tre
</li>
</ol>
</li>
<li>
Due
</li>
</ul>
</li>
<li>
<p>
Suspendisse id sem consectetuer libero luctus adipiscing.
</p>
</li>
</ol>
<p>
Ancora
</p>
<ul>
<li>
<p>
This is a list item with two paragraphs.
</p>
<p>
This is the second paragraph in the list item. You're only required to
indent the first line. Lorem ipsum dolor sit amet, consectetuer adipiscing
elit.
</p>
</li>
<li>
<p>
Another item in the same list.
</p>
</li>
</ul>
</div>

View file

@ -26,4 +26,9 @@ md_el(:document,[md_html("<br />")],{},[])
<p><br/>123</p> <p><br/>123</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
<br/>
123
</p>
</div>

View file

@ -54,16 +54,58 @@ $$ x = y $$$$ x$$ x = y $$$$ x = y $$
*** Output of Markdown.pl *** *** Output of Markdown.pl ***
<p>$$ x = y $$</p> <math xmlns='http://www.w3.org/1998/Math/MathML' display='block'><mi>x</mi><mo>=</mo><mi>y</mi></math>
<p>$$ x <math xmlns='http://www.w3.org/1998/Math/MathML' display='block'><mi>x</mi><mo>=</mo><mi>y</mi></math>
= y $$</p>
<p>$$ <math xmlns='http://www.w3.org/1998/Math/MathML' display='block'><mi>x</mi><mo>=</mo><mi>y</mi></math>
x = y $$</p>
<p>$$ x = y <math xmlns='http://www.w3.org/1998/Math/MathML' display='block'><mi>x</mi><mo>=</mo><mi>y</mi></math>
$$</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<math display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
<mi>
x
</mi>
<mo>
=
</mo>
<mi>
y
</mi>
</math>
<math display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
<mi>
x
</mi>
<mo>
=
</mo>
<mi>
y
</mi>
</math>
<math display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
<mi>
x
</mi>
<mo>
=
</mo>
<mi>
y
</mi>
</math>
<math display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
<mi>
x
</mi>
<mo>
=
</mo>
<mi>
y
</mi>
</math>
</div>

View file

@ -91,11 +91,61 @@ Here are some formulas:Thats it, nothing else is supported.
<p>Here are some formulas:</p> <p>Here are some formulas:</p>
<ul> <ul>
<li>$\alpha$</li> <li><math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><mi>&alpha;</mi></math></li>
<li>$x^{n}+y^{n} \neq z^{n}$</li> <li><math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><msup><mi>x</mi> <mi>n</mi></msup><mo>+</mo><msup><mi>y</mi> <mi>n</mi></msup><mo>&ne;</mo><msup><mi>z</mi> <mi>n</mi></msup></math></li>
</ul> </ul>
<p>That's it, nothing else is supported.</p> <p>That's it, nothing else is supported.</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Here are some formulas:
</p>
<ul>
<li>
<math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'>
<mi>
&alpha;
</mi>
</math>
</li>
<li>
<math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'>
<msup>
<mi>
x
</mi>
<mi>
n
</mi>
</msup>
<mo>
+
</mo>
<msup>
<mi>
y
</mi>
<mi>
n
</mi>
</msup>
<mo>
&ne;
</mo>
<msup>
<mi>
z
</mi>
<mi>
n
</mi>
</msup>
</math>
</li>
</ul>
<p>
That's it, nothing else is supported.
</p>
</div>

View file

@ -57,9 +57,7 @@ md_el(:document,[
*** Output of Markdown.pl *** *** Output of Markdown.pl ***
<p>[ <math xmlns='http://www.w3.org/1998/Math/MathML' display='block'><mi>&alpha;</mi></math>
\alpha
]</p>
<p>\begin{equation} <p>\begin{equation}
\alpha \alpha
@ -71,4 +69,19 @@ md_el(:document,[
<p>\begin{equation} \gamma \end{equation}</p> <p>\begin{equation} \gamma \end{equation}</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<math display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
<mi>
&alpha;
</mi>
</math>
<p>
\begin{equation} \alpha \end{equation}
</p>
<p>
\begin{equation} \beta \end{equation}
</p>
<p>
\begin{equation} \gamma \end{equation}
</p>
</div>

View file

@ -32,9 +32,24 @@ This is not $math$.[ \alpha ]
*** Output of Markdown.pl *** *** Output of Markdown.pl ***
<p>This is not $math$.</p> <p>This is not <math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><mi>math</mi></math>.</p>
<p>[ \alpha ]</p> <math xmlns='http://www.w3.org/1998/Math/MathML' display='block'><mi>&alpha;</mi></math>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
This is not
<math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'>
<mi>
math
</mi>
</math>
.
</p>
<math display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
<mi>
&alpha;
</mi>
</math>
</div>

View file

@ -48,11 +48,28 @@ md_el(:document,[
*** Output of Markdown.pl *** *** Output of Markdown.pl ***
<table markdown='1'> <table markdown='1'>
$\alpha$ <math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><mi>&alpha;</mi></math>
<thead> <thead>
<td>$\beta$</td> <td><math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><mi>&beta;</mi></math></td>
</thead> </thead>
</table> </table>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<table markdown='1'>
<math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'>
<mi>
&alpha;
</mi>
</math>
<thead>
<td>
<math display='inline' xmlns='http://www.w3.org/1998/Math/MathML'>
<mi>
&beta;
</mi>
</math>
</td>
</thead>
</table>
</div>

View file

@ -57,4 +57,12 @@ SymbolMeaningcomments The firstI like it. The firstI like it.
<p>{:r: scope='row'}</p> <p>{:r: scope='row'}</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Symbol | Meaning | comments ------------|---------|--------- {:r} &alpha; |
The first | I like it. {:r} &aleph; | The first | I like it.
</p>
<p>
{:r: scope='row'}
</p>
</div>

View file

@ -612,4 +612,326 @@ the alternative is PowerPoint with the <a href="http://texpoint.necula.org/">Tex
</ul> </ul>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Subject: Software not painful to use Subject_short: painless software Topic:
/misc/coolsw Archive: no Date: Nov 20 2006 Order: -9.5 inMenu: true
</p>
<h3>
General
</h3>
<ul>
<li>
<em>
Operating System
</em>
:
<a href='http://www.apple.com/getamac/'>
Mac OS X
</a>
: heaven, after the purgatory of Linux and the hell of Windows.
</li>
<li>
<em>
Browser
</em>
:
<a href='http://getfirefox.com/'>
Firefox
</a>
. On a Mac,
<a href='http://www.caminobrowser.org/'>
Camino
</a>
.
</li>
<li>
<em>
Email
</em>
:
<a href='http://gmail.com/'>
GMail
</a>
, "search, don't sort" really works.
</li>
<li>
<em>
Text Editor
</em>
:
<a href='http://www.apple.com/getamac/'>
TextMate
</a>
, you have to buy it, but it's worth every penny. There are rumours that it's
been converting (recovering) Emacs users (addicts). Unfortunately, it's Mac
only. An alternative is
<a href='http://www.jedit.org/'>
jedit
</a>
(GPL, Java).
</li>
</ul>
<h3>
Development
</h3>
<ul>
<li>
<em>
Build system
</em>
:
<a href='http://www.cmake.org/'>
cmake
</a>
, throw the
<a href='http://sources.redhat.com/autobook/'>
autotools
</a>
away.
</li>
<li>
<em>
Source code control system
</em>
: ditch CVS for
<a href='http://subversion.tigris.org'>
subversion
</a>
.
</li>
<li>
<em>
Project management
</em>
:
<a href='http://trac.edgewall.org/'>
Trac
</a>
tracks everything.
</li>
<li>
<p>
<em>
Scripting language
</em>
:
<a href='http://www.ruby-lang.org/'>
Ruby
</a>
is Japanese pragmatism (and has a
<a href='http://poignantguide.net/ruby/'>
poignant
</a>
guide). Python, you say? Python is too academic and snob:
</p>
<p>
$ python
<br/>
Python 2.4.1 (#1, Jun 4 2005, 00:54:33) Type "help", "copyright", "credits"
or "license" for more information.
</p>
<blockquote>
<blockquote>
<blockquote>
<p>
exit 'Use Ctrl-D (i.e. EOF) to exit.' quit 'Use Ctrl-D (i.e. EOF) to
exit.'
</p>
</blockquote>
</blockquote>
</blockquote>
</li>
<li>
<p>
<em>
Java IDE
</em>
:
<a href='http://www.borland.com/us/products/jbuilder/index.html'>
JBuilder
</a>
is great software and has a free version (IMHO better than Eclipse). Java
is not a pain anymore since it gained
<a href='http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html'>
generics
</a>
and got opensourced.
</p>
</li>
<li>
<em>
Mark-up language
</em>
: HTML is so 2001, why don't you take at look at
<a href='http://en.wikipedia.org/wiki/Markdown'>
Markdown
</a>
?
<a href='data/misc_markdown.png'>
Look at the source of this page
</a>
.
</li>
<li>
<em>
C++ libraries
</em>
:
<ul>
<li>
<a href='http://www.trolltech.no/'>
QT
</a>
for GUIs.
</li>
<li>
<a href='http://www.gnu.org/software/gsl/'>
GSL
</a>
for math.
</li>
<li>
<a href='http://www.imagemagick.org/Magick++/'>
Magick++
</a>
for manipulating images.
</li>
<li>
<a href='http://cairographics.org/'>
Cairo
</a>
for creating PDFs.
</li>
<li>
<a href='http://www.boost.org/'>
Boost
</a>
for just about everything else.
</li>
</ul>
</li>
</ul>
<h3>
Research
</h3>
<ul>
<li>
<em>
Writing papers
</em>
:
<a href='http://en.wikipedia.org/wiki/LaTeX'>
LaTeX
</a>
</li>
<li>
<em>
Writing papers &amp; enjoying the process
</em>
:
<a href='http://www.lyx.org'>
LyX
</a>
</li>
<li>
<em>
Handsome figures in your papers
</em>
:
<a href='http://www.xfig.org/'>
xfig
</a>
or, better,
<a href='http://tams-www.informatik.uni-hamburg.de/applets/jfig/'>
jfig
</a>
.
</li>
<li>
<em>
The occasional presentation with many graphical content
</em>
:
<a href='http://www.openoffice.org/product/impress.html'>
OpenOffice Impress
</a>
(using the
<a href='http://ooolatex.sourceforge.net/'>
OOOlatex plugin
</a>
); the alternative is PowerPoint with the
<a href='http://texpoint.necula.org/'>
TexPoint
</a>
plugin.
</li>
<li>
<em>
Managing BibTeX
</em>
:
<a href='http://jabref.sourceforge.net/'>
jabref
</a>
: multi-platform, for all your bibtex needs.
</li>
<li>
<em>
IEEExplore and BibTeX
</em>
: convert citations using
<a href='http://www.bibconverter.net/ieeexplore/'>
BibConverter
</a>
.
</li>
</ul>
<h3>
Cool websites
</h3>
<ul>
<li>
<em>
Best site in the wwworld
</em>
:
<a href='http://en.wikipedia.org/'>
Wikipedia
</a>
</li>
<li>
<a href='http://www.mutopiaproject.org/'>
Mutopia
</a>
for sheet music;
<a href='http://www.gutenberg.org/'>
the Gutenberg Project
</a>
for books;
<a href='http://www.liberliber.it/'>
LiberLiber
</a>
for books in italian.
</li>
<li>
<em>
Blogs
</em>
:
<a href='http://bloglines.com/'>
Bloglines
</a>
</li>
<li>
<em>
Sharing photos
</em>
:
<a href='http://www.flickr.com/'>
flickr
</a>
exposes an API you can use.
</li>
</ul>
</div>

View file

@ -33,4 +33,15 @@ md_el(:document,[md_par([md_code("\\\\")]), md_par([md_code("\\")])],{},[])
<p><code>\</code></p> <p><code>\</code></p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
<code>
\\
</code>
</p>
<p>
<code>
\
</code>
</p>
</div>

View file

@ -78,4 +78,23 @@ ParagraphheaderParagraphheaderParagraphheader
<h1>header</h1> <h1>header</h1>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Paragraph
</p>
<h3>
header
</h3>
<p>
Paragraph
</p>
<h2>
header
</h2>
<p>
Paragraph
</p>
<h1>
header
</h1>
</div>

View file

@ -28,4 +28,10 @@ md_el(:document,[md_par([md_code("There is a literal backtick (`) here.")])],{},
<p><code>There is a literal backtick (`) here.</code></p> <p><code>There is a literal backtick (`) here.</code></p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
<code>
There is a literal backtick (`) here.
</code>
</p>
</div>

View file

@ -203,4 +203,53 @@ Paragraph, list with no space: * ciaoParagraph, list with 1 space: * ciaoParagra
<h2>header</h2> <h2>header</h2>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Paragraph, list with no space: * ciao
</p>
<p>
Paragraph, list with 1 space: * ciao
</p>
<p>
Paragraph, list with 3 space: * ciao
</p>
<p>
Paragraph, list with 4 spaces: * ciao
</p>
<p>
Paragraph, list with 1 tab: * ciao
</p>
<p>
Paragraph (1 space after), list with no space: * ciao
</p>
<p>
Paragraph (2 spaces after), list with no space:
<br/>
* ciao
</p>
<p>
Paragraph (3 spaces after), list with no space:
<br/>
* ciao
</p>
<p>
Paragraph with block quote:
</p>
<blockquote>
<p>
Quoted
</p>
</blockquote>
<p>
Paragraph with header:
</p>
<h3>
header
</h3>
<p>
Paragraph with header on two lines:
</p>
<h2>
header
</h2>
</div>

View file

@ -61,4 +61,19 @@ This is a list:onetwothree
</ol> </ol>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
This is a list:
</p>
<ol>
<li>
one
</li>
<li>
two
</li>
<li>
three
</li>
</ol>
</div>

View file

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

View file

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

View file

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

View file

@ -36,4 +36,11 @@ Paragraph1Paragraph2
<p>Paragraph2</p> <p>Paragraph2</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Paragraph1
</p>
<p>
Paragraph2
</p>
</div>

View file

@ -63,4 +63,16 @@ Paragraph Br-> <br />
Paragraph 5</p> Paragraph 5</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Paragraph 1
</p>
<p>
Paragraph 2
</p>
<p>
Paragraph 3 Paragraph 4 Paragraph Br->
<br/>
Paragraph 5
</p>
</div>

View file

@ -25,4 +25,8 @@ Search on Google imagesGoOgle search ]
<p>Search on [Google images][ GoOgle search ]</p> <p>Search on [Google images][ GoOgle search ]</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Search on [Google images][ GoOgle search ]
</p>
</div>

View file

@ -85,4 +85,36 @@ inspiration for Markdown's syntax is the format of plain text email.</p>
<p>To this end, Markdown's syntax is comprised entirely of punctuation</p> <p>To this end, Markdown's syntax is comprised entirely of punctuation</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
filters -- including
<a href='http://docutils.sourceforge.net/mirror/setext.html'>
Setext
</a>
,
<a href='http://www.aaronsw.com/2002/atx/'>
atx
</a>
,
<a href='http://textism.com/tools/textile/'>
Textile
</a>
,
<a href='http://docutils.sourceforge.net/rst.html'>
reStructuredText
</a>
,
<a href='http://www.triptico.com/software/grutatxt.html'>
Grutatext
</a>
, and
<a href='http://ettext.taint.org/doc/'>
EtText
</a>
-- the single biggest source of inspiration for Markdown's syntax is the
format of plain text email.
</p>
<p>
To this end, Markdown's syntax is comprised entirely of punctuation
</p>
</div>

View file

@ -25,4 +25,4 @@ md_el(:document,[md_ref_def("6", "http://ettext.taint.org/doc/", {:title=>nil})]
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div/>:REXML::Element> <div/>

View file

@ -149,16 +149,16 @@ 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\'.</>
/sw/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:320:in `pull'
/sw/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:21:in `parse'
/sw/lib/ruby/1.8/rexml/document.rb:190:in `build' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/document.rb:204:in `build'
/sw/lib/ruby/1.8/rexml/document.rb:45: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'
bin/marutest:263:in `marutest' bin/marutest:275:in `marutest'
bin/marutest:260:in `each' bin/marutest:272:in `each'
bin/marutest:260:in `marutest' bin/marutest:272:in `marutest'
bin/marutest:335 bin/marutest:347
... ...
Missing end tag for 'here' (got "p") Missing end tag for 'here' (got "p")
Line: Line:

View file

@ -63,18 +63,8 @@ This is ruby code:This is ruby code:
<pre><code>require 'maruku' <pre><code>require 'maruku'
puts Maruku.new($stdin).to_html puts Maruku.new(&lt;math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'&gt;&lt;mi&gt;stdin&lt;/mi&gt;&lt;mo stretchy="false"&gt;)&lt;/mo&gt;&lt;mo&gt;.&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;to&lt;/mi&gt; &lt;mi&gt;html&lt;/mi&gt;&lt;/msub&gt;&lt;mi&gt;This&lt;/mi&gt;&lt;mi&gt;is&lt;/mi&gt;&lt;mi&gt;ruby&lt;/mi&gt;&lt;mi&gt;code&lt;/mi&gt;&lt;mo&gt;:&lt;/mo&gt;&lt;mi&gt;require&lt;/mi&gt;&lt;mo&gt;&amp;prime;&lt;/mo&gt;&lt;mi&gt;maruku&lt;/mi&gt;&lt;mo&gt;&amp;prime;&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;:&lt;/mo&gt;&lt;mi&gt;lang&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;ruby&lt;/mi&gt;&lt;msub&gt;&lt;mi&gt;html&lt;/mi&gt; &lt;mi&gt;use&lt;/mi&gt;&lt;/msub&gt;&lt;msub&gt;&lt;mo&gt;&lt;/mo&gt;&lt;mi&gt;syntax&lt;/mi&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;mi&gt;puts&lt;/mi&gt;&lt;mi&gt;Maruku&lt;/mi&gt;&lt;mo&gt;.&lt;/mo&gt;&lt;mi&gt;new&lt;/mi&gt;&lt;mo stretchy="false"&gt;(&lt;/mo&gt;&lt;/math&gt;stdin).to_html
</code></pre>
<p>This is ruby code:</p>
<pre><code>require 'maruku'
</code></pre>
<p>{: lang=ruby html<em>use</em>syntax}</p>
<pre><code>puts Maruku.new($stdin).to_html
</code></pre> </code></pre>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> Error: #<TypeError: no implicit conversion from nil to integer>

View file

@ -49,4 +49,13 @@ hh c1c2
<p>{:t: scope="row"}</p> <p>{:t: scope="row"}</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
h | h ----------|-- {:t} c1 | c2 {: summary="Table summary" .class1
style="color:red" border=3 width="50%" frame=lhs rules=cols cellspacing=2em
cellpadding=4px}
</p>
<p>
{:t: scope="row"}
</p>
</div>

View file

@ -29,4 +29,8 @@ md_el(:document,[md_el(:code,[],{:raw_code=>" $ python "},[])],{},[]
<p>$ python </p> <p>$ python </p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
$ python
</p>
</div>

View file

@ -85,4 +85,25 @@ Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet</li>
</ul> </ul>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem
ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum
dolor amet. Break:
<br/>
Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem
ipsum dolor amet.
</p>
<ul>
<li>
Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem
ipsum dolor amet Lorem ipsum Break:
<br/>
Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet
</li>
<li>
Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem ipsum dolor amet. Lorem
ipsum dolor amet
</li>
</ul>
</div>

View file

@ -51,4 +51,16 @@ width="600px" height="400px">
</svg:svg></p> </svg:svg></p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <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>

View file

@ -31,4 +31,8 @@ md_el(:document,[md_html("<!--\n<\n-->")],{},[])
--> -->
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<!--
<
-->
</div>

View file

@ -41,4 +41,13 @@ md_el(:document,[
</table> </table>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<table markdown='1'>
Blah
<thead>
<td>
*em*
</td>
</thead>
</table>
</div>

View file

@ -69,4 +69,23 @@ Targets Inside: last
<p>Inside: <?mrk puts "Inside: Hello" ?> last</p> <p>Inside: <?mrk puts "Inside: Hello" ?> last</p>
*** Output of Markdown.pl (parsed) *** *** Output of Markdown.pl (parsed) ***
Error: #<NoMethodError: private method `write_children' called for <div> ... </>:REXML::Element> <div>
<p>
<? noTarget?>
<?php ?>
<?xml ?>
<?mrk ?>
</p>
<p>
Targets
<? noTarget?>
<?php ?>
<?xml ?>
<?mrk ?>
</p>
<p>
Inside:
<?mrk puts "Inside: Hello"?>
last
</p>
</div>

View file

@ -0,0 +1,167 @@
# FUNDAMENTAL FLAWS:
# The order of $: must be preserved. Therefore, there are two sort
# criteria: Versioned files are sorted high; after that, the sort order
# is the order of $:.
# We must preserve the load path; if rexml-2.4 is required in one place,
# all rexml/* packages should be loaded from there.
############################################################################
# #
# This is based on Phil Tomson's #
# ("ptkwt!shell1#aracnet#com".tr("!#","@.")) #
# code. The changes I made are: #
# 1) The Version class is now a member of the Kernel module, to avoid #
# name space conflicts. #
# 2) Version::to_s() returns the original string, not a comma-separated #
# string. #
# 3) The versioning is package based, not file based. In fact, with #
# this, you can't version individual files. AFAIC, this is better, #
# since versioning on individual files is much more tedious than #
# package-based versioning, and it is arguably less useful and less #
# commonly desired. #
# 4) Versions can have arbitrary length. EG: 2.7 < 2.7.1, and "2" #
# matches any version that starts with "2", such as "2.5.2.6.7" #
# #
# The rules are these: #
# 1) All of the locations in $: will be searched #
# 2) The highest version of the package found that satisfies the #
# requirements will be used. #
# 3) If there is no versioned package, or no version matches, we default #
# to the normal Ruby require mechanism. This maintains backward #
# compatible behavior. #
# 4) The packages must be installed as foo-x.y.z. The cardinality of #
# the version is not significant, and packages that do not match this #
# naming pattern match by default. #
# #
# Rule (1) and (2) mean that the highest matching version anywhere in #
# the search path will be used. Rule (3) and (4) mean that even if #
# packages are not installed with this naming convention, programs that #
# use require_version will still work. #
# #
# Usage: #
# To use this, require this module. Then use require_with_ver, instead #
# of require in your files. #
# #
# Examples: #
# require_version('rexml/document'){|v| v > '2.0' and v < '2.5'} #
# require_version('rexml/document'){|v| v > '2.0'} #
# require_version('rexml/document') #
# require_version('rexml/document'){|v| v > '2.0'} #
# require_version('rexml/document'){|v| v >= '1.0' and v < '2.0'} #
# require_version('rexml/document'){|v| v >= '1.0' and v < '2.0' and #
# v != '1.7'} #
# require_version('rexml/document'){|v| (v >= '1.0' and #
# v < '2.0' and #
# v != '1.7') or #
# v == '3.0.1'} #
# require_version('rexml/document'){|v| v.to_s =~ /^2.[02468]/} #
# #
############################################################################
module Kernel
#########################################################
# Version - takes a string in the form: 'X1.X2.X3...Xn' #
# (where 'Xn' is a number) #
#########################################################
class Version
include Comparable
def initialize(str)
@vs = str.split('.').map!{|i| i.to_i}
end
def [](i)
@vs[i]
end
def to_s
@vs.join('.')
end
def <=>(other)
if other.class == String
other = Version.new(other)
end
@vs.each_with_index { |v,i|
return 1 unless other[i]
unless v == other[i]
return v <=> other[i]
end
}
return 0
end
end
alias :old_require :require
@@__versioned__ = {}
def require(file,&b)
path = file.split('/')
root = path[0]
rest = path[1..-1].join('/')
unless @@__versioned__[root]
package = File.dirname( file )
files = []
$:.each {|dir|
if File.exists? dir
fileset = Dir.new(dir).entries.delete_if {|f|
fpath = File.join( dir, f )
!(File.directory?(fpath) and f =~ /^#{root}(-\d(\.\d)*)?$/)
}
fileset.collect!{ |f| File.join( dir, f ) }
files += fileset
end
}
if files.size > 0
@@__versioned__[root] = files.uniq.sort{|x,y|
File.basename(x) <=> File.basename(y)
}
@@__versioned__[root].reverse!
else
@@__versioned__[root] = [root]
end
end
base = @@__versioned__[root][0]
if b #block_given?
p @@__versioned__[root]
base = @@__versioned__[root].delete_if { |f|
l = File.basename(f)
l.include?('-') and yield( Version.new( l.split('-')[1] ) ) and
Dir.new(f).entries.include?( rest+".rb" ) ? false : true
}
p base
base = base[0]
end
#old_require "#{base}/#{rest}"
puts <<-EOL
old_require "#{base}/#{rest}"
EOL
end
end
#=begin
# For testing
if $0 == __FILE__
$: << "./"
puts "\n\nv > '2.0' and v < '2.5'"
require('rexml/document'){|v| v > '2.0' and v < '2.5'}
puts "\n\nv > '2.0' and v < '3'"
require('rexml/document'){|v| v > '2.0' and v < '3'}
=begin
puts "\n\nv > '2.0'"
require('rexml/document'){|v| v > '2.0'}
require('rexml/document')
puts "\n\nv > '2.0'"
require('rexml/document'){|v| v > '2.0'}
puts "\n\nv >= '1.0' and v < '2.0'"
require('rexml/document'){|v| v >= '1.0' and v < '2.0'}
puts "\n\nv >= '1.0' and v < '2.0' and v != '1.7'"
require('rexml/document'){|v| v >= '1.0' and v < '2.0' and v != '1.7'}
require('rexml/document'){|v| (v >= '1.0' and
v < '2.0' and
v != '1.7') or
v == '3.0.1'}
puts "\n\nv.to_s =~ /^2.[02468]/"
require('rexml/document'){|v| v.to_s =~ /^2.[02468]/}
require('rexml/parsers/baseparser' )
=end
end
#=end

View file

@ -0,0 +1,62 @@
#vim:ts=2 sw=2 noexpandtab:
require 'rexml/child'
require 'rexml/source'
module REXML
# This class needs:
# * Documentation
# * Work! Not all types of attlists are intelligently parsed, so we just
# spew back out what we get in. This works, but it would be better if
# we formatted the output ourselves.
#
# AttlistDecls provide *just* enough support to allow namespace
# declarations. If you need some sort of generalized support, or have an
# interesting idea about how to map the hideous, terrible design of DTD
# AttlistDecls onto an intuitive Ruby interface, let me know. I'm desperate
# for anything to make DTDs more palateable.
class AttlistDecl < Child
include Enumerable
# What is this? Got me.
attr_reader :element_name
# Create an AttlistDecl, pulling the information from a Source. Notice
# that this isn't very convenient; to create an AttlistDecl, you basically
# have to format it yourself, and then have the initializer parse it.
# Sorry, but for the forseeable future, DTD support in REXML is pretty
# weak on convenience. Have I mentioned how much I hate DTDs?
def initialize(source)
super()
if (source.kind_of? Array)
@element_name, @pairs, @contents = *source
end
end
# Access the attlist attribute/value pairs.
# value = attlist_decl[ attribute_name ]
def [](key)
@pairs[key]
end
# Whether an attlist declaration includes the given attribute definition
# if attlist_decl.include? "xmlns:foobar"
def include?(key)
@pairs.keys.include? key
end
# Itterate over the key/value pairs:
# attlist_decl.each { |attribute_name, attribute_value| ... }
def each(&block)
@pairs.each(&block)
end
# Write out exactly what we got in.
def write out, indent=-1
out << @contents
end
def node_type
:attlistdecl
end
end
end

View file

@ -0,0 +1,188 @@
require "rexml/namespace"
require 'rexml/text'
module REXML
# Defines an Element Attribute; IE, a attribute=value pair, as in:
# <element attribute="value"/>. Attributes can be in their own
# namespaces. General users of REXML will not interact with the
# Attribute class much.
class Attribute
include Node
include Namespace
# The element to which this attribute belongs
attr_reader :element
# The normalized value of this attribute. That is, the attribute with
# entities intact.
attr_writer :normalized
PATTERN = /\s*(#{NAME_STR})\s*=\s*(["'])(.*?)\2/um
NEEDS_A_SECOND_CHECK = /(<|&((#{Entity::NAME});|(#0*((?:\d+)|(?:x[a-fA-F0-9]+)));)?)/um
# Constructor.
# FIXME: The parser doesn't catch illegal characters in attributes
#
# first::
# Either: an Attribute, which this new attribute will become a
# clone of; or a String, which is the name of this attribute
# second::
# If +first+ is an Attribute, then this may be an Element, or nil.
# If nil, then the Element parent of this attribute is the parent
# of the +first+ Attribute. If the first argument is a String,
# then this must also be a String, and is the content of the attribute.
# If this is the content, it must be fully normalized (contain no
# illegal characters).
# parent::
# Ignored unless +first+ is a String; otherwise, may be the Element
# parent of this attribute, or nil.
#
#
# Attribute.new( attribute_to_clone )
# Attribute.new( attribute_to_clone, parent_element )
# Attribute.new( "attr", "attr_value" )
# Attribute.new( "attr", "attr_value", parent_element )
def initialize( first, second=nil, parent=nil )
@normalized = @unnormalized = @element = nil
if first.kind_of? Attribute
self.name = first.expanded_name
@unnormalized = first.value
if second.kind_of? Element
@element = second
else
@element = first.element
end
elsif first.kind_of? String
@element = parent
self.name = first
@normalized = second.to_s
else
raise "illegal argument #{first.class.name} to Attribute constructor"
end
end
# Returns the namespace of the attribute.
#
# e = Element.new( "elns:myelement" )
# e.add_attribute( "nsa:a", "aval" )
# e.add_attribute( "b", "bval" )
# e.attributes.get_attribute( "a" ).prefix # -> "nsa"
# e.attributes.get_attribute( "b" ).prefix # -> "elns"
# a = Attribute.new( "x", "y" )
# a.prefix # -> ""
def prefix
pf = super
if pf == ""
pf = @element.prefix if @element
end
pf
end
# Returns the namespace URL, if defined, or nil otherwise
#
# e = Element.new("el")
# e.add_attributes({"xmlns:ns", "http://url"})
# e.namespace( "ns" ) # -> "http://url"
def namespace arg=nil
arg = prefix if arg.nil?
@element.namespace arg
end
# Returns true if other is an Attribute and has the same name and value,
# false otherwise.
def ==( other )
other.kind_of?(Attribute) and other.name==name and other.value==value
end
# Creates (and returns) a hash from both the name and value
def hash
name.hash + value.hash
end
# Returns this attribute out as XML source, expanding the name
#
# a = Attribute.new( "x", "y" )
# a.to_string # -> "x='y'"
# b = Attribute.new( "ns:x", "y" )
# b.to_string # -> "ns:x='y'"
def to_string
if @element and @element.context and @element.context[:attribute_quote] == :quote
%Q^#@expanded_name="#{to_s().gsub(/"/, '&quote;')}"^
else
"#@expanded_name='#{to_s().gsub(/'/, '&apos;')}'"
end
end
def doctype
if @element
doc = @element.document
doctype = doc.doctype if doc
end
end
# Returns the attribute value, with entities replaced
def to_s
return @normalized if @normalized
@normalized = Text::normalize( @unnormalized, doctype )
@unnormalized = nil
@normalized
end
# Returns the UNNORMALIZED value of this attribute. That is, entities
# have been expanded to their values
def value
return @unnormalized if @unnormalized
@unnormalized = Text::unnormalize( @normalized, doctype )
@normalized = nil
@unnormalized
end
# Returns a copy of this attribute
def clone
Attribute.new self
end
# Sets the element of which this object is an attribute. Normally, this
# is not directly called.
#
# Returns this attribute
def element=( element )
@element = element
if @normalized
Text.check( @normalized, NEEDS_A_SECOND_CHECK, doctype )
end
self
end
# Removes this Attribute from the tree, and returns true if successfull
#
# This method is usually not called directly.
def remove
@element.attributes.delete self.name unless @element.nil?
end
# Writes this attribute (EG, puts 'key="value"' to the output)
def write( output, indent=-1 )
output << to_string
end
def node_type
:attribute
end
def inspect
rv = ""
write( rv )
rv
end
def xpath
path = @element.xpath
path += "/@#{self.expanded_name}"
return path
end
end
end
#vim:ts=2 sw=2 noexpandtab:

67
vendor/plugins/rexml/lib/rexml/cdata.rb vendored Normal file
View file

@ -0,0 +1,67 @@
require "rexml/text"
module REXML
class CData < Text
START = '<![CDATA['
STOP = ']]>'
ILLEGAL = /(\]\]>)/
# Constructor. CData is data between <![CDATA[ ... ]]>
#
# _Examples_
# CData.new( source )
# CData.new( "Here is some CDATA" )
# CData.new( "Some unprocessed data", respect_whitespace_TF, parent_element )
def initialize( first, whitespace=true, parent=nil )
super( first, whitespace, parent, false, true, ILLEGAL )
end
# Make a copy of this object
#
# _Examples_
# c = CData.new( "Some text" )
# d = c.clone
# d.to_s # -> "Some text"
def clone
CData.new self
end
# Returns the content of this CData object
#
# _Examples_
# c = CData.new( "Some text" )
# c.to_s # -> "Some text"
def to_s
@string
end
def value
@string
end
# == DEPRECATED
# See the rexml/formatters package
#
# Generates XML output of this object
#
# output::
# Where to write the string. Defaults to $stdout
# indent::
# The amount to indent this node by
# transitive::
# Ignored
# ie_hack::
# Ignored
#
# _Examples_
# c = CData.new( " Some text " )
# c.write( $stdout ) #-> <![CDATA[ Some text ]]>
def write( output=$stdout, indent=-1, transitive=false, ie_hack=false )
Kernel.warn( "#{self.class.name}.write is deprecated" )
indent( output, indent )
output << START
output << @string
output << STOP
end
end
end

96
vendor/plugins/rexml/lib/rexml/child.rb vendored Normal file
View file

@ -0,0 +1,96 @@
require "rexml/node"
module REXML
##
# A Child object is something contained by a parent, and this class
# contains methods to support that. Most user code will not use this
# class directly.
class Child
include Node
attr_reader :parent # The Parent of this object
# Constructor. Any inheritors of this class should call super to make
# sure this method is called.
# parent::
# if supplied, the parent of this child will be set to the
# supplied value, and self will be added to the parent
def initialize( parent = nil )
@parent = nil
# Declare @parent, but don't define it. The next line sets the
# parent.
parent.add( self ) if parent
end
# Replaces this object with another object. Basically, calls
# Parent.replace_child
#
# Returns:: self
def replace_with( child )
@parent.replace_child( self, child )
self
end
# Removes this child from the parent.
#
# Returns:: self
def remove
unless @parent.nil?
@parent.delete self
end
self
end
# Sets the parent of this child to the supplied argument.
#
# other::
# Must be a Parent object. If this object is the same object as the
# existing parent of this child, no action is taken. Otherwise, this
# child is removed from the current parent (if one exists), and is added
# to the new parent.
# Returns:: The parent added
def parent=( other )
return @parent if @parent == other
@parent.delete self if defined? @parent and @parent
@parent = other
end
alias :next_sibling :next_sibling_node
alias :previous_sibling :previous_sibling_node
# Sets the next sibling of this child. This can be used to insert a child
# after some other child.
# a = Element.new("a")
# b = a.add_element("b")
# c = Element.new("c")
# b.next_sibling = c
# # => <a><b/><c/></a>
def next_sibling=( other )
parent.insert_after self, other
end
# Sets the previous sibling of this child. This can be used to insert a
# child before some other child.
# a = Element.new("a")
# b = a.add_element("b")
# c = Element.new("c")
# b.previous_sibling = c
# # => <a><b/><c/></a>
def previous_sibling=(other)
parent.insert_before self, other
end
# Returns:: the document this child belongs to, or nil if this child
# belongs to no document
def document
return parent.document unless parent.nil?
nil
end
# This doesn't yet handle encodings
def bytes
encoding = document.encoding
to_s
end
end
end

View file

@ -0,0 +1,80 @@
require "rexml/child"
module REXML
##
# Represents an XML comment; that is, text between \<!-- ... -->
class Comment < Child
include Comparable
START = "<!--"
STOP = "-->"
# The content text
attr_accessor :string
##
# Constructor. The first argument can be one of three types:
# @param first If String, the contents of this comment are set to the
# argument. If Comment, the argument is duplicated. If
# Source, the argument is scanned for a comment.
# @param second If the first argument is a Source, this argument
# should be nil, not supplied, or a Parent to be set as the parent
# of this object
def initialize( first, second = nil )
#puts "IN COMMENT CONSTRUCTOR; SECOND IS #{second.type}"
super(second)
if first.kind_of? String
@string = first
elsif first.kind_of? Comment
@string = first.string
end
end
def clone
Comment.new self
end
# == DEPRECATED
# See REXML::Formatters
#
# output::
# Where to write the string
# indent::
# An integer. If -1, no indenting will be used; otherwise, the
# indentation will be this number of spaces, and children will be
# indented an additional amount.
# transitive::
# Ignored by this class. The contents of comments are never modified.
# ie_hack::
# Needed for conformity to the child API, but not used by this class.
def write( output, indent=-1, transitive=false, ie_hack=false )
Kernel.warn("Comment.write is deprecated. See REXML::Formatters")
indent( output, indent )
output << START
output << @string
output << STOP
end
alias :to_s :string
##
# Compares this Comment to another; the contents of the comment are used
# in the comparison.
def <=>(other)
other.to_s <=> @string
end
##
# Compares this Comment to another; the contents of the comment are used
# in the comparison.
def ==( other )
other.kind_of? Comment and
(other <=> self) == 0
end
def node_type
:comment
end
end
end
#vim:ts=2 sw=2 noexpandtab:

View file

@ -0,0 +1,270 @@
require "rexml/parent"
require "rexml/parseexception"
require "rexml/namespace"
require 'rexml/entity'
require 'rexml/attlistdecl'
require 'rexml/xmltokens'
module REXML
# Represents an XML DOCTYPE declaration; that is, the contents of <!DOCTYPE
# ... >. DOCTYPES can be used to declare the DTD of a document, as well as
# being used to declare entities used in the document.
class DocType < Parent
include XMLTokens
START = "<!DOCTYPE"
STOP = ">"
SYSTEM = "SYSTEM"
PUBLIC = "PUBLIC"
DEFAULT_ENTITIES = {
'gt'=>EntityConst::GT,
'lt'=>EntityConst::LT,
'quot'=>EntityConst::QUOT,
"apos"=>EntityConst::APOS
}
# name is the name of the doctype
# external_id is the referenced DTD, if given
attr_reader :name, :external_id, :entities, :namespaces
# Constructor
#
# dt = DocType.new( 'foo', '-//I/Hate/External/IDs' )
# # <!DOCTYPE foo '-//I/Hate/External/IDs'>
# dt = DocType.new( doctype_to_clone )
# # Incomplete. Shallow clone of doctype
#
# +Note+ that the constructor:
#
# Doctype.new( Source.new( "<!DOCTYPE foo 'bar'>" ) )
#
# is _deprecated_. Do not use it. It will probably disappear.
def initialize( first, parent=nil )
@entities = DEFAULT_ENTITIES
@long_name = @uri = nil
if first.kind_of? String
super()
@name = first
@external_id = parent
elsif first.kind_of? DocType
super( parent )
@name = first.name
@external_id = first.external_id
elsif first.kind_of? Array
super( parent )
@name = first[0]
@external_id = first[1]
@long_name = first[2]
@uri = first[3]
elsif first.kind_of? Source
super( parent )
parser = Parsers::BaseParser.new( first )
event = parser.pull
if event[0] == :start_doctype
@name, @external_id, @long_name, @uri, = event[1..-1]
end
else
super()
end
end
def node_type
:doctype
end
def attributes_of element
rv = []
each do |child|
child.each do |key,val|
rv << Attribute.new(key,val)
end if child.kind_of? AttlistDecl and child.element_name == element
end
rv
end
def attribute_of element, attribute
att_decl = find do |child|
child.kind_of? AttlistDecl and
child.element_name == element and
child.include? attribute
end
return nil unless att_decl
att_decl[attribute]
end
def clone
DocType.new self
end
# output::
# Where to write the string
# indent::
# An integer. If -1, no indentation will be used; otherwise, the
# indentation will be this number of spaces, and children will be
# indented an additional amount.
# transitive::
# Ignored
# ie_hack::
# Ignored
def write( output, indent=0, transitive=false, ie_hack=false )
f = REXML::Formatters::Default.new
indent( output, indent )
output << START
output << ' '
output << @name
output << " #@external_id" if @external_id
output << " #{@long_name.inspect}" if @long_name
output << " #{@uri.inspect}" if @uri
unless @children.empty?
next_indent = indent + 1
output << ' ['
@children.each { |child|
output << "\n"
f.write( child, output )
}
output << "\n]"
end
output << STOP
end
def context
@parent.context
end
def entity( name )
@entities[name].unnormalized if @entities[name]
end
def add child
super(child)
@entities = DEFAULT_ENTITIES.clone if @entities == DEFAULT_ENTITIES
@entities[ child.name ] = child if child.kind_of? Entity
end
# This method retrieves the public identifier identifying the document's
# DTD.
#
# Method contributed by Henrik Martensson
def public
case @external_id
when "SYSTEM"
nil
when "PUBLIC"
strip_quotes(@long_name)
end
end
# This method retrieves the system identifier identifying the document's DTD
#
# Method contributed by Henrik Martensson
def system
case @external_id
when "SYSTEM"
strip_quotes(@long_name)
when "PUBLIC"
@uri.kind_of?(String) ? strip_quotes(@uri) : nil
end
end
# This method returns a list of notations that have been declared in the
# _internal_ DTD subset. Notations in the external DTD subset are not
# listed.
#
# Method contributed by Henrik Martensson
def notations
children().select {|node| node.kind_of?(REXML::NotationDecl)}
end
# Retrieves a named notation. Only notations declared in the internal
# DTD subset can be retrieved.
#
# Method contributed by Henrik Martensson
def notation(name)
notations.find { |notation_decl|
notation_decl.name == name
}
end
private
# Method contributed by Henrik Martensson
def strip_quotes(quoted_string)
quoted_string =~ /^[\'\"].*[\´\"]$/ ?
quoted_string[1, quoted_string.length-2] :
quoted_string
end
end
# We don't really handle any of these since we're not a validating
# parser, so we can be pretty dumb about them. All we need to be able
# to do is spew them back out on a write()
# This is an abstract class. You never use this directly; it serves as a
# parent class for the specific declarations.
class Declaration < Child
def initialize src
super()
@string = src
end
def to_s
@string+'>'
end
# == DEPRECATED
# See REXML::Formatters
#
def write( output, indent )
output << to_s
end
end
public
class ElementDecl < Declaration
def initialize( src )
super
end
end
class ExternalEntity < Child
def initialize( src )
super()
@entity = src
end
def to_s
@entity
end
def write( output, indent )
output << @entity
end
end
class NotationDecl < Child
attr_accessor :public, :system
def initialize name, middle, pub, sys
super(nil)
@name = name
@middle = middle
@public = pub
@system = sys
end
def to_s
"<!NOTATION #@name #@middle#{
@public ? ' ' + public.inspect : ''
}#{
@system ? ' ' +@system.inspect : ''
}>"
end
def write( output, indent=-1 )
output << to_s
end
# This method retrieves the name of the notation.
#
# Method contributed by Henrik Martensson
def name
@name
end
end
end

View file

@ -0,0 +1,208 @@
require "rexml/element"
require "rexml/xmldecl"
require "rexml/source"
require "rexml/comment"
require "rexml/doctype"
require "rexml/instruction"
require "rexml/rexml"
require "rexml/parseexception"
require "rexml/output"
require "rexml/parsers/baseparser"
require "rexml/parsers/streamparser"
require "rexml/parsers/treeparser"
module REXML
# Represents a full XML document, including PIs, a doctype, etc. A
# Document has a single child that can be accessed by root().
# Note that if you want to have an XML declaration written for a document
# you create, you must add one; REXML documents do not write a default
# declaration for you. See |DECLARATION| and |write|.
class Document < Element
# A convenient default XML declaration. If you want an XML declaration,
# the easiest way to add one is mydoc << Document::DECLARATION
# +DEPRECATED+
# Use: mydoc << XMLDecl.default
DECLARATION = XMLDecl.default
# Constructor
# @param source if supplied, must be a Document, String, or IO.
# Documents have their context and Element attributes cloned.
# Strings are expected to be valid XML documents. IOs are expected
# to be sources of valid XML documents.
# @param context if supplied, contains the context of the document;
# this should be a Hash.
def initialize( source = nil, context = {} )
super()
@context = context
return if source.nil?
if source.kind_of? Document
@context = source.context
super source
else
build( source )
end
end
def node_type
:document
end
# Should be obvious
def clone
Document.new self
end
# According to the XML spec, a root node has no expanded name
def expanded_name
''
#d = doc_type
#d ? d.name : "UNDEFINED"
end
alias :name :expanded_name
# We override this, because XMLDecls and DocTypes must go at the start
# of the document
def add( child )
if child.kind_of? XMLDecl
@children.unshift child
child.parent = self
elsif child.kind_of? DocType
# Find first Element or DocType node and insert the decl right
# before it. If there is no such node, just insert the child at the
# end. If there is a child and it is an DocType, then replace it.
insert_before_index = 0
@children.find { |x|
insert_before_index += 1
x.kind_of?(Element) || x.kind_of?(DocType)
}
if @children[ insert_before_index ] # Not null = not end of list
if @children[ insert_before_index ].kind_of DocType
@children[ insert_before_index ] = child
else
@children[ index_before_index-1, 0 ] = child
end
else # Insert at end of list
@children[insert_before_index] = child
end
child.parent = self
else
rv = super
raise "attempted adding second root element to document" if @elements.size > 1
rv
end
end
alias :<< :add
def add_element(arg=nil, arg2=nil)
rv = super
raise "attempted adding second root element to document" if @elements.size > 1
rv
end
# @return the root Element of the document, or nil if this document
# has no children.
def root
elements[1]
#self
#@children.find { |item| item.kind_of? Element }
end
# @return the DocType child of the document, if one exists,
# and nil otherwise.
def doctype
@children.find { |item| item.kind_of? DocType }
end
# @return the XMLDecl of this document; if no XMLDecl has been
# set, the default declaration is returned.
def xml_decl
rv = @children[0]
return rv if rv.kind_of? XMLDecl
rv = @children.unshift(XMLDecl.default)[0]
end
# @return the XMLDecl version of this document as a String.
# If no XMLDecl has been set, returns the default version.
def version
xml_decl().version
end
# @return the XMLDecl encoding of this document as a String.
# If no XMLDecl has been set, returns the default encoding.
def encoding
xml_decl().encoding
end
# @return the XMLDecl standalone value of this document as a String.
# If no XMLDecl has been set, returns the default setting.
def stand_alone?
xml_decl().stand_alone?
end
# Write the XML tree out, optionally with indent. This writes out the
# entire XML document, including XML declarations, doctype declarations,
# and processing instructions (if any are given).
#
# A controversial point is whether Document should always write the XML
# declaration (<?xml version='1.0'?>) whether or not one is given by the
# user (or source document). REXML does not write one if one was not
# specified, because it adds unneccessary bandwidth to applications such
# as XML-RPC.
#
# See also the classes in the rexml/formatters package for the proper way
# to change the default formatting of XML output
#
# _Examples_
# Document.new("<a><b/></a>").serialize
#
# output_string = ""
# tr = Transitive.new( output_string )
# Document.new("<a><b/></a>").serialize( tr )
#
# output::
# output an object which supports '<< string'; this is where the
# document will be written.
# indent::
# An integer. If -1, no indenting will be used; otherwise, the
# indentation will be twice this number of spaces, and children will be
# indented an additional amount. For a value of 3, every item will be
# indented 3 more levels, or 6 more spaces (2 * 3). Defaults to -1
# trans::
# If transitive is true and indent is >= 0, then the output will be
# pretty-printed in such a way that the added whitespace does not affect
# the absolute *value* of the document -- that is, it leaves the value
# and number of Text nodes in the document unchanged.
# ie_hack::
# Internet Explorer is the worst piece of crap to have ever been
# written, with the possible exception of Windows itself. Since IE is
# unable to parse proper XML, we have to provide a hack to generate XML
# that IE's limited abilities can handle. This hack inserts a space
# before the /> on empty tags. Defaults to false
def write( output=$stdout, indent=-1, transitive=false, ie_hack=false )
if xml_decl.encoding != "UTF-8" && !output.kind_of?(Output)
output = Output.new( output, xml_decl.encoding )
end
formatter = if indent > -1
if trans
REXML::Formatters::Transitive.new( indent, ie_hack )
else
REXML::Formatters::Pretty.new( indent, ie_hack )
end
else
REXML::Formatters::Default.new( ie_hack )
end
formatter.write( self, output )
end
def Document::parse_stream( source, listener )
Parsers::StreamParser.new( source, listener ).parse
end
private
def build( source )
Parsers::TreeParser.new( source, self ).parse
end
end
end

View file

@ -0,0 +1,10 @@
require "rexml/child"
module REXML
module DTD
class AttlistDecl < Child
START = "<!ATTLIST"
START_RE = /^\s*#{START}/um
PATTERN_RE = /\s*(#{START}.*?>)/um
end
end
end

View file

@ -0,0 +1,51 @@
require "rexml/dtd/elementdecl"
require "rexml/dtd/entitydecl"
require "rexml/comment"
require "rexml/dtd/notationdecl"
require "rexml/dtd/attlistdecl"
require "rexml/parent"
module REXML
module DTD
class Parser
def Parser.parse( input )
case input
when String
parse_helper input
when File
parse_helper input.read
end
end
# Takes a String and parses it out
def Parser.parse_helper( input )
contents = Parent.new
while input.size > 0
case input
when ElementDecl.PATTERN_RE
match = $&
source = $'
contents << ElementDecl.new( match )
when AttlistDecl.PATTERN_RE
matchdata = $~
source = $'
contents << AttlistDecl.new( matchdata )
when EntityDecl.PATTERN_RE
matchdata = $~
source = $'
contents << EntityDecl.new( matchdata )
when Comment.PATTERN_RE
matchdata = $~
source = $'
contents << Comment.new( matchdata )
when NotationDecl.PATTERN_RE
matchdata = $~
source = $'
contents << NotationDecl.new( matchdata )
end
end
contents
end
end
end
end

View file

@ -0,0 +1,17 @@
require "rexml/child"
module REXML
module DTD
class ElementDecl < Child
START = "<!ELEMENT"
START_RE = /^\s*#{START}/um
PATTERN_RE = /^\s*(#{START}.*?)>/um
PATTERN_RE = /^\s*#{START}\s+((?:[:\w_][-\.\w_]*:)?[-!\*\.\w_]*)(.*?)>/
#\s*((((["']).*?\5)|[^\/'">]*)*?)(\/)?>/um, true)
def initialize match
@name = match[1]
@rest = match[2]
end
end
end
end

View file

@ -0,0 +1,56 @@
require "rexml/child"
module REXML
module DTD
class EntityDecl < Child
START = "<!ENTITY"
START_RE = /^\s*#{START}/um
PUBLIC = /^\s*#{START}\s+(?:%\s+)?(\w+)\s+PUBLIC\s+((["']).*?\3)\s+((["']).*?\5)\s*>/um
SYSTEM = /^\s*#{START}\s+(?:%\s+)?(\w+)\s+SYSTEM\s+((["']).*?\3)(?:\s+NDATA\s+\w+)?\s*>/um
PLAIN = /^\s*#{START}\s+(\w+)\s+((["']).*?\3)\s*>/um
PERCENT = /^\s*#{START}\s+%\s+(\w+)\s+((["']).*?\3)\s*>/um
# <!ENTITY name SYSTEM "...">
# <!ENTITY name "...">
def initialize src
super()
md = nil
if src.match( PUBLIC )
md = src.match( PUBLIC, true )
@middle = "PUBLIC"
@content = "#{md[2]} #{md[4]}"
elsif src.match( SYSTEM )
md = src.match( SYSTEM, true )
@middle = "SYSTEM"
@content = md[2]
elsif src.match( PLAIN )
md = src.match( PLAIN, true )
@middle = ""
@content = md[2]
elsif src.match( PERCENT )
md = src.match( PERCENT, true )
@middle = ""
@content = md[2]
end
raise ParseException.new("failed Entity match", src) if md.nil?
@name = md[1]
end
def to_s
rv = "<!ENTITY #@name "
rv << "#@middle " if @middle.size > 0
rv << @content
rv
end
def write( output, indent )
indent( output, indent )
output << to_s
end
def EntityDecl.parse_source source, listener
md = source.match( PATTERN_RE, true )
thing = md[0].squeeze(" \t\n\r")
listener.send inspect.downcase, thing
end
end
end
end

View file

@ -0,0 +1,39 @@
require "rexml/child"
module REXML
module DTD
class NotationDecl < Child
START = "<!NOTATION"
START_RE = /^\s*#{START}/um
PUBLIC = /^\s*#{START}\s+(\w[\w-]*)\s+(PUBLIC)\s+((["']).*?\4)\s*>/um
SYSTEM = /^\s*#{START}\s+(\w[\w-]*)\s+(SYSTEM)\s+((["']).*?\4)\s*>/um
def initialize src
super()
if src.match( PUBLIC )
md = src.match( PUBLIC, true )
elsif src.match( SYSTEM )
md = src.match( SYSTEM, true )
else
raise ParseException.new( "error parsing notation: no matching pattern", src )
end
@name = md[1]
@middle = md[2]
@rest = md[3]
end
def to_s
"<!NOTATION #@name #@middle #@rest>"
end
def write( output, indent )
indent( output, indent )
output << to_s
end
def NotationDecl.parse_source source, listener
md = source.match( PATTERN_RE, true )
thing = md[0].squeeze(" \t\n\r")
listener.send inspect.downcase, thing
end
end
end
end

1244
vendor/plugins/rexml/lib/rexml/element.rb vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,71 @@
# -*- mode: ruby; ruby-indent-level: 2; indent-tabs-mode: t; tab-width: 2 -*- vim: sw=2 ts=2
module REXML
module Encoding
@encoding_methods = {}
def self.register(enc, &block)
@encoding_methods[enc] = block
end
def self.apply(obj, enc)
@encoding_methods[enc][obj]
end
def self.encoding_method(enc)
@encoding_methods[enc]
end
# Native, default format is UTF-8, so it is declared here rather than in
# an encodings/ definition.
UTF_8 = 'UTF-8'
UTF_16 = 'UTF-16'
UNILE = 'UNILE'
# ID ---> Encoding name
attr_reader :encoding
def encoding=( enc )
old_verbosity = $VERBOSE
begin
$VERBOSE = false
enc = enc.nil? ? nil : enc.upcase
return false if defined? @encoding and enc == @encoding
if enc and enc != UTF_8
@encoding = enc
raise ArgumentError, "Bad encoding name #@encoding" unless @encoding =~ /^[\w-]+$/
@encoding.untaint
begin
require 'rexml/encodings/ICONV.rb'
Encoding.apply(self, "ICONV")
rescue LoadError, Exception
begin
enc_file = File.join( "rexml", "encodings", "#@encoding.rb" )
require enc_file
Encoding.apply(self, @encoding)
rescue LoadError => err
puts err.message
raise ArgumentError, "No decoder found for encoding #@encoding. Please install iconv."
end
end
else
@encoding = UTF_8
require 'rexml/encodings/UTF-8.rb'
Encoding.apply(self, @encoding)
end
ensure
$VERBOSE = old_verbosity
end
true
end
def check_encoding str
# We have to recognize UTF-16, LSB UTF-16, and UTF-8
if str[0,2] == "\xfe\xff"
str[0,2] = ""
return UTF_16
elsif str[0,2] == "\xff\xfe"
str[0,2] = ""
return UNILE
end
str =~ /^\s*<\?xml\s+version\s*=\s*(['"]).*?\1\s+encoding\s*=\s*(["'])(.*?)\2/m
return $3.upcase if $3
return UTF_8
end
end
end

Some files were not shown because too many files have changed in this diff Show more