summaryrefslogtreecommitdiff
path: root/txtile.bas
diff options
context:
space:
mode:
authorJeff Armstrong <jeffrey.armstrong@approximatrix.com>2017-05-22 09:32:22 -0400
committerJeff Armstrong <jeffrey.armstrong@approximatrix.com>2017-05-22 09:32:22 -0400
commit2eef1bf3e30b7d1205afd83c31d103f900b35467 (patch)
treed1c758749baae648b6b8299b4865ec1ace91a078 /txtile.bas
parent0370be971a5011a84b50dd4e8fb30194c7255b24 (diff)
downloadgwblog-2eef1bf3e30b7d1205afd83c31d103f900b35467.tar.gz
gwblog-2eef1bf3e30b7d1205afd83c31d103f900b35467.zip
Improvements to per-line Textile processing, including proper support for images and additional operators within links.
Diffstat (limited to 'txtile.bas')
-rw-r--r--txtile.bas24
1 files changed, 16 insertions, 8 deletions
diff --git a/txtile.bas b/txtile.bas
index f9edc43..dbc739b 100644
--- a/txtile.bas
+++ b/txtile.bas
@@ -53,9 +53,9 @@
10650 LCOPT$ = "##c"+LC$
10660 GOSUB 11200
10664 REM If we're in a link, suppress any character processing
-10665 IF LCOPT$ <> LASTOP$ AND LASTOP$ = "##c!" THEN GOTO 10800
+10665 REM IF LCOPT$ <> LASTOP$ AND LASTOP$ = "##c!" THEN GOTO 10800
10667 REM Links must have a space preceding the !
-10668 IF LC$ = "!" AND LASTC$ <> " " THEN GOTO 10800
+10668 REM IF LC$ = "!" AND LASTC$ <> " " THEN GOTO 10800
10670 PUSHTXT$ = MID$(LTXT$, LSTART, LI-LSTART):GOSUB 11300
10680 LSTART=LI+1
10690 IF LCOPT$ = LASTOP$ AND (LCOPT$ = "##c"+CHR$(34) OR LCOPT$="##c!") AND MID$(LTXT$, LI+1, 1) = ":" THEN GOSUB 11400 ELSE LINK$ = ""
@@ -86,16 +86,22 @@
11200 REM Last stack operator - search for the last stack op
11201 REM Returned as LASTOP$
-11210 IF STKPOS = 0 THEN LASTOP$ = "":RETURN
+11205 IF STKPOS = 0 THEN LASTOP$ = "":RETURN
+11209 REM First search for a match...
11210 FOR LASTI = STKPOS TO 1 STEP -1
-11220 IF LEN(STK$(LASTI)) > 3 AND MID$(STK$(LASTI),1,2) = "##" THEN LASTOP$ = STK$(LASTI):RETURN
+11215 IF LEN(STK$(LASTI)) > 3 AND MID$(STK$(LASTI),1,2) = "##" THEN LASTOP$ = STK$(LASTI) ELSE GOTO 11230
+11217 PRINT STK$(LASTI);" VS. ";LCOPT$
+11220 IF LCOPT$ = STK$(LASTI) THEN PRINT"MATCHING ";LASTOP$:RETURN ELSE LASTOP$ = ""
11230 NEXT LASTI
-11240 LASTOP$ = ""
-11250 RETURN
+11239 REM Just look for the last operator instead
+11240 FOR LASTI = STKPOS TO 1 STEP -1
+11250 IF LEN(STK$(LASTI)) > 3 AND MID$(STK$(LASTI),1,2) = "##" THEN LASTOP$ = STK$(LASTI):RETURN
+11260 NEXT LASTI
+11270 LASTOP$ = ""
+11280 RETURN
11300 REM Push to the stack
11301 REM PUSHTXT$ contains the item
-11310 IF LASTOP$
11310 STKPOS = STKPOS+1
11320 STK$(STKPOS) = PUSHTXT$
11330 RETURN
@@ -140,7 +146,9 @@
12020 WHILE(STK$(BACKSTK) <> LASTOP$)
12030 BACKSTK = BACKSTK - 1
12040 WEND
-12050 FOR ISTK = BACKSTK+1 TO STKPOS:OPARG$ = OPARG$ + STK$(ISTK):NEXT ISTK
+12050 FOR ISTK = BACKSTK+1 TO STKPOS
+12052 IF LEN(STK$(ISTK)) > 3 AND MID$(STK$(ISTK),1,3) = "##c" THEN OPARG$ = OPARG$ + MID$(STK$(ISTK),4,1) ELSE OPARG$ = OPARG$ + STK$(ISTK)
+12055 NEXT ISTK
12060 IF LASTOP$ = "##c_" THEN PREOP$ = "<em>":POSTOP$="</em>":GOTO 12200
12070 IF LASTOP$ = "##c*" THEN PREOP$ = "<strong>":POSTOP$="</strong>":GOTO 12200
12080 IF LASTOP$ = "##c^" THEN PREOP$ = "<sup>":POSTOP$="</sup>":GOTO 12200