Topkg_care.Text
Text processing helpers.
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.
flavour_of_fpath p
determines a flavour according to the extension of p
as follows:
Some `Markdown
for .md
Some `Asciidoc
for .asciidoc
or .adoc
None
otherwiseval head : ?flavour:flavour -> string -> (string * string) option
head ~flavour text
extracts the head of the document text
of flavour flavour
(defaults to `Markdown
).
The head is defined as follows:
val header_title : ?flavour:flavour -> string -> string
header_title ~flavour text
extract the title of a header text
of flavour flavour
(defaults to `Markdown
).
val change_log_last_entry : ?flavour:flavour ->
string -> (string * (string * string)) option
val change_log_file_last_entry : Fpath.t -> (string * (string * string), Bos_setup.R.msg) Bos_setup.result
change_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
.
split_uri uri
splits uri
into a triple (scheme, host, path)
. If rel
is true
(defaults to false
), a leading "/"
in path
is removed.
val edit_file : Fpath.t -> (int, Bos_setup.R.msg) Bos_setup.result
edit_file f
invokes the tool mentioned in the EDITOR
environment variable with f
and returns the exit code of the program.
val find_pager : don't:bool -> (Bos_setup.Cmd.t option, Bos_setup.R.msg) Bos_setup.result
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
.