package slugline

  1. Overview
  2. Docs
A very small (and portable) slugifier implementation

Install

dune-project
 Dependency

Authors

Maintainers

Sources

slugline-1.0.0.tbz
sha256=3b155d1eab3d43900e02227befc2bab0e288ca6f7e04209c08ef9d10ac4f5c0b
sha512=b43412e53801893ddffcb239317d63c95cd9d05c760e31a435e1795a9103e710d0b93eac18d1b739c8c688b91eacfe3e7997f9d0f1abde3f5b896d3bf380ac63

doc/slugline/Slugline/index.html

Module SluglineSource

Slugline is a relatively portable implementation of slug or speaking URLs, short identifiers used only to name URLs (or other keys). The implementation closely resembles.

The goal of this implementation is to be compact and portable, and it draws heavily on the one found in YOCaml. If you're looking for more sophisticated and advanced implementations, we encourage you to try: slug.

Types

Sourcetype t

Describes a slug, a string whose characters have been replaced.

Mapping

Describes a mapping that explains how to replace invalid characters.

Sourcemodule Mapping : sig ... end

A mapping is a table that maps Uchar.t characters to character strings in order to perform a substitution during slug conversion.

Conversion

Sourceval from_string : ?lowercase:bool -> ?mapping:Mapping.t -> ?sep:string -> ?unknown:string -> string -> t

from_string ?lowercase ?mapping ?sep ?unknown subject converts the string subject into a slug. The lowercase flag (default true) forces the result to be in lowercase. mapping allows you to provide your own substitution rules, sep is the string used to replace spaces, and unknown is the string used to replace unknown characters. If the separators and placeholders are identical, they are merged when they appear consecutively.

Sourceval to_string : t -> string

to_string slug converts the given slug into a string.