Tuesday, 15 June 2010

php - how to change inline css to free attributes -



php - how to change inline css to free attributes -

i'm trying alter au generated html code exp :

<div class="intro editable" id="field_text">text <strong>text</strong> text <span style="text-decoration: underline;">text</span> <span style="color: #ff0000; font-size: 16px;">text </span></div> <h2 id="field_subtitle" class="editable">sub-title</h2> <ul> <li id="bp1" class="editable"><span style="text-decoration: underline; color: #008000; font-size: 14px;">text text text </span></li> <li id="bp2" class="editable"><ul><br /> <li><span style="color: #008000;"><strong>text text text</strong></span></li><br /> <li><span style="font-size: 18px; color: #ff0000;"><em>text text text</em> </span></li><br /> </ul></li> <li id="bp3" class="editable"><span style="text-decoration: underline; color: #00376f; font-size: 14px;">text text text text text text </span></li> </ul>

to html can read adobe air :

span = font strong = <b> text-decoration:underlinded = <u> <span style="font-size:; color:#;">text</span> ==> <font color=""><font size="">text</font></font>

i'm working regex code, still don't results :

$output = str_replace("<span", "<font", $output); $output = str_replace("span>", "font>", $output); $output = str_replace("<strong", "<b", $output); $output = str_replace("strong>", "b>", $output); $output = preg_replace("/<font(.*)text-decoration: underline;([^>]*)>(.*)<\/font>/", '<font $1 $2><u>$3</u></font>', $output); $output = preg_replace("/<font(.*)font-size:\s(.*)px;([^>]*)>(.*)<\/font>/", '<font $1 $3 size="$2" >$4</font>', $output); $output = preg_replace("/<font(.*)color:\s(.*);([^>]*)>(.*)<\/font>/", '<font $1 $3 color="$2" >$4</font>', $output);

any helps ! :)

i have made regex ! yes have parsed html regex ...

only me , chuck norris can lol...

after have cleaned html code using domdocument, formate add together lost closing tags

thanks

php html css regex

No comments:

Post a Comment