mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-06 03:30:23 +00:00
Merge pull request #90 from QB64-Phoenix-Edition/wiki-dev
Latest Wiki changes and -u switch to populate internal/help during build. Once this is implemented, the respective helpfiles can be removed from the repository.
This commit is contained in:
commit
9a1ad7dad3
|
@ -2307,7 +2307,7 @@ FUNCTION ide2 (ignore)
|
||||||
Help_sy = Help_Back(Help_Back_Pos).sy
|
Help_sy = Help_Back(Help_Back_Pos).sy
|
||||||
Help_cx = Help_Back(Help_Back_Pos).cx
|
Help_cx = Help_Back(Help_Back_Pos).cx
|
||||||
Help_cy = Help_Back(Help_Back_Pos).cy
|
Help_cy = Help_Back(Help_Back_Pos).cy
|
||||||
a$ = Wiki(Back$(Help_Back_Pos))
|
a$ = Wiki$(Back$(Help_Back_Pos))
|
||||||
WikiParse a$
|
WikiParse a$
|
||||||
GOTO newpageparsed
|
GOTO newpageparsed
|
||||||
END IF
|
END IF
|
||||||
|
@ -2565,7 +2565,7 @@ FUNCTION ide2 (ignore)
|
||||||
Help_sy = Help_Back(Help_Back_Pos).sy
|
Help_sy = Help_Back(Help_Back_Pos).sy
|
||||||
Help_cx = Help_Back(Help_Back_Pos).cx
|
Help_cx = Help_Back(Help_Back_Pos).cx
|
||||||
Help_cy = Help_Back(Help_Back_Pos).cy
|
Help_cy = Help_Back(Help_Back_Pos).cy
|
||||||
a$ = Wiki(Back$(Help_Back_Pos))
|
a$ = Wiki$(Back$(Help_Back_Pos))
|
||||||
WikiParse a$
|
WikiParse a$
|
||||||
GOTO newpageparsed
|
GOTO newpageparsed
|
||||||
END IF
|
END IF
|
||||||
|
@ -2652,7 +2652,7 @@ FUNCTION ide2 (ignore)
|
||||||
Help_Back(Help_Back_Pos).cx = 1
|
Help_Back(Help_Back_Pos).cx = 1
|
||||||
Help_Back(Help_Back_Pos).cy = 1
|
Help_Back(Help_Back_Pos).cy = 1
|
||||||
Help_sx = 1: Help_sy = 1: Help_cx = 1: Help_cy = 1
|
Help_sx = 1: Help_sy = 1: Help_cx = 1: Help_cy = 1
|
||||||
a$ = Wiki(l$)
|
a$ = Wiki$(l$)
|
||||||
WikiParse a$
|
WikiParse a$
|
||||||
GOTO newpageparsed
|
GOTO newpageparsed
|
||||||
END IF
|
END IF
|
||||||
|
@ -2758,7 +2758,7 @@ FUNCTION ide2 (ignore)
|
||||||
Help_Back(Help_Back_Pos).cy = 1
|
Help_Back(Help_Back_Pos).cy = 1
|
||||||
Help_sx = 1: Help_sy = 1: Help_cx = 1: Help_cy = 1
|
Help_sx = 1: Help_sy = 1: Help_cx = 1: Help_cy = 1
|
||||||
|
|
||||||
a$ = Wiki(lnk$)
|
a$ = Wiki$(lnk$)
|
||||||
|
|
||||||
IF idehelp = 0 THEN
|
IF idehelp = 0 THEN
|
||||||
IF idesubwindow THEN PCOPY 3, 0: SCREEN , , 3, 0: GOTO ideloop
|
IF idesubwindow THEN PCOPY 3, 0: SCREEN , , 3, 0: GOTO ideloop
|
||||||
|
@ -5414,8 +5414,16 @@ FUNCTION ide2 (ignore)
|
||||||
PCOPY 2, 0
|
PCOPY 2, 0
|
||||||
q$ = ideyesnobox("Update Help", "This can take up to 15 minutes.\nRedownload all cached help content from the wiki?")
|
q$ = ideyesnobox("Update Help", "This can take up to 15 minutes.\nRedownload all cached help content from the wiki?")
|
||||||
PCOPY 2, 0
|
PCOPY 2, 0
|
||||||
IF q$ = "Y" THEN ideupdatehelpbox
|
IF q$ = "Y" THEN
|
||||||
|
Help_Recaching = 1: Help_IgnoreCache = 1
|
||||||
|
uerr = ideupdatehelpbox
|
||||||
|
Help_Recaching = 0: Help_IgnoreCache = 0
|
||||||
PCOPY 3, 0: SCREEN , , 3, 0
|
PCOPY 3, 0: SCREEN , , 3, 0
|
||||||
|
IF uerr THEN
|
||||||
|
lnk$ = "Update All"
|
||||||
|
GOTO OpenHelpLnk
|
||||||
|
END IF
|
||||||
|
END IF
|
||||||
GOTO ideloop
|
GOTO ideloop
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
@ -17607,7 +17615,7 @@ SUB Help_ShowText
|
||||||
IF setup = 0 AND UBOUND(back$) = 1 THEN
|
IF setup = 0 AND UBOUND(back$) = 1 THEN
|
||||||
setup = 1
|
setup = 1
|
||||||
IF IdeContextHelpSF = 0 THEN
|
IF IdeContextHelpSF = 0 THEN
|
||||||
a$ = Wiki(Back$(1))
|
a$ = Wiki$(Back$(1))
|
||||||
WikiParse a$
|
WikiParse a$
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
|
@ -18665,7 +18673,15 @@ SUB IdeAddSearched (s2$)
|
||||||
CLOSE #fh
|
CLOSE #fh
|
||||||
END SUB
|
END SUB
|
||||||
|
|
||||||
SUB ideupdatehelpbox
|
FUNCTION ideupdatehelpbox
|
||||||
|
ideupdatehelpbox = 0 'all good, getting 1 on error
|
||||||
|
IF Help_Recaching = 2 THEN
|
||||||
|
DIM FullMessage$(1 TO 2)
|
||||||
|
UpdateStep = 1
|
||||||
|
Help_ww = 78
|
||||||
|
GOTO startMainLoop
|
||||||
|
END IF
|
||||||
|
|
||||||
'-------- generic dialog box header --------
|
'-------- generic dialog box header --------
|
||||||
PCOPY 0, 2
|
PCOPY 0, 2
|
||||||
PCOPY 0, 1
|
PCOPY 0, 1
|
||||||
|
@ -18707,8 +18723,9 @@ SUB ideupdatehelpbox
|
||||||
FOR i = 1 TO 100: o(i).par = p: NEXT 'set parent info of objects
|
FOR i = 1 TO 100: o(i).par = p: NEXT 'set parent info of objects
|
||||||
'-------- end of generic init --------
|
'-------- end of generic init --------
|
||||||
|
|
||||||
|
startMainLoop:
|
||||||
DO 'main loop
|
DO 'main loop
|
||||||
|
IF Help_Recaching = 2 GOTO updateRoutine
|
||||||
|
|
||||||
'-------- generic display dialog box & objects --------
|
'-------- generic display dialog box & objects --------
|
||||||
idedrawpar p
|
idedrawpar p
|
||||||
|
@ -18813,6 +18830,7 @@ SUB ideupdatehelpbox
|
||||||
END IF
|
END IF
|
||||||
'end of custom controls
|
'end of custom controls
|
||||||
|
|
||||||
|
updateRoutine:
|
||||||
'-------- update routine -------------------------------------
|
'-------- update routine -------------------------------------
|
||||||
SELECT CASE UpdateStep
|
SELECT CASE UpdateStep
|
||||||
CASE 1
|
CASE 1
|
||||||
|
@ -18830,9 +18848,8 @@ SUB ideupdatehelpbox
|
||||||
CASE 3
|
CASE 3
|
||||||
'Download and PARSE alphabetical index to build required F1 help links
|
'Download and PARSE alphabetical index to build required F1 help links
|
||||||
FullMessage$(1) = "Regenerating keyword list..."
|
FullMessage$(1) = "Regenerating keyword list..."
|
||||||
Help_Recaching = 1: Help_IgnoreCache = 1
|
|
||||||
a$ = Wiki$("Keyword Reference - Alphabetical")
|
a$ = Wiki$("Keyword Reference - Alphabetical")
|
||||||
Help_Recaching = 0: Help_IgnoreCache = 0
|
IF INSTR(a$, "{{PageInternalError}}") > 0 THEN ideupdatehelpbox = 1: EXIT DO
|
||||||
WikiParse a$
|
WikiParse a$
|
||||||
UpdateStep = UpdateStep + 1
|
UpdateStep = UpdateStep + 1
|
||||||
CASE 4
|
CASE 4
|
||||||
|
@ -18889,13 +18906,14 @@ SUB ideupdatehelpbox
|
||||||
f2$ = LEFT$(f2$, LEN(f2$) - 4)
|
f2$ = LEFT$(f2$, LEN(f2$) - 4)
|
||||||
n = n + 1
|
n = n + 1
|
||||||
FullMessage$(2) = "Page title: " + f2$
|
FullMessage$(2) = "Page title: " + f2$
|
||||||
Help_IgnoreCache = 1: Help_Recaching = 1: ignore$ = Wiki(f2$): Help_Recaching = 0: Help_IgnoreCache = 0
|
ignore$ = Wiki$(f2$)
|
||||||
END IF
|
END IF
|
||||||
ELSE
|
ELSE
|
||||||
UpdateStep = UpdateStep + 1
|
UpdateStep = UpdateStep + 1
|
||||||
END IF
|
END IF
|
||||||
CASE 6
|
CASE 6
|
||||||
stoprecache:
|
stoprecache:
|
||||||
|
IF Help_Recaching = 2 THEN EXIT DO
|
||||||
FullMessage$(1) = "All pages updated."
|
FullMessage$(1) = "All pages updated."
|
||||||
FullMessage$(2) = ""
|
FullMessage$(2) = ""
|
||||||
idetxt(o(ButtonID).txt) = "#Close"
|
idetxt(o(ButtonID).txt) = "#Close"
|
||||||
|
@ -18906,7 +18924,7 @@ SUB ideupdatehelpbox
|
||||||
mousedown = 0
|
mousedown = 0
|
||||||
mouseup = 0
|
mouseup = 0
|
||||||
LOOP
|
LOOP
|
||||||
END SUB
|
END FUNCTION
|
||||||
|
|
||||||
FUNCTION ideASCIIbox$(relaunch)
|
FUNCTION ideASCIIbox$(relaunch)
|
||||||
|
|
||||||
|
@ -19867,20 +19885,30 @@ FUNCTION findHelpTopic$(topic$, lnks, firstOnly AS _BYTE)
|
||||||
'check if topic$ is in help links
|
'check if topic$ is in help links
|
||||||
' - returns a list of help links separated by CHR$(0)
|
' - returns a list of help links separated by CHR$(0)
|
||||||
' - returns the total number of links found by changing 'lnks'
|
' - returns the total number of links found by changing 'lnks'
|
||||||
IF NOT _FILEEXISTS("internal\help\links.bin") THEN
|
lnks = 0: lnks$ = CHR$(0)
|
||||||
|
fh = FREEFILE
|
||||||
|
'----------
|
||||||
|
linksFileExist = _FILEEXISTS("internal\help\links.bin")
|
||||||
|
IF linksFileExist THEN
|
||||||
|
OPEN "internal\help\links.bin" FOR INPUT AS #fh
|
||||||
|
linksFileEmpty = (LOF(fh) = 0): CLOSE #fh
|
||||||
|
END IF
|
||||||
|
IF (NOT linksFileExist) OR linksFileEmpty THEN
|
||||||
q$ = ideyesnobox("Help problem", "The help system is not yet initialized,\ndo it now? (Make sure you're online.)")
|
q$ = ideyesnobox("Help problem", "The help system is not yet initialized,\ndo it now? (Make sure you're online.)")
|
||||||
PCOPY 3, 0: SCREEN , , 3, 0
|
PCOPY 3, 0: SCREEN , , 3, 0
|
||||||
IF q$ = "N" THEN lnks = 0: lnks$ = CHR$(0): GOTO noLinksFile
|
IF q$ = "N" GOTO noLinksFile
|
||||||
Help_IgnoreCache = 1
|
Help_IgnoreCache = 1
|
||||||
a$ = Wiki$("Keyword Reference - Alphabetical")
|
a$ = Wiki$("Keyword Reference - Alphabetical")
|
||||||
Help_IgnoreCache = 0
|
Help_IgnoreCache = 0
|
||||||
|
IF INSTR(a$, "{{PageInternalError}}") THEN
|
||||||
|
lnks = 1: lnks$ = lnks$ + "Initialize" + CHR$(0)
|
||||||
|
GOTO noLinksFile
|
||||||
|
END IF
|
||||||
Help_ww = 78: WikiParse a$ 'assume standard IDE width for parsing
|
Help_ww = 78: WikiParse a$ 'assume standard IDE width for parsing
|
||||||
END IF
|
END IF
|
||||||
'----------
|
'----------
|
||||||
a2$ = UCASE$(topic$)
|
a2$ = UCASE$(topic$)
|
||||||
fh = FREEFILE
|
|
||||||
OPEN "internal\help\links.bin" FOR INPUT AS #fh
|
OPEN "internal\help\links.bin" FOR INPUT AS #fh
|
||||||
lnks = 0: lnks$ = CHR$(0)
|
|
||||||
DO UNTIL EOF(fh)
|
DO UNTIL EOF(fh)
|
||||||
LINE INPUT #fh, l$
|
LINE INPUT #fh, l$
|
||||||
c = INSTR(l$, ","): l1$ = LEFT$(l$, c - 1): l2$ = RIGHT$(l$, LEN(l$) - c)
|
c = INSTR(l$, ","): l1$ = LEFT$(l$, c - 1): l2$ = RIGHT$(l$, LEN(l$) - c)
|
||||||
|
|
|
@ -32,20 +32,6 @@ FUNCTION Wiki$ (PageName$) 'Read cached wiki page (download, if not yet cached)
|
||||||
a$ = SPACE$(LOF(fh))
|
a$ = SPACE$(LOF(fh))
|
||||||
GET #fh, , a$
|
GET #fh, , a$
|
||||||
CLOSE #fh
|
CLOSE #fh
|
||||||
chr13 = INSTR(a$, CHR$(13))
|
|
||||||
removedchr13 = 0
|
|
||||||
DO WHILE chr13 > 0
|
|
||||||
removedchr13 = -1
|
|
||||||
a$ = LEFT$(a$, chr13 - 1) + MID$(a$, chr13 + 1)
|
|
||||||
chr13 = INSTR(a$, CHR$(13))
|
|
||||||
LOOP
|
|
||||||
IF removedchr13 THEN
|
|
||||||
fh = FREEFILE
|
|
||||||
OPEN Cache_Folder$ + "/" + PageName3$ + ".txt" FOR OUTPUT AS #fh: CLOSE #fh
|
|
||||||
OPEN Cache_Folder$ + "/" + PageName3$ + ".txt" FOR BINARY AS #fh
|
|
||||||
PUT #fh, 1, a$
|
|
||||||
CLOSE #fh
|
|
||||||
END IF
|
|
||||||
Wiki$ = a$
|
Wiki$ = a$
|
||||||
EXIT FUNCTION
|
EXIT FUNCTION
|
||||||
END IF
|
END IF
|
||||||
|
@ -53,10 +39,20 @@ FUNCTION Wiki$ (PageName$) 'Read cached wiki page (download, if not yet cached)
|
||||||
|
|
||||||
'Check for curl
|
'Check for curl
|
||||||
IF _SHELLHIDE("curl --version") <> 0 THEN
|
IF _SHELLHIDE("curl --version") <> 0 THEN
|
||||||
PCOPY 2, 0
|
a$ = CHR$(10) + "{{PageInternalError}}" + CHR$(10)
|
||||||
result = idemessagebox("QB64", "Cannot find 'curl'.", "#Abort")
|
IF PageName$ = "Initialize" THEN
|
||||||
PCOPY 3, 0: SCREEN , , 3, 0
|
a$ = a$ + "To be able to initialize the help system, "
|
||||||
EXIT FUNCTION
|
ELSEIF PageName$ = "Update All" THEN
|
||||||
|
a$ = a$ + "To be able to update the help pages from the online Wiki, "
|
||||||
|
ELSE
|
||||||
|
a$ = a$ + "The requested help page is not yet cached locally. To download the help page from the online Wiki, "
|
||||||
|
END IF
|
||||||
|
a$ = a$ + "a tool called ''curl'' is required, but it wasn't found on your system." + CHR$(10) + CHR$(10)
|
||||||
|
a$ = a$ + "* To get ''curl'', visit the official [https://curl.se/download.html download page]." + CHR$(10)
|
||||||
|
a$ = a$ + "** Grab the latest ''binary'' archive available for your system." + CHR$(10)
|
||||||
|
a$ = a$ + "** Unpack and drop the ''curl'' executable into the QB64 folder." + CHR$(10)
|
||||||
|
a$ = a$ + "** If there's a file named ''curl-ca-bundle.crt'' or similar, drop it into the QB64 folder too." + CHR$(10)
|
||||||
|
Wiki$ = a$: EXIT FUNCTION
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
'Download message (Status Bar)
|
'Download message (Status Bar)
|
||||||
|
@ -112,9 +108,10 @@ FUNCTION Wiki$ (PageName$) 'Read cached wiki page (download, if not yet cached)
|
||||||
a$ = StrReplace$(a$, "Start}}" + CHR$(10) + "'' ''", "Start}}")
|
a$ = StrReplace$(a$, "Start}}" + CHR$(10) + "'' ''", "Start}}")
|
||||||
a$ = StrReplace$(a$, "'' ''" + CHR$(10) + "{{", CHR$(10) + "{{")
|
a$ = StrReplace$(a$, "'' ''" + CHR$(10) + "{{", CHR$(10) + "{{")
|
||||||
a$ = StrReplace$(a$, "'' '' " + CHR$(10) + "{{", CHR$(10) + "{{")
|
a$ = StrReplace$(a$, "'' '' " + CHR$(10) + "{{", CHR$(10) + "{{")
|
||||||
a$ = StrReplace$(a$, "'' ''" + MKI$(&H0A0A) + "{{", CHR$(10) + "{{")
|
a$ = StrReplace$(a$, "'' ''" + CHR$(10) + CHR$(10) + "{{", CHR$(10) + "{{")
|
||||||
'--- wiki redirects
|
'--- wiki redirects & crlf
|
||||||
a$ = StrReplace$(a$, "#REDIRECT", "See page")
|
a$ = StrReplace$(a$, "#REDIRECT", "See page")
|
||||||
|
a$ = StrReplace$(a$, CHR$(13) + CHR$(10), CHR$(10))
|
||||||
'--- put a download date/time entry
|
'--- put a download date/time entry
|
||||||
a$ = "{{QBDLDATE:" + DATE$ + "}}" + CHR$(10) + "{{QBDLTIME:" + TIME$ + "}}" + CHR$(10) + a$
|
a$ = "{{QBDLDATE:" + DATE$ + "}}" + CHR$(10) + "{{QBDLTIME:" + TIME$ + "}}" + CHR$(10) + a$
|
||||||
'--- now save it
|
'--- now save it
|
||||||
|
@ -775,8 +772,8 @@ SUB WikiParse (a$) 'Wiki page interpret
|
||||||
IF c$ = ";" AND nl = 1 THEN 'definition (new line only)
|
IF c$ = ";" AND nl = 1 THEN 'definition (new line only)
|
||||||
IF c$(2) = "; " THEN i = i + 1
|
IF c$(2) = "; " THEN i = i + 1
|
||||||
Help_Bold = 1: col = Help_Col: Help_DList = 1
|
Help_Bold = 1: col = Help_Col: Help_DList = 1
|
||||||
IF c$(3) = ";* " THEN i = i + 2: Help_DList = 3 'list dot belongs to description
|
IF c$(3) = ";* " OR c$(3) = ";# " THEN i = i + 2: Help_DList = 3 'list dot belongs to description
|
||||||
IF c$(2) = ";*" THEN i = i + 1: Help_DList = 2 'list dot belongs to description
|
IF c$(2) = ";*" OR c$(2) = ";#" THEN i = i + 1: Help_DList = 2 'list dot belongs to description
|
||||||
GOTO charDone
|
GOTO charDone
|
||||||
END IF
|
END IF
|
||||||
IF c$ = ":" AND Help_DList > 0 THEN 'description (same or new line)
|
IF c$ = ":" AND Help_DList > 0 THEN 'description (same or new line)
|
||||||
|
@ -803,16 +800,16 @@ SUB WikiParse (a$) 'Wiki page interpret
|
||||||
'Wiki lists (*, **) are not handled in blocks (soft- and hard lock), as it would
|
'Wiki lists (*, **) are not handled in blocks (soft- and hard lock), as it would
|
||||||
'disrupt the block, also in code blocks it could be part of the code example itself
|
'disrupt the block, also in code blocks it could be part of the code example itself
|
||||||
IF Help_LockParse = 0 THEN
|
IF Help_LockParse = 0 THEN
|
||||||
'Unordered lists
|
'Unordered/Ordered lists
|
||||||
IF nl = 1 THEN
|
IF nl = 1 THEN
|
||||||
IF c$(2) = "**" THEN
|
IF c$(2) = "**" OR c$(2) = "##" THEN
|
||||||
IF c$(3) = "** " THEN i = i + 2: ELSE i = i + 1
|
IF c$(3) = "** " OR c$(3) = "## " THEN i = i + 2: ELSE i = i + 1
|
||||||
Help_AddTxt " " + CHR$(4) + " ", 14, 0
|
Help_AddTxt " " + CHR$(4) + " ", 14, 0
|
||||||
Help_NewLineIndent = Help_NewLineIndent + 5
|
Help_NewLineIndent = Help_NewLineIndent + 5
|
||||||
GOTO charDone
|
GOTO charDone
|
||||||
END IF
|
END IF
|
||||||
IF c$ = "*" THEN
|
IF c$ = "*" OR c$ = "#" THEN
|
||||||
IF c$(2) = "* " THEN i = i + 1
|
IF c$(2) = "* " OR c$(2) = "# " THEN i = i + 1
|
||||||
Help_AddTxt CHR$(4) + " ", 14, 0
|
Help_AddTxt CHR$(4) + " ", 14, 0
|
||||||
Help_NewLineIndent = Help_NewLineIndent + 2
|
Help_NewLineIndent = Help_NewLineIndent + 2
|
||||||
GOTO charDone
|
GOTO charDone
|
||||||
|
|
|
@ -13118,6 +13118,14 @@ FUNCTION ParseCMDLineArgs$ ()
|
||||||
PRINT " -z Generate C code without compiling to executable"
|
PRINT " -z Generate C code without compiling to executable"
|
||||||
PRINT
|
PRINT
|
||||||
SYSTEM
|
SYSTEM
|
||||||
|
CASE "-u" 'Invoke "Update all pages" to populate internal/help files (hidden build option)
|
||||||
|
Help_Recaching = 2: Help_IgnoreCache = 1
|
||||||
|
IF ideupdatehelpbox THEN
|
||||||
|
_DEST _CONSOLE
|
||||||
|
PRINT "Update failed: curl not found"
|
||||||
|
SYSTEM 1
|
||||||
|
END IF
|
||||||
|
SYSTEM
|
||||||
CASE "-c" 'Compile instead of edit
|
CASE "-c" 'Compile instead of edit
|
||||||
NoIDEMode = 1
|
NoIDEMode = 1
|
||||||
cmdlineswitch = -1
|
cmdlineswitch = -1
|
||||||
|
|
Loading…
Reference in a new issue