Edgewall Software
Modify

Opened 18 years ago

Closed 14 years ago

Last modified 14 years ago

#3225 closed enhancement (fixed)

[PATCH] Configurable shortening of headings in wiki

Reported by: bruno@… Owned by: Christian Boos
Priority: normal Milestone: 0.10
Component: wiki system Version: devel
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Little patch to configure (via trac.ini) the shortening of headings in wiki formatting.

usage

If you don't want headings to be shortened, apply this patch and add the following line in your trac.ini in the wiki section :

[wiki]
shorten_headings = false

rationale

We tend to use [wiki:PathToPage Some more descriptive text here], and discovered that when doing this in a heading, the heading text was shortened - before wiki links were resolved. This somewhat screw up our nice page headings !-), so I choose the shortest path : making this configurable. Thanks to you guys, this took me no more than 5 minutes - which is a sure proof that you did a pretty good work.

Attachments (3)

shorten_headings.diff (867 bytes ) - added by bruno@… 18 years ago.
patch to trac/wiki/formatter.py
shorten_headings.2.diff (1.5 KB ) - added by bruno@… 18 years ago.
configurable shortening of headings (with correct support in PageOutline)
page_outline_shortening.patch (1.9 KB ) - added by mike_mp@… 14 years ago.
restore "dont shorten lines in PageOutline inline"

Download all attachments as: .zip

Change History (13)

by bruno@…, 18 years ago

Attachment: shorten_headings.diff added

patch to trac/wiki/formatter.py

comment:1 by bruno@…, 18 years ago

Summary: Configurable shortening of headings in wiki[PATCH] Configurable shortening of headings in wiki

added [PATCH] in the summary.

comment:2 by Christian Boos, 18 years ago

Milestone: 0.10
Owner: changed from Jonas Borgström to Christian Boos

Well, I'd rather say we should never shorten headings. Why should we?

by bruno@…, 18 years ago

Attachment: shorten_headings.2.diff added

configurable shortening of headings (with correct support in PageOutline)

comment:3 by bruno@…, 18 years ago

Well, I'd rather say we should never shorten headings. Why should we?

Well, at least, this patch leaves the choice to the user. I made it so the default was to keep existing behaviour, but it's quite easy to change this too !-)

comment:4 by Christian Boos, 18 years ago

I think there's no reason to shorten a heading, and I actually introduced the shortening in r3353 by mistake… So r3365 fixed this.

The only place where this would make sense is in the outliner formatter (the one used to produce a clickable index of the page). There, if the heading is split at the wrong place, it's less important than having a compact view of the document's structure.

See also related #2064, for the problem of splitting in the middle of a link with alias.

comment:5 by Christian Boos, 18 years ago

Resolution: fixed
Status: newclosed

Fixed in r3365 (forgot to close it in previous comment)

comment:6 by anonymous, 14 years ago

Resolution: fixed
Status: closedreopened

I believe there's been a regression on this issue. The current OutlineFormatter hardcodes to "shorten" on line 1403 of formatter.py. I've hardcoded my own installation to not do this (over at http://www.sqlalchemy.org/trac/wiki/FAQ , these headings were being chopped before), attached is a patch (not tested) that sets it based on whether or not the 'inline' flag is set on PageOutlineMacro.

by mike_mp@…, 14 years ago

restore "dont shorten lines in PageOutline inline"

comment:7 by Remy Blank, 14 years ago

Resolution: fixed
Status: reopenedclosed

I believe that this was left on purpose (according to comment:4). There are other tickets about avoiding cutting through e.g. links (#7792, #2064), so these should solve the "ugliness" issue.

in reply to:  7 comment:8 by anonymous, 14 years ago

Replying to rblank:

I believe that this was left on purpose (according to comment:4). There are other tickets about avoiding cutting through e.g. links (#7792, #2064), so these should solve the "ugliness" issue.

its not clear here, or from those referenced tickets, if there are plans to maintain the behavior that "inline" outline links are not truncated at all. this is not the same as a global "truncate" setting like that suggested in #7792. The issue is that it makes no sense at all to truncate the text when using the "outline" setting. As you can see from my linked FAQ page, the outline is totally useless if the links are truncated, people can't read the full text of the questions.

Do I need to write my own trac plugin for this purpose ?

comment:9 by Remy Blank, 14 years ago

Oh, sorry, I misunderstood. Your patch only prevents shortening on inline page outlines. That makes sense, yes. Or maybe we could add a separate option shorten=False to control the shortening behavior.

Would you mind opening a separate ticket for this? Re-using a 4-year old ticket closed against a milestone makes it a bit difficult to track. You can target it to 0.12.1 and assign it to me. Thanks.

comment:10 by mike_mp@…, 14 years ago

i created #9391.

this ticket seemed like a good first start as this does seem to be a regression.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.