pico-org / org-http.l

(load "@lib/http.l")
(load "org.l")
(load "picostache.l")

(de readLines (File)
  (filter '((X) X) 
      (make
         (in File
             (until (eof)
                (link (pack (line))))))))

(de passoc (Key Lst) (cadr (seek '((X) (= Key (car X))) Lst)))
(setq lookup passoc) #hack to override picostache to use plists

(allow "*Text")
(setq File "example.org.bak")

(de start() 
   (when *Post
         (out 2 (prin *Text))
         (out File (prin *Text))
         (let Msg (in (list 'git "commit" "-a" "-m" "web update") (line))
            (out 2 (prin Msg))))

  (let (Html (pack (readLines "org-html.html"))
         TemplateTree (parse Html)
         Text (pack (in File (till NIL)))
         Lines (readLines File)
         Org (org-parse Lines 0)
         Model (cons 'org (list Org))
         HeaderTemplate (nth TemplateTree 4))
         
         (setq Template TemplateTree)


         #need to find a more robust way to do this
         (push 'Model '((X) (if View (renderTree (cons 'org (list (list View))) HeaderTemplate))))
         (push 'Model 'orgt)
         (push 'Model (pipe (ht:Prin (pack Text)) (till NIL)))
         (push 'Model 'text)
         (httpHead NIL NIL)
         (prinl (renderTree Model TemplateTree))))

(de go ()
 (server 21000 "!start") )
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.