mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-07 15:20:18 +00:00
Merge pull request #327 from QB64-Phoenix-Edition/export-finetuning
Export finetuning
This commit is contained in:
commit
7db0529994
1 changed files with 19 additions and 9 deletions
|
@ -20397,6 +20397,10 @@ SUB ExportCodeAs (docFormat$)
|
||||||
IdeInfo = CHR$(0) + STRING$(3 - LEN(perc$), 32) + perc$ + "% exported..."
|
IdeInfo = CHR$(0) + STRING$(3 - LEN(perc$), 32) + perc$ + "% exported..."
|
||||||
UpdateIdeInfo
|
UpdateIdeInfo
|
||||||
NEXT i&
|
NEXT i&
|
||||||
|
WHILE RIGHT$(sTxt$, LEN(cEol$)) = cEol$ 'normalize line feeds at EOF
|
||||||
|
sTxt$ = LEFT$(sTxt$, LEN(sTxt$) - LEN(cEol$))
|
||||||
|
WEND
|
||||||
|
IF sTxt$ = "" THEN sTxt$ = sTxt$ + cEol$: ELSE sTxt$ = sTxt$ + cEol$ + cEol$
|
||||||
sLen& = LEN(sTxt$) ' '=> source code length
|
sLen& = LEN(sTxt$) ' '=> source code length
|
||||||
sPos& = 1 ' '=> source code read position
|
sPos& = 1 ' '=> source code read position
|
||||||
eTxt$ = SPACE$(10000000) '=> export text buffer
|
eTxt$ = SPACE$(10000000) '=> export text buffer
|
||||||
|
@ -20442,7 +20446,8 @@ SUB ExportCodeAs (docFormat$)
|
||||||
CASE 10, 13 'line feed
|
CASE 10, 13 'line feed
|
||||||
IF NOT lb% THEN
|
IF NOT lb% THEN
|
||||||
IF me% THEN
|
IF me% THEN
|
||||||
GOSUB VerifyKeyword: GOSUB WriteLink: me% = 0: le% = 0
|
IF NOT in% THEN GOSUB VerifyKeyword: GOSUB WriteLink: ELSE me$ = "": in% = 0
|
||||||
|
me% = 0: le% = 0
|
||||||
IF UCASE$(me$) = "$NOPREFIX" THEN np% = -1
|
IF UCASE$(me$) = "$NOPREFIX" THEN np% = -1
|
||||||
END IF
|
END IF
|
||||||
IF kw% THEN
|
IF kw% THEN
|
||||||
|
@ -20464,7 +20469,8 @@ SUB ExportCodeAs (docFormat$)
|
||||||
IF me% THEN
|
IF me% THEN
|
||||||
GOSUB VerifyKeyword: GOSUB WriteLink: me% = 0: le% = 0
|
GOSUB VerifyKeyword: GOSUB WriteLink: me% = 0: le% = 0
|
||||||
SELECT CASE UCASE$(me$)
|
SELECT CASE UCASE$(me$)
|
||||||
CASE "$IF", "$ELSEIF", "$END": pc% = -1
|
CASE "$LET", "$ELSE", "$END": pc% = -1
|
||||||
|
CASE "$IF", "$ELSEIF": pc% = -1: bo% = -1
|
||||||
END SELECT
|
END SELECT
|
||||||
END IF
|
END IF
|
||||||
IF kw% THEN
|
IF kw% THEN
|
||||||
|
@ -20620,15 +20626,17 @@ SUB ExportCodeAs (docFormat$)
|
||||||
CloseCodeBlock:
|
CloseCodeBlock:
|
||||||
SELECT CASE LCASE$(docFormat$)
|
SELECT CASE LCASE$(docFormat$)
|
||||||
CASE "html": tmp$ = "</pre></body></html>"
|
CASE "html": tmp$ = "</pre></body></html>"
|
||||||
CASE "rich": tmp$ = "}"
|
CASE "rich": tmp$ = "}": ePos& = ePos& - 4 'remove final /par
|
||||||
CASE "wiki": tmp$ = "{{CodeEnd}}"
|
CASE "wiki": tmp$ = "{{CodeEnd}}"
|
||||||
CASE ELSE: RETURN
|
CASE ELSE: RETURN
|
||||||
END SELECT
|
END SELECT
|
||||||
|
ePos& = ePos& - LEN(cEol$) 'remove final code line feed
|
||||||
MID$(eTxt$, ePos&, LEN(tmp$)) = tmp$: ePos& = ePos& + LEN(tmp$)
|
MID$(eTxt$, ePos&, LEN(tmp$)) = tmp$: ePos& = ePos& + LEN(tmp$)
|
||||||
MID$(eTxt$, ePos&, LEN(cEol$)) = cEol$: ePos& = ePos& + LEN(cEol$)
|
MID$(eTxt$, ePos&, LEN(cEol$)) = cEol$: ePos& = ePos& + LEN(cEol$)
|
||||||
RETURN
|
RETURN
|
||||||
'----------
|
'----------
|
||||||
OpenText:
|
OpenText:
|
||||||
|
IF ml% AND NOT pc% AND LCASE$(what$) <> "co" THEN RETURN
|
||||||
SELECT CASE LCASE$(docFormat$)
|
SELECT CASE LCASE$(docFormat$)
|
||||||
CASE "html"
|
CASE "html"
|
||||||
SELECT CASE LCASE$(what$)
|
SELECT CASE LCASE$(what$)
|
||||||
|
@ -20656,6 +20664,7 @@ SUB ExportCodeAs (docFormat$)
|
||||||
RETURN
|
RETURN
|
||||||
'----------
|
'----------
|
||||||
CloseText:
|
CloseText:
|
||||||
|
IF ml% AND NOT pc% AND LCASE$(what$) <> "co" THEN RETURN
|
||||||
SELECT CASE LCASE$(docFormat$)
|
SELECT CASE LCASE$(docFormat$)
|
||||||
CASE "html"
|
CASE "html"
|
||||||
SELECT CASE LCASE$(what$)
|
SELECT CASE LCASE$(what$)
|
||||||
|
@ -20692,7 +20701,7 @@ SUB ExportCodeAs (docFormat$)
|
||||||
ELSEIF me% AND NOT le% THEN
|
ELSEIF me% AND NOT le% THEN
|
||||||
IF INSTR("$DYNAMIC$INCLUDE$STATIC", UCASE$(veri$)) > 0 THEN me$ = ""
|
IF INSTR("$DYNAMIC$INCLUDE$STATIC", UCASE$(veri$)) > 0 THEN me$ = ""
|
||||||
END IF
|
END IF
|
||||||
IF pc% AND (UCASE$(veri$) = "IF" OR UCASE$(veri$) = "THEN") THEN me$ = veri$
|
IF pc% THEN me$ = veri$
|
||||||
ELSEIF np% AND kw% THEN
|
ELSEIF np% AND kw% THEN
|
||||||
IF ASC(veri$, 1) > 90 OR INSTR(listOfKeywords$, "@_" + UCASE$(veri$) + "@") = 0 THEN kw$ = ""
|
IF ASC(veri$, 1) > 90 OR INSTR(listOfKeywords$, "@_" + UCASE$(veri$) + "@") = 0 THEN kw$ = ""
|
||||||
ELSEIF NOT ml% AND INSTR(listOfCustomKeywords$, "@" + UCASE$(removesymbol2$(veri$)) + "@") > 0 THEN
|
ELSEIF NOT ml% AND INSTR(listOfCustomKeywords$, "@" + UCASE$(removesymbol2$(veri$)) + "@") > 0 THEN
|
||||||
|
@ -20721,6 +20730,7 @@ SUB ExportCodeAs (docFormat$)
|
||||||
ELSE
|
ELSE
|
||||||
la$ = LTRIM$(StrReplace$(MID$(sTxt$, sPos&, 100), CHR$(9), " "))
|
la$ = LTRIM$(StrReplace$(MID$(sTxt$, sPos&, 100), CHR$(9), " "))
|
||||||
SELECT EVERYCASE page$
|
SELECT EVERYCASE page$
|
||||||
|
CASE "$END": IF UCASE$(LEFT$(la$, 2)) = "IF" THEN me$ = me$ + " " + LEFT$(la$, 2): page$ = "$END IF": in% = -1
|
||||||
CASE "CALL": IF UCASE$(LEFT$(la$, 8)) = "ABSOLUTE" THEN kw$ = kw$ + " " + LEFT$(la$, 8): page$ = "CALL ABSOLUTE": in% = -1
|
CASE "CALL": IF UCASE$(LEFT$(la$, 8)) = "ABSOLUTE" THEN kw$ = kw$ + " " + LEFT$(la$, 8): page$ = "CALL ABSOLUTE": in% = -1
|
||||||
CASE "DECLARE": IF UCASE$(LEFT$(la$, 7)) = "LIBRARY" THEN kw$ = kw$ + " " + LEFT$(la$, 7): page$ = "DECLARE LIBRARY": in% = -1
|
CASE "DECLARE": IF UCASE$(LEFT$(la$, 7)) = "LIBRARY" THEN kw$ = kw$ + " " + LEFT$(la$, 7): page$ = "DECLARE LIBRARY": in% = -1
|
||||||
CASE "DEF": IF UCASE$(LEFT$(la$, 3)) = "SEG" THEN kw$ = kw$ + " " + LEFT$(la$, 3): page$ = "DEF SEG": in% = -1
|
CASE "DEF": IF UCASE$(LEFT$(la$, 3)) = "SEG" THEN kw$ = kw$ + " " + LEFT$(la$, 3): page$ = "DEF SEG": in% = -1
|
||||||
|
@ -20755,9 +20765,9 @@ SUB ExportCodeAs (docFormat$)
|
||||||
IF UCASE$(LEFT$(la$, 5)) = "UNTIL" THEN kw$ = kw$ + " " + LEFT$(la$, 5): page$ = "DO...LOOP": fu% = -1: bo% = -1: in% = -1
|
IF UCASE$(LEFT$(la$, 5)) = "UNTIL" THEN kw$ = kw$ + " " + LEFT$(la$, 5): page$ = "DO...LOOP": fu% = -1: bo% = -1: in% = -1
|
||||||
CASE "ON"
|
CASE "ON"
|
||||||
IF UCASE$(LEFT$(la$, 5)) = "ERROR" THEN kw$ = kw$ + " " + LEFT$(la$, 5): page$ = "ON ERROR": in% = -1
|
IF UCASE$(LEFT$(la$, 5)) = "ERROR" THEN kw$ = kw$ + " " + LEFT$(la$, 5): page$ = "ON ERROR": in% = -1
|
||||||
IF UCASE$(LEFT$(la$, 3)) = "KEY" THEN kw$ = kw$ + " " + LEFT$(la$, 3): page$ = "ON KEY": in% = -1
|
IF UCASE$(LEFT$(la$, 3)) = "KEY" THEN kw$ = kw$ + " " + LEFT$(la$, 3): page$ = "ON KEY(n)": in% = -1
|
||||||
IF UCASE$(LEFT$(la$, 5)) = "STRIG" THEN kw$ = kw$ + " " + LEFT$(la$, 5): page$ = "ON STRIG": in% = -1
|
IF UCASE$(LEFT$(la$, 5)) = "STRIG" THEN kw$ = kw$ + " " + LEFT$(la$, 5): page$ = "ON STRIG(n)": in% = -1
|
||||||
IF UCASE$(LEFT$(la$, 5)) = "TIMER" THEN kw$ = kw$ + " " + LEFT$(la$, 5): page$ = "ON TIMER": in% = -1
|
IF UCASE$(LEFT$(la$, 5)) = "TIMER" THEN kw$ = kw$ + " " + LEFT$(la$, 5): page$ = "ON TIMER(n)": in% = -1
|
||||||
CASE "OPTION": IF UCASE$(LEFT$(la$, 4)) = "BASE" THEN kw$ = kw$ + " " + LEFT$(la$, 4): page$ = "OPTION BASE": in% = -1
|
CASE "OPTION": IF UCASE$(LEFT$(la$, 4)) = "BASE" THEN kw$ = kw$ + " " + LEFT$(la$, 4): page$ = "OPTION BASE": in% = -1
|
||||||
CASE "PALETTE": IF UCASE$(LEFT$(la$, 5)) = "USING" THEN kw$ = kw$ + " " + LEFT$(la$, 5): page$ = "PALETTE USING": in% = -1
|
CASE "PALETTE": IF UCASE$(LEFT$(la$, 5)) = "USING" THEN kw$ = kw$ + " " + LEFT$(la$, 5): page$ = "PALETTE USING": in% = -1
|
||||||
CASE "PRINT"
|
CASE "PRINT"
|
||||||
|
@ -20784,8 +20794,8 @@ SUB ExportCodeAs (docFormat$)
|
||||||
pal% = LEN(page$): lkl% = LEN(lnk$)
|
pal% = LEN(page$): lkl% = LEN(lnk$)
|
||||||
SELECT CASE LCASE$(docFormat$)
|
SELECT CASE LCASE$(docFormat$)
|
||||||
CASE "html"
|
CASE "html"
|
||||||
MID$(eTxt$, ePos&, pal% + lkl% + 111) = "<a style=" + CHR$(34) + "text-decoration: none; color: " + lkc$ + ";" + CHR$(34) + " href=" + CHR$(34) + "https://qb64phoenix.com/qb64wiki/index.php?title=" + page$ + CHR$(34) + ">" + lnk$ + "</a>"
|
MID$(eTxt$, ePos&, (2 * pal%) + lkl% + 120) = "<a style=" + CHR$(34) + "text-decoration: none; color: " + lkc$ + ";" + CHR$(34) + " href=" + CHR$(34) + "https://qb64phoenix.com/qb64wiki/index.php?title=" + page$ + CHR$(34) + " title=" + CHR$(34) + page$ + CHR$(34) + ">" + lnk$ + "</a>"
|
||||||
ePos& = ePos& + pal% + lkl% + 111
|
ePos& = ePos& + (2 * pal%) + lkl% + 120
|
||||||
CASE "rich"
|
CASE "rich"
|
||||||
MID$(eTxt$, ePos&, pal% + lkl% + 108) = "{\field{\*\fldinst HYPERLINK " + CHR$(34) + "https://qb64phoenix.com/qb64wiki/index.php?title=" + page$ + CHR$(34) + "}{\fldrslt{" + rtc$ + "\ul0 " + lnk$ + "}}}\cf0 "
|
MID$(eTxt$, ePos&, pal% + lkl% + 108) = "{\field{\*\fldinst HYPERLINK " + CHR$(34) + "https://qb64phoenix.com/qb64wiki/index.php?title=" + page$ + CHR$(34) + "}{\fldrslt{" + rtc$ + "\ul0 " + lnk$ + "}}}\cf0 "
|
||||||
ePos& = ePos& + pal% + lkl% + 108
|
ePos& = ePos& + pal% + lkl% + 108
|
||||||
|
|
Loading…
Reference in a new issue