Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 327249

Summary: TextileLanguage fails against parts of the specifications
Product: z_Archived Reporter: nicolas
Component: MylynAssignee: David Green <greensopinion>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: dev, jneethling, nicolas
Version: unspecified   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Test cases for the reported issue
none
mylyn/context/zip none

Description nicolas CLA 2010-10-07 11:12:29 EDT
Build Identifier: 3.5.0.I20100930-0300

While writing test cases for a part of my system that relies heavily on TextileLanguage, I've encountered a few examples where the specifications are not respected.

I've attached the corresponding test cases, organised as:
* X.txt: textile source
* expected-X.html: expected HTML output
* observed-X.html: actual HTML output

Note that all of the observed-X.html files were generated by using the default HtmlDocumentBuilder configuration with setEmitAsDocument set to false.

Reproducible: Always

Steps to Reproduce:
1. Transform each X.txt textile file though HtmlDocumentBuilder.
2. Compare the output to expected-X.html
Comment 1 nicolas CLA 2010-10-07 11:13:40 EDT
Created attachment 180429 [details]
Test cases for the reported issue
Comment 2 David Green CLA 2010-10-07 14:19:15 EDT
Nicolas, thanks for the test cases!  Where did you get the expected content from?

If you can repackage these test cases as part of the JUnit test suite and attach here as a patch, then I'll be happy to incorporate them into Mylyn WikiText.
Comment 3 nicolas CLA 2010-10-07 14:49:09 EDT
You're welcome - I actually have plenty more, but have only attached the one that failed. I'll see what I can do about integrating them to the JUnit test suite.

This is the specifications I used to design my test cases: http://thresholdstate.com/articles/4312/the-textile-reference-manual

