Stog library reference documentation : Stog_engine

Module Stog_engine

module Stog_engine: sig .. end
Rewrite engine.

exception Cant_open_cache_file of string
Exception raised when a cache file of a loaded plugin could not be open.
type 'a level_fun = 
| Fun_stog of (Stog_types.stog Xtmpl.env ->
Stog_types.stog -> Stog_types.Doc_set.t -> Stog_types.stog)
| Fun_data of ('a Xtmpl.env ->
Stog_types.stog * 'a -> Stog_types.Doc_set.t -> Stog_types.stog * 'a)
| Fun_stog_data of ((Stog_types.stog * 'a) Xtmpl.env ->
Stog_types.stog * 'a -> Stog_types.Doc_set.t -> Stog_types.stog * 'a)
A function associated to a level. All functions take in parameter the environment, the stog and structure and the list of documents to rewrite. They return the new stog structure. Some function (Fun_data, Fun_stog_data) also handle an additional data structure: the callbacks in the environment also handle it, and the function returns it with the stog structure.
type 'a modul = {
   mod_data : 'a;
   mod_levels : 'a level_fun Stog_types.Int_map.t;
   mod_name : string;
}
A structure containing data and functions associated to levels. Contains also the module name.
module type Module = sig .. end
A module.
type stog_state = {
   st_stog : Stog_types.stog;
   st_modules : (module Stog_engine.Module) list;
   st_docs : Stog_types.Doc_set.t;
}
val run : ?use_cache:bool ->
?default_style:Xtmpl.tree list ->
stog_state -> stog_state
val generate : ?use_cache:bool ->
?gen_cache:bool ->
?default_style:Xtmpl.tree list ->
?only_docs:string list ->
Stog_types.stog -> (module Stog_engine.Module) list -> unit
Generate the target files, with the following steps:
  • create the output directory,
  • build the base environment from the site global attributes,
  • compute by-topic, by-keyword and by-month documents,
  • compute documents,
  • for each level, for each document, apply level functions on the document
  • output Stog_types.doc.doc_out field in the destination file.

val doc_dst : (string -> string -> string) ->
?encode:bool -> Stog_types.stog -> string -> Stog_types.doc -> string
val doc_dst_file : Stog_types.stog -> Stog_types.doc -> string
Build the final file where the given document will be generated.
val doc_url : Stog_types.stog -> Stog_types.doc -> Neturl.url
Build the final url of the given document.
val env_of_defs : ?env:'a Xtmpl.env -> Stog_types.def list -> 'a Xtmpl.env
val env_of_used_mods : Stog_types.stog -> ?env:'a Xtmpl.env -> Stog_types.Str_set.t -> 'a Xtmpl.env
type 'a stog_doc_rules = Stog_types.stog -> Stog_types.doc_id -> (Xtmpl.name * 'a Xtmpl.callback) list 
val get_in_env : 'a -> 'a Xtmpl.env -> Xmlm.name -> 'a * Xtmpl.tree list
val opt_in_env : 'a -> 'a Xtmpl.env -> Xmlm.name -> 'a * Xtmpl.tree list option
val get_in_args_or_env : 'a -> 'a Xtmpl.env -> Xtmpl.attributes -> Xmlm.name -> 'a * Xtmpl.tree list
get_in_args_or_env env args s returns the value associated to s in args of else return the result of get_in_env env s.
val get_path : 'a -> 'a Xtmpl.env -> 'a * Stog_path.path
get_path env returns the path associated to "doc-path" in env.
Raises Stog_path.Invalid if "doc-path" is not found in the environment or is not a valid path.
val get_path_in_args_or_env : 'a -> 'a Xtmpl.env -> Xtmpl.attributes -> 'a * Stog_path.path
Same as Stog_engine.get_path but first looks for "doc-path" attribute in the given args.
val doc_env : 'a -> 'a Xtmpl.env -> Stog_types.stog -> Stog_types.doc -> 'a * 'a Xtmpl.env
val apply_stog_env_doc : Stog_types.stog ->
Stog_types.stog Xtmpl.env -> Stog_types.doc_id -> Stog_types.stog
val apply_stog_data_env_doc : Stog_types.stog * 'a ->
(Stog_types.stog * 'a) Xtmpl.env -> Stog_types.doc_id -> Stog_types.stog * 'a
val apply_data_env_doc : Stog_types.stog * 'a ->
'a Xtmpl.env -> Stog_types.doc_id -> Stog_types.stog * 'a
val fun_apply_stog_doc_rules : Stog_types.stog stog_doc_rules -> 'a level_fun
val fun_apply_stog_data_doc_rules : (Stog_types.stog * 'a) stog_doc_rules -> 'a level_fun
val fun_apply_data_doc_rules : 'a stog_doc_rules -> 'a level_fun
val get_languages : 'a -> 'a Xtmpl.env -> 'a * string list

Registering modules

type module_fun = Stog_types.stog -> (module Stog_engine.Module) 
val modules : unit -> (string * module_fun) list
val register_module : string -> module_fun -> unit
val module_by_name : string -> module_fun option