Commits

Joe Bogner committed 0c3aeba

retab

  • Participants
  • Parent commits 38afc68

Comments (0)

Files changed (2)

 (load "picostache.l")
 
 (de readLines (File)
-	(filter '((X) X) 
+  (filter '((X) X) 
       (make
          (in File
              (until (eof)
 (setq lookup passoc) #hack to override picostache to use plists
 
 (de start() 
-	(let (Html (pack (readLines "org-html.html"))
+  (let (Html (pack (readLines "org-html.html"))
          TemplateTree (parse Html)
          Lines (readLines "example.org.bak")
          Org (org-parse Lines 0)
 (de collectUntil (Lst Func)
-	(let (Ret NIL) (find '((X) (if (Func X) T (push 'Ret X) NIL)) Lst) (reverse Ret)))
+  (let (Ret NIL) (find '((X) (if (Func X) T (push 'Ret X) NIL)) Lst) (reverse Ret)))
 
 (de org-parse-level (Line)
  (- (length (split (chop Line) "*")) 1))
 
 (de org-parse-body (Lines)
-	(collectUntil Lines '((Line) (> (org-parse-level Line) 0))))
+  (collectUntil Lines '((Line) (> (org-parse-level Line) 0))))
 
 (de org-parse-children (Lines Level)
-	(let Children (collectUntil Lines '((X) (= Level (org-parse-level X))))
-  	(if Children (org-parse Children Level))))
+  (let Children (collectUntil Lines '((X) (= Level (org-parse-level X))))
+    (if Children (org-parse Children Level))))
 
 (de org-next-sibling (Level Lines)
-	(seek '((Line) (= Level (org-parse-level (car Line)))) Lines))
+  (seek '((Line) (= Level (org-parse-level (car Line)))) Lines))
 
 (de org-parse-heading (Line Level Lines)
   (when (> Level 0)
     (let (Body (org-parse-body Lines)
-				 Children (org-parse-children Lines Level)
-				 Heading (list 'level Level 'name Line 'body Body 'children Children)
-				 NextPosition (org-next-sibling Level Lines))
-		 (cons Heading NextPosition))))
+         Children (org-parse-children Lines Level)
+         Heading (list 'level Level 'name Line 'body Body 'children Children)
+         NextPosition (org-next-sibling Level Lines))
+     (cons Heading NextPosition))))
 
 (de org-parse (Lines Until)
-	(let Lst NIL
-		(while Lines 
-			(let (Line (car Lines)
-						Level (org-parse-level Line)
-						IsBody (= 0 Level)
-						Sibling (<= Level Until)
-						ShouldParse (and (not Sibling) (not IsBody)) 
-						ParsedHeading (if ShouldParse (org-parse-heading Line Level (cdr Lines)))
-						Heading (car ParsedHeading)
-						NextPosition (cdr ParsedHeading))
-			 (if (and Sibling (not IsBody)) (setq Lines NIL))
-	     (if (and Lines ParsedHeading)
-				 (prog
-					 (setq Lst (cons Heading Lst))
-					 (setq Lines NextPosition))
-				 (setq Lines (cdr Lines)))))
+  (let Lst NIL
+    (while Lines 
+      (let (Line (car Lines)
+            Level (org-parse-level Line)
+            IsBody (= 0 Level)
+            Sibling (<= Level Until)
+            ShouldParse (and (not Sibling) (not IsBody)) 
+            ParsedHeading (if ShouldParse (org-parse-heading Line Level (cdr Lines)))
+            Heading (car ParsedHeading)
+            NextPosition (cdr ParsedHeading))
+       (if (and Sibling (not IsBody)) (setq Lines NIL))
+       (if (and Lines ParsedHeading)
+         (prog
+           (setq Lst (cons Heading Lst))
+           (setq Lines NextPosition))
+         (setq Lines (cdr Lines)))))
        (reverse Lst)))