version 0.8.2
This commit is contained in:
parent
581572b28c
commit
053309e60a
125 changed files with 6564 additions and 1308 deletions
23
examples/filterex.nim
Executable file
23
examples/filterex.nim
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
#! stdtmpl | standard
|
||||
#proc generateHTMLPage(title, currentTab, content: string,
|
||||
# tabs: openArray[string]): string =
|
||||
# result = ""
|
||||
<head><title>$title</title></head>
|
||||
<body>
|
||||
<div id="menu">
|
||||
<ul>
|
||||
#for tab in items(tabs):
|
||||
#if currentTab == tab:
|
||||
<li><a id="selected"
|
||||
#else:
|
||||
<li><a
|
||||
#end if
|
||||
href="${tab}.html" title = "$title - $tab">$tab</a></li>
|
||||
#end for
|
||||
</ul>
|
||||
</div>
|
||||
<div id="content">
|
||||
$content
|
||||
A dollar: $$.
|
||||
</div>
|
||||
</body>
|
||||
37
examples/iupex1.nim
Executable file
37
examples/iupex1.nim
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
# Example IUP program
|
||||
|
||||
# IupTabs: Creates a IupTabs control.
|
||||
|
||||
import iup
|
||||
|
||||
discard iup.Open(nil, nil)
|
||||
|
||||
var vbox1 = Iup.Vbox(Iup.Label("Inside Tab A"), Iup.Button("Button A", ""), nil)
|
||||
var vbox2 = Iup.Vbox(Iup.Label("Inside Tab B"), Iup.Button("Button B", ""), nil)
|
||||
|
||||
Iup.SetAttribute(vbox1, "TABTITLE", "Tab A")
|
||||
Iup.SetAttribute(vbox2, "TABTITLE", "Tab B")
|
||||
|
||||
var tabs1 = Iup.Tabs(vbox1, vbox2, nil)
|
||||
|
||||
vbox1 = Iup.Vbox(Iup.Label("Inside Tab C"), Iup.Button("Button C", ""), nil)
|
||||
vbox2 = Iup.Vbox(Iup.Label("Inside Tab D"), Iup.Button("Button D", ""), nil)
|
||||
|
||||
Iup.SetAttribute(vbox1, "TABTITLE", "Tab C")
|
||||
Iup.SetAttribute(vbox2, "TABTITLE", "Tab D")
|
||||
|
||||
var tabs2 = Iup.Tabs(vbox1, vbox2, nil)
|
||||
Iup.SetAttribute(tabs2, "TABTYPE", "LEFT")
|
||||
|
||||
var box = Iup.Hbox(tabs1, tabs2, nil)
|
||||
Iup.SetAttribute(box, "MARGIN", "10x10")
|
||||
Iup.SetAttribute(box, "GAP", "10")
|
||||
|
||||
var dlg = Iup.Dialog(box)
|
||||
Iup.SetAttribute(dlg, "TITLE", "IupTabs")
|
||||
Iup.SetAttribute(dlg, "SIZE", "200x80")
|
||||
|
||||
discard ShowXY(dlg, IUP_CENTER, IUP_CENTER)
|
||||
discard MainLoop()
|
||||
Close()
|
||||
|
||||
7
examples/keyval2.nim
Executable file
7
examples/keyval2.nim
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
# Filter key=value pairs from "myfile.txt"
|
||||
import pegs
|
||||
|
||||
for x in lines("myfile.txt"):
|
||||
if x =~ peg"{\ident} \s* '=' \s* {.*}":
|
||||
echo "Key: ", matches[1],
|
||||
" Value: ", matches[2]
|
||||
8
examples/transff.nim
Executable file
8
examples/transff.nim
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
# Shows how to transform a file
|
||||
|
||||
import pegs
|
||||
|
||||
transformFile("infile.txt", "outfile.txt",
|
||||
[(peg"""S <- {typedesc} \s* {\ident} \s* ','
|
||||
typedesc <- \ident '*'* """, r"$2: $1")])
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue