SunQuest
           Scripts
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb Site ManagementScripts

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old November 16th, 2004, 06:30 AM
deanmas deanmas is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 1 deanmas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Arrow script to filter css

Hi all,

Im looking at writing a shell-script to filter css on the fly, allowing only specific properties through, and removing others, eg.

given a css file containing:
div.important,p.important {
margin: 1em;
padding: 0.1em;
border: solid #F00;
font-size: larger;
}
(note: above css code could be represented as one line)

and some sort of config file containing a list of allowed properties:
font-size
font-color
background-color

it woud return
div.important,p.important { font-size: larger; }

How do I go about it? Ive looked at SAC parser but couldnt find any examples and Im not realy interested in the object model of the css file.
Is sed/awk the way to go ? Any code samples would help, since Im not familiar with those.

Thanks

Reply With Quote
  #2  
Old November 24th, 2004, 11:00 PM
Magnus12 Magnus12 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 4 Magnus12 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile

Quote:
Originally Posted by deanmas
Hi all,

Im looking at writing a shell-script to filter css on the fly, allowing only specific properties through, and removing others, eg.

given a css file containing:
div.important,p.important {
margin: 1em;
padding: 0.1em;
border: solid #F00;
font-size: larger;
}
(note: above css code could be represented as one line)

and some sort of config file containing a list of allowed properties:
font-size
font-color
background-color

it woud return
div.important,p.important { font-size: larger; }

How do I go about it? Ive looked at SAC parser but couldnt find any examples and Im not realy interested in the object model of the css file.
Is sed/awk the way to go ? Any code samples would help, since Im not familiar with those.

Thanks


You probably want to use perl. The "tr" function is for text substitution.
Do you need to do this in a CGI script?

Magnus

Reply With Quote
  #3  
Old November 28th, 2004, 12:46 PM
dkaitouni dkaitouni is offline
Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 27 dkaitouni User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb Site ManagementScripts > script to filter css


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway