The softdrink Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The softdrink Reference Manual

This is the softdrink Reference Manual, version 0.1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 05:53:50 2022 GMT+0.

Table of Contents


1 Introduction

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


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 softdrink

Tools to inline or extract CSS into/from HTML.

Maintainer

Nicolas Hafner <shinmera@tymoon.eu>

Author

Nicolas Hafner <shinmera@tymoon.eu>

Home Page

https://Shinmera.github.io/softdrink/

Source Control

(GIT https://github.com/Shinmera/softdrink.git)

Bug Tracker

https://github.com/Shinmera/softdrink/issues

License

zlib

Version

0.1.0

Dependencies
  • lquery (system).
  • lass (system).
Source

softdrink.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 softdrink/softdrink.asd

Source

softdrink.asd.

Parent Component

softdrink (system).

ASDF Systems

softdrink.


3.1.2 softdrink/package.lisp

Source

softdrink.asd.

Parent Component

softdrink (system).

Packages

softdrink.


3.1.3 softdrink/toolkit.lisp

Dependency

package.lisp (file).

Source

softdrink.asd.

Parent Component

softdrink (system).

Internals

3.1.4 softdrink/inline.lisp

Dependency

toolkit.lisp (file).

Source

softdrink.asd.

Parent Component

softdrink (system).

Public Interface
Internals

Previous: , Up: Lisp   [Contents][Index]

3.1.5 softdrink/extract.lisp

Dependency

inline.lisp (file).

Source

softdrink.asd.

Parent Component

softdrink (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 softdrink

Source

package.lisp.

Nickname

org.tymoonnext.softdrink

Use List
  • common-lisp.
  • lquery.
  • plump.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Macros

Macro: define-inliner (name (root &rest args) &body body)

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.

Package

softdrink.

Source

inline.lisp.

Macro: define-manipulator (name (element &rest args) &body body)

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.

Package

softdrink.

Source

inline.lisp.


Previous: , Up: Public Interface   [Contents][Index]

5.1.2 Ordinary functions

Function: extract-sheet (root &key modify)

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.

Package

softdrink.

Source

extract.lisp.

Function: inline-block (root block)

Inlines the given LASS block into the ROOT node. Returns the ROOT.

Package

softdrink.

Source

inline.lisp.

Function: inline-sheet (lass-sheet root)

Inlines the given LASS-SHEET into the ROOT node. Returns the ROOT.

Package

softdrink.

Source

inline.lisp.

Function: inliner (type)

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.

Package

softdrink.

Source

inline.lisp.

Function: (setf inliner) (type)

Set a new inliner function. The TYPE is automatically converted to a keyword.

Package

softdrink.

Source

inline.lisp.

Function: manipulate (node item)

Manipulate the NODE with the given ITEM. Returns the NODE.

Package

softdrink.

Source

inline.lisp.

Function: manipulator (type)

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.

Package

softdrink.

Source

inline.lisp.

Function: (setf manipulator) (type)

Set a new manipulator function. The TYPE is automatically converted to a keyword.

Package

softdrink.

Source

inline.lisp.

Function: mix (source &rest lass-sheet)

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

Package

softdrink.

Source

inline.lisp.

Function: pour (node &optional stream)

Serializes NODE into STREAM.

STREAM can either be an object of type STREAM, NIL (to string), or T (to *standard-output*).

See PLUMP:SERIALIZE

Package

softdrink.

Source

inline.lisp.

Function: slurp (source &key stream pretty modify)

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.

Package

softdrink.

Source

extract.lisp.


5.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.1 Special variables

Special Variable: *inliners*
Package

softdrink.

Source

inline.lisp.

Special Variable: *manipulators*
Package

softdrink.

Source

inline.lisp.


Previous: , Up: Internals   [Contents][Index]

5.2.2 Ordinary functions

Function: find-similar (node)
Package

softdrink.

Source

extract.lisp.

Function: parse-style (style)
Package

softdrink.

Source

toolkit.lisp.

Function: read-property ()
Package

softdrink.

Source

toolkit.lisp.

Function: selector (child)

Returns a string that should (hopefully) uniquely identify the NODE.

Package

softdrink.

Source

extract.lisp.

Function: to-keyword (thing)
Package

softdrink.

Source

toolkit.lisp.

Function: unique-descriptor (node)
Package

softdrink.

Source

extract.lisp.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (  
D   E   F   I   M   P   R   S   T   U  
Index Entry  Section

(
(setf inliner): Public ordinary functions
(setf manipulator): Public ordinary functions

D
define-inliner: Public macros
define-manipulator: Public macros

E
extract-sheet: Public ordinary functions

F
find-similar: Private ordinary functions
Function, (setf inliner): Public ordinary functions
Function, (setf manipulator): Public ordinary functions
Function, extract-sheet: Public ordinary functions
Function, find-similar: Private ordinary functions
Function, inline-block: Public ordinary functions
Function, inline-sheet: Public ordinary functions
Function, inliner: Public ordinary functions
Function, manipulate: Public ordinary functions
Function, manipulator: Public ordinary functions
Function, mix: Public ordinary functions
Function, parse-style: Private ordinary functions
Function, pour: Public ordinary functions
Function, read-property: Private ordinary functions
Function, selector: Private ordinary functions
Function, slurp: Public ordinary functions
Function, to-keyword: Private ordinary functions
Function, unique-descriptor: Private ordinary functions

I
inline-block: Public ordinary functions
inline-sheet: Public ordinary functions
inliner: Public ordinary functions

M
Macro, define-inliner: Public macros
Macro, define-manipulator: Public macros
manipulate: Public ordinary functions
manipulator: Public ordinary functions
mix: Public ordinary functions

P
parse-style: Private ordinary functions
pour: Public ordinary functions

R
read-property: Private ordinary functions

S
selector: Private ordinary functions
slurp: Public ordinary functions

T
to-keyword: Private ordinary functions

U
unique-descriptor: Private ordinary functions

Jump to:   (  
D   E   F   I   M   P   R   S   T   U