Advertisement
andrewb

web.r

Sep 28th, 2015
3,305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
REBOL 0.69 KB | None | 0 0
  1. rebol [
  2.     Title: "Web Library"
  3. ]
  4.  
  5. pTag: func [text] [ join "<p>" [ text "</p>" ] ]
  6.  
  7. linkTag: func [href link] [
  8.     join {<a href="} [href {">} link "</a>"]
  9. ]
  10.  
  11. homeLink: func [] [ pTag linkTag "index.r" "Go home..." ]
  12.  
  13. listItem: func [item] [
  14.     switch to-string (type? item) [
  15.         "block" [
  16.             either (length? item) > 1 [
  17.                 join (listItem item/1) (ulTag skip item 1)
  18.             ] [
  19.                 listItem item/1
  20.             ]
  21.         ]
  22.         "word" [ get item ]
  23.         "string" [ item ]
  24.     ]
  25. ]
  26.  
  27. ulTag: func [ list ] [
  28.     join "<ul>" [(liTag list) "</ul>"]
  29. ]
  30.  
  31. liTag: func [ list ] [
  32.     either (length? list) > 1 [
  33.         join "<li>" [(listItem list/1) "</li>" (liTag skip list 1)]
  34.     ] [
  35.         join "<li>" [(listItem list/1) "</li>"]
  36.     ]
  37. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement