More comprehensive webby.pl
Allow for longer strings, but there's still another limiting element somewhere.
This commit is contained in:
parent
1d5621923c
commit
a59ce1646f
|
@ -1,17 +1,26 @@
|
||||||
|
#!/usr/bin/pl
|
||||||
|
|
||||||
(struct post
|
(struct post
|
||||||
(title body))
|
(title body))
|
||||||
|
|
||||||
(def x (post "Hey" "This is a post"))
|
|
||||||
|
|
||||||
(def html (fn (text) (cat "<html>" text "</html>")))
|
(def html (fn (text) (cat "<html>" text "</html>")))
|
||||||
(def body (fn (text) (cat "<body>" text "</body>")))
|
(def body (fn (text) (cat "<body>" text "</body>")))
|
||||||
(def h1 (fn (text) (cat "<h1>" text "</h1>")))
|
(def h1 (fn (text) (cat "<h1>" text "</h1>
|
||||||
(def p (fn (text) (cat "<p>" text "</p>")))
|
")))
|
||||||
|
(def h2 (fn (text) (cat "<h2>" text "</h2>")))
|
||||||
|
(def p (fn (text) (cat "<p>" text "</p>
|
||||||
|
")))
|
||||||
|
|
||||||
(def htmlize (fn (po)
|
(def htmlize (fn (po)
|
||||||
(html
|
(cat
|
||||||
(body (cat
|
(h2 po's title)
|
||||||
(h1 po's title)
|
(p po's body))))
|
||||||
(p po's body))))))
|
|
||||||
|
|
||||||
(prnl (htmlize x))
|
(def p1 (post "Hey" "This is a post"))
|
||||||
|
(def p2 (post "This" "Is ALSO a post"))
|
||||||
|
|
||||||
|
(prnl (html (body (cat
|
||||||
|
(h1 "This is Sage's Blog")
|
||||||
|
(htmlize p1)
|
||||||
|
(htmlize p2)
|
||||||
|
))))
|
||||||
|
|
|
@ -427,7 +427,7 @@ void _printObj(const Object* obj, int newline)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char temp[100] = "";
|
char temp[200] = "";
|
||||||
stringObj(temp, obj);
|
stringObj(temp, obj);
|
||||||
if (newline) {
|
if (newline) {
|
||||||
printf("%s\n", temp);
|
printf("%s\n", temp);
|
||||||
|
|
|
@ -413,8 +413,9 @@ Object catObjects(const Object obj1, const Object obj2, struct Environment* env)
|
||||||
Object evalObj1 = eval(&obj1, env);
|
Object evalObj1 = eval(&obj1, env);
|
||||||
Object evalObj2 = eval(&obj2, env);
|
Object evalObj2 = eval(&obj2, env);
|
||||||
|
|
||||||
char str1[100] = "";
|
#define CAT_MAX 200
|
||||||
char str2[100] = "";
|
char str1[CAT_MAX] = "";
|
||||||
|
char str2[CAT_MAX] = "";
|
||||||
stringObj(str1, &evalObj1);
|
stringObj(str1, &evalObj1);
|
||||||
stringObj(str2, &evalObj2);
|
stringObj(str2, &evalObj2);
|
||||||
cleanObject(&evalObj1);
|
cleanObject(&evalObj1);
|
||||||
|
|
Loading…
Reference in New Issue