Putting "[/text]" inside [text]...[/text] pair

Started by cormullion, January 27, 2006, 01:11:25 PM

Previous topic - Next topic

cormullion

I'm confused yet again! I want to describe the [text] and [/text] tags in some HTML text but I then have to enclose the entire HTML source in [text] ...[/text] tags so that newLISP can process the entire HTML. Obviously it doesn't work unless I do something to the non-active [text][/text] occurrences but I don't know what. Suggestions welcome...

Fanda

#1
If you don't use '{' or '}' inside the text, use them instead:


(define (test str)
  (println str))

(test {
  [text] Just testing... [/text]
})

=>  [text] Just testing... [/text]


Fanda

cormullion

#2
Thanks - I'll have another look at the problem...

Lutz

#3
... but {,} will not work for more than 2048 characters. What you can do is use the HTML code options:  & # 9 1 ; and & # 9 3 ; for [ and ] respectively:



(set 'str
[text]
this is about the & # 9 2 ; text & # 9 3 ;  tag
[/text])

; will display as
; this is about the [text] tag
; in a browser


Lutz



ps: I had to put spaces in between so it would not translate in this post

cormullion

#4
Yes, that's the solution! Thanks - as usual, Lutz, you save the day!

newdep

#5
And how to do this when reading large code of text that includes [text] and [/text] ? [text][text][/text][/text]



Im unable to get this working.. There seems to be no quoting for for this in normal text files...



Lutz, perhpas the parser function should always seek for the "last" occeurance of '[/text]' when reading/writing large newlisp code as text...??



Or do you have another hint?
-- (define? (Cornflakes))

Lutz

#6
'base64-enc'-ode bigger text portions of unknown content first, then bracket them with [text],[/text] tags, e.g:


[text]dGhpcyBoYXMgW3RleHRdZW1iZWRkZWRbL3RleHRdIHRhZ3M=[/text]


Any other solution can lead to ambiguities.