package topkg-care
Install
    
    dune-project
 Dependency
Authors
Maintainers
Sources
sha512=34d22ae5b6bd166dd4a601a7d12d89c336684b3c56d7c7f481b40837eab263616cc3a6e6f63602f3d4a7d53c911967bf261de6c1ac205341b98a9838e5ea7aeb
    
    
  doc/topkg_care/Topkg_care/Text/index.html
Module Topkg_care.TextSource
Text processing helpers.
Marked-up text files
Warning. Some of the following functions are not serious and can break on certain valid inputs in all sorts of fashion. To understand breakage bear in mind that they operate line-wise.
val flavour_of_fpath : Fpath.t -> flavour optionflavour_of_fpath p determines a flavour according to the extension of p as follows:
- Some `Markdownfor- .md
- Some `Asciidocfor- .asciidocor- .adoc
- Noneotherwise
val head : ?flavour:flavour -> string -> (string * string) optionhead ~flavour text extracts the head of the document text of flavour flavour (defaults to `Markdown).
The head is defined as follows:
- Anything before the first header is discarded.
- The first header is kept in the first component
- Everything that follows until the next header of the same or greater level is kept discarding trailing blank lines.
val header_title : ?flavour:flavour -> string -> stringheader_title ~flavour text extract the title of a header text of flavour flavour (defaults to `Markdown).
Toy change log parsing
val change_log_last_entry : 
  ?flavour:flavour ->
  string ->
  (string * (string * string)) optionval change_log_file_last_entry : 
  Fpath.t ->
  (string * (string * string), Bos_setup.R.msg) Bos_setup.resultchange_log_file_last_entry file tries to parse the last change log entry of the file file using flavour_of_fpath and and change_log_last_entry.
Toy URI parsing
split_uri uri splits uri into a triple (scheme, host, path). If rel is true (defaults to false), a leading "/" in path is removed.
Edit and page text
edit_file f invokes the tool mentioned in the EDITOR environment variable with f and returns the exit code of the program.
find ~no_pager is an optional pager command. If don't is true returns None. Otherwise first consults the PAGER environment variable, then tries less or more in that order. If the TERM environment variable is "dumb" or undefined unconditionaly returns None.