Doxygen: how to link to a source file written in an unsupported language? - t4

We are using Doxygen for generating HTML docs for a cross-language project. In some documentation, I would like to link to the source a of file written in a language not supported by Doxygen (actually, it's a Visual Studio T4 template).
Currently, I simply write out the file name inside the doc comment.
Including the file's extension in the Doxyfile makes the link work, but Doxygen completely misinterprets the file, and links to this misinterpreted documentation, instead of the source file, which is what I want.
If I exclude the file's extension, however, Doxygen does not take up the file at all.
Is there any Doxygen command to directly link to a file's source, instead of its documentation?
I don't really care that Doxygen is generating incorrect documentation for this file: as long as I can link directly to the file's source and not the documentation, I'll be happy enough. The docs themselves are so clearly incorrect that it does not harm that the page is generated and potentially could be found.
Any ideas?

I'm not sure if this is the answer you are looking for, but a few hopefully useful points follow:
You can include blocks of source code using the \include command. From the Doxygen manual:
\include <file-name>
This command can be used to include a source file as a block of code. The command takes the name of an include file as an argument. Source files or directories can be specified using the EXAMPLE_PATH tag of Doxygen's configuration file.
Using the \include command is equivalent to inserting the file into the documentation block and surrounding it with \code and \endcode commands.
Also, from this page
Links to files.
All words that contain a dot (.) that is not the last character in the word are considered to be file names. If the word is indeed the name of a documented input file, a link will automatically be created to the documentation of that file.
and finally, from the Doxygen FAQ:
11. Doxygen automatically generates a link to the class MyClass somewhere in the running text. How do I prevent that at a certain place?
Put a % in front of the class name. Like this: %MyClass. Doxygen will then remove the % and keep the word unlinked.
From the last two points, it seems that Doxygen will automatically link to a documented file if it finds what it thinks is a filename. The % character will prevent Doxygen from doing this, but then you will need to find a way to link to the code you included with \include.
Also, see my comment to your question for how to stop Doxygen generating documentation for your Visual Studio T4 template - I presume that if you followed the suggestion in the comment then Doxygen won't automatically put a link to that file's (incorrect) documentation.
Edit: As discussed in the comments to the question, one possible solution is to create a new page for the source code and to include the source directly onto this page. For example, one could use
/*! \page src_code Visual Studio T4 Template
\include src.tt
*/
This will include a page headed "Visual Studio T4 Template" under the "Related Pages" tab of the documentation, which can be referenced with the tag src_code (i.e. use \ref src_code to link to that page/source code).
As a final aside, if you are including C/C++ code you could enclose the \include with the \code and \endcode commands to syntax highlight the code.

Related

godoc pass external reference file containing documentation for code without comments

Instead of comments written in the code itself, is it possible to pass an external reference file to the godoc command containing the documentation for any uncommented code?
The requirement here is that we need to generate documentation for a codebase that does not have any proper comments within the code and we also want to keep changes to the source files to a minimum.
Any other approach which fits this requirement is welcome. No strict rule to use godoc

How to make translations of full articles from po files in Sphinx or gettext

I'm writing a project documentation in Sphinx. I want to make translations of my .rst files, and I generated and translated .po files. Sphinx generates html translations fine, but I want to have .rst or markdown full articles (to use them on another site).
How can I recreate .rst or markdown files with translations from these .po (or .mo) files?
Sphinx, gettext or Python solutions will suit.
I tried to find information about that, but most answers concern translation of a string, not of a complete article.
I finally asked this question on the sphinx-users official mailing list. That one is really active and good. Matt from Documatt gave the following answer (with my small rewriting):
There is no direct way. Such a tool is on Docutil's todo list too. Just the idea that might help:
Build your Sphinx to Docutils XML. For example, if you have French localization (fr), then
sphinx-build -b xml source_dir output_dir -D language="fr"
in your project root.
Use Docutils's tool xml2rst.
The author of xml2rst also gave svn and sourceforge.net links to the code.
That worked indeed. There was a problem with extra whitespaces, however. They appeared during creation of the XML, and they threaten a well-formed rst (the xml2rst doesn't erase them). I'm going to delete them manually (this is not a big problem, any decent editor or sed can do that).

How to put ASM source code comments in comment window of OllyDbg?

I have the source code of an assembly language program, which has comments on every line, and I want to see those comments in the comment column of OllyDbg's disassembly as it debugs. Without writing a full blown plugin, is there any way to do this?
Comments do not make it into the final exe. I don't even think comments make it into the pdb file for a debug build.
If you have the source code that includes the comments in the directory of the exe, open the exe in olly, click the view menu then click source, this will open the source file with your comments and all.
99% of the time, what you write in your source file, is what olly shows, unless you are using a lot of macros.
After some more experience I found that there are basically 3 approaches:
Modify the .udd files that OllyDbg uses to store comments directly.
Use a label plug (unfortunately the one I found does not work on 2.01)
Create a debug file in a format OllyDbg understands (DWARF I think)
Since 3 is pretty complex, my best option is probably 1.

Is there a way to link two comments together in an IDE?

Case: One source file has a comment in it that is directly linked to a comment in another source file (it says see line 315 in xxx.cs for more information). The problem with this approach is that the comment on line 315 may not be at that line number in the future. Is there a way to link comments together in an IDE? (currently using Visual Studio 2010, but use other IDEs from time to time)
You can try this addin (I haven't used this):
http://hyperaddin.codeplex.com/
Besides this addin, the only thing I can think of is using a file link to directly go to the linked file; something like:
// ...
// See file://path_to_file
//...
The link will be converted to an actual link that you can click using Ctrl+Left Click but it won't take you to a given line number - it just opens the file.
The path can be a relative file path or a full file path - full paths work best if all team members use the same folder structure in the project. For example:
// file://w:/projects/GUI/frmMain.cs
Referring to a particular source file and line number is never a good idea, because someone might move things around in the other file without being aware that something is pointing at it. It's better to point at the particular type/method, for example See DoThings() in the MyThing class..
In Java, using Javadoc, you can use #link to do this, for instance See {#link MyThing#doThings()}. Eclipse will automatically update these when using its refactoring tools (e.g. renaming the class or the method). If the change is done manually, Eclipse will still warn that the target of the #link is invalid. (There is also #see which is more appropriate in some situations.)
I'm not sure about C# and Visual Studio, but it's likely that its XML-based doc format offers similar functionality.
The only way to handle this is to put the comment in the same file. Duplicating a comment is not the same as duplicating code, although ideally the code wouldn't need too much explanation in comments.
There are many, many reasons why the comment being in another file will cause pain. As you have stated, the line number may change but also it could be deleted (as they won't know another comment references it), updated in a way that changes its meaning and it is annoying to have to open another file in any case.

Adding syntax highlighter to JamWiki-1.2

The tutorial http://sinnerinc22.blogspot.de/2010/07/adding-syntax-highlighter-to-jamwiki.html describes how to enable syntax highlighting in JAMWiki.
My problem is that in the recent version of JAMWiki v1.2 the two files to be modified WEB-INF/jsp/top.jsp and WEB-INF/jsp/close-document.jsp do not exist any longer...
There is a third-party syntax highlighting tag extension available with JAMWiki 1.2 link that may work for you
I have added SHJS to my installation just following SHJS instructions rather than JAMWiki instructions. Simply edit JAMWiki JSP pages to add content as documented here. To see how does it work, look into the source code of this HTML document.
You even do not need to compile anything after you edit JSP, the server does this for you automatically.
Following up on Audrius's answer, here's exactly what you need to modify.
./jamwiki.war/WEB-INF/jsp/topic.jsp Modify it to look like this
Download the SHJS zip and copy all of the individual files from ./css/, ./lang/, ./sh_main.js, and ./sh_style.css from the zip to JamWiki.war/shjs/. (This will flatten the directory structure so everything is now in ./shjs/. Flattening the structure is optional but it makes for easier paths when referencing them in the jsp.)
You can modify the .war with 7zip or dig into your web app container file system and place the JSP and shjs folder directly.
Redeploy or refresh as needed depending on your preferred edit method.

Resources