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

Assigned To
None
Priority
Low
Author
HappyDog
Commits
Unknown Object (Diffusion Commit)
Subscribers
HappyDog, wikibugs-l
Projects
Reference
bz1600
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

bzimport added a subscriber: wikibugs-l.
bzimport set Reference to bz1600.
HappyDog created this task.Via LegacyFeb 26 2005, 4:54 PM
brion added a comment.Via ConduitDec 11 2005, 11:56 AM

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

brion added a comment.Via ConduitDec 11 2005, 12:18 PM

Applied to HEAD.

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

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.

bzimport added a comment.Via ConduitDec 12 2005, 5:53 PM

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).

bzimport added a comment.Via ConduitSep 18 2007, 2:05 AM

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...).

bzimport added a comment.Via ConduitSep 18 2007, 2:24 AM

ayg wrote:

Agree this is probably not needed.

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

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

bzimport added a comment.Via ConduitSep 24 2007, 4:57 PM

alxndr wrote:

trims whitespace and =s from summary

attachment EditPage-bug1600.diff ignored as obsolete

HappyDog added a comment.Via ConduitSep 24 2007, 5:22 PM

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

HappyDog added a comment.Via ConduitSep 24 2007, 5:35 PM

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

bzimport added a comment.Via ConduitSep 24 2007, 5:42 PM

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.

HappyDog added a comment.Via ConduitSep 24 2007, 5:51 PM

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.Via ConduitMar 24 2008, 6:32 PM

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

Attached: diff.patch

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

Woohoo! :) Applied in r32376

bzimport added a comment.Via ConduitApr 6 2008, 5:59 PM

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).Via DaemonsMar 4 2015, 8:22 AM

Add Comment