Remove section markup inside heading text when using "section=new"
Closed, ResolvedPublic

Description

I often mistakenly use the heading markers when filling in the headline in a
'post a comment' box, which results in the == appearing twice in the code, and
therefore on-screen. The software should detect this and remove == if found at
both ends of an edit comment.


Version: unspecified
Severity: enhancement

Details

Commits
Unknown Object (Diffusion Commit)
Reference
bz1600
bzimport set Reference to bz1600.
bzimport added a subscriber: Unknown Object (MLST).
HappyDog created this task.Feb 26 2005, 4:54 PM

Created attachment 1169
Patch for EditPage.php in HEAD

Patch to trigger edit conflict on 'section=new' when the previous edit's
username and comment string match; this should get most dupe posts.

Attached: 1600.diff

Applied to HEAD.

brion added a comment.Dec 12 2005, 2:42 AM
  • Bug 2360 has been marked as a duplicate of this bug. ***

This patch is fixing a different bug to the one stated, so I'm reopening it.
Perhaps it's because my original post is not clear enough.

The problem I was referring to is that when I post a new comment (i.e. add a new
section) I will often enter "== Title ==" (minus quotes) into the
subject/heading box. This results in the following string being entered into
the wiki markup (again minus quotes): "== == Title == ==", which then needs to
be fixed.

The suggestion is for the software to spot this situation and not add the
heading tags if they are already at both ends of the subject string.

rowan.collins wrote:

(In reply to comment #4)

This patch is fixing a different bug to the one stated, so I'm reopening it.
Perhaps it's because my original post is not clear enough.

I think your description was descriptive enough, but the summary line seems to
have got off the point (I've changed it now).

bugs wrote:

Unneeded change requested from early days of software, this capability is no longer really needed anymore (and everyone has adapted to the current situation, I can't remember the last time I saw something like this happen...).

ayg wrote:

Agree this is probably not needed.

brion added a comment.Sep 18 2007, 2:49 PM

To be honest, I make this mistake sometimes. :) Reopening.

alxndr wrote:

trims whitespace and =s from summary

attachment EditPage-bug1600.diff ignored as obsolete

Created attachment 4150
trims whitespace and =s from summary, anchored

Modification to previous patch, so that the regex is anchored to the start/end of the submitted string. Original patch would mangle headings such as "$Foo == $Bar instead of $Foo === $Bar!".

attachment New Notepad++ Document.txt ignored as obsolete

Created attachment 4151
trims whitespace and =s from summary, anchored, stricter

A stricter version, with fewer false positives (for example, it won't alter titles with = symbols on just one side, e.g. "=Text").

Also moved trimming out of regex and into separate trim() statements to stop it matching multiple equals signs separated by spaces.

I could make this stricter, e.g. it always removes the same number of = from the start and end (e.g. "=== test ==" becomes "= test") and it doesn't modify the special case of a title that is purely made up of = symbols, if requested.

Finally, a question - does this display correctly in the summary preview, or is it only applied on save? I haven't been able to test as I don't have HEAD setup on this machine.

attachment New Notepad++ Document.txt ignored as obsolete

alxndr wrote:

(In reply to comment #11)

Finally, a question - does this display correctly in the summary preview, or is
it only applied on save? I haven't been able to test as I don't have HEAD
setup on this machine.

It removes =s on preview.

Created attachment 4152
trims whitespace and =s from summary, anchored, stricter

Fix typo

attachment New Notepad++ Document.txt ignored as obsolete

demon added a comment.Mar 24 2008, 6:32 PM

Created attachment 4755
Updated patch against current head, same regex/trim() function

Attached: diff.patch

brion added a comment.Mar 24 2008, 6:41 PM

Woohoo! :) Applied in r32376

ayg wrote:

Reverted the white-space-stripping part of this in r32863, as my commit message says:

Partial revert of r32376: don't strip whitespace from summaries. If you do, that means that the default "/* Section name */ " summary loses its trailing space if you hit preview before submitting, which is noticeably inconsistent and annoying. Maybe trim it on save, but I don't know if there's any point.

epriestley added a commit: Unknown Object (Diffusion Commit).Mar 4 2015, 8:22 AM

Add Comment