mla-titlecase
mla-titlecase is a Rust workspace for MLA-style title casing.
It ships two crates:
mla-titlecase: a library crate with a deterministic MLA rule engine and optional external lexicon supportmla-titlecase-cli: a companion CLI for fetching, preparing, building, inspecting, and diffing lexicon plugins
The library stays useful without any downloaded data. Built-in MLA rules remain authoritative; external lexicons are additive and opt-in.
Installation
Install the library in your own Cargo.toml:
[]
= "0.1"
Install the CLI from crates.io:
Install the prebuilt CLI binary from GitHub Releases with cargo binstall:
This installs the mla-titlecase executable from the mla-titlecase-cli crate.
Quickstart
Library
use titlecase_mla;
assert_eq!;
You can also protect spellings or register external lexicons:
use ;
let mut lexicons = default;
lexicons.add_protected_spellings;
let options = with_external_lexicons;
assert_eq!;
CLI
List supported sources:
Fetch a real upstream source, prepare it, and build a plugin:
For authority-style sources such as Wikidata, choose the payload shape during prepare:
Inspect or diff plugins:
JSON vs FST plugins
- Use JSON plugins when you want readable artifacts that are easy to inspect or edit manually.
- Use FST plugins when you want compact, deterministic, machine-oriented artifacts.
- Use
ExternalLexicons::register_mmap_fst_pluginwhen you want the runtime to query an FST plugin directly from a memory map. - Both formats round-trip through the same library schema.
Licensing notes for fetchable sources
The CLI preserves source metadata and notice text in prepared/plugin artifacts.
scowlis the recommended general English membership source.gndis a narrower CC0 authority source aimed at German and European person-name coverage.musicbrainzis a music-specific CC0 source for artist names and stylized forms.orcidis a researcher-name source; its public data is CC0, but its trademark/community guidance is separate.stopwords-isois convenient heuristic input, but it does not define MLA semantics.wikidatais the first optional authority-style source and defaults to a live CC0 SPARQL query.wordfreqis opt-in and requires--acknowledge-cc-by-sa.
Docs index
docs/architecture.mddocs/mla-rules.mddocs/lexicon-sources.mddocs/plugin-format.mddocs/performance.md
Examples and benches
Examples live in crates/mla-titlecase/examples/ and cargo test --examples -p mla-titlecase compiles them.
Criterion benches live in crates/mla-titlecase/benches/ and cover title casing, lookup behavior, and plugin load costs.
Contributor note
Before sending changes, run:
To validate publishability locally, also run:
For the first crates.io release, mla-titlecase-cli cannot complete a local dry run until
mla-titlecase has already been published, because Cargo resolves the versioned dependency through
the crates.io index during packaging.