Skip to content

Commit

Permalink
Documented text module for lua-filters.
Browse files Browse the repository at this point in the history
See #4077.
  • Loading branch information
jgm committed Nov 18, 2017
1 parent 17f6621 commit 47e7474
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions doc/lua-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,43 @@ function CodeBlock(block)
end
```

# Module text

UTF-8 aware text manipulation functions, implemented in Haskell.
These are available to any lua filter. However, the module must
be explicitly loaded:

```lua
-- uppercase all regular text in a document:
text = require 'text'
function Str (s)
s.text = text.upper(s.text)
return s
end
```

[`lower (s)`]{#text-lower}

: Returns a copy of a UTF-8 string, converted to lowercase.

[`upper (s)`]{#text-upper}

: Returns a copy of a UTF-8 string, converted to uppercase.

[`reverse (s)`]{#text-reverse}

: Returns a copy of a UTF-8 string, with characters reversed.

[`len (s)`]{#text-len}

: Returns the length of a UTF-8 string.

[`sub (s)`]{#text-sub}

: Returns a substring of a UTF-8 string, using lua's string
indexing rules.


# Module pandoc

Lua functions for pandoc scripts.
Expand Down

0 comments on commit 47e7474

Please sign in to comment.