summaryrefslogtreecommitdiffstats
path: root/DOCS
diff options
context:
space:
mode:
authorGuido Cella <guido@guidocella.xyz>2022-05-01 07:29:32 +0200
committerKacper Michajłow <kasper93@gmail.com>2024-03-21 03:20:14 +0100
commitd6610a5b2f34e398e2ceba2a4da2b79e556b1c9e (patch)
treecb5d6e8777179a4383067e05c52467d198096912 /DOCS
parent520849dd48e34e68be09b5f4849fea1d5212fb44 (diff)
downloadmpv-d6610a5b2f34e398e2ceba2a4da2b79e556b1c9e.tar.bz2
mpv-d6610a5b2f34e398e2ceba2a4da2b79e556b1c9e.tar.xz
command: add escape-ass
This adds a command to escape ASS tags to remove code duplication between sub/osd_libass.c, console.lua, osc.lua, stats.lua and any user script that calls mp.create_osd_overlay(). A command is used instead of scripting functions so that all clients can use this and not just use Lua and JS ones. osd_mangle_ass() also interprets osd-sym-cc and osd-ass-cc/{0,1}, but since they use invalid UTF-8 characters there is no risk of escape-ass users using them by accident, like with any OSD message. Always replacing \n with \\N in mangle_ass() even when it is not called by escape-ass doesn't seem to cause any issue, but I made it conditional anyway to avoid changing how all OSD messages are treated unnecessarily.
Diffstat (limited to 'DOCS')
-rw-r--r--DOCS/interface-changes/escape-ass.txt1
-rw-r--r--DOCS/man/input.rst12
2 files changed, 13 insertions, 0 deletions
diff --git a/DOCS/interface-changes/escape-ass.txt b/DOCS/interface-changes/escape-ass.txt
new file mode 100644
index 0000000000..93ec1ca5e5
--- /dev/null
+++ b/DOCS/interface-changes/escape-ass.txt
@@ -0,0 +1 @@
+add the `escape-ass` command
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index cf4a43636b..bb353cd117 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -1259,6 +1259,18 @@ Input Commands that are Possibly Subject to Change
use the ``mp.create_osd_overlay()`` helper instead of invoking this
command directly.
+``escape-ass <text>``
+ Modify ``text`` so that commands and functions that interpret ASS tags,
+ such as ``osd-overlay`` and ``mp.create_osd_overlay``, will display it
+ verbatim, and return it. This can only be used through the client API or
+ from a script using ``mp.command_native``.
+
+ .. admonition:: Example
+
+ ``mp.osd_message(mp.command_native({"escape-ass", "foo {bar}"}))``
+
+ This line of Lua prints "foo \\{bar}" on the OSD.
+
``script-message [<arg1> [<arg2> [...]]]``
Send a message to all clients, and pass it the following list of arguments.
What this message means, how many arguments it takes, and what the arguments