问题
I want to link from my project Trac page to my javadoc index.html file, which is located inside the source repository. However I don't know how to link in such a way that the file will be rendered as a usual page. I tried
[source:.../index.html]and
[http://.../index.html]both just displays its content, as any other source file.
From Trac version 0.11 an onwards, the
[export:.../index.html](as answered by Gregory Pakosz) seems to be exactly what I need, however we currently work with 10.3 (with no intention to upgrade due to some broken functionality with templates). Is there any plugin to support it in 10.3 version?
回答1:
See export: links
export: links
To force the download of a file in the repository, as opposed to displaying it in the browser, use the export link. Several forms are available:
export:/some/file - get the HEAD revision of the specified file
export:123:/some/file - get revision 123 of the specified file export:/some/file@123 - get revision 123 of the specified file
This can be very useful for displaying XML or HTML documentation with correct stylesheets and images, in case that has been checked in into the repository. Note that for this use case, you'd have to allow the web browser to render the content by setting [browser] render_unsafe_content = yes (see TracIni#browser-section), otherwise Trac will force the files to be downloaded as attachments for security concerns.
EDIT: It has been backported in 0.10.5, see this ticket.
回答2:
If you are server index.html in your webserver, you can include it in an Iframe within Trac using the TracTabPlugin
回答3:
You might also look into IncludeMacro.
来源:https://stackoverflow.com/questions/1938532/how-to-link-to-html-file-in-trac