Automatic Help File generation

Discussions about the wiki documentation of FreeCAD and its translation.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Automatic Help File generation

Post by catman »

The QT help file shipped with the full installers contains selected content from the wiki. I am insterested to lean how that works, but I using the wrong links or keywords to find anything useful. I did not see a Mediawiki extension that support this. I found the 'Collection' for selectable PDF extraction or ways to export into DocuWiki or MediaWiki:Export to XMLetc, but nothing with the goal to provide a local software help file. From this thread I did learn some bits, but I am missing the full picture.

I think the wiki page Online Help Toc is a control page that defines what pages from the FreeCAD wiki are collected into the help file. All local sublinks of the pages are collected as well or a setting gives a max depth level. The collection and conversion is done by a script on the server (24h process, i guess for all languages). The result of the script is an input file for the external tool QT Assistant. This outputs Qt Compressed Help (.qch) and Qt Help Collection (.qhc), which is located in the FreeCAD help folder. Current size is about 80MB.

If be interested if that apporach is a FreeCAD invetion or (if not) from where you got the information for this process. I'd like to set up the system on a local Mediawiki install in order to understand how it works.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Automatic Help File generation

Post by NormandC »

catman wrote: Sun Mar 10, 2019 3:23 pm I think the wiki page Online Help Toc is a control page that defines what pages from the FreeCAD wiki are collected into the help file.
The scripts are located in the source code, there's a README.

https://github.com/FreeCAD/FreeCAD/tree ... offlinedoc
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Automatic Help File generation

Post by NormandC »

By the way, kkremitzki is a FreeCAD developer who co-maintains the web services (forum, wiki, bug tracker) with Yorik, he's also a Debian packager (Debian is a prominent Linux distribution). Debian has strict rules about packaging source that contain binary files such as FC's offline help file; the content used to build the binary files must also be available. Therefore Kurt created a separate repository for the offline doc that contains the /src/Tools/offlinedoc scripts, as well as the complete localwiki in html format. It's not been updated for 7 months though.

His version also builds other languages (currently only French and Italian).

https://salsa.debian.org/science-team/freecad-doc
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Re: Automatic Help File generation

Post by catman »

NormandC wrote: Sun Mar 10, 2019 3:50 pm By the way, kkremitzki is a FreeCAD developer who co-maintains the web services (forum, wiki, bug tracker) with Yorik, he's also a Debian packager (Debian is a prominent Linux distribution). Debian has strict rules about packaging source that contain binary files such as FC's offline help file; the content used to build the binary files must also be available. Therefore Kurt created a separate repository for the offline doc that contains the /src/Tools/offlinedoc scripts, as well as the complete localwiki in html format. It's not been updated for 7 months though.

His version also builds other languages (currently only French and Italian).

https://salsa.debian.org/science-team/freecad-doc
Great. Also I found a thread on that issue under Dumpbackup for Offline Wiki. It shows they are short of better ways. The exercise seems not to be very easy.
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Re: Automatic Help File generation

Post by catman »

NormandC wrote: Sun Mar 10, 2019 3:50 pm Therefore Kurt created a separate repository for the offline doc that contains the /src/Tools/offlinedoc scripts, as well as the complete localwiki in html format. It's not been updated for 7 months though.
https://salsa.debian.org/science-team/freecad-doc
That link contains the answers. So the availablilty of the Wiki in the Help file its a FreeCAD invetion, indeed. The details is in the scipts, the process is explained in the readme. The process is not easy but it surprises me that it seem to work without access to the service itself. So basically everyone could use the process to get an update on the help files at any time.

So basically all I wanted to know is somewhere in there. Time to lean Python.. ;)

Code: Select all

this suite of tools can be used to retrieve a local copy
from the FreeCAD wiki and then use it to generate qhelp
and pdf files. The downloading of the entire wiki is now
a huge operation, prone to network errors, so it has been
cut into 2 parts, one to retrieve a list of files to
download and another to actually download the files.

1) run "buildwikiindex.py" to build an index file containing
   a list of all the files to download

2) run "downloadwiki.py". If connection drops, run it again, 
   the already downloaded files will be skipped.

3) run "buildqhelp.py" to generate freecad.qhc and freecad.qch
   files

4) run "buildpdf.py" to generate freecad.pdf (wkhtmltopdf must be installed)

5) the qhelp files can be tested with "assistant -collectionFile freecad.qhc"

6) If you have already downloaded the whole wiki, run "update.py" immediately 
   after, to create a list of revision IDs for each page.
   
7) Once the initial revisions list has been created, the "update.py" script
   can be ran anytime in the future, to check for pages that have changed
   since the stored revision ID. The script is meant to run twice, one to get
   a list of pages that have changed, and another one to download the changed
   pages (and all their dependencies) again.

8) To split the generated freecad.qch into parts that are smaller than 50Mb 
   (github limit): split -d --byte=49M localwiki/freecad.qch localwiki/freecad.qch.part
   
9) To join the parts again (for testing): cat localwiki/freecad.qch.part* >> test.qch
   Then check that test.qch has the same md5 number than localwiki/freecad.qch

10) To test: assistant -collectionFile localwiki/freecad.qhc
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Automatic Help File generation

Post by NormandC »

catman wrote: Sun Mar 10, 2019 4:35 pm That link contains the answers.
It's actually cloned word for word from FreeCAD's own repository of which I gave you the link in the reply above.

NormandC wrote: Sun Mar 10, 2019 3:39 pm The scripts are located in the source code, there's a README.

https://github.com/FreeCAD/FreeCAD/tree ... offlinedoc
catman
Posts: 412
Joined: Fri Jan 11, 2019 10:42 pm

Re: Automatic Help File generation

Post by catman »

NormandC wrote: Wed Mar 13, 2019 3:56 am
catman wrote: Sun Mar 10, 2019 4:35 pm That link contains the answers.
It's actually cloned word for word from FreeCAD's own repository of which I gave you the link in the reply above.

NormandC wrote: Sun Mar 10, 2019 3:39 pm The scripts are located in the source code, there's a README.

https://github.com/FreeCAD/FreeCAD/tree ... offlinedoc
Well, your are right. Acutally both links in your 2 posts pointed to different places but they contained the same information. For convenience I copied the readme into my last post, because it answers the OP. Hope its not against the rules.
Post Reply