Skip to content

Commit 9f0d5f3

Browse files
committed
docs: add code comments
1 parent a1b4a21 commit 9f0d5f3

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

decritic.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Command decritic reads text (from its arguments, or from stdin line by line)
2+
// and removes diacritics (accents), optionally applying extended
3+
// transliterations for letters that have no simple decomposed form.
14
package main
25

36
import (
@@ -43,6 +46,8 @@ func action(c *cli.Context) error {
4346
"ł", "l", "Ł", "L",
4447
)
4548

49+
// Decompose to NFD, drop the combining marks (Unicode category Mn) that
50+
// carry the accents, then recompose to NFC.
4651
t := transform.Chain(norm.NFD, runes.Remove(runes.In(unicode.Mn)), norm.NFC)
4752
if c.NArg() > 0 {
4853
for i, in := range c.Args().Slice() {

0 commit comments

Comments
 (0)