Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua: add function pandoc.text.toencoding. #8516

Merged
merged 1 commit into from
Jan 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions doc/lua-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -2418,6 +2418,18 @@ function Str (s)
end
```

### fromencoding {#text.fromencoding}

`fromencoding(s, encoding)`

Converts a string to UTF-8. The `encoding` parameter specifies the
encoding of the input string. On Windows, that parameter defaults
to the current ANSI code page; on other platforms the function
will try to use the file system's encoding.

See [`toencoding`](#text.toencoding) for more info on supported
encodings.

### lower {#text.lower}

`lower (s)`
Expand Down Expand Up @@ -2449,6 +2461,19 @@ Returns the length of a UTF-8 string.
Returns a substring of a UTF-8 string, using Lua's string
indexing rules.

### toencoding {#text.toencoding}

`toencoding(s, encoding)`

Converts a UTF-8 string to a different encoding. The `encoding`
parameter defaults to the current ANSI code page on Windows; on
other platforms it will try to guess the file system's encoding.

The set of known encodings is system dependent, but includes at
least `UTF-8`, `UTF-16BE`, `UTF-16LE`, `UTF-32BE`, and `UTF-32LE`.
Note that the default code page on Windows is available through
`CP0`.

# Module pandoc

Fields and functions for pandoc scripts; includes constructors for
Expand Down
2 changes: 1 addition & 1 deletion pandoc-lua-engine/pandoc-lua-engine.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ library
, hslua-module-doclayout>= 1.0.4 && < 1.1
, hslua-module-path >= 1.0.3 && < 1.1
, hslua-module-system >= 1.0 && < 1.1
, hslua-module-text >= 1.0 && < 1.1
, hslua-module-text >= 1.0.3 && < 1.1
, hslua-module-version >= 1.0.3 && < 1.1
, hslua-module-zip >= 1.0.0 && < 1.1
, lpeg >= 1.0.1 && < 1.1
Expand Down
1 change: 1 addition & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ extra-deps:
- hslua-core-2.2.1
- hslua-list-1.1.0
- hslua-marshalling-2.2.1
- hslua-module-text-1.0.3
- hslua-module-version-1.0.3
- hslua-module-zip-1.0.0
- hslua-objectorientation-2.2.1
Expand Down