Generate chm output from doxygen output - doxygen

I am using
chmcmd, a CHM compiler. (c) 2010 Free Pascal core.
for generating .chm file from Doxygen output. It presents me with error messages like
Warning: Found file dynsections.js while scanning files.html, but couldn't find it on disk
and similar for "namespacestd.html". It looks like something has changed in the installation of Doxygen during the times. It is just a warning, but I guess it has reason and consequences. How can I overcome it?

I don't use ChmCmd but even with Doxygen version 1.8.13 the file dynsections.js is always contained in the output directory ..\html on my Windows10 machine.
Of course I have <script type="text/javascript" src="dynsections.js"></script> in files.html.
Please first search for the files like dynsections.js. Try adding the names of the *.js files to the [FILES] list in your project (.hhp) file. This will ensure that the .js files are compiled into the help file, which may not be the case at present.
If you're using HTML Help Workshop as an alternative to chmcmd, the procedure for adding the file names to the [FILES] section is as follows:
Open the .hhp file in HTML Help Workshop.
Click the Add/Remove Topic Files button on the Project tab.
Click Add.
In the File Name field, type *.js.
Click Open, select the files to add to the list, and then click Open again.
You can go the short way by editing your *.hhp file with a text editor. Add a new wildcard line for all *.js files in the [FILES] section like:
[FILES]
dynsections.js
jquery.js
menu.js
menudata.js
design.css
...

Related

asciidoc, doctoolchain, target github readme.adoc - how to export asciidoc file containing includes into ONE file without include?

