LC insists on interpreting HTML code
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 508
- Joined: Sun Dec 18, 2011 7:23 pm
- Location: London
- Contact:
LC insists on interpreting HTML code
I have some text with HTML code on some lines. It is not complete HTML code. e.g. no <p> tags.
When I put the text in a field I see it with the HTML tags, as expected. But when I try to search for the tags using say matchChunk, it does not find them as it seems to automatically have interpreted them.
I have not set the HTMLtext, just using it as pure text in a variable.
When I use "answer" to see the code, again I see the partial HTML code interpreted. Please see attached shot of a field with the tags showing correctly, but the tags interpreted in an answer dialog. Any ideas how I can force LC to read text and not to interpret?
When I put the text in a field I see it with the HTML tags, as expected. But when I try to search for the tags using say matchChunk, it does not find them as it seems to automatically have interpreted them.
I have not set the HTMLtext, just using it as pure text in a variable.
When I use "answer" to see the code, again I see the partial HTML code interpreted. Please see attached shot of a field with the tags showing correctly, but the tags interpreted in an answer dialog. Any ideas how I can force LC to read text and not to interpret?
Kaveh
-
- VIP Livecode Opensource Backer
- Posts: 9802
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: LC insists on interpreting HTML code
The answer command will do that (see its Dictionary entry).
To spot check while you're working consider either the Variable Watcher or the Message Box.
To spot check while you're working consider either the Variable Watcher or the Message Box.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Livecode Opensource Backer
- Posts: 508
- Joined: Sun Dec 18, 2011 7:23 pm
- Location: London
- Contact:
Re: LC insists on interpreting HTML code
Thank you Richard. I have now looked at the documentation for "Answer" and can see it looks for html code and interprets it when it can.
In my case I found a solution. I still can't understand why but if I have a some text in myVar that contains "</font>" and if I say:
it does not work but if I say:
I get a hit. The problem is solved, but it would be good to understand the reason for this.
In my case I found a solution. I still can't understand why but if I have a some text in myVar that contains "</font>" and if I say:
Code: Select all
if "</font>" is in line 5 of myVar then answer "yes"
Code: Select all
get line 5 of myVar
if "</font>" is in it then answer "yes"
Kaveh
-
- VIP Livecode Opensource Backer
- Posts: 9802
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: LC insists on interpreting HTML code
In the second example "it" is referring to something other than myVar.
If you post an example stack or the complete code I'm sure we can fix this for you quickly.
If you post an example stack or the complete code I'm sure we can fix this for you quickly.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Livecode Opensource Backer
- Posts: 508
- Joined: Sun Dec 18, 2011 7:23 pm
- Location: London
- Contact:
Re: LC insists on interpreting HTML code
"it" is referring to "line 5 of myVar", no?
So when I extract line 5 and test that I can test for the HTML code, but when I refer directly to that line, LC interprets the HTML first.
Thank you very much for the offer Richard. I tried it in a minimal stack and the effect is not present and the stack I am working on has too many things going on.
It could be something to do with the stack. At least it is working nicely now...
So when I extract line 5 and test that I can test for the HTML code, but when I refer directly to that line, LC interprets the HTML first.
Thank you very much for the offer Richard. I tried it in a minimal stack and the effect is not present and the stack I am working on has too many things going on.
It could be something to do with the stack. At least it is working nicely now...
Kaveh
-
- VIP Livecode Opensource Backer
- Posts: 9802
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: LC insists on interpreting HTML code
You're absolutely right. I should know better than to try to answer forum posts in between rounds of eggnog.
If you get stuck again please revisit this thread with a complete handler and we'll sort it out. Next time I promise to post without eggnog.So when I extract line 5 and test that I can test for the HTML code, but when I refer directly to that line, LC interprets the HTML first.
Thank you very much for the offer Richard. I tried it in a minimal stack and the effect is not present and the stack I am working on has too many things going on.
It could be something to do with the stack. At least it is working nicely now...
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Livecode Opensource Backer
- Posts: 508
- Joined: Sun Dec 18, 2011 7:23 pm
- Location: London
- Contact:
Re: LC insists on interpreting HTML code
I would not normally be forgiving, but I will make an exception as it is the festive period. Happy holidays and New Year.
Kaveh
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: LC insists on interpreting HTML code
Kaveh,
just try the following. It works as it should.
So the problem may be that you have an unusual linedelimiter in your code? Or an otherwise different variable myVar?
As to your original post (where, by the way, the colorizing should also include the opening backslash of the LaTeX command) you could simply replace "<font" with "<ffont" if you don't want the html interpretation.
just try the following. It works as it should.
So the problem may be that you have an unusual linedelimiter in your code? Or an otherwise different variable myVar?
Code: Select all
on mouseUp
put "1"&cr&"2"&cr&"3"&cr&"4"&cr&"5<font></font>"&cr&"6" into myVar
get line 5 of myVar
if "</font>" is in it then answer "yes"
if "</font>" is in line 5 of myVar then answer "yes"
end mouseUp
shiftLock happens
-
- Livecode Opensource Backer
- Posts: 508
- Joined: Sun Dec 18, 2011 7:23 pm
- Location: London
- Contact:
Re: LC insists on interpreting HTML code
Thank you for your time on this...
I have not reset linedelimiter in the code...
Good hint to change the html code temporarily. I find that we have to be very careful whenever there is "<" in the source text. So to be safe, I am temporarily changing this to a unique string before saving the htmltext, then changing back in a field.
I have not reset linedelimiter in the code...
Good hint to change the html code temporarily. I find that we have to be very careful whenever there is "<" in the source text. So to be safe, I am temporarily changing this to a unique string before saving the htmltext, then changing back in a field.
Kaveh