General Community > Scripting Help

php/html code beautifier

<< < (3/3)

writeto:
what I could do is have the program read in the deliminators from a file in the format
start , end. If this would be preferrable let me know.

[Unknown]:

--- Quote from: writeto on October 28, 2003, 12:10:15 AM ---So you want me to lowercase any predecessing /<, ?, !, [, ?, \w, +, ., *, until it reaches its end mark like ?>, ]. My worry is that it will be impossible to do if there is no ending mark. So let me know the groupings and I will do it.

--- End quote ---

Umm.. no, that's nto what my regular expression said ;P.

/<(?![?])[\/]?(\w+).*?>/
Means:
Find a < NOT followed by a ?, and then a word of any length (which should be captured), followed by anything and then a >.

Basically this part:
<html lang="en">

BUT NOT:
<?php echo 'temp';?>
(because it has a ?.)

-[Unknown]

Jim Yarbro:
freshmeat 9 times out of 10 will have whatever open source solution you need.

i just hope you are running this in unix cuz scripting > manual labor

[edit]

here's an html tidy:
http://freshmeat.net/projects/htmltidy/?topic_id=90

writeto:

--- Quote from: [Unknown] on October 28, 2003, 01:24:22 AM ---
--- Quote from: writeto on October 28, 2003, 12:10:15 AM ---So you want me to lowercase any predecessing /<, ?, !, [, ?, \w, +, ., *, until it reaches its end mark like ?>, ]. My worry is that it will be impossible to do if there is no ending mark. So let me know the groupings and I will do it.

--- End quote ---

Umm.. no, that's nto what my regular expression said ;P.

/<(?![?])[\/]?(\w+).*?>/
Means:
Find a < NOT followed by a ?, and then a word of any length (which should be captured), followed by anything and then a >.

Basically this part:
<html lang="en">

BUT NOT:
<?php echo 'temp';?>
(because it has a ?.)

-[Unknown]

--- End quote ---

To do what you are asking you would simply have to add the deliminators <html,> or <?php,?>.
I decided to do it this way because I do not want to hardcode anything in, this will allow for greater flexibility and updating without recompilation (although it will slow down the application a bit).

Andrew

Nemesis:
in dreamweaver, (you can use trial version for one month if you don't have it)

just go to ( file ) the go down to ( convert ) then click on ( xhtml )

and it will convert all tags to lowercase. ;)

I know it works in dreamweaver 3, dreamweaver mx and dreamweaver mx 2004

Navigation

[0] Message Index

[*] Previous page

Go to full version