package dune-release

  1. Overview
  2. Docs

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.

type flavour = [
  1. | `Markdown
  2. | `Asciidoc
]

The type for text document formats.

val flavour_of_fpath : Fpath.t -> flavour option

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 otherwise
val 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:

  • 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 -> string

header_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:[< `Asciidoc | `Markdown Markdown ] -> string -> (Version.Changelog.t * (string * string)) option

change_log_last_entry ?flavour changes tries to parse the last change log entry of the string changes using the flavour syntax.

val change_log_file_last_entry : Fpath.t -> (Version.Changelog.t * (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 change_log_last_entry.

val rewrite_github_refs : user:string -> repo:string -> string -> string

rewrite_github_refs ~user ~repo s replaces references like #yyy with user/repo#yyy.

module Pp : sig ... end

Pretty printers.

OCaml

Innovation. Community. Security.