Skip to content

Casing rules restart from scratch on each segment of nested/styled content #38

@eltos

Description

@eltos

When using styled content (such as boldface, underline etc.) the sentence- and title-casing does not work as expected.

Here is an example that shows the issue(s) related to style transitions, e.g. change of normal to bold text

  • Sentencecase treats a style transition as if a new sentence was started
  • Titlecase capitalizes words like "a", "for", "and" etc. unexpectedly if they appear as the last/first word before/after a style transition

There are two more things I find unexpected here, though these are not caused by styled content and might be a topic for a separate issue:

  • The lowercasing of "WASM" only for sentence-, but not for titlecase
  • The uppercasing of "is" for titlecase

Image


Typst code to reproduce

#import "@preview/decasify:0.9.0": sentencecase, titlecase

#set page(margin: 1em, width: auto, height: auto)
#set text(lang: "en")

#table(columns: (3cm, 19cm))[Source][
  decasify is a *typst WASM package* providing typst _functions for locale and #underline[style guide aware]_ text casing.
]

== Sentencecase
#table(columns: (3cm, 19cm))[Actual][
  #sentencecase[decasify is a *typst WASM package* providing typst _functions for locale and #underline[style guide aware]_ text casing.]
][Expected][
  Decasify is a *typst WASM package* providing typst _functions for locale and #underline[style guide aware]_ text casing.
][Actual w/o style][
  #sentencecase[decasify is a typst WASM package providing typst functions for locale and style guide aware text casing.]
]

== Titlecase
#table(columns: (3cm, 19cm))[Actual (styled)][
  #titlecase[decasify is a *typst WASM package* providing typst _functions for locale and #underline[style guide aware]_ text casing.]
][Expected][
  Decasify is a *Typst WASM Package* Providing Typst _Functions for Locale and #underline[Style Guide Aware]_ Text Casing.
][Actual w/o style][
  #titlecase[decasify is a typst WASM package providing typst functions for locale and style guide aware text casing.]
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions