git.iko.soy/typeable/pandoc
on master help sign in
Documented text module for lua-filters.

See #4077.

commit47e74742a86ced0098626202bd9a0faccf18f17d authorJohn MacFarlane <jgm@berkeley.edu> dateSat 18 Nov 2017, 13:40 (9 years ago) parent17f6621
1 file changed+37
doc/lua-filters.md+37
doc/lua-filters.md+37
@@ -478,6 +478,43 @@ function CodeBlock(block)
478478end
479479```
480480
481+# Module text
482+
483+UTF-8 aware text manipulation functions, implemented in Haskell.
484+These are available to any lua filter. However, the module must
485+be explicitly loaded:
486+
487+```lua
488+-- uppercase all regular text in a document:
489+text = require 'text'
490+function Str (s)
491+ s.text = text.upper(s.text)
492+ return s
493+end
494+```
495+
496+[`lower (s)`]{#text-lower}
497+
498+: Returns a copy of a UTF-8 string, converted to lowercase.
499+
500+[`upper (s)`]{#text-upper}
501+
502+: Returns a copy of a UTF-8 string, converted to uppercase.
503+
504+[`reverse (s)`]{#text-reverse}
505+
506+: Returns a copy of a UTF-8 string, with characters reversed.
507+
508+[`len (s)`]{#text-len}
509+
510+: Returns the length of a UTF-8 string.
511+
512+[`sub (s)`]{#text-sub}
513+
514+: Returns a substring of a UTF-8 string, using lua's string
515+ indexing rules.
516+
517+
481518# Module pandoc
482519
483520Lua functions for pandoc scripts.