From 75a2838a7c3c82a72e1d3b2304377c8322891ad6 Mon Sep 17 00:00:00 2001
From: Doug Coleman <doug.coleman@gmail.com>
Date: Tue, 26 Feb 2008 15:17:04 -0600
Subject: [PATCH] clean up duplication of words that used <foo> </foo>

---
 extra/farkup/farkup.factor | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/extra/farkup/farkup.factor b/extra/farkup/farkup.factor
index e605483f54..aadc61be85 100644
--- a/extra/farkup/farkup.factor
+++ b/extra/farkup/farkup.factor
@@ -21,10 +21,13 @@ MEMO: delimiter ( -- parser )
     [ dup delimiters member? swap CHAR: \n = not and ] satisfy
     [ 1string ] action ;
 
+: surround-with-foo ( string tag -- seq )
+    dup <foo> swap </foo> swapd 3array ;
+
 : delimited ( str html -- parser )
     [
         over token hide ,
-        text [ dup <foo> swap </foo> swapd 3array ] swapd curry action ,
+        text [ surround-with-foo ] swapd curry action ,
         token hide ,
     ] seq* ;
 
@@ -72,14 +75,22 @@ MEMO: link ( -- parser ) [ simple-link , labelled-link , ] choice* ;
 DEFER: line
 MEMO: list-item ( -- parser )
     [
-        "-" token hide ,
-        line ,
-    ] seq*
-    [ "li" <foo> swap "li" </foo> 3array ] action ;
+        "-" token hide , line ,
+    ] seq* [ "li" surround-with-foo ] action ;
 
 MEMO: list ( -- parser )
     list-item "\n" token hide list-of
-    [ "ul" <foo> swap "ul" </foo> 3array ] action ;
+    [ "ul" surround-with-foo ] action ;
+
+MEMO: table-column ( -- parser ) [ "|" token text ] seq* ;
+MEMO: table-row ( -- parser )
+    [
+        "|" 
+    ] seq* ; 
+MEMO: table ( -- parser )
+    [
+        "|" 
+    ] seq* ;
 
 MEMO: code ( -- parser )
     [
@@ -93,10 +104,6 @@ MEMO: code ( -- parser )
         ] seq* [ concat ] action ,
     ] seq* [ first2 swap render-code ] action ;
 
-MEMO: table-column ( -- parser ) [ "|" token text ] seq* ;
-MEMO: table-row ( -- parser ) [ ] seq* ; 
-MEMO: table ( -- parser ) [ "[" ] seq* ;
-
 MEMO: line ( -- parser )
     [
         text , strong , emphasis , link ,
@@ -121,9 +128,3 @@ MEMO: farkup ( -- parser )
 : parse-farkup ( string -- string' )
     farkup parse parse-result-ast
     [ [ dup string? [ write ] [ drop ] if ] deep-each ] with-string-writer ;
-
-! paragraph
-    ! [
-        ! line ,
-        ! "\n" token ,
-    ! ] choice* repeat1