softdrink
0.1.0Tools to inline or extract CSS into/from HTML.
Table of Contents
About Softdrink
Softdrink is a small toolkit to extract CSS from HTML or inline it. Softdrink relies on lQuery and LASS.
How To
Extracting style information happens with slurp
.
(softdrink:slurp "<div><foo/><foo id=\"bla\" style=\"bar:baz;bluh: bbab\" /></div>")
Injecting CSS back in happens with mix
. You can then prettify the output with pour
.
(softdrink:pour (softdrink:mix "<foo><p/></foo>" '(p :text-decoration underline)))
Softdrink includes support for the LASS item-types :BLOCK
and :PROPERTY
. Any other type needs to be added with DEFINE-INLINER
or DEFINE-MANIPULATOR
.
See Also
System Information
Definition Index
-
SOFTDRINK
- ORG.TYMOONNEXT.SOFTDRINK
No documentation provided.-
EXTERNAL FUNCTION EXTRACT-SHEET
- ROOT
- &KEY
- MODIFY
- &REST
Extract style elements from ROOT into a LASS sheet. If MODIFY is non-NIL the STYLE attributes are removed. Returns two values: the LASS sheet and the ROOT.
-
EXTERNAL FUNCTION INLINE-BLOCK
- ROOT
- BLOCK
- &REST
Inlines the given LASS block into the ROOT node. Returns the ROOT.
-
EXTERNAL FUNCTION INLINE-SHEET
- LASS-SHEET
- ROOT
- &REST
Inlines the given LASS-SHEET into the ROOT node. Returns the ROOT.
-
EXTERNAL FUNCTION INLINER
- TYPE
- &REST
Returns a function to use as an inliner. The TYPE is automatically converted to a keyword. If no fitting function can be found, a noop-function is returned.
-
EXTERNAL FUNCTION (SETF INLINER)
- FUNCTION
- TYPE
- &REST
Set a new inliner function. The TYPE is automatically converted to a keyword.
-
EXTERNAL FUNCTION MANIPULATE
- NODE
- ITEM
- &REST
Manipulate the NODE with the given ITEM. Returns the NODE.
-
EXTERNAL FUNCTION MANIPULATOR
- TYPE
- &REST
Returns a function to use as a manipulator. The TYPE is automatically converted to a keyword. If no fitting function can be found, a noop-function is returned.
-
EXTERNAL FUNCTION (SETF MANIPULATOR)
- FUNCTION
- TYPE
- &REST
Set a new manipulator function. The TYPE is automatically converted to a keyword.
-
EXTERNAL FUNCTION MIX
- SOURCE
- &REST
- LASS-SHEET
- &REST
Mixes the LASS-SHEET definition into the SOURCE. Returns a NODE. Source can either be a NODE or something PARSEable. See PLUMP:PARSE, LASS:COMPILE-SHEET
-
EXTERNAL FUNCTION POUR
- NODE
- &OPTIONAL
- STREAM
- &REST
Serializes NODE into STREAM. STREAM can either be an object of type STREAM, NIL (to string), or T (to *standard-output*). See PLUMP:SERIALIZE
-
EXTERNAL FUNCTION SLURP
- SOURCE
- &KEY
- STREAM
- PRETTY
- MODIFY
- &REST
Slurp all style information from SOURCE into STREAM. SOURCE --- can be either a NODE or something PLUMP:PARSEable. STREAM --- Where to output the CSS to. See LASS:WRITE-SHEET PRETTY --- Whether to prettify CSS or not. See LASS:WRITE-SHEET MODIFY --- Whether to modify the root or not. See EXTRACT-SHEET Returns two values: The ourput of WRITE-SHEET and the ROOT.
-
EXTERNAL MACRO DEFINE-INLINER
- NAME
- ROOT
- &REST
- ARGS
- &REST
- &BODY
- BODY
- &REST
Defines a new inliner. NAME --- The inliner's name, automatically converted to a keyword. ROOT --- Symbol bound to the root node to process. ARGS --- Lambda-list for the manipulator arguments.
-
EXTERNAL MACRO DEFINE-MANIPULATOR
- NAME
- ELEMENT
- &REST
- ARGS
- &REST
- &BODY
- BODY
- &REST
Defines a new manipulator. NAME --- The manipulator's name, automatically converted to a keyword. ELEMENT --- Symbol bound to the element to process. ARGS --- Lambda-list for the manipulator arguments.