Skip to:
Content

bbPress.org

Opened 8 years ago

Closed 8 years ago

#2317 closed defect (fixed)

bbPress Posting Codes Bugs

Reported by: alex-ye Owned by:
Milestone: 2.3.2 Priority: high
Severity: normal Version: 2.3.1
Component: General - Content Creation Keywords: needs-patch dev-feedback
Cc: nashwan.doaqan@…

Description

1- The codes doesn't displayed correctly in the edit screens:

Original source code:
<pre><code><p>bbPress <b>2.3.1</b>.</p></code></pre>

Viewing source Code (Good):
<pre><code>&lt;p&gt;bbPress &lt;b&gt;2.3.1&lt;/b&gt;.&lt;/p&gt;</code></pre>

Edit-sceen source code (not-good):
'<p>bbPress <b>2.3.1</b>.</p>'

After save the edit-screen code (not-good):
<code>&lt;p&gt;bbPress &lt;b&gt;2.3.1&lt;/b&gt;.&lt;/p&gt;</code>

The codes in the edit-screens must be displayed the same as the original code.

2- Posting codes by admins, not a good experience:

The users who have the 'unfiltered_html' capability, should be able to use all HTML tags without decoding them except those tags inside <pre><code> </code><pre>

3- Codes inside codes !

Try to post this code:

Original source code:
<code><code><b>bbPress</b></code></code>

Edit-screen source code (not-good):
'<code><b>bbPress</b>'</code>

View source code (not-good):
<code></code><code>&lt;b&gt;bbPress&lt;/b&gt;</code>

4- Smiles Inside codes:
When you post a smile symbol like " :) ", it should displayed as it's and not converted to an image.

5- Anchors\Links inside codes:
When you post an anchor tag, It should displayed as it's and not converted to a link.

Original source code:
<pre><code><a href="http://google.com">Google</a></code></pre>

View source code (not-good):
<pre><code><a href="http://google.com" rel="nofollow">Google</a></code></pre>

6- ' or <code> , What's the rule?!
I notice that you convert the <code> tags to markdown ' symbol but I can't realized Why? and When? and how I can disable this?

Attachments (1)

2317.patch (2.3 KB) - added by johnjamesjacoby 8 years ago.

Download all attachments as: .zip

Change History (18)

#1 in reply to: ↑ description ; follow-ups: @johnjamesjacoby
8 years ago

Replying to alex-ye:

Original source code:
Edit-sceen source code (not-good):
<p>bbPress <b>2.3.1</b>.</p>

The conversion to backticks is by design.

After save the edit-screen code (not-good):
<code>&lt;p&gt;bbPress &lt;b&gt;2.3.1&lt;/b&gt;.&lt;/p&gt;</code>

I'm not able to duplicate this. It seems to work okay.

2- Posting codes by admins, not a good experience:

The users who have the 'unfiltered_html' capability, should be able to use all HTML tags without decoding them except those tags inside <pre><code> </code><pre>

This valid. I saw the other ticket (#2315) about this, so let's address this there.

3- Codes inside codes !

Try to post this code:

Original source code:
<code><code><b>bbPress</b></code></code>

Edit-screen source code (not-good):
<code><b>bbPress</b></code>

View source code (not-good):
<code></code><code>&lt;b&gt;bbPress&lt;/b&gt;</code>

Valid, and the main reason to use backticks from the start instead of wrapping in pre and code tags.

4- Smiles Inside codes:
When you post a smile symbol like " :) ", it should displayed as it's and not converted to an image.

Able to reproduce, and will be hard to prevent. Should look into this in 2.4.

5- Anchors\Links inside codes:
When you post an anchor tag, It should displayed as it's and not converted to a link.

Original source code:
<pre><code><a href="http://google.com">Google</a></code></pre>

View source code (not-good):
<pre><code><a href="http://google.com" rel="nofollow">Google</a></code></pre>

If you use backticks, this doesn't happen. Maybe the make_clickable filter is out of order.

6- ' or <code> , What's the rule?!
I notice that you convert the <code> tags to markdown ' symbol but I can't realized Why? and When? and how I can disable this?

This is the way bbPress originally worked. We didn't implement it in bbPress 2.0, but brought it back in 2.3. Because of most of the issues you've posted above, I'd recommend not trying to disable them, or helping improve the nesting of code tags in core where backticks aren't necessary.

#2 in reply to: ↑ 1 ; follow-up: @alex-ye
8 years ago

Replying to johnjamesjacoby:

I'm not able to duplicate this. It seems to work okay.

Wired?! , What I meant that the

<pre><code>bbPress</code></pre>

converted to backticks only

'bbPress'

It should converted to:

<pre>'bbPress'</pre>

Right?

#3 in reply to: ↑ 1 @alex-ye
8 years ago

Replying to johnjamesjacoby:

Able to reproduce, and will be hard to prevent. Should look into this in 2.4.

I think it will be kind of hack, but it's possible, I will try to upload a patch.

If you use backticks, this doesn't happen. Maybe the make_clickable filter is out of order.

Sure thing it's about make_clickable() I create a ticket in the WordPress
http://core.trac.wordpress.org/ticket/23756

but I am not good in patterns to fix it :D

Another question related to this topic why bbPress convert the <p>,<br /> to <coded p>, I think the reason around wpautop but if you can post more explanation?

#4 in reply to: ↑ 2 ; follow-up: @johnjamesjacoby
8 years ago

Replying to alex-ye:

Right?

<pre> tags are block level elements. If you put your code blocks on their own lines, they'll act as such. If you keep them inline with other text, it will display only with code tags, and not with pre tags.

#5 in reply to: ↑ 4 @alex-ye
8 years ago

Replying to johnjamesjacoby:

<pre> tags are block level elements. If you put your code blocks on their own lines, they'll act as such. If you keep them inline with other text, it will display only with code tags, and not with pre tags.

Got it, but I think it still there some bugs around this, It's about the change before/after save if the <pre> must be in multi-line

so when you post

<pre><code>bbPress</code></pre>

It should be converted to:

<code>bbPress</code>

immediately.

and when you post this:

<pre><code>
<?php 
  echo "Hi"; 
?>
</code></pre>


it should be displayed as below in the edit-screen

<pre>'
<?php 
  echo "Hi"; 
?>
'</pre>

#6 follow-up: @johnjamesjacoby
8 years ago

You're misunderstanding what backticks do. Backticks are like "smart code tags" that convert pre/code tags to backticks if you use them pre-save, and then format them correctly on output.

They don't only convert <code> tags, rather they convert all usages of <code> and <pre> and then format the output as needed.

Last edited 8 years ago by johnjamesjacoby (previous) (diff)

#7 in reply to: ↑ 6 @alex-ye
8 years ago

Replying to johnjamesjacoby:

You're misunderstanding what backticks do. Backticks are like "smart code tags" that convert pre/code tags to backticks if you use them pre-save, and then format them correctly on output.

They don't only convert <code> tags, rather they convert all usages of <code> and <pre> and then format the output as needed.

aha, I think I understand it a little bit now, I will do some tests to make sure I get the idea .

#8 @alex-ye
8 years ago

  • Cc nashwan.doaqan@… added

#9 @alex-ye
8 years ago

Confirmed, bbPress backticks are really smart feature, a less-headache when posting code , I was usually using pre/code tags so it make me confuse.

Anyway.. waiting for someone help to solve the listed bugs above.

#11 @johnjamesjacoby
8 years ago

In 4877:

Switch to using esc_textarea() for filtering form post content values. When using TinyMCE, remove that textarea escaping, and trust tinymce to do its thing. See #2317. (trunk)

#12 @johnjamesjacoby
8 years ago

In 4878:

Switch to using esc_textarea() for filtering form post content values. When using TinyMCE, remove that textarea escaping, and trust tinymce to do its thing. See #2317. (2.3 branch)

#13 @johnjamesjacoby
8 years ago

In 4879:

Only remove filters if bbp_use_wp_editor() is true. See #2317. (2.3 branch)

#14 @johnjamesjacoby
8 years ago

In 4880:

Only remove filters if bbp_use_wp_editor() is true. See #2317. (trunk)

#15 @johnjamesjacoby
8 years ago

  • Milestone changed from Awaiting Review to 2.3.2

#16 @jaredatch
8 years ago

We can close this, no?

#17 @johnjamesjacoby
8 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Looks fixed to me. Closing.

Note: See TracTickets for help on using tickets.