Modify

Opened 16 years ago

Last modified 5 years ago

#3069 new enhancement

TracLinks cut when specifying max_size in BlogList

Reported by: whitelynx Owned by: osimons
Priority: normal Component: FullBlogPlugin
Severity: normal Keywords:
Cc: John Hampton Trac Release: 0.11

Description (last modified by Ryan J Ollos)

When using the BlogList macro and specifying max_size, it simply trims the raw wiki text, which will sometimes cut TracLinks in half.

Attachments (2)

truncate.diff (3.6 KB) - added by Dan Sheridan 15 years ago.
Trivial port of pacopablo's splitting function
FullBlogSidebar_CuttingPosts.png (35.1 KB) - added by Ryan J Ollos 15 years ago.
Screen capture of sidebar.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 16 years ago by osimons

Cc: John Hampton added; anonymous removed

Yes, I know - and might I add: It was a concious decision to just do it that way. It is a very complex thing to trim it without interfering with any markup - be it links, pre-formatted text or whatever. You do not necessarily know what the wiki markup will render as before actually rendering it. Regardless of how it is done, it is quite likely that it won't be sufficient in all circumstances.

I did look at what pacopablo did for his TracBlogPlugin - see tracblogplugin/0.10/tBlog/web_ui.py@3516#L622. I pondered nabbing that code some 6 months ago, but decided against it.

Now that pacopablo come on board the FullBlogPlugin team for 0.11+, he might feel it is worth porting that code or some variation of it? I haven't used that plugin and don't really now how successful that trimming actually is. John, what do you think?

comment:2 Changed 16 years ago by John Hampton

Well, my solution worked pretty well. I never received any bugs with it. The biggest problem is that it wasn't a hard cut. I always cut at the end of the line. This saved me from having to deal with most of the wiki markup. However, if someone has a long paragraph that is a single line, then the post can be much longer than the max_size

comment:3 in reply to:  2 Changed 16 years ago by osimons

Replying to pacopablo:

Well, my solution worked pretty well.

Nice. Reading through it again I think it represents a fair trade-off between avoiding unexpected output without too much complexity.

However, if someone has a long paragraph that is a single line, then the post can be much longer than the max_size.

Or some macro like [[TicketQuery]] in table mode is part of the content that gets rendered. Or using the [[Include]] macro pulling in a full page resource from somewhere else....

Anyway pacopablo, feel free if you want to port that code to a new util method :-)

(PS! As a possible alternative, one could render everything first and then trim at the HTML level - open (and push onto a heap) the discovered tags and traverse the tree until max_size from text() length is exceeded, and then just pop off and close the tags that are left on the heap. Perhaps... Or maybe it just introduces new kinds of corner-cases...)

comment:4 Changed 15 years ago by osimons

#6347 closed as duplicate.

Changed 15 years ago by Dan Sheridan

Attachment: truncate.diff added

Trivial port of pacopablo's splitting function

Changed 15 years ago by Ryan J Ollos

Screen capture of sidebar.

comment:5 Changed 15 years ago by Ryan J Ollos

Screen capture from my Trac installation demonstrating the issue.

Screen capture of sidebar.

comment:6 Changed 9 years ago by anonymous

Has any changes with this problem?

comment:7 Changed 5 years ago by Ryan J Ollos

Description: modified (diff)

comment:8 Changed 5 years ago by Ryan J Ollos

Type: defectenhancement

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain osimons.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.