summaryrefslogtreecommitdiffstats
path: root/Content_functions.md
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2024-02-02 19:10:34 +0100
committerThomas Lange <code@nerdmind.de>2024-02-02 19:12:28 +0100
commit9d7f67c96f1946b6a5e8aa1c393ba4e3c9eed00b (patch)
tree2fbf56d062483722494e1cf92f28958716363c7c /Content_functions.md
parent0bd53c6dbf91e6e8942a556227b3de8fa6b72171 (diff)
downloadwiki-9d7f67c96f1946b6a5e8aa1c393ba4e3c9eed00b.tar.gz
wiki-9d7f67c96f1946b6a5e8aa1c393ba4e3c9eed00b.tar.xz
wiki-9d7f67c96f1946b6a5e8aa1c393ba4e3c9eed00b.zip
Update documentation
Diffstat (limited to 'Content_functions.md')
-rw-r--r--Content_functions.md13
1 files changed, 9 insertions, 4 deletions
diff --git a/Content_functions.md b/Content_functions.md
index ad144c9..dacd978 100644
--- a/Content_functions.md
+++ b/Content_functions.md
@@ -1,8 +1,8 @@
-The so-called *content functions* are a feature of this blogging system that gives you an easy way to reference another item of your blog from the content of any other item, without the need to hard link the URL of the referenced item.
+The so-called *content functions* are a feature of this blogging system that gives you an easy way to reference another entity of your blog from the content of any other entity, without the need to hard link the URL of the referenced entity.
This document explains the available *content functions* that are shipped with the system by default and shows you how to add your own customized *content functions* to do some interesting things and prevent repetitive lines of text in your content.
-**Note:** There is a second older syntax for the so-called *content tags* (like `{POST[1]}`) which are deprecated now. They are still supported and will still be parsed and transformed, but please do not use them anymore if you can use the much more powerful *content functions* described in this document.
+**Note:** There is a second older syntax for the so-called *content tags* (like `{POST[1]}`) which are deprecated. They will still be parsed and transformed, but please do not use them anymore if you can use the much more powerful *content functions* described in this document. It's planned to remove parsing/transforming support for the *content tags* soon!
## Registered default functions
The table below contains all default *content functions* you can use.
@@ -28,7 +28,7 @@ After the opening curly brace (and the optional blank space), the name of the *c
Parameters (or "arguments") for the *content function* are separated from the function name by a required colon (`:`) and a required blank space. The parameter list consists of either integer values (`123`) or string values (`"Hello"`).
-String values must be put between double quotes (`"`) while integer values do not need quotes around. Multiple parameters are separated from each other by a required comma (`,`) with an optional blank space directly after the comma.
+String values must be put between double (`"`) or single (`'`) quotes while integer values do not need quotes around. Multiple parameters are separated from each other by a required comma (`,`) with an optional blank space directly after the comma. It is possible to escape quotes in string arguments by preceding them with a backslash (`\`).
**Note:** The parameters passed to the PHP callback function are (currently) always of type `string`!
@@ -38,6 +38,11 @@ String values must be put between double quotes (`"`) while integer values do no
{CATEGORY: 1, "Look at this category!"}
~~~
+### Example: Escape quotes in string arguments
+~~~
+{POST: 1, "And then he said: \"Hello\""}
+~~~
+
## How to add custom functions?
The new *content function* feature gives you the ability to define your own custom functions. This is especially useful if you, for example, want to embed a YouTube video in a post but do not want to repeat the repetitive HTML embed code anytime when you want to show a YouTube video in your posts. You can just register a new *content function* to do this!
@@ -63,4 +68,4 @@ Application::addContentFunction('YOUTUBE', function($watch) {
Done. You can now call this function by typing `{YOUTUBE: "aqz-KE-bpKQ"}` into the editor!
-The benefits of this are obvious: If you later change your mind about the way how videos are embedded, you just need to change your *content function* without modifying all the posts in which you have a video embedded. \ No newline at end of file
+The benefits of this are obvious: If you later change your mind about the way how videos are embedded, you just need to change your *content function* without modifying all the posts in which you have a video embedded.