开发者

quote marks in movable type

开发者 https://www.devze.com 2023-03-05 02:04 出处:网络
Is there an attribute to escape single and double quotes in Movable Type? I am dumping the body of an entry in a mailto. I have removed any html with remove_html=\"1\" but if the entry has quotes it c

Is there an attribute to escape single and double quotes in Movable Type? I am dumping the body of an entry in a mailto. I have removed any html with remove_html="1" but if the entry has quotes it chokes.

Also is there a way to convert BR Tags and/or DIV tags to new lines s开发者_如何学JAVAo it will format correctly in the email?


What you're asking for is the template tag modifier 'encode_php' which could be applied to any movable type template that.

You could use it like this for the 'Entry Title':

<mt:EntryTitle encode_php="qq" encode_php="q">

This would escape both the double and the single quotes.

Kind Regards, Mihai Bocsaru


The URI module knows how to encode quotation characters.

use URI;
my $entry = text_from_html(q{<div>bla<br>bla "bla bla 'bla'" bla<br>bla bla</div>});
my $uri = URI->new($recipient, 'mailto');
$uri->query_form(body => $entry);
print $uri->as_string; # mailto:invalid@example.com?body=bla%0Abla+%22bla+bla+'bla'%22+bla%0Abla+bla

Open a new question for the unrelated problem of converting hyper-text markup to text with newlines.

0

精彩评论

暂无评论...
验证码 换一张
取 消