Nicolas
Comment 4 David Green CLA 2010-10-19 16:31:41 EDT
(In reply to comment #3)
> This is the specifications I used to design my test cases:
> http://thresholdstate.com/articles/4312/the-textile-reference-manual

It's a good idea to verify against the reference implementation (ie: the PHP implementation) of Textile.  You can do that "online here":http://textile.thresholdstate.com/
Comment 5 James Neethling CLA 2011-10-26 11:06:10 EDT
I was going to add test cases, but I've noticed that there appear to be two different implementation of Textile:

http://textile.sitemonks.com/?eg=RefGuide#results listed as version 2.2.

and the 'reference implementation' at http://textile.thresholdstate.com/ listed as version 2.0.

The first version has some very nice enhancements to the second version. I assume that wikitext follows the thresholdstate.com (second) version?

Can anyone provide some resources for the differences? I've been writing based on the sitemonks.com version and was really struggling to get the wikitext plugin to output it correctly. Now I know why....

(currently using org.eclipse.mylyn.wikitext.code 1.5.1v20110720-0100 with org.eclipse.mylyn.wikitext.textile.core v 1.5.1v20110720-0100)
Comment 6 David Green CLA 2011-10-26 12:14:34 EDT
(In reply to comment #5)

We would definitely welcome any contributions to the test suite.  Mylyn WikiText has been developed against the http://textile.thresholdstate.com/ reference implementation.

http://textile.thresholdstate.com/ provides a great test-bed, but it's not kept up to date with the latest implementation of Textile.  The reference implementation is maintained as part of a CMS project hosted at http://textpattern.com/, where you can get access to the latest and greatest.  

As for differences, you can probably find what you need in the SVN log of the textpattern source repository (though I haven't checked).  Currently it's hosted on Google Code: http://code.google.com/p/textpattern/
Comment 7 James Neethling CLA 2011-10-26 12:19:50 EDT
To answer my own question ..... 

Textile was created and used within an open source CMS called textpattern.
According to the textpattern release notes
(http://code.google.com/p/textpattern/source/detail?r=3400) the textile part of
the app is now at least version 2.2. The latest version within textpattern is
http://code.google.com/p/textpattern/source/browse/development/4.x/textpattern/lib/classTextile.php?r=3566

The version hosted on github, from which the sitemonks version is created, is a
fork from the original PHP version from revision 3359 on July 02, 2010
(https://github.com/netcarver/textile/commit/7f43de7d63fd1bbf001219ce04b6f41f2ee02ac1)

From what I gather, the community regards the 'official' implementation to be
the one hosted on github (see 
http://forum.textpattern.com/viewtopic.php?id=34647 and
http://forum.textpattern.com/viewtopic.php?id=36687)

If this is regarded as the 'reference implementation', are there any plans up
support the changes from 2.0 to 2.2?

Note that I'm not affiliated with any of these projects and could have the
history completely wrong....
Comment 8 James Neethling CLA 2011-10-26 12:21:18 EDT
(In reply to comment #6)
mid-air collision!
see my comment #7 which has some more details ...
Comment 9 David Green CLA 2011-10-26 12:25:50 EDT
Thanks for the background!

(In reply to comment #7)
> If this is regarded as the 'reference implementation', are there any plans up
> support the changes from 2.0 to 2.2?

We'd like to see Mylyn WikiText evolve on the same trajectory as the reference implementation.  As much as possible, we try to produce equivalent output to the reference implementation.  The emphasis is on "equivalent": we're not trying to be tag-for-tag identical.

There are no immediate plans to implement Textile 2.2 changes, but we would welcome any contributions that move us in that direction.
Comment 10 James Neethling CLA 2011-10-26 12:37:20 EDT
(In reply to comment #9)
> Thanks for the background!
> 
> (In reply to comment #7)
> > If this is regarded as the 'reference implementation', are there any plans up
> > support the changes from 2.0 to 2.2?
> 
> We'd like to see Mylyn WikiText evolve on the same trajectory as the reference
> implementation.  As much as possible, we try to produce equivalent output to
> the reference implementation.  The emphasis is on "equivalent": we're not
> trying to be tag-for-tag identical.
> 
> There are no immediate plans to implement Textile 2.2 changes, but we would
> welcome any contributions that move us in that direction.

Unfortunately, i'm not a coder, but I'll be happy to submit some test cases. Would that format that nicolas submitted be suitable? Or is there another format that would work better?
Comment 11 David Green CLA 2011-11-01 14:20:07 EDT
James, sounds great.  I've been thinking about ways that we could make it easy to contribute test cases without writing any code.

One way that we could do that would be to have unit tests consist of two distinct files; one that contains Textile markup, and a second file that contains expected output.   The unit test framework could automatically find these files if they're put in a well-known location, so that new tests could be developed by just working with Textile and HTML.  Would that work for you?
Comment 12 David Green CLA 2011-11-04 15:15:32 EDT
created review http://review.mylyn.org/#change,101

this change creates a new test suite that runs a test for each combination of files in @/org.eclipse.mylyn.wikitext.tests/markupLanguageTests/org.eclipse.mylyn.wikitext.textile.core.TextileLanguage@

To add a test, simply create a file in that folder with the ".textile" file extension, and a corresponding "expected output" file with the same name and ".txt" file extension.  The test loads the file containing markup, generates HTML, then asserts that the generated HTML contains the contents of the ".txt" file.

Tests for additional markup languages can be added by adding a folder with the corresponding markup language class name, for example @/org.eclipse.mylyn.wikitext.tests/markupLanguageTests/org.eclipse.mylyn.wikitext.confluence.core.ConfluenceLanguage@.
Comment 13 David Green CLA 2011-11-04 15:15:38 EDT
Created attachment 206480 [details]
mylyn/context/zip
Comment 14 David Green CLA 2011-11-04 21:18:52 EDT
I've now pushed this test suite to master, so now it's possible to develop markup language tests simply by creating two files: input and expected output

For an example, see the following:

* /org.eclipse.mylyn.wikitext.tests/markupLanguageTests/org.eclipse.mylyn.wikitext.textile.core.TextileLanguage/bold-italic.textile
* /org.eclipse.mylyn.wikitext.tests/markupLanguageTests/org.eclipse.mylyn.wikitext.textile.core.TextileLanguage/bold-italic.txt

Feel free to attach new tests as pairs of files to this task.  To run them locally, run @org.eclipse.mylyn.wikitext.core.MarkupFilesTest@ from your local workspace.  If you need an easier way to run these tests, let me know.
Comment 15 James Neethling CLA 2011-11-06 15:10:53 EST
Hi David,

Thanks for the effort to make it easier to submit test - it seems simple enough. I'm going to put some together and attach each set as a separate attachment. 

> Feel free to attach new tests as pairs of files to this task.  To run them
> locally, run @org.eclipse.mylyn.wikitext.core.MarkupFilesTest@ from your local
> workspace.  If you need an easier way to run these tests, let me know.

Actually, I'm going to need a pointer to some docs about how to run that test suite, but I'm sure that it will be simple enough. Although I've used eclipse for a while now, it has always been as a 'user' and not much as a developer, certainly not a Java/Plugin Dev :(. In the meantime, I'll get those tests going...
Comment 16 Steffen Pingel CLA 2011-11-18 04:14:35 EST
David, integration tests are failing with the following error which looks like it may be related to this change:

http://ci.mylyn.org/job/mylyn-3.7.x/33/TARGET=juno/testReport/org.eclipse.mylyn.wikitext.core/MarkupFilesTest$PlatformMarkupFileCase/bold_italic/

org.eclipse.mylyn.wikitext.core.MarkupFilesTest$PlatformMarkupFileCase.bold-italic (from org.eclipse.mylyn.tests.AllTests)
java.lang.NullPointerException
	at org.eclipse.mylyn.wikitext.core.MarkupFilesTest$PlatformMarkupFileCase.readExpectedContent(MarkupFilesTest.java:209)
	at org.eclipse.mylyn.wikitext.core.MarkupFilesTest$AbstractMarkupFileCase.runTest(MarkupFilesTest.java:123)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
Comment 17 David Green CLA 2011-11-18 14:04:23 EST
Strange, the test runs just fine here: https://hudson.eclipse.org/hudson/job/mylyn-docs-nightly/

I've pushed a change that should eliminate the NPE - but doesn't address the underlying cause.  When I get a chance I'll run the integration build here and see if I can reproduce the problem.
Comment 18 Jeremie Bresson CLA 2012-10-12 01:11:50 EDT
I was looking for the code mentioned in this bug. From what I have seen, the code is in the "task-327249-easy-tests" branch.

See:
http://git.eclipse.org/c/mylyn/org.eclipse.mylyn.docs.git/log/?h=task-327249-easy-tests
Comment 19 David Green CLA 2013-08-02 12:43:34 EDT
Closed as part of backlog clean-up.  Please re-open if you'd like to see this revisited, perhaps with a contribution.