Skip to content

Commit

Permalink
Merge pull request #571 from QB64-Phoenix-Edition/export-fix
Browse files Browse the repository at this point in the history
Fix export as Wiki example
  • Loading branch information
RhoSigma-QB64 authored Nov 21, 2024
2 parents 38045eb + 8ca4b70 commit e02a75a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions source/ide/ide_export.bas
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ SUB ExportCodeAs (docFormat$)
END IF
END IF
END IF
IF NOT (me% OR kw%) THEN GOSUB EscapeChar 'html
IF NOT (me% OR kw%) THEN GOSUB EscapeChar 'html, wiki
CASE 39 ''
IF nl% THEN
IF sPos& + 1 <= sLen& THEN
Expand Down Expand Up @@ -177,7 +177,7 @@ SUB ExportCodeAs (docFormat$)
END IF
IF nu% THEN post% = 0: what$ = "nu": GOSUB CloseText: nu% = 0
IF curr% = 61 AND NOT (co% OR qu% OR (fu% < -1) OR bo%) THEN fu% = -3
IF curr% = 60 OR curr% = 62 OR curr% = 92 THEN GOSUB EscapeChar 'html, rtf
IF curr% = 60 OR curr% = 62 OR curr% = 92 THEN GOSUB EscapeChar 'html, rtf, wiki
nt% = -1
CASE 45 '-
IF kw% THEN
Expand Down Expand Up @@ -540,11 +540,19 @@ SUB ExportCodeAs (docFormat$)
ech$ = "\u" + LTRIM$(STR$(uni&)) + "\'bf": sk% = -1
CASE ELSE: RETURN
END SELECT
CASE "foru", "wiki" ' 'Keeps the original encoding, so Forum/Wiki examples can be copied
CASE "foru" ' 'Keeps the original encoding, so Forum/Wiki examples can be copied
SELECT CASE curr% 'back to the IDE. However, chars appear wrong in the Forum/Wiki.
CASE IS > 127: ech$ = "&#" + LTRIM$(STR$(curr%)) + ";": sk% = -1
CASE ELSE: RETURN
END SELECT
CASE "wiki" ' 'Keeps the original encoding, so Forum/Wiki examples can be copied
SELECT CASE curr% 'back to the IDE. However, chars appear wrong in the Forum/Wiki.
CASE 38: ech$ = "&amp;": sk% = -1
CASE 60: ech$ = "&lt;": sk% = -1
CASE 62: ech$ = "&gt;": sk% = -1
CASE IS > 127: ech$ = "&#" + LTRIM$(STR$(curr%)) + ";": sk% = -1
CASE ELSE: RETURN
END SELECT
CASE ELSE: RETURN
END SELECT
MID$(eTxt$, ePos&, LEN(ech$)) = ech$: ePos& = ePos& + LEN(ech$)
Expand Down

0 comments on commit e02a75a

Please sign in to comment.