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
|
||||
[ "<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
|
||||
|
||||
[ "<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.
|
||||
USING: arrays io io.styles kernel memoize namespaces peg
|
||||
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 ;
|
||||
IN: farkup
|
||||
|
||||
|
@ -56,11 +56,9 @@ MEMO: eq ( -- parser )
|
|||
: render-code ( string mode -- string' )
|
||||
>r string-lines r>
|
||||
[
|
||||
[
|
||||
H{ { wrap-margin f } } [
|
||||
htmlize-lines
|
||||
] with-nesting
|
||||
] with-html-stream
|
||||
<pre>
|
||||
htmlize-lines
|
||||
</pre>
|
||||
] with-string-writer ;
|
||||
|
||||
: check-url ( href -- href' )
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
USING: xmode.tokens xmode.marker xmode.catalog kernel html
|
||||
html.elements io io.files sequences words io.encodings.utf8
|
||||
namespaces ;
|
||||
namespaces xml.entities ;
|
||||
IN: xmode.code2html
|
||||
|
||||
: htmlize-tokens ( tokens -- )
|
||||
[
|
||||
dup token-str swap token-id [
|
||||
<span word-name =class span> write </span>
|
||||
<span word-name =class span> escape-string write </span>
|
||||
] [
|
||||
write
|
||||
] if*
|
||||
|
@ -21,7 +21,7 @@ IN: xmode.code2html
|
|||
: default-stylesheet ( -- )
|
||||
<style>
|
||||
"resource:extra/xmode/code2html/stylesheet.css"
|
||||
utf8 file-contents write
|
||||
utf8 file-contents escape-string write
|
||||
</style> ;
|
||||
|
||||
: htmlize-stream ( path stream -- )
|
||||
|
@ -29,7 +29,7 @@ IN: xmode.code2html
|
|||
<html>
|
||||
<head>
|
||||
default-stylesheet
|
||||
<title> dup write </title>
|
||||
<title> dup escape-string write </title>
|
||||
</head>
|
||||
<body>
|
||||
<pre>
|
||||
|
|
Loading…
Reference in New Issue