newLISP Fan Club

Forum => newLISP in the real world => Topic started by: cormullion on January 27, 2006, 01:11:25 PM

Title: Putting "[/text]" inside [text]...[/text] pair
Post by: cormullion on January 27, 2006, 01:11:25 PM
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...
Title:
Post by: Fanda on January 27, 2006, 06:05:53 PM
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
Title:
Post by: cormullion on January 28, 2006, 02:06:54 PM
Thanks - I'll have another look at the problem...
Title:
Post by: Lutz on January 28, 2006, 05:46:55 PM
... 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
Title:
Post by: cormullion on January 29, 2006, 12:11:44 AM
Yes, that's the solution! Thanks - as usual, Lutz, you save the day!
Title:
Post by: newdep on November 21, 2008, 12:31:42 PM
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?
Title:
Post by: Lutz on November 21, 2008, 07:17:19 PM
'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.