I have a rather large single documentation page and I want to generate a symbol list (Jump to: on phobos docs, see std.compiler) with dub --build=ddoc because it is not there by default (current documentation page)
I would not want to include a list of all symbols with links in the code for obvious reasons.
I know that this is possible with ddox or javascript, but is there any way to do this using only vanilla ddoc so maintenance effort can be kept at a minimum? Thanks
Edit: I want to generate a listing for both global symbols, but also for members of classes and put the table near the class.
Ddoc is a macro system. It just replaces one thing with something else. The compiler defines certain macros for you (which you can redefine), and for actually generating a documentation page using ddoc, the compiler takes the documentation comments from the module, its list of documented symbols, etc. and basically generates a .dd page like you'd have when creating something like the dlang.org website. It's a bunch of text with ddoc markup. That ddoc markup is then replaced with whatever those ddoc macros are defined to be replaced with. By default, that's a bunch of html geared towards creating a web page, but those macros could be redefined to generate different html than the default or to generate something completely different like latex.
However, ultimately, all you're getting is the equivalent of a .dd page where you can affect what the results are by redefining the macros and thus redefining how one piece of text is converted into another. You have zero capability to iterate a list of symbols or do anything particularly turing complete. All you get is macro expansion.
That's why dlang.org uses javascript to generate the jump to links, and that's why the build process for dlang.org actually has a small D program that it runs to generate the ddoc for the navigation bar with the module list. ddoc can't do any of that. And that's why a tool like ddox uses the json output from the compiler to get at the symbol list and documentation info and generate its own thing.
So, no, you can't do anything like what you're trying to do with just standard ddoc. Really, the only options are to use javascript so that the browser can manipulate the result when viewing the document, to manipulate and/or generate ddoc with an external program, or to generate the documentation with a completely different tool such as ddox.
ddoc is a great macro system and fairly powerful as such, but if you're trying to do anything fancier than affect how the generated documentation looks, ddoc really doesn't get you there - at least not without the help of other tools to generate or manipulate either the ddoc that's processed or the results of processing the ddoc.
Ddoc documentation: https://dlang.org/spec/ddoc.html
There are some alternative documentation generators (which may or may not use ddoc) listed here: https://wiki.dlang.org/Open_Source_Projects#Documentation_Generators
Related
I batch create the documents from the code by using doxygen. However, I lost code and I didn't lose the document. I want to convert the code back from the documents. Is there any option in doxygen to do this? Thank you very much.
By the way, the documents are all html files
Doxygen is a documentation generator; it's job is to go from code to documentation. As such, it has no functionality for reversing this process. Especially since the generated HTML can change from version to version.
Documentation conversion is also an inherently lossy process. Unless you outputted all of your source code into the documentation, you're not going to be able to reconstruct everything. The best you might do is rebuild most aspects of some headers, but even then, anything that goes undocumented (like header include files and such) won't be in the HTML.
I want to be able to query what dependencies there are for C++ functions and variables in my source code. You could do that with Clang on the Linux side, but for Windows(.NET, etc) I can't seem to find a way to get access to the AST.
Background:
Say I fixed a part of my code. I'm trying to find a tool to easily identify all the areas in my source code affected by this fix. For example, if I changed Foo(), I'll check all areas that Foo() is used and all functions that Foo() calls, gather them, and print them out in a list. Preferably, it will also be able to gather multiple levels of dependencies. If it were to be represented visually, it'll look something like Sourcetrail. Unfortunately, I want to be able to do this programmatically instead of via a UI, so that link isn't what I'm looking for. I looked at DMS Search Engine but I can't seem to make its trial version to download. So I was wondering if I can just do it myself. But I can't seem to figure out how Sourcetrail, for example, was able to get the AST from a Visual Studio C++ project.
So I've been trying to implement an #if parser into an infobox, but I seem to be out of luck. The previous code I used seems to be outdated, and I can't find the a way to code it in again, differentely. :/
Basically, in this infobox, if a field is not typed in(or if typed in is left empty) it should become 'invisible' or not even render.
This code worked fine in a previous version of MediaWiki(not sure which one though), but no longer: http://pastebin.com/uQ49mPbQ. I've been trying to use it as a tutorial, and even outright copy and pasted it, but it simply doesn't work. All of the fields would become invisible, regardless of what I would have done to them...
This is the new code that I am using, and would like to be #if'ed: http://pastebin.com/3j0AbN5v
Any help would be welcome.
You need to enable the ParserFunctions extension to be able to use the {{#if}} parser function. Do this in your LocalSettings.php:
require_once( "$IP/extensions/ParserFunctions/ParserFunctions.php" );
If you want to use the string functions (like {{#replace}}, {{#explode}}, etc), also add:
$wgPFEnableStringFunctions = true;
In recent versions of MediaWiki, ParserFunctions is included (but not enabled) so you don't need to download anything.
Basic troubleshooting: Whenever you see code like {{#zyx:...}} in a wiki page, it (probably) means, that someone tried to use a parser function that is not installed. Unless there is a parser function called “zyx” installed, the code {{#zyx:...}} has no special meaning to the wiki, and the text will be printed just like it is. The most common parser functions are collected in an extension called ParserFunctions, that is used on WikiMedia wikis. You will need the parser functions from ParserFunctions whenever copying templates from e.g. English Wikipedia.
To see what parser functions you have enabled, navigate to Special:Version on your wiki. Below the list of installed extensions is a list of tags (such as <gallery />) and parser functions available. As you can see, “if” is among the parser functions on your old wiki, but not on your new.
I work on unix.
I have my complete source code in unix in the form of building blocks and modules.
Like headers,sources files,make files etc.
I can copy all the files with the same directory structure to windows.
I need some tool which will convert all the source to html tags with all the links to functions,variables,classes,headers.There should be some tool to do this easily.
by this way it would be easy for debugging the code in a fast way.
Is anybody aware of such tool?
The term you're probably looking for is "documentation generator". You're specifically interested in ones that output HTML files.
Doxygen is popular, but if you want a master comparison list of documentation generators Wikipedia has a summary:
http://en.wikipedia.org/wiki/Comparison_of_documentation_generators
Looking at the output generated by the different programs (on projects that use them) will probably inform your choice of which meets your needs.
You can use doxygen to generate your documentation. In its basic form it will generate what you need but to add comments that appear in the final html you will need to use special style comments.
I am trying to develop a tool that inserts comments in C/C++ source files in pre-defined formats.
The comments could be:
file headers <-> file names required
class comments <-> class name required
function comments <-> function name required
Following points are required to be taken mind:
If the comments are already there in right format then leave them intact.
If the comments are broken them fix them and insert them.
Some desirable but non important features:
Check and fix the indentation.
Check if any breaks are missing in their respective cases.
Please suggest open-source / free libraries / logic to aid in this.
I guess you 've got two choices:
Generate the whole c/c++ code and headers from a template or scripting language and use this one to insert the preformated comments. This is of course not an option if you still got a lot of code.
Or you need a tool to parse the code into sth. you can further use. You could try doxygen to generate html, xml or some other format. Problem would still be, how to get the generated documentation back into your sources...