Cross-platform HTML Help module

Developed or developing a new product in PureBasic? Tell the world about it.
deeproot
Enthusiast
Enthusiast
Posts: 269
Joined: Thu Dec 17, 2009 12:00 pm
Location: Llangadog, Wales, UK
Contact:

Cross-platform HTML Help module

Post by deeproot »

Here is my take on a cross-platform HTML help file viewer. It's only a viewer module - not to create the help files. There's been some recent discussion on this subject so this is just what works for me. Though most of the code is a few years old, I didn't post before because I assumed (maybe wrongly?) that people would already have a good solution.

The module, called HelpViewX, takes the same approach as the help for the PureBasic IDE on the Mac. I think the PB Help is great on all platforms and I wanted to attempt something similar for my application on the Mac. Also over the last year I've been using it for Linux. I don't use it for Windows as I'm currently happy with .chm and the native PureBasic OpenHelp, but the module does work the same on Windows.

Main code calls the help with OpenHelpX(dirpath) - intentionally quite similar to the native PureBasic so it's easy to switch between platforms. It uses two XML files to show the Contents and Index. The module code is simple and not too big. The XML stuff is virtually lifted from the PureBasic example - nothing fancy.

The zip file contains 'helpviewx.pbi' and a 'helpexample' directory with a small complete help system for test and demonstration. The module code can be compiled on its own, with a requester to select the directory, either helpexample or your own. The example help gives a bit more info about the module.

Should work on Windows, Mac and Linux (gtk2, gtk3 and qt) - runs on my systems but don't blame me if it falls over in a smelly heap or needs tweaking to suit your set-up!

http://www.deeproot.co.uk/downloads/HelpViewX.zip
Mesa
Enthusiast
Enthusiast
Posts: 342
Joined: Fri Feb 24, 2012 10:19 am

Re: Cross-platform HTML Help module

Post by Mesa »

Infortually, html files are not displayed with Windows XP 32b, PB5.70b4 32b.

M.
deeproot
Enthusiast
Enthusiast
Posts: 269
Joined: Thu Dec 17, 2009 12:00 pm
Location: Llangadog, Wales, UK
Contact:

Re: Cross-platform HTML Help module

Post by deeproot »

Mesa wrote:Infortually, html files are not displayed with Windows XP 32b, PB5.70b4 32b.
@Mesa
Works fine here - Windows XP Professional SP3 32-bit, Purebasic 5.70 B4 X86.

Does the WebGadget work OK on your system? The files themselves will also open in a browser - FF, IE and Opera all display them on XP.
Mesa
Enthusiast
Enthusiast
Posts: 342
Joined: Fri Feb 24, 2012 10:19 am

Re: Cross-platform HTML Help module

Post by Mesa »

Everything is ok, with FF, or the webgadget.
So, i don't know, maybe the path ?
deeproot
Enthusiast
Enthusiast
Posts: 269
Joined: Thu Dec 17, 2009 12:00 pm
Location: Llangadog, Wales, UK
Contact:

Re: Cross-platform HTML Help module

Post by deeproot »

Hmm - strange!
Can't reproduce it here - tried different locations and drive partitions to alter path but works as it should. Will try a different Win XP machine tomorrow.
mestnyi
Addict
Addict
Posts: 995
Joined: Mon Nov 25, 2013 6:41 am

Re: Cross-platform HTML Help module

Post by mestnyi »

Checked on Mac OS works great.
And how to create this help?
User avatar
Lord
Addict
Addict
Posts: 846
Joined: Tue May 26, 2009 2:11 pm

Re: Cross-platform HTML Help module

Post by Lord »

Mesa wrote:Everything is ok, with FF, or the webgadget.
So, i don't know, maybe the path ?
It's the URLEncoder() who makes the program not working.
(At least here)

Called link is "file://D:/Eigene Dateien/PureBasic/HelpViewX/helpexample/introduction.html"
after URLEncoder(): "file://D:/Eigene%20Dateien/PureBasic/HelpViewX/helpexample/introduction.html"

Space in folder name is replaced by "%20". And that is what the WebGadget doesn't like.

Eliminating all URLEncoder() works for me here with Win7x64 and PB5.70LTSbeta3(x64).
Image
deeproot
Enthusiast
Enthusiast
Posts: 269
Joined: Thu Dec 17, 2009 12:00 pm
Location: Llangadog, Wales, UK
Contact:

Re: Cross-platform HTML Help module

Post by deeproot »

Lord wrote:Space in folder name is replaced by "%20". And that is what the WebGadget doesn't like.

Eliminating all URLEncoder() works for me here with Win7x64 and PB5.70LTSbeta3(x64).
Thanks Lord - I also suspected something to do with URLEncoder - more testing today and I can now reproduce the problem and confirm your finding.

URLEncoder was added a long time ago due to the opposite problem on the Mac (my main use of the module). Paths with spaces prevented display of files in WebGadget - they needed to be replaced with %20. Also some other characters were not valid.

Using URLEncoder fixed the problem on MacOS, but it appears WebGadget on Windows does not like it :?

WebGadget on Linux appears to work both with and without URLEncoder (on my distro at least!).

Module source has been changed to omit URLEncoder for Windows only - Zip file is replaced, same link as top post.
deeproot
Enthusiast
Enthusiast
Posts: 269
Joined: Thu Dec 17, 2009 12:00 pm
Location: Llangadog, Wales, UK
Contact:

Re: Cross-platform HTML Help module

Post by deeproot »

mestnyi wrote:Checked on Mac OS works great.
And how to create this help?
Personally I make my help files manually, using any convenient text editor. I thought about writing tools to assist with this but never had the time. Also I don't write new help files very often, so it's not a big deal for me. Maintaining an existing help system, even a big one, is not much trouble.

All files are just text so there are lots of possibilities on all platforms - Notepad++, TextWrangler and many others. Even the Purebasic IDE is good for a quick edit! For more fancy html layout you could try a WYSIWYG method such as BlueGriffon. However, I think the best advice is to keep the help pages as simple as possible. There is also not much to the two XML files - just repetitive statements.

During development of an application it makes sense to progressively add the help pages as you go, so it doesn't become a huge task at the end. If it helps then feel free to use my example files as templates.
Post Reply