GitHub supports asciidoc readme files, but it looks like "include" is not supported.
I want to use doctoolchain which can render and export to html and pdf (and maybe into other formats). This tool works great.
I could use raw.githack.com to show the generated html file from the GitHub repository.
But I think it would be a good idea to have the result also as one (1) readme.adoc file.
How to export into one (1) asciidoc file, which I could use as it is as readme file so that github will render it and show? Best would be to use doctoolchain, when this tool will render my documentation it could also generate the one-file-asciidoc-documentation.
I think internally asciidoctor collects and merge all these "include" files. So maybe this file is already available in any place? The doctoolchain build folder contains only the target files.
You are right there is a long dicussion why includeis not supported by github.
You can achieve your goal with doctoolChain and pandoc(https://pandoc.org/). Following steps are required:
configure your docDir/Config.groovy
inputFiles should have docbook defined
inputFiles = [[file: 'yourfile', formats['docbook']]]
run the doctoolchain task generateDocbook - it creates ???.xml file somewhere in docDir/build
generate from the generated docbook again an asciidoctor file - `pandoc <FILENAME_OF_GENERATED_DOCBOOK.XML> -f docbook -t asciidoctor -o <FILENAME_OF_ASCIIDOCTOR_WHICH_HAS_EVERYTHING>
make sure it runs automatically and you commit it regulary
now you are ready
This script can be used to resolve includes and to generate one (1) output file:
https://github.com/asciidoctor/asciidoctor-extensions-lab/blob/master/scripts/asciidoc-coalescer.rb
some information about the script and possible next steps you can read here:
AsciiDoc Backend (AsciiDoc 2 AsciiDoc) for preprocessing
to use it, ruby and asciidoc must be installed:
asciidoctor.org/#installation

How to rename files in VS Code in bulk?

Is there a way to search for ALL .txt files in a project and automatically replace/rename them to .js?
E.g user.txt to user.js
It seems I can't search for a file format in VS Code.
If you know how, please share!
You could just do it in the terminal.
mv *.txt *.js
You can use a combination of:
Filtering the EXPLORER panel to just show .txt files
See "Filtering the document tree" section of the VS Code docs
See related Stack Overflow post: "Filter files shown in Visual Studio Code"
Installing and using the Batch Rename extension
For example, given these files/folders:
Steps:
Start by clicking on the EXPLORER panel and filtering to just display .txt files
Select/highlight all the files, then right-click on any selected file, then select "Batch Rename"
That would open a text file ".Batch Rename.txt" with all the selected files
Do a regular find-and-replace to change .txt to .js
Note that the ".Batch Rename.txt" is unsaved. It's like a preview of what the changes would look like
Save ".Batch Rename.txt" and it will automatically close
The EXPLORER panel should now be empty since it's filtered on .txt
Remove the filter and the files should now be renamed
You can use find to do this in a terminal recursively.
find . -iname "*.txt" -exec rename .txt .js '{}' \;
refer Find multiple files and rename them in Linux
mv works if you want to just do it in a folder itself.
Old question, I know, but for you or anyone else coming in, if you're okay with using a non-VS Code solution, there's a GUI Windows tool called RegexRenamer that is so well-named, you already know what it does.
It gives you a preview of what the renamed files will look like, and has options to rename everything in subfolders or only the current folder, ignore/include file extensions in the search, and apply the rename only to folders/files or both.
What do you think?

Doxygen failed to run html help compiler, hhc.exe error HHC5010 when running from folder that has a parent folder that starts with "."

I am using Conan package manager on Windows to create a package. The conan command to create the package copies files to a folder within %USERPROFILE%\.conan (or C:\Users\xxxxxxx\.conan). Then from this location it builds a Visual Studio project and ultimately calls doxygen.exe to create a .chm help file in a post-build command. The doxygen command fails with:
error : failed to run html help compiler on index.hhp
Further investigation reveals the hhc.exe command executed by doxygen is failing with:
C:\Users\xxxxxxx\.conan\data\Module\1.0.0\user\channel\build\524dc97e4a3dd1f774ea3897f9e4faf26c5457d2\Documentation>"C:/Program Files (x86)/HTML Help Workshop/hhc.exe" html\index.hhp
HHC5010: Error: Cannot open "C:\Users\xxxxxxx\data\Module\1.0.0\user\channel\build\524dc97e4a3dd1f774ea3897f9e4faf26c5457d2\Documentation\html\Module.chm". Compilation stopped.
Close inspection reveals that in the error message, the ".conan" folder is missing. Sure enough, I confirmed that hhc.exe fails when the index.hpp resides in a folder that has a parent folder that starts with a ".".
Attempts to resolve this:
changing the Doxyfile setting OUTPUT_DIRECTORY to "$(TMP)/DoxygenModule" resolves the error, but creates the .chm file in another location, which I do not prefer.
navigating to the 8DOT3 name of the ".conan" folder, which is "CONAN~1", to run the hhc.exe command, succeeds, but unfortunately I have no way of getting conan to use this 8DOT3 path for creating the package. E.g. C:\Users\xxxxxxx\CONAN~1\...
I can live with the using the %TMP% folder but would prefer generating the .chm in the current folder. Anyone have any ideas?
HTML Help Workshop v1.31 is installed on my machine at C:\Program Files (x86)\HTML Help Workshop, probably from a Visual Studio installation (not sure). I attempted using a version downloaded from Microsoft website (v1.30) as well, which made no difference.
Other info: Conan version 1.18.0, Doxygen version 1.8.14, Windows 10 Version 1809
Unfortunately not a solution, but this is a known limitation in the hhc.exe, see: https://social.msdn.microsoft.com/Forums/en-US/0681145c-223b-498c-b7bf-be83209cbf4e/issue-with-html-workshop-in-a-windows-container?forum=visualstudiogeneral
HTML Help 1.x command line compiler hhc.exe cannot compile CHM file to folder whose full path contains folder name starting with dot. If you have that problem, you probably specified output path with folder starting with dot, e.g. "d:\My files.NET\documentation". You can use dots in folder names but not at the beginning.
Edit 2019-11-15:
I've just pushed a proposed patch to github (pull request 7402, https://github.com/doxygen/doxygen/pull/7402).
This proposed patch changes inside doxygen from the current directory to the short named current directory, but just for the HTML Help compilation.
Edit 2019-11-16:
Code has been integrated in the master version on github.
This is not an answer either. Actually, you found the answer and workaround[s] yourself.
Use OUTPUT_DIRECTORY to specify a directory containing no folder names beginning with periods.
The error you described is a known issue of the MS HTML Help compiler. More general, the HTML Help compiler does not like some folder and file names. Try and stick with these characters _, a..z, A..Z, 0..9. Do not use these signs in particular ., -, # .
Please note that the proprietary CHM file format is about 20 years old (Windows 95, ...). HTML Help is in maintenance mode, which means no new features and bug fixes are expected for either the runtime or the compiler. All mainstream development on HH has stopped.
There is no way to avoid this error if a directory name above begins with a period. Not even if only the necessary files are written by Doxygen and compiling of the index.hhp is done by a third-party tool like FAR HTML using your path that contains .conan. This is because all applications are using the faulty HHA.dll.
The above applies of course to the entire workflow you have described. Maybe you can interrupt it.
Doxygen can be configured not to call the HTMLHelp compiler. Just uncheck the GENERATE_HTMLHELP option (DoxyWizard: Experts > Topics > HTML). You have all files generated by Doxygen in your preferred output directory - but of course without the CHM file. This can be imported later e.g. by HelpNDoc and compiled as a CHM file in another location.
If you can interrupt the workflow and can also make changes to Doxygen's settings, then a preference setting of OUTPUT_DIRECTORY to e.g. C:/CacheMenu/CONAN~1/DOXYGE~1 also works as expected (here used as test case).
No matter what you do, your workaround and copy and paste from another directory outside is a quick solution at this stage. Please note the EDIT in #albert's answer.

How to add a DLL Plugin without NSH file into my NSIS script?

I'm using NSIS 2.46. Plugin I'm trying to use is HwInfo plug-in (Official Link). The ZIP file comes with some source codes and a DLL file. I put the HwInfo.dll inside \NSIS\Plugins directory. When adding a plugin, I'm supposed to !include the .nsh file as well, which HwInfo does not supply.
I'm trying to analyze the client's harware before installing-
Function .onInit
HwInfo::GetCpuSpeed
StrCpy $R0 $0
MessageBox MB_OK "You have a $0GHz CPU"
HwInfo::GetSystemMemory
StrCpy $0
MessageBox MB_OK "You have $0MB of RAM"
FunctionEnd
But the line HwInfo::GetCpuSpeed is 'invalid command'.
How do I use a plugin without a NSH file? And are there any alternatives?
Solved:
I added !addplugindir "${NSISDIR}\Plugins" at the very top of this script. This helped detect HwInfo.dll inside \NSIS\Plugins directory at compile-time.
Not all plugins have a .nsh file but the wiki page usually tells you how to use a specific plugin.
If you run makensis /V4 yourscript.nsi it will list all plugins and the functions they export, if your plugin is not on the list it is probably not in the correct directory. Make sure you put it in the correct directory or use !addplugindir...
I know this question has an accepted answer, but for info for people using NSIS v3.x:
The plugin folder now has two sub-folders, one for ANSI and one for UNICODE, so you'd need to copy your plugins into ${NSISDIR}\Plugins\x86-ansi\ and ${NSISDIR}\Plugins\x86-unicode\ for the ANSI and UNICODE versions of the plugin dlls respectively.
I'm guessing if you use the 64-bit NSIS port, you'd have \x64-ansi\ and \x64-unicode subfolders too, but I've not checked that specifically.

How to add an external resource (pdf file) in my doxygen documentation

I generate a doxygen documentation. In one of my "page" I have a link to a pdf file:
<b>Overview</b>
This file is in my project in another directory. The documentation ends up in folder called "html".
How do I tell doxygen to copy the pdf file into html ?
There is a doxygen configuration option HTML_EXTRA_FILES that allows extra files to be copied to the root of the html documentation. You should be able to specify the following to copy the file:
HTML_EXTRA_FILES = ../documents/xxx.pdf
This will place xxx.pdf in the root of your HTML documentation, so you will likely need to change your link to:
<b>Overview</b>