Making WordPress.org

Changeset 14395


Ignore:
Timestamp:
02/20/2025 02:11:57 AM (16 months ago)
Author:
dd32
Message:

Trac: Limit the length of code blocks, and note that it's been truncated for display.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/trac.wordpress.org/templates/ticket_change.html

    r14392 r14395  
    1616def wporg_wiki_to_html(context, wikidom, escape_newlines=None):
    1717
    18     # Syntax highlight HTML blocks
     18    # Syntax highlight HTML blocks.
    1919    wikidom = re.sub( r'{{{\s*#!html', '{{{#!xml \n HTML', wikidom, flags=re.IGNORECASE )
    2020
    2121    # Unsupported code types get converted to plaintext.
    2222    wikidom = re.sub( r'{{{\s*#!(?!CommitTicketReference|xml|php|js|javascript|sql|sh|table|tr|th|td|diff)(\S+)\s', '{{{#!default \n \\1', wikidom, flags=re.IGNORECASE )
     23
     24    # Long code blocks (20k+) should be truncated to 10k characters.
     25    wikidom = re.sub( r'{{{(.{10000}?).{10000,}?(}}}|$)', '{{{\\1 \n\nWordPress.org: Please note that this content has been truncated for display.\n }}}', wikidom, flags=re.DOTALL )
    2326
    2427    # Convert WikiMarkup.
Note: See TracChangeset for help on using the changeset viewer.