Examples using Aao with Twitter's Bootstrap. And here is a much longer subsection for an abstract that also does formatting.
As an introduction, a section without any subsections should not produce a dropdown in the topmenu.
{!Note} some {`code} can be marked up as {*strong} with {~emphasis} or {,subtle}, {-small}, {+big} or as {|term} formatting.
comment:
equations {$E=mc^2} are commented out because are computationally expensive to generate
Other features include {^supperscript} and {_subscript}.
code
can be marked up as strong with emphasis or subtle small big or as term formatting.Other features include supperscript and subscript.
{!Note} {!p Primary} {!i Info} {!s Success} {!w Warning} {!e Error} {!d Dark}
{#1} {#p 2} {#i 3} {#s 4} {#w 5} {#e 6} {#d 7}
More complex features include links {LE:http://lifesend.com} rel links with names {test rel link: rel:test.jpg} and without names {rel:test.jpg}. These same links can take an action (button) form if in the name mode {LE! http://lifesend.com} and with rel links {test rel link! rel:test.jpg}. Finally a complex link with icons {link! http://lifesend.com{{icn:home} LE}}.
Button links can also have associated coloring as
Default! http://drx.cc/aao/default
Primary!p http://drx.cc/aao/primary
Info!i http://drx.cc/aao/info
Success!s http://drx.cc/aao/success
Warning!w http://drx.cc/aao/warning
Danger!e http://drx.cc/aao/danger
Inverse!d http://drx.cc/aao/inverse
drop: mini
LE: http://lifesend.com
DRX: http://drx.cc
-
aradke: http://aradke.com
resume: http://lifesend.com/resume
Drop: normal
LE: http://lifesend.com
DROP: large
LE: http://lifesend.com
Bibliography references use the @ symbol. This is similar to {@LE}.
tb:icns
icn icn! label
icn:envelope icn!envelope envelope
icn:ok icn!ok ok
icn:search icn!search search
icn:heart icn!heart heart
icn | icn! | label |
---|---|---|
envelope | ||
ok | ||
search | ||
heart |
Inline figures {fig:../src/main/resources/tinyprofile.png} use a lower case {`fig:}.
fig:
.
Central figures user an upercase {`Fig:} are simply placed as is
Fig:../src/main/resources/tinyprofile.png
Fig:
are simply placed as isHard coding a width size to a percentage relative to the page width. This will shrink or expand images. For example, the following scale's up the tiny image to 20% of the page width.
Fig20:../src/main/resources/tinyprofile.png
Text flows above and below the figure for some nice padding. Whitespace is important for cleanliness and organization.
:h2:header level 2
paragraph content
:h3:header level 3
paragraph content
:h4:header level 4
paragraph content
:h5:header level 5
paragraph content
:h6:header level 6
paragraph content
paragraph content
paragraph content
paragraph content
A single line is a paragraph
A second single line demonstrating a paragraph
Really long lines (paragraphs) can be separated by a space for clearer visibility. Some people think that simple is the opposite of complex, but there is a complexity of detail required to maintain simplicity.
And again another paragraph.
p:
an explicit paragraph
with sentences and lines
p:
another explicit paragraph
an explicit paragraph with sentences and lines
another explicit paragraph
well:
Some things can be stored and offset in a well.
dl:
one
the first number
two
the second number
three
the trinity count
four
points on a square
Quotations can be added easily as
qt:
I have made this letter longer than usual, only because I have not had the time to make it shorter.
-Blaise Pascal
qt:
In faith there is enough light for those who want to believe and enough shadows to blind those who don't.
-Blaise Pascal
I have made this letter longer than usual, only because I have not had the time to make it shorter.
Blaise Pascal
In faith there is enough light for those who want to believe and enough shadows to blind those who don't.
Blaise Pascal
p:
Some {`inline} code.
Some inline
code.
code:|
#!/bin/sh
# title: highlight this leading key
// author: highlight this leading key
:section: the first section
/*
title: multi line c comment
*/
"multi- line
string"
"""
scala style
multi line string
"""
['a','b']'; % typical matlab
hexU16 = @(x) sprintf('%04X',x); % typical matlab
int i = 0x7FFh; /* typical c */
cout << "test"; // typical c++
echo "test" # typical bash
"\s".r.replaceAllIn(s,Code) // typical scala
//previous line was empty
//previous previous line was empty
//previous line was empty
//previous previous line was empty
--- typical aao
title: code examples
author: Aaron J. Radke
:section1: top level
:section2: sublevel
;typical assembly
mov 10,AX ; move 10 into the register
C typical fortran
CSQUARE = A^2 + B*B !Pythagoreans equation
#!/bin/sh
# title: highlight this leading key
// author: highlight this leading key
:section: the first section
/*
title: multi line c comment
*/
"multi- line
string"
"""
scala style
multi line string
"""
['a','b']'; % typical matlab
hexU16 = @(x) sprintf('%04X',x); % typical matlab
int i = 0x7FFh; /* typical c */
cout << "test"; // typical c++
echo "test" # typical bash
"\s".r.replaceAllIn(s,Code) // typical scala
//previous line was empty
//previous previous line was empty
//previous line was empty
//previous previous line was empty
--- typical aao
title: code examples
author: Aaron J. Radke
:section1: top level
:section2: sublevel
;typical assembly
mov 10,AX ; move 10 into the register
C typical fortran
CSQUARE = A^2 + B*B !Pythagoreans equation
code:|
diff syntax highlighting
+diff inserted content
diff regular content
-diff removed content
"a string quoted
-diff
"
"something" (=+inline diff insert+=) regular (=-inline diff deleted-=)
Try (=+4 or 5 "complex" Diff edits +=) regular (=-This one contains "broken elements-=)
// diff in a (=+comment+=)
diff in a "(=+string+=)"
diff around a (=+"string"+=)
diff across a ending (=+"str+=)ing"
diff across a starting "str(=+ing"+=)
diff (=-
spanned content-=)// (=-with modified with comment
// -=)
diff syntax highlighting
+diff inserted content
diff regular content
-diff removed content
"a string quoted
-diff
"
"something" (=+inline diff insert+=) regular (=-inline diff deleted-=)
Try (=+4 or 5 "complex" Diff edits +=) regular (=-This one contains "broken elements-=)
// diff in a (=+comment+=)
diff in a "(=+string+=)"
diff around a (=+"string"+=)
diff across a ending (=+"str+=)ing"
diff across a starting "str(=+ing"+=)
diff (=-
spanned content-=)// (=-with modified with comment
// -=)
diff:
Aaron and Shelah
Aaron, Shelah and Sebastian
Aaronand Shelah, Shelah and Sebastian
code:|
case Nstr(str) :: _ if str startsWith "#" => "\n<!--" + str + "-->"
case Nstr(str) :: _ if str startsWith "--" => "\n<!--" + str + "-->"
code:|
case Nstr(str) :: _ if str startsWith "#" => "\n<!--" + str + "-->"
case Nstr(str) :: _ if str startsWith "--" => "\n<!--" + str + "-->"
code:|
import cc.drx.aao
case class Name(first,last)
override def toString = first+" "+last
code:|
int main(char* args)
print("%f",5 / 5);
case Nstr(str) :: _ if str startsWith "#" => "\n<!--" + str + "-->"
case Nstr(str) :: _ if str startsWith "--" => "\n<!--" + str + "-->"
case Nstr(str) :: _ if str startsWith "#" => "\n<!--" + str + "-->"
case Nstr(str) :: _ if str startsWith "--" => "\n<!--" + str + "-->"
import cc.drx.aao
case class Name(first,last){
override def toString = first+" "+last
}
int main(char* args){
print("%f",5 / 5);
}
convey:|
"simple.txt" template . ; "complex.txt" template . ; ""
code:simple.txt
code:complex.txt
simple file contents
complex contents includes tags {that would cause convey to break}
along with tags that <strong>would cause html to break</strong>
and still preserve things like \n new line escapes
code:
include|simple.txt
simple file contents
code:
include|complex.txt
complex contents includes tags {that would cause convey to break}
along with tags that <strong>would cause html to break</strong>
and still preserve things like \n new line escapes
diff:
include|simple.txt
include|complex.txt
sicomplefile contentx contents includes tags {that would cause convey to break}
along with tags that <strong>would cause html to break</strong>
and still preserve things like \n new line escapes
All of the column sizes are based on a percent of the full width of the page.
printf("Hello World");
cout << "Hello World";
"Hello World" >> out
This gets a little half width header
Just normal text that prints across the page.
tb:simple
digit english spanish
1 one uno
2 two dos
3 three tres
digit | english | spanish |
---|---|---|
1 | one | uno |
2 | two | dos |
3 | three | tres |
tb:span
digit english spanish
*Odds
1 one uno
3 three tres
*Evens
2 two dos
4 four quatro
digit | english | spanish |
---|---|---|
Odds | ||
1 | one | uno |
3 | three | tres |
Evens | ||
2 | two | dos |
4 | four | quatro |
tb:complex
*Adjective *Noun *Verb phrase *Example
table elements are separated with 2 or more spaces
each element is parsed as an aao document LE: http://lifesend.com
each element is parsed as an aao document ! E = m c^2
each element is parsed as an aao document @2011-09-27
each element is parsed as an aao document ft/s
tb:convey
lang 1 2 3
*en one two three
*sp uno dos tres
math =1 =1+1 =9/3
npaths =n.path =n.children =n.root
parents =n parent 1 =n parent 2 =n parent 1 child 1 as string
rel c 1 2 =(parent 1 child _ as int) -> col ; (n col 2) + (n col 3)
lang | 1 | 2 | 3 |
---|---|---|---|
en | one | two | three |
sp | uno | dos | tres |
math | 1 | 2 | 3.0 |
npaths | /tb:convey/aaobunch/=n.path | List() | Node(/, & 1kids) |
parents | Node(/tb:convey/aaobunch, & 4kids) | Node(/tb:convey, & 7kids) | parents |
rel c | 1 | 2 | 3 |
Excel files can be imported directly
tb:../src/test/resources/test.xls
convey
. Here all columns are loaded into a vector called col
and each child is a convey
evaluation that should result in a vector representing that column. The desired column can be indexed by an integer
or a A-Z
as all vectors in convey
.TODO:?? broke excel tables reformatting
tb:../src/test/resources/test.xls
col#A
col#3 @ .upper
10
rows automatically have a dynamic filter. All elements are sortable by clicking on the header column.tb:filter
Name Sex Age
Bob Male 70
Tom Male 60
Pete Male 23
Mark Male 45
Matt Male 40
Julia Female 30
Frank Male 50
Alice Female 80
Shelah Female 31
Aaron Male 30
Sebastian Male 1
Anthony Male 23
Karyn Female 3
Name | Sex | Age |
---|---|---|
Bob | Male | 70 |
Tom | Male | 60 |
Pete | Male | 23 |
Mark | Male | 45 |
Matt | Male | 40 |
Julia | Female | 30 |
Frank | Male | 50 |
Alice | Female | 80 |
Shelah | Female | 31 |
Aaron | Male | 30 |
Sebastian | Male | 1 |
Anthony | Male | 23 |
Karyn | Female | 3 |
form:Signup
First name
txt:firstname
Last name
txt:lastname
txt:email
This will be the key identifier..
Snack preference 1
sel:snack1
Cheese
Transistors
Snack preference 3
sel:snack3
Cheese
Transistors
Interests
opt:interests
Computers
Art
Engineering
Writing
!Politics
Snack preference 2
rad:snack2
Pizza
Parabolic dish
!Wood
If you are a robot you have to at least pretend you like human food.
State
typeahead:state
Ohio
California
Colorado
Hawai
Maine
TODO issue with bootexample???
printf("Hello World");
cout << "Hello World";
"Hello World" >> out
printf("Hello World");
cout << "Hello World";
"Hello World" >> out
modal:Example Modal
Some modal content
can even get complex
code:
E = m*c^2
alert:warn
{*Warning} this is just a warning.
alert:stop
{*Error} this is an error.
slide:
Face 1: Aaron
fig20:../src/main/resources/tinyprofile.png
Face 2: Aaron again
fig20:../src/main/resources/tinyprofile.png
Text: Just plain text algorithms
fig20:../src/main/resources/tinyprofile.png
Here is some {*markup} text
Here is some more {*markup} text
Again Here is some more {*markup} text
toc:
and Toc:
are used to generate table of contents. The first inserts one using the current section (parent) and the second creates a section header.:h1:header level 1
toc:
:h2:header level 2
:h3:header level 3
:h2
toc:
ul:
cite:Alle03gtd
cite:Radk06diss
bib:
aao
T:Aao examples
A:Aaron J. Radke
W:test.html
icon
T:Icon of aaron
A:Aaron J. Radke
D:2011-10-26
F:../src/main/resources/tinyprofile.png
W:http://about.me/radke
LE
J:Life's End
A:Aaron J. Radke
D:2011
W:http://lifesend.com
worship
T:Science and Worship
A:Aaron J. Radke
D:2010-08-21
scala
B:Programming in Scala
A:Martin Ordersky
D:2009-08-21
W:http://scala-lang.org
=
prefix or convey:
parent node
=1+2
=now . niceDate
convey:|
1+2
3+3
@2011-09-27
~@2011-09-27
due:2011-09-27
convey:|
"*aaron" . node . transform
aao
is useful the other way around too when using convey.convey:|
LE <- @"_: http://lifesend.com/_"
drop <- (-> a ; _ -> dropname ; a @ .node node ("drop:" + dropname) . transform)
aaron,shelah,sebastian @ .LE drop Family
==
prefix or frink:
parent nodetoday's date is {==now[]}
Einstein would be {==now[] - #1879-03-14# -> ["months","days",0]} old
coffee:
(coffeescript) or js:
(javascript)chk:show-key
Show key
sel:radkes
Aaron 3.14
Shelah 7
Sebastian 0.5
???
coffee:|
key = (dom) -> $(dom).children().filter(":selected").text()
$('#sel-radkes').change((e) -> alert("Selected Radke: "+key(this)+" is "+this.value))
$('#chk-show-key').change((e) -> alert("show key: " + this.checked))
Actions & Elements:
js:|
$('#btn-jQuery').click(function(event){alert("jQuery btn event click")});
btn:jQuery
coffee:|
$('#btn-coffee').click((e) -> alert("coffee btn event click"));
btn:coffee
CoffeScript makes a nice combination with aao since both make use of indentation.
Embedded coffescript code can also be used to define functions
Note Remember to use a trailing pipe |
after this element.
coffee:|
alerts = ["First alert","Second alert","Third alert"]
clickCount = 0
coffeeAlert = () ->
clickCount += 1
if clickCount <= 3
msg = alerts[clickCount - 1]
else
msg = "Alert clicked " + clickCount + " times"
clickCount += 1
alert "#{msg}: a simple alert defined within coffeescript"
$('#btn-Coffee-alert').click((e) -> coffeeAlert())
btn:Coffee alert
coffee:|
scale16 = (d,fs) ->
Math.round(d/fs*32767)
unscale16 = (h,fs) ->
h*fs/32767
decimalToHexString = (number,padding) ->
if number < 0
number = 0xFFFFFFFF + number + 1
hex = number.toString(16).toUpperCase()
while(hex.length < padding)
hex = "0" + hex
hex.substr(hex.length-padding,hex.length)
convertHexToInt = () ->
hex = $('#num-hex16').val().toUpperCase()
int = parseInt(hex,16)
if int > 32767
int = -(0xFFFF - int)-1
if Math.abs(int) > 32767
$('#alert-scale').removeClass("info")
$('#alert-scale').addClass("error")
else
$('#alert-scale').removeClass("error")
$('#alert-scale').addClass("info")
$('#res-int16').html(int.toFixed(0))
$('#num-hex16').keyup((e) -> convertHexToInt())
convertIntToHex = () ->
#int = parseInt( $('#num-int16').val(), 10)
int = Math.round( eval($('#num-int16').val()))
if Math.abs(int) > 32767
$('#alert-scale').removeClass("info")
$('#alert-scale').addClass("error")
else
$('#alert-scale').removeClass("error")
$('#alert-scale').addClass("info")
hex = decimalToHexString(int,4)
$('#res-hex16').html(hex)
$('#num-int16').keyup((e) -> convertIntToHex())
tb:dec-hex
Decimal Hex
res:int16 num:hex16
num:int16 res:hex16
alert:scale
Decimal | Hex |
---|---|
int16 |
|
hex16 |
R
as the paper.
raphael:circle2|
R.setSize(200,200)
c = R.circle(100, 100, 80)
c.attr({fill: "green", stroke: "#020", "stroke-width": 20, "stroke-opacity": 0.5});
c.mouseup () -> c.attr("fill","green")
c.mousedown () -> c.attr("fill","red")
raphael:circle1|
R.setSize(200,200)
c = R.circle(100, 100, 60)
c.attr({"fill": "#F3F"})
toggle = on
c.click( () ->
if toggle
c.animate({"fill": "#3FF"},2000)
toggle = off
else
c.animate({"fill": "#F3F"},2000)
toggle = on
)
raphael:tetris|
R.setSize(250,200)
tetronimo = R.path "M 200 150 l 0 -50 l -50 0 l 0 -50 l -50 0 l 0 50 l -50 0 l 0 50 z"
angle = 0
tetronimo.attr
fill: "green"
stroke: '#3b4449'
"stroke-width": 10
"stroke-linejoin": 'round'
rotation: -90
tetronimo.click () ->
angle += 90
tetronimo.stop().animate(
transform: "r" + angle
,1000)
tetronimo.mouseover () -> tetronimo.attr("fill","green")
tetronimo.mouseout () -> tetronimo.attr("fill","red")
dl:
One
These are things like unicycle's and pogo sticks.
Two
These are things like bicycles or stilts
dl:
-----
One
These are things like unicycle's and pogo sticks.
Two
These are things like bicycles or stilts
--- dl:
One
These are things like unicycle's and pogo sticks.
Two
These are things like bicycles or stilts
An exploration in data transformation through "route" based programming language
An exploration in expressiveness, clarity, simplicity, elegance
data * format => result
Data | Processor | Format | Result |
---|---|---|---|
Fixed format | |||
.java |
javac | java-lang | java bytecode |
.scala |
scalac | scala-lang | java bytecode |
.html |
firefox | w3c-html5 | gui |
.coffe |
cofeescript | coffescript | js |
Variable data and results | |||
ruby defined | ruby | .erb |
ruby defined |
Variable format | |||
.html |
firefox | .css |
gui |
Variable data and format and results | |||
.xml |
xlst | xslt | xslt defined |
.aao |
aao | aao route | aao route defined |
Aao
is a "route" based language that can change based on supplying a route definition.Aao
is a unique "route" based language that can change based on supplying are route definition.Aao
is a structured tree based format similar to yaml
. When a route file is applied it transforms the meaning of the Aao document.Like, xslt the uses fit into templeting, domain specific languages, code generation, stylesheets, transformations.
There are numerous concepts that fit together.
*bold
.*\*(\Y+)
<strong>{m#1}</strong>{b}
<strong>bold</strong>
Something {*completely} {~new}
.*\*(\Y+)
<strong>{m#1}</strong>{b}
.*(\Y+)
{m#1}{b}
.*\~(\Y+)
<em>{m#1}</em>{b}
.*/aaobunch
{b}
Something <strong>completely</strong> <em>new</em>
{!Note} some {`code} can be marked up as {*strong} with {~emphasis} or {,subtle}, {-small}, {+big} or as {|term} formatting.
.*\!\s*(\Y+)
<span class="label">{m#1}</span>{b}
.*/aaobunch
{b}
.*\,(\Y+)
<span class="subtle">{m#1}</span>{b}
.*\~(\Y+)
<em>{m#1}</em>{b}
.*\`(\Y+)
<code>{m#1 for html}</code>{b}
.*\-(\Y+)
<span class="smallfont">{m#1}</span>{b}
.*(\Y+)
{m#1}{b}
.*\+(\Y+)
<big>{m#1}</big>{b}
.*\|(\Y+)
<dfn>{m#1}</dfn>{b}
.*\*(\Y+)
<strong>{m#1}</strong>{b}
<span class="label">Note</span> some <code>code</code> can be marked up as <strong>strong</strong> with <em>emphasis</em> or <span class="subtle">subtle</span><span class="subtle"> </span><span class="smallfont">small</span><span class="subtle"> </span><big>big</big> or as <dfn>term</dfn> formatting.
code
can be marked up as strong with emphasis or subtle small big or as term formatting.
regex | proposed?? | type |
---|---|---|
\Y+ |
:name |
not separator at least once |
\Y* |
?name |
not separator or none |
\Y+? |
:?name |
not separator non greedy |
.* |
*name |
any or none |
/ |
/ |
separator |
.*? |
*?name |
any or none non greedy |
.+ |
+name |
any at least once |
(a|b) |
(a|b):name |
or |
\d+ |
\d:name |
digit |
\d* |
\d*:name |
digit |
\w+ |
\w:name |
character |
Route:
interpolate: String with Convey
Routes:
findAndTransform: Convey (includes body and node)
transformKids: Nodes, Convey
transformNode: Node, Convey
code:
n :: rest => n.findAndTransform + rest.transformKids
Node:
Convey:
true,yes,on,T
Vector(true, true, true, true)
false,no,off,F
Vector(false, false, false, false)
tb:
A B A&B A|B A^B
=F =F =F&F =F|F =F^F
=F =T =F&T =F|T =F^T
=T =F =T&F =T|F =T^F
=T =T =T&T =T|T =T^T
A | B | A&B | A|B | A^B |
---|---|---|---|---|
false | false | false | false | false |
false | true | false | true | true |
true | false | false | true | true |
true | true | true | true | false |
1
1
1.0
1.0
-1
-1
-1.0
-1.0
id
id
<=
<=
"string literal"
string literal
+ 2
(+ 2)
+ 2 + 4
(+ 2 + 4)
+ _
(+ _)
1 plus 2
1.plus(2)
1 +_ 2
3
+_ -> plus
(+ _)
1 plus 2
3
1 . +2
3
+2 -> addTwo
(+ 2)
addTwo <- +2
(+ 2)
1 . addTwo
3
1 @ addTwo
1.@((+ 2))
_ -> addTwo
addTwo
Characters,and punctuation:sequences of characters, numbers, and punctuation are grouped together
abcd+&+efgh+3.1415plus34^^ijkl
abcd.+&+(efgh).+(3.1415).+(34).^^(ijkl)
a (+ 2 + _) 3
Vector(aaron: http://lifesend.com/aaron, shelah: http://lifesend.com/shelah, sebastian: http://lifesend.com/sebastian).+(2).+(3)
this allows for concise readable function literals, however dangling punctuation can be a source of error
a +2+_ 3
Vector(aaron: http://lifesend.com/aaron, shelah: http://lifesend.com/shelah, sebastian: http://lifesend.com/sebastian).+(2).+(3)
;
operatorconey
programs
return
the
last_value
last_value
newline groups can be saved in parenthesis
(1
2)+(3
4)
6
1,a,3,yes
Vector(1, Vector(aaron: http://lifesend.com/aaron, shelah: http://lifesend.com/shelah, sebastian: http://lifesend.com/sebastian), 3, true)
1,2,3,4,5 @ *2
Vector(2, 4, 6, 8, 10)
ab,ra,cad,ab,ra @ .size
Vector(2, 2, 3, 2, 2)
ab,ra,cad,ab,ra > ""
abracadabra
string sorting
sebastian,shelah,aaron ssort .toString
Vector(aaron, sebastian, shelah)
numeric sorting
sebastian,shelah,aaron nsort .size
Vector(aaron, shelah, sebastian)
general sorting (via a boolean)
sebastian,shelah,aaron sort (-> ab ; ab#1.size < ab#2.size)
Vector(aaron, shelah, sebastian)
sun:happy,cloud:sad,rain:silly,snow:excited
Map(sun -> happy, cloud -> sad, rain -> silly, snow -> excited)
one,two,three mkmap 1,2,3
Map(1 -> one, 2 -> two, 3 -> three)
one,two,three,four mkmap .size
Map(3 -> two, 5 -> three, 4 -> four)
"a470n","561ah","sebast14n","se14stian",sebastian mkmap match"\d+"#0or"nonum" -> leetNum
Map(470 -> a470n, 561 -> 561ah, 14 -> se14stian, nonum -> sebastian)
leetNum # "470" or none
a470n
leetNum get "470" or none
a470n
conveyexample"src/main/resources" glob ".aao$"
src rglob ".aao$"
WrappedArray()
1+2
3
2^2
4
aaron.toString
aaron
aaron take 2
aa
aaron . methods take 5 > "\n\n"
public boolean scala.collection.immutable.WrappedString.equals(java.lang.Object)
public java.lang.String scala.collection.immutable.WrappedString.toString()
public int scala.collection.immutable.WrappedString.hashCode()
public java.lang.Object scala.collection.immutable.WrappedString.min(scala.math.Ordering)
public java.lang.Object scala.collection.immutable.WrappedString.max(scala.math.Ordering)
box <- pre"{"+"}"
= <- (.box + "=" + _.box)
^ <- (.box + "^" + _.box)
+ <- (.box + "+" + _.box)
# <- (.box + "_" + _.box)
* <- +" "_
E = (m * c^2)
μ = Σ#(x # i=0)^∞
\ <- (-> x ; "\" + _ + "{" + x + "}")
x\dot = A*x + B*u
mat <- (-> m ; "\" + _#1 + (m@((@ .box > " &, "))>"\\") + "\" + _#2)
A = (0,1,0 , 0,0,1 , 0,0,0) mat [] ^ 2
:name
parameter that can be specified with a constraint clause.readablematch "/services/:id/add_to_package/:package_id"
match "/packages/:id/remove_service/:service_id", :id => /\d+/, :service_id => /\d+/
match "books/*section/:title"
get %r{/hello/([\w]+)} do |c|
"Hello, #{c}!"
end
get '/download/*.*' do |path, ext|
[path, ext] # => ["path/to/file", "xml"]
end
name
default and <regex>name
for regex./clients/{id}/accounts/{accountId}
/clients/{<[0-9]+>id}
GET /clients/:id controllers.Clients.show(id: Long)
GET /files/*name controllers.Application.download(name)
GET /clients/$id<[0-9]+> controllers.Clients.show(id: Long)
(?P<name>regex)
.urlpatterns = patterns('',
(r'^articles/2003/$', 'news.views.special_case_2003'),
(r'^articles/(?P<year>\d{4})/$', 'news.views.year_archive'),
(r'^articles/(?P<year>\d{4})/(?P<month>\d{2})/$', 'news.views.month_archive'),
(r'^articles/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$', 'news.views.article_detail'),
)
case GET(Path("/record/1")) => ...
case GET(Path(Seg("record" :: id :: Nil))) => ...
requirements
.blog_show:
pattern: /blog/{slug}
defaults: { _controller: AcmeBlogBundle:Blog:show }
blog:
pattern: /blog/{page}
defaults: { _controller: AcmeBlogBundle:Blog:index, page: 1 }
requirements:
page: \d+
homepage:
pattern: /{culture}
defaults: { _controller: AcmeDemoBundle:Main:homepage, culture: en }
requirements:
culture: en|fr
article_show:
pattern: /articles/{culture}/{year}/{title}.{_format}
defaults: { _controller: AcmeDemoBundle:Article:show, _format: html }
requirements:
culture: en|fr
_format: html|rss
year: \d+
<name:regex>
formlocalizeddepartment/<department:\w+>
# maps any controller name/id/action to any controller/action:
pattern: <controller:\w+>/<id:\d+>/<action:\w+>
need
have not found