+
1
|
list
|
skin
|
login
|
editor
α-wwwiki
::
syntax
user:none
(16103 bytes)
_h1 λ-talk syntax _h3 code _p As everything displayed in a digital device, a wiki page comes from the evaluation of an {b underlying code} which is always {b in pure text format}. In a wiki, this code is entered in an editor frame and the result is displayed in a view frame, linked together in real-time. Click on the "+" character on the top-left of the page and on the "editor" button to open the editor frame and to see the code. _h3 s-expression _p Following a syntax popularized by the LISP language, the code is nothing but text with or without so-called {b S-expressions} whose general and unique form is : {pre {@ style="margin:0px; font-size:2em; text-align:center;"} °°{first rest}°°} {pre where first is a word, and rest is any text eventually containing nested S-expressions °°{first {first {first {first rest} } } }°° } _p Without any S-expression, the text should be displayed in the view frame as it is, without any enrichment, without line returns and shaped in the default font defined in the current skin. Try it in the [[sandbox]] page. See the pages [[parser]] and [[substitution]] for technical informations. _h3 dictionary _p When the word {b first} is chosen in the {b λ-talk dictionary}, the following text {b rest} is evaluated and transformed according to the behaviour given to this word. For instance, the code {b °°{b text}°°} will be replaced by the word "text" in bold style : {b text}. The dictionary contains a good subset of the standard HTML tags, their properties and the CSS rules. It contains extended tags for managing clickable notes, display of multiple pictures, display of complex math expressions (mathML) and basic math operations. The lambdatalk dictionary can be extended by the user, dynamically in a wiki page, as it will be shown later. _h3 alternative _p The syntax built on the form {b °°{first rest}°°} is general and unique. It supposes a perfect balance between the opening and closing braces. For new users it may look "horrible" and may be rejecting, and for everyone, that can be boring for frequently used operators such those defining titles, standard paragraphs, list items and basic links. It's the reason why alternative forms exist to make easier writing and reading long bunches of text. The [[help]] page is a good example of these simplified alternative tags which are listed in the last section of this page : {a {@ name="alt" href="#alter"}Alternatives}. _h2 reference list _h3 general syntax {table {@ style="background-color:#ccc; color:#222;"} {tr {td first} {td {pre °°{first rest}°°} _p This expression defines the {b general and unique syntax} used in lambdatalk. _ul first is the name of an operator chosen in the set listed below in the "lib" operator _ul rest is any text with or without nested °°{first rest }°° S-expression _ul example : {pre °° {div {@ style="color:red;"} I am a red text with a {b bold word}. } °°} }} } _h3 list of operators {table {@ style="background-color:#ccc; color:#222;"} {tr {td lib} {td {pre °°{lib}°°} _ul This expression lists the basic and the extended lambdatalk operators. _ul complete list : {pre {@ style="white-space:pre-wrap;"} {lib} } }} } _h3 basic operators {table {@ style="background-color:#ccc; color:#222;"} {tr {@ style="font-weight:bold; text-align:center;"} {td {@ style="width:80px;"}tag} {td description} } {tr {td span, div, ul, ol, li, dl, dt, dd, table, tr, td, h1, h2, h3, h4, h5, h6, p, br, hr, b, i, u, sup, sub, del, pre, center, blockquote, a, img, iframe, embed, canvas, math, mrow, mfrac, mo, mi, mn, msup, msub, msubsup, msqrt, munder, mover, munderover} {td {pre °°{tag {@ attributes list} rest }°°} _p This expression defines inline or block bunches of taged texts. _ul tag can be one of the HTML tags listed at left, (see HTML tutorial) _ul the °°{@ attributes list}°° expression is analyzed next row in "@" operator _ul rest is any text with or without nested °°{first rest }°° S-expression _ul contrary to the other operators, the "pre" tag preserves white spaces and newlines and displays rest preformated as it is typed in ; this tag can be seen as an easy alternative to insert long texts coming from copy/paste, as it can be seen in page [[julesverne|../lambdaway/?view=julesverne]]. _ul b, i, u, center are simplified alternatives to the general span and div HTML, and are used without attributes. _ul example : {pre °° {div {@ id="myID" style="border:1px solid black; width:480px; background:white; color:blue; text-align:center; box-shadow:0 0 8px black;" } I am a blue text with a {b bold word} in a shadowed frame. } °°} {div {@ id="myID" style="border:1px solid black; width:480px; background:white; color:blue; text-align:center; box-shadow:0 0 8px black;" } I am a blue text with a {b bold word} in a shadowed frame. } _ul More informations about some of these operators in wiki pages, see the list in the page [[start]]. _ul See alternative forms for {b h1..h6, p, ul and ol} in section {a {@ name="alt" href="#alter"}Alternatives}. }} {tr {td @} {td {pre °°{@ attributes list }°°} _p This expression defines the optional properties of the lambdatalk operators. _ul the attribute list is a sequence of key:value; expressions in this set : _ul30 a sequence of any valid {i HTML_key="HTML_value"}, (see HTML tutorial) _ul30 and a sequence of any valid "{i CSS_key:CSS_value;}" embeded in a "{i style="..." form}", (see CSS tutorial) _ul example : {pre °° {@ id="myID" style="font:bold 32px arial; color:red; text-shadow:2px 2px 2px black;" }°° } }} } _h3 extended operators {table {@ style="background-color:#ccc; color:#222;"} {tr {td note note_start note_end } {td {pre °°{note|note_start|note_end {@ attributes} rest}°°} _p These expressions define a set of click-displayable texts ... _ul rest is any text with or without nested °°{first rest }°° S-expression _ul examples : {pre °°{note note I am called by note !}°° -> {note note I am called by note !} °° {note_start foo {img {@ src="data/amelie_sepia.jpg" height="30" title="click on me"} } } {note_end {@ id="foo" style="..."} I am called by "Amélie" ! } °° -> {note_start foo {img {@ src="data/amelie_sepia.jpg" height="30" title="click on me"}} } {note_end {@ id="foo" style=" position:relative; width:350px; left:80px; top:-80px; padding:5px; border:1px solid; background:#ffe; box-shadow:0 0 8px black; text-align:center; font:bold 1.5em arial; color:blue; "}I am called by "Amélie" !} } }} {tr {td show} {td {pre °° {show {@ src="URL" height="h_start" width="w_end" title="infotext" } }°°} _p This operator displays an image ; when clicked, the image is displayed on a grey background until it is clicked again. It's waiting for 3 values : _ul URL is a valid adress for a picture jpg, gif or png ; when the image has been loaded in the wiki, its name must be prefixed by "data/" _ul h_start is an integer defining the height of the initial displayed image _ul w_end is an integer defining the width of the final image shown on a grey background _ul infotext is any text with or without nested °°{first rest }°° S-expression _ul example : {table {tr {td {pre °° {show {@ src="data/amelie_sepia.jpg" height="100" width="300" title="Amélie Poulain {u {b loves}} ze lambdaway"}} °°} {td {show {@ src="data/amelie_sepia.jpg" height="100" width="300" title="Amélie Poulain {u {b loves}} ze lambdaway"}} }}}}}} {tr {td lightbox} {td {pre °° {lightbox {@ height="h_start" width="w_end" } (pict_URL pict_text) .. (pict_URL pict_text) }°°} _p This operator displays a set of image-thumbs and a preview of the first image. When an image-thumb is clicked, the set of image-thumbs and the chosen image are displayed on a grey background. A click on the plain image returns to the initial page display. It's waiting for 2 numbers and a sequence of expressions between parenthesis : _ul h_start is an integer defining the height of the initial displayed images _ul w_end is an integer defining the width of the final images shown on a grey background _ul each of the expression between parenthesis contains the URL of an image and any text with or without nested °°{first rest }°° S-expression _ul the URL must be a valid adress for a picture jpg, gif or png ; when the image has been loaded in the wiki, its name must be prefixed by "data/" _ul example : {table {tr {td {pre °° {lightbox {@ height="100" width="300"} (data/amelie_sepia.jpg Amélie Poulain {b loves} ze lambdaway) (data/montgomery_clift.jpg Montgomery Clift is {b fan} of ze lambdaway) } °°} {td {@ style="width:220px;"} {lightbox {@ height="100" width="300"} (data/amelie_sepia.jpg Amélie Poulain {b loves} ze lambdaway) (data/montgomery_clift.jpg Montgomery Clift is {b fan} of ze lambdaway) } }}}}}} } _h3 more operators {table {@ style="background-color:#ccc; color:#222;"} {tr {td post} {td {pre °°{post pseudo yyyy/mm/dd hh:mm}°°} _p This expression defines a title in the page forum. _ul rest should be in this format : name or pseudo yyyy/mm/dd hh:mm _ul example : {pre °°{post am 2013/01/13 16:10}°° -> {post am 2013/01/13 16:10}} _ul See alternative form for {b post} in section {a {@ name:alt; href:#alter;}Alternatives}. }} {tr {td back} {td {pre °°{back}°°} _p This expression defines a link to the previous page. _ul example : {pre °°{back}°° -> returns to the previous page} }} {tr {td drag} {td {pre °°{drag}°°} _p This expression gives a handle to drag the container it belongs to. _ul The container must have defined properties "position, top, left". _ul example : {pre °°{drag}°° -> displays a red square which constitutes a handle for draging} }} {tr {td date} {td {pre °°{date}°°} _p This expression displays the local time in format : yyyy mm dd hh mn ss _ul example : {pre °°{date}°° -> {date}} }} }°°°end more operators°°° _h3 math operators & functions {table {@ style="background-color:#ccc; color:#222;"} {tr {td {@ style="white-space:pre-wrap;"} + * - / ++ -- = < > =< >= abs floor ceil round cos sin tan log exp sqrt acos asin atan atan2 max min random if serie map } {td {pre °°{operator math λ-talk expressions}°°} _p This expression evaluates a math expression. _ul operator must be in the list at left _ul rest must be math λ-talk expressions _ul examples : {pre °°{< 1 2}°° -> {< 1 2} °°{> 1 2}°° -> {> 1 2} °°{= 1 1.0}°° -> {= 1 1.0} °°{* 1 2 3 4 5 6}°° -> {* 1 2 3 4 5 6} °°{sqrt 2}°° -> {sqrt 2} °°{sqrt {+ {* 3 3} {* 4 4}}}°° -> {sqrt {+ {* 3 3} {* 4 4}}} // and so on ... // see more examples in the wiki pages : [[map]] ... }}} }°°°end math operators & functions°°° _h3 input and define operators {table {@ style="background-color:#ccc; color:#222;"} {tr {td input} {td {pre °°{input {@ type="..." value="" onEvent="..."}°°} _p This expression defines standard HTML buttons and their behaviour. _ul "type" can be "text, submit, checkbox, radio, ..." _ul "value" is a string displayed in the button field _ul "onEvent" can be any event "onclick, onkeyup, ..." _ul and the value of "onEvent" can be any sequence of JS expressions. Because it may contain braces, in order to avoid conficts with the lambdatalk engine, body must be desactivated and so, embedded between two •• (degree characters, see "special cases" at the end of this page). _ul example : {pre °° {input {@ type="submit" value="Hello" onclick="•• // 1) defining some Javascript code : function foo ( str ) { return alert( str ) } // 2) this is the code which will be called ... foo('Hello'); // ... which will display "Hello" on a click on the button "••} } °°} _ul more can be seen in page [[input]] and other pages in the wiki. }} {tr {td define defun} {td {pre °° {define name (args) any javascript expressions } {defun name (args) any λ-talk expressions } °°} _p These expressions allow to create in the wiki page, new operators extending the basic set of lambdatalk operators. _ul name is the name of the function _ul args is a list of arguments separated by spaces, _ul body is any sequence of JS or λ-talk expressions. _ul examples : {pre °° // 1) defining a function square with a Javascript body : {define js_square (x) return x*x } -> function js_square OK // 2) defining a function square with a λ-talk body : {define lt_square (x) {* x x}} -> function lt_square OK // 3) calling the functions : {js_square 12} -> 144 {lt_square 12} -> 144 °°} _ul more can be seen in pages [[function]], [[define]], [[defun]] and other pages in the wiki. }} } _h3 special cases {table {@ style="background-color:#ccc; color:#222;"} {tr {td {sup oo} } {td {pre {sup oo} °°{first rest}°° {sup oo}} _p Any text embedded between two couples of characters "{sup oo}" is not evaluated and is displayed as it is. It's not possible to nest the "{sup oo}". _ul example : {pre {sup oo} °°{b bold} and {i italic}°° {sup oo} -> °°{b bold} and {i italic}°°} }} {tr {td {sup ooo} } {td {pre {sup ooo} any text {sup ooo}} _p Any text embedded between two triplets of characters "{sup oo}" are removed out of the text. It's not possible to nest the "{sup ooo}". _ul example : {pre {sup ooo} SOME COMMENT {sup ooo} -> .......} }} {tr {td unknown operator} {td {pre °°{unknown_operator rest}°°} _p When the first term of an S-expression is unknown, the S-expression is not evaluatd (it can't be) and is displayed as it is with braces replaced by parenthesis. _ul example : {pre °°{unknown_operator {u rest}}°° -> {unknown_operator {u rest}}} }} }°°°end special case°°° _h3 {a {@ name="alter" href="#alt"}alternative forms} {table {@ style="background-color:#ccc; color:#222;"} {tr {td {@ style="white-space:pre-wrap;"} h1..h6 p ul ol post } {td {pre h1..h6, p, ul, ol, post} _p The tags "{b h1..h6, p, ul, ol and post}" define blocks, ie portions of text between two line-returns "{b CR}". It's so possible to replace the °°{first rest}°° general form by the opening tag prefixed by a {b "_"} character, followed by the text and terminated by a "{b CR}". _ul Note that there must be {b NO SPACE} between the {b "_"} character and the tag _ul example : {pre _ h1 some title CR _ p some paragraph CR _ ul some list item _ post the title of a post in the page [[forum]]. } _ul Have a look on the pahe [[help]] to see how it can be useful. }} {tr {td {@ style="width:70px;"}''[ [..] ]''} {td {pre ''[ [..] ]''} _p Defining an internal or external link is built on the {b °°{a rest}°°} form. According to the standard form used in most of the wiki syntaxes on the web, and in order to make easier writing and reading of the code, it's possible to use an alternative form built on opening and closing double brackets. _ul Note that there must be {b NO SPACE} between the double opening and closing brackets _ul example : {pre ''[ [start] ]'' is equal to °°{a start}°° and displays [[start]], a link to the page {b start} of the wiki ''[ [PIXAR|http://www.pixar.com/] ]'' is equal to °°{a {@ href:http://www.pixar.com/;} PIXAR}°°, and displays [[PIXAR|http://www.pixar.com/]], a link to the PIXAR website. } }} }°°°end alternative forms°°°