You are viewing a plain text version of this content. The canonical link for it is here.
Posted to doxia-dev@maven.apache.org by Dennis Lundberg <de...@apache.org> on 2007/08/17 22:56:03 UTC
Re: svn commit: r567032 - in /maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test:
java/org/apache/maven/doxia/module/xhtml/XhtmlParserTest.java java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
resources/test.xhtml
I can't find the IdentityTest file, did you commit that?
ltheussl@apache.org wrote:
> Author: ltheussl
> Date: Fri Aug 17 05:08:17 2007
> New Revision: 567032
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=567032
> Log:
> Use new test classes. The IdentityTest fails with a parsing error (probably MSITE-194, not sure), to be done later.
>
> Added:
> maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/resources/test.xhtml
> Modified:
> maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlParserTest.java
> maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
>
> Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlParserTest.java
> URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlParserTest.java?view=diff&rev=567032&r1=567031&r2=567032
> ==============================================================================
> --- maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlParserTest.java (original)
> +++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlParserTest.java Fri Aug 17 05:08:17 2007
> @@ -20,7 +20,7 @@
> */
>
> import org.apache.maven.doxia.WellformednessCheckingSink;
> -import org.apache.maven.doxia.parser.AbstractParserTestCase;
> +import org.apache.maven.doxia.parser.AbstractParserTest;
> import org.apache.maven.doxia.parser.Parser;
>
> import java.io.FileReader;
> @@ -31,28 +31,16 @@
> * @version $Id$
> */
> public class XhtmlParserTest
> - extends AbstractParserTestCase
> + extends AbstractParserTest
> {
> - protected Parser getParser()
> + protected Parser createParser()
> {
> return new XhtmlParser();
> }
>
> - protected String getDocument()
> + protected String outputExtension()
> {
> - return "src/test/resources/fun.html";
> + return "xhtml";
> }
>
> - public void testParser()
> - throws Exception
> - {
> - //use the new wellformedness checking sink.
> - WellformednessCheckingSink sink = new WellformednessCheckingSink();
> -
> - Reader reader = new FileReader( getTestFile( getBasedir(), getDocument() ) );
> -
> - getParser().parse( reader, sink );
> -
> - assertTrue( "Input not wellformed, offending element: " + sink.getOffender(), sink.isWellformed() );
> - }
> }
>
> Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
> URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java?view=diff&rev=567032&r1=567031&r2=567032
> ==============================================================================
> --- maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java (original)
> +++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java Fri Aug 17 05:08:17 2007
> @@ -20,14 +20,14 @@
> */
>
> import org.apache.maven.doxia.module.xhtml.decoration.render.RenderingContext;
> -import org.apache.maven.doxia.sink.AbstractSinkTestCase;
> +import org.apache.maven.doxia.sink.AbstractSinkTest;
> import org.apache.maven.doxia.sink.Sink;
> -import org.apache.maven.doxia.parser.Parser;
>
> import java.io.File;
> import java.io.Reader;
> import java.io.InputStream;
> import java.io.InputStreamReader;
> +import java.io.Writer;
> import java.util.HashMap;
>
> /**
> @@ -35,22 +35,14 @@
> * @version $Id:XhtmlSinkTest.java 348605 2005-11-24 12:02:44 +1100 (Thu, 24 Nov 2005) brett $
> */
> public class XhtmlSinkTest
> - extends AbstractSinkTestCase
> + extends AbstractSinkTest
> {
> protected String outputExtension()
> {
> return "xhtml";
> }
>
> - // START SNIPPET: foo
> -
> - protected Parser createParser()
> - {
> - return new XhtmlParser();
> - }
> -
> - protected Sink createSink()
> - throws Exception
> + protected Sink createSink( Writer writer )
> {
> String apt = "test.apt";
>
> @@ -60,20 +52,201 @@
> //PLXAPI: This horrible fake map is being used because someone neutered the directives approach in the
> // site renderer so that it half worked. Put it back and make it work properly.
>
> - return new XhtmlSink( getTestWriter(), renderingContext, new FakeMap() );
> + return new XhtmlSink( writer, renderingContext, new FakeMap() );
> }
>
> - protected Reader getTestReader()
> + public void testLinks()
> throws Exception
> {
> - InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( "fun.html" );
> + Writer writer = getTestWriter( "links" );
> + XhtmlSink sink = (XhtmlSink) createSink( writer );
> + sink.link( "http:/www.xdoc.com" );
> + sink.link_();
> + sink.link( "./index.html#anchor" );
> + sink.link_();
> + sink.link( "../index.html#anchor" );
> + sink.link_();
> + sink.link( "index.html" );
> + sink.link_();
> + sink.close();
> + }
> +
> + /** {@inheritDoc} */
> + protected String getTitleBlock( String title )
> + {
> + return "<title>" + title + "</title>";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getAuthorBlock( String author )
> + {
> + return author;
> + }
> +
> + /** {@inheritDoc} */
> + protected String getDateBlock( String date )
> + {
> + return date;
> + }
> +
> + /** {@inheritDoc} */
> + protected String getHeadBlock()
> + {
> + return "";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getBodyBlock()
> + {
> + return "";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getSectionTitleBlock( String title )
> + {
> + return title;
> + }
> +
> + /** {@inheritDoc} */
> + protected String getSection1Block( String title )
> + {
> + return "<div class=\"section\"><h2>" + title + "</h2></div>";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getSection2Block( String title )
> + {
> + return "<div class=\"section\"><h3>" + title + "</h3></div>";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getSection3Block( String title )
> + {
> + return "<div class=\"section\"><h4>" + title + "</h4></div>";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getSection4Block( String title )
> + {
> + return "<div class=\"section\"><h5>" + title + "</h5></div>";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getSection5Block( String title )
> + {
> + return "<div class=\"section\"><h6>" + title + "</h6></div>";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getListBlock( String item )
> + {
> + return "<ul><li>" + item + "</li></ul>";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getNumberedListBlock( String item )
> + {
> + return "<ol type=\"i\"><li>" + item + "</li></ol>";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getDefinitionListBlock( String definum, String definition )
> + {
> + return "<dl><dt>" + definum + "</dt><dd>" + definition + "</dd></dl>";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getFigureBlock( String source, String caption )
> + {
> + return "<img src=\"" + source + "\" alt=\"" + caption + "\" />";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getTableBlock( String cell, String caption )
> + {
> + return "<table class=\"bodyTable\"><tbody><tr class=\"a\"><td align=\"center\">"
> + + cell + "</td></tr></tbody><caption>" + caption + "</caption></table>";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getParagraphBlock( String text )
> + {
> + return "<p>" + text + "</p>";
> + }
>
> - InputStreamReader reader = new InputStreamReader( is );
> + /** {@inheritDoc} */
> + protected String getVerbatimBlock( String text )
> + {
> + return "<div class=\"source\"><pre>" + text + "</pre></div>";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getHorizontalRuleBlock()
> + {
> + return "<hr />";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getPageBreakBlock()
> + {
> + return "";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getAnchorBlock( String anchor )
> + {
> + return "<a name=\"" + anchor + "\">" + anchor + "</a>";
> + }
>
> - return reader;
> + /** {@inheritDoc} */
> + protected String getLinkBlock( String link, String text )
> + {
> + return "<a href=\"#" + link + "\">" + text + "</a>";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getItalicBlock( String text )
> + {
> + return "<i>" + text + "</i>";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getBoldBlock( String text )
> + {
> + return "<b>" + text + "</b>";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getMonospacedBlock( String text )
> + {
> + return "<tt>" + text + "</tt>";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getLineBreakBlock()
> + {
> + return "<br />";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getNonBreakingSpaceBlock()
> + {
> + return " ";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getTextBlock( String text )
> + {
> + // TODO: need to be able to retreive those from outside the sink
> + return "~, =, -, +, *, [, ], <, >, {, }, \\";
> + }
> +
> + /** {@inheritDoc} */
> + protected String getRawTextBlock( String text )
> + {
> + return text;
> }
>
> - // END SNIPPET: foo
>
> class FakeMap
> extends HashMap
>
> Added: maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/resources/test.xhtml
> URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/resources/test.xhtml?view=auto&rev=567032
> ==============================================================================
> --- maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/resources/test.xhtml (added)
> +++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/resources/test.xhtml Fri Aug 17 05:08:17 2007
> @@ -0,0 +1,113 @@
> +<html xmlns="http://www.w3.org/1999/xhtml">
> +
> +<head>
> + <title>Title</title>
> + <meta name="author" content="Author" />
> + <meta name="date" content="Date" />
> +</head>
> +
> +<body>
> +
> +<p>Paragraph 1, line 1. Paragraph 1, line 2.</p>
> +<p>Paragraph 2, line 1. Paragraph 2, line 2.</p>
> +
> +<div class="section"><h2>Section title</h2>
> +<div class="section"><h3>Sub-section title</h3>
> +<div class="section"><h4>Sub-sub-section title</h4>
> +<div class="section"><h5>Sub-sub-sub-section title</h5>
> +<div class="section"><h6>Sub-sub-sub-sub-section title</h6>
> +
> +<ul>
> + <li>List item 1.</li>
> + <li>List item 2.<p>Paragraph contained in list item 2.</p>
> + <ul>
> + <li>Sub-list item 1.</li>
> + <li>Sub-list item 2.</li>
> + </ul>
> + </li>
> + <li>List item 3. Force end of list:</li>
> +</ul>
> +
> +<div class="source"><pre>Verbatim text not contained in list item 3</pre></div>
> +
> +<ol type="1">
> + <li>Numbered item 1.
> + <ol type="A">
> + <li>Numbered item A.</li>
> + <li>Numbered item B.</li>
> + </ol>
> + </li>
> + <li>Numbered item 2.</li>
> +</ol>
> +
> +<p>List numbering schemes: [[1]], [[a]], [[A]], [[i]], [[I]].</p>
> +
> +<dl>
> + <dt>Defined term 1</dt>
> + <dd>of definition list.</dd>
> + <dt>Defined term 2</dt>
> + <dd>of definition list.<div class="source"><pre>Verbatim text
> + in a box </pre></div></dd>
> +</dl>
> +
> +<p>--- instead of +-- suppresses the box around verbatim text.</p>
> +
> +<img src="figure" alt="Figure caption" />
> +
> +<table class="bodyTable">
> + <tbody>
> + <tr class="a">
> + <th align="center">Centered<br />cell 1,1</th>
> + <th align="left">Left-aligned<br />cell 1,2</th>
> + <th align="right">Right-aligned<br />cell 1,3</th>
> + </tr>
> + <tr class="b">
> + <td align="center">cell 2,1</td>
> + <td align="left">cell 2,2</td>
> + <td align="right">cell 2,3</td>
> + </tr>
> + </tbody>
> + <caption>Table caption</caption>
> +</table>
> +
> +<p>No grid, no caption:</p>
> +
> +<table class="bodyTable">
> + <tbody>
> + <tr class="a">
> + <td align="center">cell</td>
> + <td align="center">cell</td>
> + </tr>
> + <tr class="b">
> + <td align="center">cell</td>
> + <td align="center">cell</td>
> + </tr>
> + </tbody>
> +</table>
> +
> +<p>Horizontal line:</p><hr />
> +
> +<p>New page.</p>
> +
> +<p><i>Italic</i> font. <b>Bold</b> font. <tt>Monospaced</tt> font.</p>
> +
> +<p><a name="anchor">Anchor</a>.
> + Link to <a href="#Anchor">Anchor</a>.
> + Link to <a href="http://www.pixware.fr" class="externalLink">http://www.pixware.fr</a>.
> + Link to <a href="#Anchor">showing alternate text</a>.
> + Link to <a href="http://www.pixware.fr" class="externalLink">Pixware home page</a>.
> +</p>
> +
> +<p>Force line<br />break.</p>
> +
> +<p>Non breaking space.</p>
> +
> +<p>Escaped special characters: ~, =, -, +, *, [, ], <, >, {, }, \.</p>
> +
> +<p>Copyright symbol: ©, ©, ©.</p>
> +
> +</div></div></div></div></div>
> +
> +</body>
> +
> +</html>
> \ No newline at end of file
>
>
>
--
Dennis Lundberg
Re: svn commit: r567032 - in /maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test:
java/org/apache/maven/doxia/module/xhtml/XhtmlParserTest.java java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
resources/test.xhtml
Posted by Dennis Lundberg <de...@apache.org>.
Lukas Theussl wrote:
> Sorry, I probably misunderstood you. I didn't commit the
> XhtmlIdentityTest since I couldn't make it work. You can easily adapt
> the AptIdentityTest to see how it goes.
Ah, I see. That is something on the todo list for beta-1 then.
> I don't quite understand the structure of the xhtml module yet (eg why
> there is only this horrible constructor with the RenderingContext and
> Map?). I guess it's been tweaked to fit the needs of maven/site
> rendering but AFAICT it can't be used stand-alone right now.
>
> -Lukas
>
>
> Lukas Theussl wrote:
>> It's in the core: o.a.m.d/module/AbstractIdentityTest.java, see eg the
>> AptIdentityTest.java in the apt module for how to use it.
>>
>> -Lukas
>>
>>
>> Dennis Lundberg wrote:
>>
>>> I can't find the IdentityTest file, did you commit that?
>>>
>>> ltheussl@apache.org wrote:
>>>
>>>> Author: ltheussl
>>>> Date: Fri Aug 17 05:08:17 2007
>>>> New Revision: 567032
>>>>
>>>> URL: http://svn.apache.org/viewvc?view=rev&rev=567032
>>>> Log:
>>>> Use new test classes. The IdentityTest fails with a parsing error
>>>> (probably MSITE-194, not sure), to be done later.
>>>>
>>
>> [snip]
>
--
Dennis Lundberg
Re: svn commit: r567032 - in /maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test:
java/org/apache/maven/doxia/module/xhtml/XhtmlParserTest.java java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
resources/test.xhtml
Posted by Lukas Theussl <lt...@apache.org>.
Sorry, I probably misunderstood you. I didn't commit the
XhtmlIdentityTest since I couldn't make it work. You can easily adapt
the AptIdentityTest to see how it goes.
I don't quite understand the structure of the xhtml module yet (eg why
there is only this horrible constructor with the RenderingContext and
Map?). I guess it's been tweaked to fit the needs of maven/site
rendering but AFAICT it can't be used stand-alone right now.
-Lukas
Lukas Theussl wrote:
> It's in the core: o.a.m.d/module/AbstractIdentityTest.java, see eg the
> AptIdentityTest.java in the apt module for how to use it.
>
> -Lukas
>
>
> Dennis Lundberg wrote:
>
>> I can't find the IdentityTest file, did you commit that?
>>
>> ltheussl@apache.org wrote:
>>
>>> Author: ltheussl
>>> Date: Fri Aug 17 05:08:17 2007
>>> New Revision: 567032
>>>
>>> URL: http://svn.apache.org/viewvc?view=rev&rev=567032
>>> Log:
>>> Use new test classes. The IdentityTest fails with a parsing error
>>> (probably MSITE-194, not sure), to be done later.
>>>
>
> [snip]
Re: svn commit: r567032 - in /maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test:
java/org/apache/maven/doxia/module/xhtml/XhtmlParserTest.java java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
resources/test.xhtml
Posted by Lukas Theussl <lt...@apache.org>.
It's in the core: o.a.m.d/module/AbstractIdentityTest.java, see eg the
AptIdentityTest.java in the apt module for how to use it.
-Lukas
Dennis Lundberg wrote:
> I can't find the IdentityTest file, did you commit that?
>
> ltheussl@apache.org wrote:
>
>> Author: ltheussl
>> Date: Fri Aug 17 05:08:17 2007
>> New Revision: 567032
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=567032
>> Log:
>> Use new test classes. The IdentityTest fails with a parsing error
>> (probably MSITE-194, not sure), to be done later.
>>
[snip]