Serchilo:Command syntax

From Serchilo

Jump to: navigation, search

Serchilo's Command syntax is a bit like XML. Let's look at some examples:

Contents

[edit] Simple commands

<command>
    keyword = google
    url     = http://www.google.com/
</command>
 
<command>
    keyword = google
    url     = http://www.google.com/search?q={%query}
</command>
 

Instead of {%query} you can also use {%foo}, {%bar} ...

<command>
    keyword = google
    url     = http://www.google.com/search?q={%query}&p={%second query}
</command>
 
<command>
    keyword = google
    url     = http://www.google.com/search?hl={$language}&q={%query}
</command>
 

Note the difference between arguments ({%query}) and variables {$language})

[edit] Priority in a language

<command>
    keyword  = google
    language = de
    url      = http://www.google.de/
</command>
 

If called from http://de.serchilo.net/ and there are more commands using the keyword google, this one will be taken.

[edit] Own title

<command>
    keyword  = google
    title    = Google Homepage
    url      = http://www.google.com/
</command>
 

By default the command title is the title of the wiki-page where it is defined. With title you can define a different title.

This title is shown in the suggestions and the command search.

[edit] Regular expressions

<command>
    regexp   = ^g([a-z]{2}) (.*)$
    syntax   = g{language} {query}
    url      = http://www.google.com/search?lr=lang_{$1}&q={$2}
</command>
 

[edit] Encoding

<command>
    keyword  = google
    url      = http://www.google.com/search?hl=en&q={%query}
</command>
 
  • will encode %query in UTF-8 (default)
<command>
    keyword  = google
    url      = http://www.google.com/search?hl=en&q={%query|iso-8859-1}
</command>
 
  • will encode %query in ISO-8859-1

Besides iso-8859-1 you may also use: pass, auto, wchar, byte2be, byte2le, byte4be, byte4le, base64, uuencode, html-entities, quoted-printable, 7bit, 8bit, ucs-4, ucs-4be, ucs-4le, ucs-2, ucs-2be, ucs-2le, utf-32, utf-32be, utf-32le, utf-16, utf-16be, utf-16le, utf-8, utf-7, utf7-imap, ascii, euc-jp, sjis, eucjp-win, sjis-win, cp51932, jis, iso-2022-jp, iso-2022-jp-ms, windows-1252, iso-8859-1, iso-8859-2, iso-8859-3, iso-8859-4, iso-8859-5, iso-8859-6, iso-8859-7, iso-8859-8, iso-8859-9, iso-8859-10, iso-8859-13, iso-8859-14, iso-8859-15, iso-8859-16, euc-cn, cp936, hz, euc-tw, big-5, euc-kr, uhc, iso-2022-kr, windows-1251, cp866, koi8-r, armscii-8 (using mb-convert-encoding()

<command>
    keyword  = google
    url      = http://www.google.com/search?hl=en&q={%query|none}
</command>
 
  • will apply no encoding at all, even no urlencode