package htmlfromtexbooks

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Main module for parsing string to an AST representing LaTeX Books

type cmd =
  1. | NullCommand
    (*

    A nullcommand is nothing

    *)
  2. | AtomCmd of string * string list
    (*

    An atomic command just have a name and eventual parameters like \newline

    *)
  3. | SimpleCmd of string * string list * string
    (*

    A command with extactly one argument e.g. \chaptername

    *)
  4. | MultipleCmd of string * string list * string list
    (*

    A command with multiple arguments e.g. \fracx

    *)

Commande type : an internal used in the first phase of the parsing

type structure =
  1. | Nul
  2. | Line of string
    (*

    A line of just plain text like "It's the Enterprise!"

    *)
  3. | Cmd of cmd
    (*

    A command of our internal type used in the parsing

    *)
  4. | AtomicCmd of string * string list
    (*

    The final type to represent an atomic command like \newline

    *)
  5. | OneArgCmd of string * string list * structure list
    (*

    Structure version of SimpleCdm

    *)
  6. | MultipleArgCmd of string * string list * structure list list
    (*

    Structure version of MultipleCmd

    *)
  7. | Env of string * structure list
    (*

    An environment like document,center,equation...

    *)
  8. | Math of string
    (*

    A re-latexified math literal to be sent to an online image processing

    *)
  9. | Subsubsection of string * structure list
    (*

    Represent the LaTeX subsubsection, a subsubsection have a name and a list of structure children

    *)
  10. | Subsection of string * structure list
    (*

    See above

    *)
  11. | Section of string * structure list
    (*

    See above

    *)
  12. | Chapter of string * structure list
    (*

    See above

    *)

Structure used to represent in an AST-ish (just one node with a list of structure children) LaTeX

val preamble : (string, string) Hashtbl.t
val commands : (string, structure list) Hashtbl.t
val parse_interior_of_an_accolade : char list -> string -> string * char list

Parses an accolade for the first time (command reading)

val parse_arguments : char list -> string -> string list -> string list * char list

Parses arguments of a function colorlinks,12pt to a list of string "colorlinks","12pt"

val parse_command : char list -> cmd * char list

Parses a command recursively, called when a \ is detected in the parsing of a string

val append_line : string -> structure list -> structure list

Appends a line to a list if the line is not empty

val parse_math : char list -> structure * char list

Parses inline $$ math

val parse_string : String.t -> structure list

Parses recursively a string into a list of structure, transforms commands to their final type

val separate_preamble : structure list -> structure list * structure list

Take the list of structure and gives the preamble (everything before the start of the document) and the document itself

val calculate_environments : structure list -> structure list

Recursively generates the environments (begin...end) statements

val read_preamble : structure list -> unit

Reads the preamble for type,title,author and eventual glossary input

val separate_sections : structure list -> structure list

Take the structure list and order of the Chapters,section etc.

OCaml

Innovation. Community. Security.