Home » Text » Text_Wiki_Mediawiki » Bug #9378
Addition to pear/Text_Wiki/Text/Wiki/Parse/Mediawiki/Preformatted.php
Details
| Request #9378 | Addition to pear/Text_Wiki/Text/Wiki/Parse/Mediawiki/Preformatted.php |
|---|---|
| Submitted | 2006-11-19 04:10 UTC |
| From | outtatime at gmail dot com |
| Assigned | ritzmo |
| Status | Closed |
| Package | Text_Wiki_Mediawiki |
| PHP Version | 5.1.6 |
| OS | OpenSuse 10.1 |
| Roadmaps | (Not assigned) |
Comments
[2006-11-19 04:10 UTC] outtatime at gmail dot com
Description:
------------
I spent some time this afternoon and created a functional preformatted text parser for Mediawiki. When I went to go checkout the CVS repository (after I had made my own), I was surprised to see that someone else had already created a pear/Text_Wiki/Text/Wiki/Parse/Mediawiki/Preformatted.php !
However, upon testing the one in the cvs repository, I am uncertain as to what purpose it serves. It does not parse preformatted text like normal mediawiki parsers do.
I have put together a simple text which shows what my module does. The input, output, test, and all associated sourcefiles may be found in the following directory:
http://jetlib.com/code/pear/2006_11-mediawiki/pre/
For example, if you were to do:
--
Blah blah blah, this is a test
this is the beginning of the preformatted text
this continues it
its still going
okay this is the last line of preformatted text
all done
all done
--
(http://jetlib.com/code/pear/2006_11-mediawiki/pre/input.txt)
The proper output would be:
--
Blah blah blah, this is a test<pre>
this is the beginning of the preformatted text
this continues it
its still going
okay this is the last line of preformatted text
</pre>
all done
all done
--
(http://jetlib.com/code/pear/2006_11-mediawiki/pre/output.txt)
http://jetlib.com/code/pear/2006_11-mediawiki/pre/mediawikwi_test.php
I have tested this extensively against "real" mediawiki parsers (ie- the package put out by the Mediawiki foundation), and mine gets the closest possible result (Any difference in newlines is due to the underlying Text_Wiki and associated Xhtml rendering package).
So, I am going to go ahead and contribute mine so that all of you can have a working mediawiki preformatted text parser. Enjoy.
http://jetlib.com/code/pear/2006_11-mediawiki/pre/Preformatted.php.tgz
Test script:
---------------
The example along with the source for this new file can be fonud at: http://jetlib.com/code/pear/2006_11-mediawiki/pre/
Expected result:
----------------
Well, before now nothing happened. Example of what output.txt looks like when using my Preformatted module:
http://jetlib.com/code/pear/2006_11-mediawiki/pre/output.txt
Actual result:
--------------
This is a feature addition. The expected result (with my package) was the same as the actual result. However, with the Preformatted.txt which is currently in the ../Parse/Mediawiki/Preformatted.php CVS does not acknowledge or parse the preformatted text in any way.
[2006-11-21 11:09 UTC] ritzmo at php dot net
From reading your example and looking at the original Parser-Output I can say that your interpretation of the Syntax is wrong (at least partially).
At least all leading Spaces are removed when converting to HTML (according to what the Parser sent me as output).
Unfortunately your uploaded code seems to be offline at the moment (or at least I can't access it), but if I remeber correctly (I took a first look when I read your E-Mail two days ago) you also removed the possibility to use <pre> to identify preformatted text, which I have always used as prefered method.
I'll see If I find the time to integrate the \n-Identifier into the Parser (which I'm quite sure about :-)). I will update this Request then.