[wp-trac] [WordPress Trac] #23776: A string of text starting with "http://" turned into a paragraph

WordPress Trac noreply at wordpress.org
Mon Dec 8 23:58:59 UTC 2014


#23776: A string of text starting with "http://" turned into a paragraph
------------------------------------+-----------------------------
 Reporter:  winterstreet            |       Owner:  SergeyBiryukov
     Type:  defect (bug)            |      Status:  reviewing
 Priority:  normal                  |   Milestone:  Future Release
Component:  Embeds                  |     Version:  2.9
 Severity:  normal                  |  Resolution:
 Keywords:  dev-feedback has-patch  |     Focuses:
------------------------------------+-----------------------------

Comment (by chipx86):

 This is an old issue, but one that I spent a good chunk of the day trying
 to deal with.

 I first noticed this issue when trying to display sample output from a
 command in a little tutorial I was writing. In one section of the output,
 there would be a URL displayed on each line. Wordpress was rendering this
 with a blank line in-between. Inside the <pre> block, this just manifested
 as a blank line in-between. Outside a `<pre>`, this manifested as a `<p>`
 for each line.

 Expected output was:

 {{{
 $ my command
 First line.

 http://example.com/1/
 http://example.com/2/
 Last line.
 }}}

 Resulting output with 4.0.1:

 {{{
 $ my command
 First line.

 http://example.com/1/

 http://example.com/2/

 Last line.
 }}}

 The current attached patch converts the URLs to links and removes a
 leading blank line that should have remained. It results in the following
 (pretend that the brackets are links):

 {{{
 $ my command
 First line.
 [http://example.com/1/]
 [http://example.com/2/]
 Last line.
 }}}

 My new patch (attaching in the next update) doesn't add any heuristics
 like checking for iframes, or removal of `linkifunknown`, but rather
 simply captures the whitespace matched in the regex and preserves it in
 the output. The resulting output matches my expected output in the first
 example above, and was tested both with and without pre-formatted text.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/23776#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list