add line-breaks? flag to farkup just for kicks. it might be useful
parent
01fcb1b856
commit
87bb2240fc
|
@ -9,6 +9,7 @@ IN: farkup
|
||||||
SYMBOL: relative-link-prefix
|
SYMBOL: relative-link-prefix
|
||||||
SYMBOL: disable-images?
|
SYMBOL: disable-images?
|
||||||
SYMBOL: link-no-follow?
|
SYMBOL: link-no-follow?
|
||||||
|
SYMBOL: line-breaks?
|
||||||
|
|
||||||
TUPLE: heading1 child ;
|
TUPLE: heading1 child ;
|
||||||
TUPLE: heading2 child ;
|
TUPLE: heading2 child ;
|
||||||
|
@ -29,6 +30,7 @@ TUPLE: link href text ;
|
||||||
TUPLE: image href text ;
|
TUPLE: image href text ;
|
||||||
TUPLE: code mode string ;
|
TUPLE: code mode string ;
|
||||||
TUPLE: line ;
|
TUPLE: line ;
|
||||||
|
TUPLE: line-break ;
|
||||||
|
|
||||||
: absolute-url? ( string -- ? )
|
: absolute-url? ( string -- ? )
|
||||||
{ "http://" "https://" "ftp://" } [ head? ] with contains? ;
|
{ "http://" "https://" "ftp://" } [ head? ] with contains? ;
|
||||||
|
@ -109,7 +111,9 @@ table = ((table-row nl => [[ first ]] )+ table-row? | table-row)
|
||||||
text = (!(nl | code | heading | inline-delimiter | table ).)+
|
text = (!(nl | code | heading | inline-delimiter | table ).)+
|
||||||
=> [[ >string ]]
|
=> [[ >string ]]
|
||||||
|
|
||||||
paragraph-nl-item = nl (list | line)?
|
paragraph-nl-item = nl list
|
||||||
|
| nl line
|
||||||
|
| nl => [[ line-breaks? get [ drop line-break new ] when ]]
|
||||||
paragraph-item = (table | code | text | inline-tag | inline-delimiter)+
|
paragraph-item = (table | code | text | inline-tag | inline-delimiter)+
|
||||||
paragraph = ((paragraph-item paragraph-nl-item)+ nl+ => [[ first ]]
|
paragraph = ((paragraph-item paragraph-nl-item)+ nl+ => [[ first ]]
|
||||||
| (paragraph-item paragraph-nl-item)+ paragraph-item?
|
| (paragraph-item paragraph-nl-item)+ paragraph-item?
|
||||||
|
@ -209,6 +213,7 @@ M: link (write-farkup) [ href>> ] [ text>> ] bi write-link ;
|
||||||
M: image (write-farkup) [ href>> ] [ text>> ] bi write-image-link ;
|
M: image (write-farkup) [ href>> ] [ text>> ] bi write-image-link ;
|
||||||
M: code (write-farkup) [ string>> ] [ mode>> ] bi render-code ;
|
M: code (write-farkup) [ string>> ] [ mode>> ] bi render-code ;
|
||||||
M: line (write-farkup) drop <hr/> ;
|
M: line (write-farkup) drop <hr/> ;
|
||||||
|
M: line-break (write-farkup) drop <br/> nl ;
|
||||||
M: table-row (write-farkup) ( obj -- )
|
M: table-row (write-farkup) ( obj -- )
|
||||||
child>> [ [ [ (write-farkup) ] "td" in-tag. ] each ] "tr" in-tag. ;
|
child>> [ [ [ (write-farkup) ] "td" in-tag. ] each ] "tr" in-tag. ;
|
||||||
M: table (write-farkup) [ child>> (write-farkup) ] "table" in-tag. ;
|
M: table (write-farkup) [ child>> (write-farkup) ] "table" in-tag. ;
|
||||||
|
|
Loading…
Reference in New Issue