Edgewall Software
Modify

Ticket #1520 (reopened enhancement)

Opened 7 years ago

Last modified 20 months ago

Highlight TracLinks in browser

Reported by: shad Owned by: cboos
Priority: normal Milestone: next-major-0.1X
Component: wiki system Version: 0.8.1
Severity: normal Keywords: mimeview postprocessing pygments comment
Cc:
Release Notes:
API Changes:

Description (last modified by cboos) (diff)

It would be nice to highlight TracLinks in browser file view.

For example to display ticket links when viewing source:trunk/ChangeLog@latest.

This is already possible by specifying text/x-trac-wiki as the mimetype for this kind of files

Another example would be to wiki format the inline Wiki syntax present in comments (this needs some cooperation from the syntax highlighter, e.g. the Pygments renderer).

Attachments

Change History

comment:1 Changed 7 years ago by cboos

  • Owner changed from jonas to cboos
  • Status changed from new to assigned

This could be achieved by setting the svn:mime-type
of the file to something like text/trac
or application/x-trac...

Then, a mimeprocessor doing a wiki_to_html() could be used
for rendering the file.

comment:2 Changed 7 years ago by cboos

  • Resolution set to fixed
  • Status changed from assigned to closed

Idea above implemented in [1611].
This should be enough to correctly handle files like source:trunk/ChangeLog#latest.

Trying to detect TracLinks in all files would certainly be overkill...

However, one could add a post-processing step for
enscript and/or ClearSilver highlighting, in order
to look for TracLinks in the comments only.
But this corresponds to a separate ticket, so I'm closing this one.

comment:3 Changed 7 years ago by cmlenz

First, I don't think [1611] really addresses the request raised here. Are you expecting people to set the content type of their ChangeLog file to "text/x-trac-wiki" so that the ticket references get hyperlinked? Wouldn't that probably mess up the formatting of the change log?

Second, I don't see much value in the TracWikiRenderer personally, i.e. I don't really understand the use case. While the implementation surely is simple enough, I feel that it might be better provided by an option plugin, as opposed to part of the core functionality. But maybe you have some use cases in mind that I can't think of?

comment:4 Changed 7 years ago by cboos

  1. Is it really such a problem to set the mime-type on a file in order to have it correctly highlighted? I can't see the problem here.
  2. The use case is pretty simple: most of the projects contain text documents like README, INSTALL.txt or such. Once developers are used to Trac's Wiki markup (because they are using the Trac Wiki for documentation purpose), they also tend naturally to use these conventions in other text documents. Then, while browsing those documents in Trac, it's also natural that they get formatted the expected way.
  3. If that approach is not correct, how would you have addressed this need, then?

comment:5 Changed 7 years ago by cmlenz

The problem isn't setting the svn:mime-type property. The problem is that the files in question, for example README, ChangeLog or README.txt, are formatted as plain text. Treating them as if they contained Trac Wiki syntax will probably mess up the formatting. You argue that people will get used to using the Trac Wiki syntax and extend its use to the above files, which I doubt myself.

I'm not saying that I know a better solution to this request. I'm also not sure it's solvable in a "correct" way.

comment:6 Changed 7 years ago by shad

I haven't tryed setting the svn:mime-type yet (simple and elegant solution), but I think cmlenz is right - we don't need full power of wiki in text-files (though it could mess the formatting of plain text file), just a link highlighting is required.

For simple plaintext files like ChangeLog there should be enough svn:mime-type property (someting like text/x-trac-links), but what about source files (c++ in my case) - sources often contain links to tickets in comments. So I think it should be configurable (through TracIni) to allow parsing of TracLinks before showing any text-like file in the repository (through Browser.py).

comment:7 Changed 7 years ago by cboos

  • Keywords mimeview postprocessing added
  • Milestone 0.9 deleted
  • Priority changed from normal to low
  • Resolution fixed deleted
  • Severity changed from normal to enhancement
  • Status changed from closed to reopened

The text/x-trac-links idea is a good one.
I also like the idea of TracLinks highlighting in C++ code comment.

There's also some material on the Mailing List on that issue:

(actually, have a look at for some prior art :) ).

comment:8 Changed 7 years ago by cboos

See also #1292

comment:9 Changed 5 years ago by cboos

  • Milestone set to 2.0

comment:10 Changed 5 years ago by cboos

  • Component changed from browser to wiki

I'll find this one quicker next time I'll be looking for it ;-)

comment:11 Changed 22 months ago by cboos

  • Milestone changed from 2.0 to unscheduled

Milestone 2.0 deleted

comment:12 Changed 20 months ago by cboos

  • Description modified (diff)
  • Keywords pygments comment added
  • Milestone changed from triaging to next-major-0.1X
  • Priority changed from low to normal

See also #2523.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as reopened
as The resolution will be set. Next status will be 'closed'
to The owner will be changed from cboos. Next status will be 'new'
Author


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

 
Note: See TracTickets for help on using tickets.