PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Text » Text_Wiki_Mediawiki » Bug #8174

Visibility of newlines within source

Details

Request #8174Visibility of newlines within source
Submitted2006-07-10 14:23 UTC
Frombjs5075 at rit dot edu
Assignedritzmo
StatusClosed
PackageText_Wiki_Mediawiki
PHP Version5.1.4
OSDebian etch
Roadmaps(Not assigned)

Comments

[2006-07-10 14:23 UTC] bjs5075 at rit dot edu

Description:
------------
The MediaWiki markup standard specifies that a single newline within the markup source does not affect the layout of the final rendered text (http://meta.wikimedia.org/wiki/Help:Editing).

The parser in Text_Wiki_MediaWiki does read newlines and the renderers output them. To be consistant with MediaWiki, the parser should ignore newlines in the wiki markup source.

Test script:
---------------
Paragraph one

Paragraph two
should stay together

Paragraph three

Expected result:
----------------
Paragraph one

Paragraph two should stay together

Paragraph three

Actual result:
--------------
Paragraph one

Paragraph two
should stay together

Paragraph three

[2006-07-10 15:23 UTC] bjs5075 at rit dot edu

The MediaWiki standard specifies inserting "<br>" within page markup to force linebreaks, so the Text_Wiki_MediaWiki newline regex should probably match something like:
/<br\ *\/?>/

or even simply force the match to be "<br>"

[2006-07-10 15:51 UTC] ritzmo at php dot net

The newline rule really defines a newline and not a linebreak, which is contained in the break-rule.

I did some testing and would like to be able to give you a better solution, but a hotfix would be to remove the return in Text_Wiki_Render_Xhtml_Newline. Removing the newline rule broke paragraphs for me and this needs some more testing first.

[2006-07-11 02:48 UTC] bjs5075 at rit dot edu

I have modified versions of the default/mediawiki parsers for Break/Newline/Paragraph that seem to do the trick together.
They are quite large to put in a message here, would you prefer that I email them directly?

[2006-07-11 08:19 UTC] ritzmo at php dot net

Thank you for taking the time to report a problem with the package.
This problem may have been already fixed by a previous change that
is in the CVS of the package. Please log into CVS with:

cvs -d :pserver:cvsread@cvs.php.net:/repository login

and check out the CVS repository of this package and upgrade

cvs -d :pserver:cvsread@cvs.php.net:/repository co pear/Text_Wiki_Mediawiki
pear upgrade pear/Text_Wiki_Mediawiki/package2.xml

or

pear upgrade pear/Text_Wiki_Mediawiki/package.xml

If you are able to reproduce the bug with the latest CVS,
please change the status back to "Open".
Again, thank you for your continued support of PEAR.

[2006-07-14 13:05 UTC] bjs5075 at rit dot edu

The CVS still does not have Paragraph.php in the Parse/Mediawiki/ direcotry.

[2006-07-14 13:22 UTC] ritzmo at php dot net

It's not about the files in CVS, it's about working correctly.
And as the current CVS works for me I asked if it also does for you.
I did not just copy over your patches, I actualy only used your Break.php.

[2006-07-14 16:27 UTC] bjs5075 at rit dot edu

The problem is that the current Newline/Paragraph combination does *not* ignore single-newlines within the wiki source, while the MediaWiki format specified that it should ignore newlines. The only time a line break should occur is given a "<br>" tag, not for newlines within a paragraph block.
My Newline/Paragraph removes single newlines and splits paragraphs on blank lines.

[2006-07-14 16:37 UTC] ritzmo at php dot net

Could you please provide a test script as your posted example gives me the expected result.

[2006-07-14 16:45 UTC] bjs5075 at rit dot edu

I'm sorry about the re-opening, it does work properly now.

I was juggling CVS/local diffs on two different hosts and I think I got confused about which host had which version.