package cascade

  1. Overview
  2. Docs
CSS generation and manipulation library for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

cascade-1.2.1.tbz
sha256=1cf5079b3797cd6e70fbced8dc2631074f357d36fcdea8597c7ba17ac2903f6e
sha512=43f5e6a3986f8f43ce948b8f1d59f6f00e1047f5707c5449b6323b683d2ecd51a0fb34793aad9c48904a67b0f7268d7379ab9baf29917c25a962064bfa3ab694

doc/cascade/Cascade/Syntax/index.html

Module Cascade.SyntaxSource

Shared byte-level CSS syntax helpers.

Predicates and small string operations used across the parser, lexer, selector, and the container/media/supports/font-face readers.

Sourceval is_ascii_ident_start : char -> bool

is_ascii_ident_start c returns true if c is a valid ASCII ident-start code point: a-z, A-Z, _, or -.

Sourceval is_ascii_ident_continue : char -> bool

is_ascii_ident_continue c returns true if c is a valid ASCII ident-continue code point: is_ascii_ident_start c or 0-9.

Sourceval is_hex : char -> bool

is_hex c returns true if c is a hexadecimal digit (0-9, a-f, A-F).

Sourceval is_ident : string -> bool

is_ident s is true when the whole of s is one ident, per CSS Syntax 3 (ED) sec. 4.3.9 for its opening and sec. 4.2 for the rest: a bare - and a - before a digit open no ident, a leading digit opens none, and every code point is an ident code point. The non-ASCII half is Lexer.spec_non_ascii_ident_cp, the range list serialisers emit verbatim, so is_ident s holds exactly when Parser.escape_ident returns s unchanged. An escape is not an ident code point: s is the decoded name, not its CSS spelling.

Sourceval url_needs_quotes : string -> bool

url_needs_quotes s returns true when serializing s as a bare url(...) argument would change tokenization; the caller must wrap s in quotes.

Sourceval split_top_level_colon : Component.t list -> (Component.t list * Component.t list) option

split_top_level_colon cvs splits a component-value sequence at the first top-level : token, returning Some (before, after); the colon itself is dropped. Returns None if no top-level colon is present.

Sourceval strip_url_suffix : string -> string

strip_url_suffix url strips a query string (?...) and fragment (#...) from url. Used when resolving @import URLs against the host filesystem, where neither suffix is meaningful.

Sourceval url_file_path : string -> string

url_file_path url decodes the path component of url for a filesystem lookup.

Sourceval is_remote_url : string -> bool

is_remote_url url is true when url has a scheme or authority.