summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2021-07-21 16:38:32 +0200
committerThomas Lange <code@nerdmind.de>2021-07-21 16:38:32 +0200
commit3110e98a7b1bbaecb37d3430983b7855a40a924d (patch)
tree613cb5e879524957d5285d3d6b6269bb1794a2ec
parent14cf9d5e2181fadfae7f6c7a64f0a49f55760624 (diff)
downloadwiki-3110e98a7b1bbaecb37d3430983b7855a40a924d.tar.gz
wiki-3110e98a7b1bbaecb37d3430983b7855a40a924d.tar.xz
wiki-3110e98a7b1bbaecb37d3430983b7855a40a924d.zip
Do some minor optimizations
-rw-r--r--Arguments.md10
-rw-r--r--Content functions.md6
-rw-r--r--Editor.md12
3 files changed, 17 insertions, 11 deletions
diff --git a/Arguments.md b/Arguments.md
index 6e00feb..801adba 100644
--- a/Arguments.md
+++ b/Arguments.md
@@ -3,7 +3,13 @@ This document explains how to use the optional field for arguments in the conten
`FOO=value|BAR=value` (or `FOO=value|BAR`; `BAR` will be automatically set to `TRUE`).
## How to access arguments in a template
-Lets assume that your argument string for a specific post is something like this: `HIGHLIGHT|PREVIEW_IMG=foobar.png`. You can now access the entire (unparsed) argument string in templates with `$POST['ATTR']['ARGV']` (see template documentation for more information). This contains the unparsed argument string as he was written into the content editor. You also can access a parsed version of the arguments as key->value array with `$POST['ARGV']`:
+Lets assume that your argument string for a specific post is something like this:
+
+~~~
+HIGHLIGHT|PREVIEW_IMG=foobar.png
+~~~
+
+You can now access the entire (unparsed) argument string in templates with `$POST['ATTR']['ARGV']` (see template documentation for more information). This contains the unparsed argument string as he was written into the content editor. You also can access a parsed version of the arguments as key->value array with `$POST['ARGV']`:
### Unparsed: `$POST['ATTR']['ARGV']`
string(32) "HIGHLIGHT|PREVIEW_IMG=foobar.png"
@@ -19,7 +25,7 @@ Lets assume that your argument string for a specific post is something like this
## How this arguments can be used to do something special
If you are a template developer, you can check within your templates if the argument `HIGHLIGHT` is present (arguments with no explicit value will be automatically set to boolean `TRUE`). If set, you can highlight this post differently. Just check if this value is set and add an extra CSS class to your HTML markup which then will highlight your post.
-You can even add an preview image functionality. Lets assume you want to show a preview image for each post in the list? There is no core functionality to do this, but with the argument functionality you can do this very simple:
+You can even add a preview image functionality. Lets assume you want to show a preview image for each post in the list? There is no core functionality to do this, but with the argument functionality you can do this very simple:
<?php if(isset($POST['ARGV']['PREVIEW_IMG'])): ?>
<img class="preview-img" href="<?=Application::getFileURL("images/preview/{$POST['ARGV']['PREVIEW_IMG']}")?>" alt="" />
diff --git a/Content functions.md b/Content functions.md
index dea14a6..667a196 100644
--- a/Content functions.md
+++ b/Content functions.md
@@ -1,4 +1,4 @@
-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 hardlink 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 item of your blog from the content of any other item, without the need to hard link the URL of the referenced item.
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.
@@ -32,14 +32,14 @@ String values must be put between double quotes (`"`) while integer values do no
**Note:** The parameters passed to the PHP callback function are (currently) always of type `string`!
-### Example: Calls with multiple parameters
+### Example: Call functions with parameters
~~~
{BASE_URL: "readme.md"}
{CATEGORY: 1, "Look at this category!"}
~~~
## How to add custom functions?
-The new *content function* feature gives you the ability to define your own custom functions with a choosable set of parameters. 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!
+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!
The interface to register a new *content function* is the method `addContentFunction` of the `Application` class. This method requires exactly two parameters: The **function name** and the **callback function**. The function name is validated and must contain only numbers, uppercase letters and underscores. An exception is thrown if this rule is violated.
diff --git a/Editor.md b/Editor.md
index 8d776f9..dd53b4b 100644
--- a/Editor.md
+++ b/Editor.md
@@ -1,4 +1,4 @@
-If you want to reference another item (e.g. a post or a category) in your content, please do not put the URL to it hardcoded into the editor. Consider what happens if you change your blog's address (or just the base directory) in the future. You would need to change all the hardcoded URLs in your content which is inflexible and not cool. Therefore, you can use the following so-called [*content functions*](Content_Functions) to link an item or a resource of your installation dynamically within your Markdown content.
+If you want to reference another item (e.g. a post or a category) in your content, please do not put the URL to it hard coded into the editor. Consider what happens if you change your blog's address (or just the base directory) in the future. You would need to change all the hard coded URLs in your content which is inflexible and not cool. Therefore, you can use the following so-called [*content functions*](Content_Functions) to link an item or a resource of your installation dynamically within your Markdown content.
**Note:** You can combine these functions with Markdown syntax since they are processed and transformed before the Markdown parser finally transforms the content to HTML. There is even the possibility [to add your own custom functions](Content_Functions#how-to-add-custom-functions).
@@ -14,7 +14,7 @@ Hello there. Check out [the README]({BASE_URL: "readme.md"})!
Hello there. Check out [the README](https://blog.git/readme.md)!
~~~
~~~html
-<!-- Final result after the Markdown was parsed: -->
+<!-- Final result after the Markdown was transformed: -->
Hello there. Check out <a href="https://blog.git/readme.md">the README</a>!
~~~
@@ -27,7 +27,7 @@ Hello there. Check out <a href="https://blog.git/readme.md">the README</a>!
![A cute kitten](https://blog.git/rsrc/image/content/kitten.jpg "Look at this!")
~~~
~~~html
-<!-- Final result after the Markdown was parsed: -->
+<!-- Final result after the Markdown was transformed: -->
<img src="https://blog.git/rsrc/image/content/kitten.jpg" alt="A cute kitten" title="Look at this!" />
~~~
@@ -47,7 +47,7 @@ Hello there! Check out this post: {POST: 1}
Hello there! Check out this post: [»Hello World!«](https://blog.git/post/hello-world/ "Post »Hello World!«")
~~~
~~~html
-<!-- Final result after the Markdown was parsed: -->
+<!-- Final result after the Markdown was transformed: -->
Hello there! Check out this post: <a href="https://blog.git/post/hello-world/" title="Post »Hello World!«">»Hello World!«</a>
~~~
@@ -60,7 +60,7 @@ Hello there! Check out {POST: 1, "this post"}!
Hello there! Check out [this post](https://blog.git/post/hello-world/ "Post »Hello World!«")!
~~~
~~~html
-<!-- Final result after the Markdown was parsed: -->
+<!-- Final result after the Markdown was transformed: -->
Hello there! Check out <a href="https://blog.git/post/hello-world/" title="Post »Hello World!«">this post</a>!
~~~
@@ -73,7 +73,7 @@ Hello there! Check out {POST: 1, "this post", "Click to show post"}!
Hello there! Check out [this post](https://blog.git/post/hello-world/ "Click to show post")!
~~~
~~~html
-<!-- Final result after the Markdown was parsed: -->
+<!-- Final result after the Markdown was transformed: -->
Hello there! Check out <a href="https://blog.git/post/hello-world/" title="Click to show post">this post</a>!
~~~