Update html.streams usages
parent
cee6ab6770
commit
3a6532a9f8
|
@ -54,7 +54,7 @@ IN: farkup.tests
|
||||||
[ "<p>=</p><h2>foo</h2>" ] [ "===foo==" convert-farkup ] unit-test
|
[ "<p>=</p><h2>foo</h2>" ] [ "===foo==" convert-farkup ] unit-test
|
||||||
[ "<h1>foo</h1><p>=</p>" ] [ "=foo==" convert-farkup ] unit-test
|
[ "<h1>foo</h1><p>=</p>" ] [ "=foo==" convert-farkup ] unit-test
|
||||||
|
|
||||||
[ "<div style='white-space: pre; font-family: monospace; '><span class='KEYWORD3'>int</span> <span class='FUNCTION'>main</span><span class='OPERATOR'>(</span><span class='OPERATOR'>)</span><br/></div>" ]
|
[ "<pre><span class='KEYWORD3'>int</span> <span class='FUNCTION'>main</span><span class='OPERATOR'>(</span><span class='OPERATOR'>)</span>\n</pre>" ]
|
||||||
[ "[c{int main()}]" convert-farkup ] unit-test
|
[ "[c{int main()}]" convert-farkup ] unit-test
|
||||||
|
|
||||||
[ "<p><img src=\"lol.jpg\"/></p>" ] [ "[[image:lol.jpg]]" convert-farkup ] unit-test
|
[ "<p><img src=\"lol.jpg\"/></p>" ] [ "[[image:lol.jpg]]" convert-farkup ] unit-test
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: arrays io io.styles kernel memoize namespaces peg
|
USING: arrays io io.styles kernel memoize namespaces peg
|
||||||
sequences strings html.elements xml.entities xmode.code2html
|
sequences strings html.elements xml.entities xmode.code2html
|
||||||
splitting io.streams.string html peg.parsers html.elements
|
splitting io.streams.string peg.parsers
|
||||||
sequences.deep unicode.categories ;
|
sequences.deep unicode.categories ;
|
||||||
IN: farkup
|
IN: farkup
|
||||||
|
|
||||||
|
@ -56,11 +56,9 @@ MEMO: eq ( -- parser )
|
||||||
: render-code ( string mode -- string' )
|
: render-code ( string mode -- string' )
|
||||||
>r string-lines r>
|
>r string-lines r>
|
||||||
[
|
[
|
||||||
[
|
<pre>
|
||||||
H{ { wrap-margin f } } [
|
htmlize-lines
|
||||||
htmlize-lines
|
</pre>
|
||||||
] with-nesting
|
|
||||||
] with-html-stream
|
|
||||||
] with-string-writer ;
|
] with-string-writer ;
|
||||||
|
|
||||||
: check-url ( href -- href' )
|
: check-url ( href -- href' )
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
USING: xmode.tokens xmode.marker xmode.catalog kernel html
|
USING: xmode.tokens xmode.marker xmode.catalog kernel html
|
||||||
html.elements io io.files sequences words io.encodings.utf8
|
html.elements io io.files sequences words io.encodings.utf8
|
||||||
namespaces ;
|
namespaces xml.entities ;
|
||||||
IN: xmode.code2html
|
IN: xmode.code2html
|
||||||
|
|
||||||
: htmlize-tokens ( tokens -- )
|
: htmlize-tokens ( tokens -- )
|
||||||
[
|
[
|
||||||
dup token-str swap token-id [
|
dup token-str swap token-id [
|
||||||
<span word-name =class span> write </span>
|
<span word-name =class span> escape-string write </span>
|
||||||
] [
|
] [
|
||||||
write
|
write
|
||||||
] if*
|
] if*
|
||||||
|
@ -21,7 +21,7 @@ IN: xmode.code2html
|
||||||
: default-stylesheet ( -- )
|
: default-stylesheet ( -- )
|
||||||
<style>
|
<style>
|
||||||
"resource:extra/xmode/code2html/stylesheet.css"
|
"resource:extra/xmode/code2html/stylesheet.css"
|
||||||
utf8 file-contents write
|
utf8 file-contents escape-string write
|
||||||
</style> ;
|
</style> ;
|
||||||
|
|
||||||
: htmlize-stream ( path stream -- )
|
: htmlize-stream ( path stream -- )
|
||||||
|
@ -29,7 +29,7 @@ IN: xmode.code2html
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
default-stylesheet
|
default-stylesheet
|
||||||
<title> dup write </title>
|
<title> dup escape-string write </title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<pre>
|
<pre>
|
||||||
|
|
Loading…
Reference in New Issue