? Pending

User tests: Successful: Unsuccessful:

avatar beetabonk
beetabonk
12 Mar 2017

the previous regex destructively strips the article text from the first <hr /> on a page to the next <hr class="system-pagebreak" /> if content does not contain TinyMCE type line-breaks.

Pull Request for Issue #14531 .

Summary of Changes

contain page-break regex to a single <hr ... />

current regex will match

<hr /><p>paragraph under first hr tag</p><hr /><p>paragraph under second hr tag</p><hr class="system-pagebreak" />

Testing Instructions

create an article with an <hr /> anywhere prior to an <hr class="system-pagebreak" /> and display on front-end.

test article exhibiting problem and fix

<p>first paragraph</p>
<hr id="system-readmore" />
<p>second paragraph</p>
<hr />
<p>third paragraph</p>
<hr />
<p>fourth paragraph</p>
<hr class="system-pagebreak" />
<p>fifth paragraph</p>
<hr />
<p>sixth paragraph</p>

[update 2017/03/13]

the test article actually works with line-breaks but not without them which can occur with any DOMDocument type processing or content created by API instead of directly with TinyMCE. so the following article HTML will exhibit the problem if entered directly into the #__com_content table.

<p>first paragraph</p><hr id="system-readmore" /><p>second paragraph</p><hr /><p>third paragraph</p><hr /><p>fourth paragraph</p><hr class="system-pagebreak" /><p>fifth paragraph</p><hr /><p>sixth paragraph</p>

[end update]

Expected result

no stripping of article content

output from test html above

first paragraph
second paragraph
------------------
third paragraph
------------------
fourth paragraph
« Start Prev 1 2 Next End»

Actual result

html between <hr /> and page break is stripped.

output from test html above

first paragraph
second paragraph
« Start Prev 1 2 Next End»

Documentation Changes Required

avatar beetabonk beetabonk - open - 12 Mar 2017
avatar beetabonk beetabonk - change - 12 Mar 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 12 Mar 2017
Category Front End Plugins
avatar beetabonk beetabonk - change - 12 Mar 2017
The description was changed
avatar beetabonk beetabonk - edited - 12 Mar 2017
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 12 Mar 2017

i can see no Difference between Article with and -out PR.

avatar beetabonk beetabonk - change - 12 Mar 2017
The description was changed
avatar beetabonk beetabonk - edited - 12 Mar 2017
avatar beetabonk
beetabonk - comment - 12 Mar 2017

@franz-wohlkoenig i added test html above.

<p>first paragraph</p>
<hr id="system-readmore" />
<p>second paragraph</p>
<hr />
<p>third paragraph</p>
<hr />
<p>fourth paragraph</p>
<hr class="system-pagebreak" />
<p>fifth paragraph</p>
<hr />
<p>sixth paragraph</p>
avatar beetabonk beetabonk - change - 12 Mar 2017
The description was changed
avatar beetabonk beetabonk - edited - 12 Mar 2017
avatar beetabonk beetabonk - change - 12 Mar 2017
The description was changed
avatar beetabonk beetabonk - edited - 12 Mar 2017
avatar zero-24 zero-24 - change - 12 Mar 2017
The description was changed
avatar zero-24 zero-24 - edited - 12 Mar 2017
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 12 Mar 2017

tested on Joomla-3.6.5 without PR:
bildschirmfoto 2017-03-12 um 20 35 58
bildschirmfoto 2017-03-12 um 20 36 08

avatar beetabonk
beetabonk - comment - 13 Mar 2017

@franz-wohlkoenig I now see the reason this is happening on our sites and not for you.

Some plugins we employ have the harmless side-effect of stripping line-breaks by passing the article's HTML text through DomDocument processing resulting in the saveHTML method not maintaining line breaks. We also create some of our content directly via an XML import process using JoomlaCLI which bypasses any TinyMCE line-break rules. The problem I've reported is not apparent in the vanilla Joomla! 3.6.5 install but becomes apparent when for any reason the TinyMCE line-breaks rules are not maintained which is not a general enough solution. This makes the pagebreak plugin unreasonably reliant on the source of the content. This is not a bug per se but the new regex provided offers a more general solution for handling HTML content without assumptions about its source and the placement of line-breaks so I recommend the new regex for generality.

the following content if created directly in the database will exhibit the problem reported:

<p>first paragraph</p><hr id="system-readmore" /><p>second paragraph</p><hr /><p>third paragraph</p><hr /><p>fourth paragraph</p><hr class="system-pagebreak" /><p>fifth paragraph</p><hr /><p>sixth paragraph</p>
avatar beetabonk beetabonk - change - 13 Mar 2017
The description was changed
avatar beetabonk beetabonk - edited - 13 Mar 2017
avatar beetabonk beetabonk - change - 13 Mar 2017
The description was changed
avatar beetabonk beetabonk - edited - 13 Mar 2017
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 13 Mar 2017

any thoughts on this, @maintainers?

avatar rdeutz rdeutz - change - 27 May 2017
Labels Added: ?
avatar brianteeman
brianteeman - comment - 9 Sep 2017

Closing as it is not a core issue

avatar brianteeman brianteeman - change - 9 Sep 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-09-09 14:25:10
Closed_By brianteeman
avatar brianteeman brianteeman - close - 9 Sep 2017
avatar beetabonk
beetabonk - comment - 10 Sep 2017

@brianteeman how is this not a core issue? is it a requirement that all content be created by tinyMCE? is the pagebreak content plugin shipped with joomla no longer maintained as part of the core? it is a bad assumption and should be fixed. it was already approved 6 months ago.

avatar brianteeman
brianteeman - comment - 10 Sep 2017

Because as you stated it is the plugins you are using etc that is stripping the required code.

avatar beetabonk
beetabonk - comment - 10 Sep 2017

where is it specified that line breaks are required? the regex in question is written very very poorly. it fails if the content does not come specifically and directly from tinyMCE.

Add a Comment

Login with GitHub to post a comment