Last modified: 2014-09-23 19:44:50 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T22760, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 20760 - Add support for "table" wrapper, to help fix cut+paste bugs in Firefox
Add support for "table" wrapper, to help fix cut+paste bugs in Firefox
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
SyntaxHighlight (GeSHi) (Other open bugs)
unspecified
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-09-22 02:13 UTC by Gregg Lind
Modified: 2014-09-23 19:44 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
patch for 20760, adding enclose="table" functionality (1.66 KB, patch)
2009-10-04 18:35 UTC, Gregg Lind
Details
simple diff based format (755 bytes, patch)
2009-10-04 19:15 UTC, Gregg Lind
Details
corrected order of diff (755 bytes, patch)
2009-10-04 19:20 UTC, Gregg Lind
Details
diff from current source to better implementation of fix (1.38 KB, patch)
2009-10-05 16:44 UTC, Gregg Lind
Details
example usage for _protect_newline; assertion test (2.29 KB, application/octet-stream)
2009-10-05 16:45 UTC, Gregg Lind
Details
svn-diff version of 2nd (improved) patch (2.26 KB, patch)
2009-10-05 17:11 UTC, Gregg Lind
Details
patch with improved naming conventions (2.44 KB, patch)
2009-10-05 19:56 UTC, Gregg Lind
Details

Description Gregg Lind 2009-09-22 02:13:12 UTC
As described at
http://sourceforge.net/project/shownotes.php?release_id=618638, there is a "table" type for headers, designed to fix FF's copy+paste badness

The proposed solution is to add a new keyword:  enclose="table" to join "div" "pre" and others.  In the main class, it would have hooks to:

$geshi->set_header_type(GESHI_HEADER_PRE_TABLE);

Not to add to the discussion going on around Bug 19416 https://bugzilla.wikimedia.org/show_bug.cgi?id=19416 , but this will be yet another set of presentation code to deal with there.  

As it stands now, this copy+paste bug is a real ugliness in wikibooks for me.  If some other way of ensuring that unformatted code is selectable is available, I'd hear it.
Comment 1 Gregg Lind 2009-10-04 18:35:04 UTC
Created attachment 6620 [details]
patch for 20760, adding  enclose="table" functionality
Comment 2 Gregg Lind 2009-10-04 18:37:07 UTC
[Attached bugfix]

Examined cases:  wrap='table' with line numbers has the correct copy and paste
behaviour in Firefox.  Without line numbers, it looks very similar to other
preformatted code.

Problems with bugfix:  it's hackish.  It relies on the particular format coming
back to protect the embedded newlines from Parser::doBlockLevels.  The
'righter' solution would be to only replace newlines with <br /> inside the
<pre> tags.  

Alternate Solutions:

Wrapping $out in <nowiki> tags doesn't seem to help protect things from
Parser::doBlockLevels.  


Example Markup:

<syntaxhighlight  lang='python'>
def hello():
    ''' print hello and exit'''
    print "hello"
</syntaxhighlight>

---

<syntaxhighlight line="GESHI_FANCY_LINE_NUMBERS" lang='python' enclose='div'>
def hello():
    ''' print hello and exit'''
    print "hello"
</syntaxhighlight>

---

<syntaxhighlight line="GESHI_FANCY_LINE_NUMBERS" lang='python' enclose='none'>
def hello():
    ''' print hello and exit'''
    print "hello"
</syntaxhighlight>

---
TABLEBASED

<syntaxhighlight line="GESHI_FANCY_LINE_NUMBERS" lang='python' enclose='table'>
def hello():
    ''' print hello and exit'''
    print "hello"
</syntaxhighlight>

---
TABLE,NOLINE

<syntaxhighlight lang='python' enclose='table'>
def hello():
    ''' print hello and exit'''
    print "hello"
</syntaxhighlight>

Comment 3 Gregg Lind 2009-10-04 19:15:10 UTC
Created attachment 6621 [details]
simple diff based format
Comment 4 Gregg Lind 2009-10-04 19:20:55 UTC
Created attachment 6622 [details]
corrected order of diff
Comment 5 Gregg Lind 2009-10-05 16:44:54 UTC
Created attachment 6626 [details]
diff from current source to better implementation of fix

cf:  http://stackoverflow.com/questions/1517102/replace-newlines-with-br-tags-but-only-inside-pre-tags/

and protect.php for discussion and example usage
Comment 6 Gregg Lind 2009-10-05 16:45:53 UTC
Created attachment 6627 [details]
example usage for _protect_newline; assertion test
Comment 7 Gregg Lind 2009-10-05 17:11:05 UTC
Created attachment 6628 [details]
svn-diff version of 2nd (improved) patch
Comment 8 Gregg Lind 2009-10-05 19:56:40 UTC
Created attachment 6633 [details]
patch with improved naming conventions

line_numbers (with underscores) retained for consistency with GeSHI methods.
Comment 9 p858snake 2011-04-30 00:09:54 UTC
*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*
Comment 10 Bugmeister Bot 2011-08-19 19:12:42 UTC
Unassigning default assignments. http://article.gmane.org/gmane.science.linguistics.wikipedia.technical/54734
Comment 11 Sumana Harihareswara 2011-11-14 16:43:15 UTC
Gregg, thank you for the patch, and my apologies that no one has responded yet.  I'm adding a keyword to this bug, "need-review," to signal that the patch awaits review.  Could you comment and clarify which of the patches you want reviewed? attachment 6633 [details], right?  then we can mark the others as obsolete.
Comment 12 Sumana Harihareswara 2012-05-25 03:23:36 UTC
Gregg: Thanks again for the patch.  Are you interested in using developer access to directly suggest it into our Git source control system?

https://www.mediawiki.org/wiki/Developer_access

https://www.mediawiki.org/wiki/Git/Workflow#How_to_submit_a_patch

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links