Please create an online version of help and integrate it in the IDE

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
NicTheQuick
Addict
Addict
Posts: 1510
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Please create an online version of help and integrate it in the IDE

Post by NicTheQuick »

When I program with PureBasic, then of course I also use the help function very often. However, it is really bad if you are looking for very specific things. For example, I recently searched for the syntax rules for escaped strings and found absolutely nothing.

But there are a lot of little things that bother me about the integrated help. And maybe it's just a problem under Linux, but it's often unusable.

Here are a few points:
  • There are always coding errors such as: “Schlüsselwörter für Fortgeschrittene”
  • The search does not work with the enter key, you have to explicitly click on “Search”
  • If you place the cursor on a keyword in the IDE and press F1, you will see the correct help page in most cases, but the “Contents” tree on the left is still often in the wrong place, e.g. when you press F1 on the "Debug" command.
  • The forward and back buttons of my mouse also do not work in the help, while in the browser they work as expected.
I would like to be able to change the IDE help optionally to the online help so that the browser opens on the correct page when I press F1. The online help could integrate a better search and be better linked to itself and integrate even more examples or even a comment section. It would just need a menu on the left-hand side. Also with online help you can even open multiple tabs on different topics instead of switching between them with the integrated help.

What do you think? Did I miss something? Do you see the same problems? Are you happy with the help?
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
AZJIO
Addict
Addict
Posts: 2152
Joined: Sun May 14, 2017 1:48 am

Re: Please create an online version of help and integrate it in the IDE

Post by AZJIO »

https://www.purebasic.fr/english/viewtopic.php?t=85486

It is necessary to replace the tag <body> with

Code: Select all

<body>
<a target="_blank" href="https://www.purebasic.com/documentation/folder/name.html"><img title="Online" src="../link.png" border="0" align="left"></a>
But as a name you need to use the name of the file, so this is not just a replacement, but the code that embeds the name of the current file into the link.
Last edited by AZJIO on Sun Feb 23, 2025 5:45 pm, edited 1 time in total.
Quin
Addict
Addict
Posts: 1132
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: Please create an online version of help and integrate it in the IDE

Post by Quin »

I'm on Windows and am much more happy with the IDE's help function than you, but it's still not perfect and I don't disagree that the web help should be updated. Also, it sounds quite broken on Linux... :oops:
An option to switch to the web help could also be useful, I think I'll forever stick to the CHM but being able to find topics such as escaping strings with ~ easier in the CHM would be great.
AZJIO
Addict
Addict
Posts: 2152
Joined: Sun May 14, 2017 1:48 am

Re: Please create an online version of help and integrate it in the IDE

Post by AZJIO »

You can unpack the CHM file and use the pages in the browser. The only thing you will need to translate all file names to the lower register, as well as write a code that in all pages will change the names of files to the lower register. Then it will be the perfect option and it will not load the server.
You can write a little code that will open the function in the browser directly from the IDE. To do this, we need to make a list of "function|paths" and you will always reliably open the information on the right page and the links on it will be working.
AZJIO
Addict
Addict
Posts: 2152
Joined: Sun May 14, 2017 1:48 am

Re: Please create an online version of help and integrate it in the IDE

Post by AZJIO »

Since I made the online help in Russian (in 2023), here is the code I used to lowercase the paths in the links.

Code: Select all

; AZJIO
; Looking for links to local files (non-Internet) inside the HTML files and translates them to the lower register
; To avoid confusion in the registers in the names of folders and files on the server and not get an error 404.
; Since HTML files in UTF-8 format without BOM, all reading/recording settings in this format.
; Before processing, a message about the number of files and the first file are issued to show the correct path.
EnableExplicit

Procedure.s ReadFileTo(FilePath$)
	Protected length, oFile, bytes, *mem, Text$
	oFile = ReadFile(#PB_Any, FilePath$)
	If oFile
		length = Lof(oFile)
		*mem = AllocateMemory(length)
		If *mem
			bytes = ReadData(oFile, *mem, length)
			If bytes
				Text$ = PeekS(*mem, -1, #PB_UTF8)
			EndIf
			FreeMemory(*mem)
		EndIf
		CloseFile(oFile)
	EndIf
	ProcedureReturn Text$
EndProcedure

Procedure SaveFileTo(File.s, Text$)
	Protected Size
	Protected Result = #False
	Protected *Buff = UTF8(Text$)
	Size = StringByteLength(Text$, #PB_UTF8)
	Protected ID = CreateFile(#PB_Any, File, #PB_UTF8)
	If ID
		If WriteData(ID, *Buff, Size) = Size
			Result = #True
		EndIf
		CloseFile(ID)
	EndIf
	FreeMemory(*Buff)
	ProcedureReturn Result
EndProcedure

Procedure FileSearch(List Files.s(), dir.s, mask.s = "")
	Protected name.s, id

	If Right(dir, 1) <> #PS$
		dir + #PS$
	EndIf

	id = ExamineDirectory(#PB_Any, dir, "")
	If id
		While NextDirectoryEntry(id)
			name = DirectoryEntryName(id)
			If name = "." Or name = ".."
				Continue
			EndIf
			If DirectoryEntryType(id) = #PB_DirectoryEntry_Directory
				FileSearch(Files(), dir + name + "\", mask)
			ElseIf (Not Asc(mask) Or GetExtensionPart(name) = mask) And AddElement(Files())
				Files() = dir + DirectoryEntryName(id)
			EndIf
		Wend
		FinishDirectory(id)
	EndIf
EndProcedure

Define Text$, rex, String$, i, j
Define NewList Files.s()
Define Path$ = "C:\PureBasic_Help_Online"
FileSearch(Files(), Path$, "html")
MessageRequester(Str(ListSize(Files())), Files())

rex = CreateRegularExpression(#PB_Any, ~"href=\"\\K[^:<>?*|\"]+?(?=\">)")
If Not rex
	MessageRequester("", RegularExpressionError())
	End
EndIf

ForEach Files()
	i+1
	If i = 200
		j + 200
		Debug j
		i = 0
	EndIf
	Text$ = ReadFileTo(Files())
	If ExamineRegularExpression(rex, Text$)
		While NextRegularExpressionMatch(rex)
			String$ = RegularExpressionMatchString(rex)
			ReplaceString(Text$ , String$ , LCase(String$), #PB_String_InPlace, RegularExpressionMatchPosition(rex), 1)
; 			Length = RegularExpressionMatchLength(rex)
		Wend
	EndIf
	SaveFileTo(Files(), Text$)
Next

MessageRequester("", "Done")
By the way, I added a tutorial there
RegExp (syntax) (En)
if
array
String parsing (new, made almost yesterday.)
Post Reply