Syntax reference

Difference between revisions from 2016/02/06 15:03 and 2016/02/06 15:02.
{include:subpage menu}
''This is a [Wiki|], so feel free to correct any factual or grammatical error.''

This document explains all syntax features of core LionWiki. Syntax of tables (provided by plugin) is on separate page: [Tables plugin|UserGuide: Tables plugin].

{{!Heading H2
!!Heading H3
!!!Heading H4}}

!Heading H2
!!Heading H3
!!!Heading H4

More exclamation marks you use, the smaller the heading will be (up to 5 exclamation marks). Exclamation marks has to be exactly at the beginning of the line.

!!Unordered list

{{* Fruit
** Apple
*** Granny smith
** Orange
* Vegetables
** Garlic
** Onion}}

* Fruit
** Apple
*** Granny smith
** Orange
* Vegetables
** Garlic
** Onion

!!Ordered list

{{# First item 
## First subitem 
### First subsubitem
## Second subitem}}

# First item 
## First subitem 
### First subsubitem
## Second subitem 

!Text styles
^''^'Bold^''^' --> '''Bold''' (three apostrophes)
^''Italic^'' --> ''Italic'' (two apostrophes)
^''^''^'Bold and italic^''^''^' --> '''''Bold and italic''''' (five apostrophes)
^'--Strikethrough--' --> '--Strikethrough--'
^'__Underlined__' --> '__Underlined__'
^{small}Small text^{/small} --> {small}Small text{/small}
x^{sup}10^{/sup} --> x{sup}10{/sup}
x^{sub}i^{/sub} --> x{sub}i{/sub}

!!CSS styles, classes, IDs
{{{.first.second#id color: blue; font-size: large}Styled text span with ID and two classes{/} }}
{.first.second#id color: blue; font-size: large}Styled text span with ID and two classes{/}

Classes begins with dot, ID with hash sign. Everything after first space is considered to be CSS style, so there can't be any space between or inside classes and ID. Few other possibilities:

{{{. display: block;}Text{/} - neither class, nor id, just style
{.citation}Text{/if} - just class}}

The enclosing element is <span>.

!Emails, links, images
Links to other pages can be created like this:
^[Main page] --> [Main page]


^[Main project page|Main page] --> [Main project page|Main page]


^[Features header on Main page|Main page#Features] --> [Features header on Main page|Main page#Features]

Emails and web links are automatically recognized:

^ -->
lionwiki^ -->
You can use also relative links, but they have to start with ./ (otherwise it will be interpreted as Wiki page). So if you want to link some HTML page in the same directory, you use:

^[Interesting page|./SomeWebPage.html] --> [Interesting page|./SomeWebPage.html]

Or to use a relative path to a file on the same server but in a higher directory, you can use:
^[Interesting File In Parent Directory|./../SomeWebPage.html] --> [Interesting File In Parent Directory|./../SomeWebPage.html]

Image handling was changed a lot in the 3.2 release, see [older version|] of this page if you use older version.

^[^] --> []

You can use your image as your link: ^[^|^link=^] --> 

You can also place your image to the left or right, possibly combined with other features:
^[^|^link=^|center|title=Big Lion|alt=Alt text]

[|link=|center|title=Big Lion|alt=Alt text]
[|link=|right|title=Big Lion|alt=Alt text]
More complex operations with images can be done with [ImageExt plugin|UserGuide: ImageExt plugin].

Subpages are useful when you need to insert some common content into multiple pages, example could be a navigational menu (by the way, we have [Menu plugin|UserGuide: Menu plugin].

Syntax: ^{include:page_to_be_included}.

You can use the same syntax to include page in template (i.e. not in page content), but in this case, whole content of this subpage must be in HTML (you can, but not have to enclose it in ^{html} and ^{/html}).

!Multilingual content
Let's say you have page named "Biography" in German and you would like to make French variant. Rename page Biography to and create page named and insert French translation there. Then visitors whose browser identifies primary language as French will see It's recommended to create a redirect from page Biography to default language variant. The obvious limitation is that page name has to stay the same in every language variant. That's not such a big problem with "Biography", but it can be worse with other names. 

This is recommended way to create multilingual content, there are more ways to do it.

If you want to redirect from some page to other, put ^{redirect:page} at the very beginning of the page. It's not straightforward to edit page containing redirect because every visit will cause redirecting. The only way to edit such page is from search results (as it provides direct edit links), or possibly by manually altering URL.


!!Table of contents
Automatically generated table of contents can be inserted with ^ (see demo on the right). It can be used in both pages and templates.

Some sequences of characters are automatically replaced:
* Arrows : <^-- : <--, ^--> : -->, <^--> : <-->
* Dash : ^-- : --
* Copyrights : ^(c) or ^(C) : (c), ^(r) or ^(R) : (r)

Code syntax is useful when you need to keep original spacing and layout of text, especially for programming source code.

^{{import sys
if len(sys.argv) == 2:
   print "Hello",sys.argv^[1]}}
{{import sys
if len(sys.argv) == 2:
   print "Hello",sys.argv[1]}}

We also have a [plugin for syntax highlighting|UserGuide: SyntaxHighlighter plugin].

!!Horizontal line
by '''^--^--'''

!!Suppressing wiki syntax
By using ^^ character before syntax keyword or using ^{{something}}. If you still don't know how, take a look on wiki code of this page, there are plenty of examples. If you want to insert ^^ character, you have to double it, i.e. ^^^^

!!HTML code
Do you want to insert youtube video to your site? Or any other HTML code? Just insert it between ^{html}some html code{/html}. This does not have to work if config value $NO_HTML is set to true. Note that it is serious security risk if you allow users to post HTML code in your wiki.

!!!HTML entities
HTML entities are automatically recognized and left without modification. 

LionWiki joins adjacent newlines together, if you need more than one newline, use ^{br}.

!!Internal comments
You can insert internal comments not intended to be displayed using HTML-like syntax ^<!^--<!^-- text not intended to be displayed ^-->