package stog

  1. Overview
  2. Docs

Base module.

module XR = Xtmpl.Rewrite
module Xml = Xtmpl.Xml
val doc_by_href : ?typ:string -> ?src_doc:Types.doc -> Types.stog -> 'a -> 'a XR.env -> ?loc:Xml.loc -> string -> 'a * (Types.doc * string * string option) option

doc_by_href ?typ ?src_doc stog env href returns the document, path and optional id matching the given href string, of the form path[#id]. Return None if the document could not be found, of the id could not be found, and an error is issued.

  • parameter src_doc

    can be used to specify the source document, to improve the error message.

val get_in_env : 'a -> 'a XR.env -> Xml.name -> 'a * XR.tree list

get_in_env env tag will look for the given string in the environment, by building a <tag/> node and evaluating it. If the result is the same node, then return "" else return the reduced value as a string.

val get_path : 'a -> 'a XR.env -> 'a * Path.path

get_path env returns the path associated to "path" in env.

val escape_html : string -> string

Escape html code in the given string: change & to &amp;, < to &lt; and > to &gt;.

val concat_name : ?sep:string -> (string * string) -> string
val url_of_path : Types.stog -> Path.path -> Url.t

Build an url from the given path. This is used for documents created on the fly, like by-word or by-month index.

val build_base_rules : Types.stog -> Types.doc_id -> (Xml.name * Types.stog XR.callback) list

Build the base rules, using the default ones and the base rules register by plugins.

val doc_list : Types.doc -> ?rss:Url.t -> ?set:Types.Doc_set.t -> Types.stog XR.callback

The calllback to insert a list of documents. Can be called directly if provided an additional environment, argument and children nodes.

val get_sectionning_tags : Types.stog -> Types.doc -> XR.name list
val mk_levels : string -> (string * 'a Engine.level_fun) list -> int list Types.Str_map.t -> ?levels:(string * int list) list -> unit -> 'a Engine.level_fun Types.Int_map.t

mk_levels modname funs default_levels returns a function to create the level map from an optional list of pairs (funname, [level1 ; level2; ...]). funs is a list of pairs (funname, Engine.level_fun) and default_levels is the default list of associations between funnames and levels.

val make_module : ?levels:(string * int list) list -> unit -> (module Engine.Module)
val module_name : string
val register_base_rule : XR.name -> Types.stog XR.callback -> unit
OCaml

Innovation. Community. Security.