help.html: clone attrs in css-styles-to-classes and double padding.
parent
15d6762449
commit
6796daab79
|
@ -1,8 +1,8 @@
|
||||||
! Copyright (C) 2008, 2011 Slava Pestov.
|
! Copyright (C) 2008, 2011 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors arrays assocs combinators.short-circuit
|
USING: accessors arrays assocs combinators.short-circuit
|
||||||
debugger fry help help.home help.topics help.vocabs html
|
debugger fonts formatting fry help help.home help.topics
|
||||||
html.streams io.directories io.encodings.binary
|
help.vocabs html html.streams io.directories io.encodings.binary
|
||||||
io.encodings.utf8 io.files io.files.temp io.pathnames kernel
|
io.encodings.utf8 io.files io.files.temp io.pathnames kernel
|
||||||
locals make math math.parser memoize namespaces regexp sequences
|
locals make math math.parser memoize namespaces regexp sequences
|
||||||
sequences.deep serialize sorting splitting tools.completion
|
sequences.deep serialize sorting splitting tools.completion
|
||||||
|
@ -93,8 +93,14 @@ M: pathname url-of
|
||||||
: css-style ( style -- style' )
|
: css-style ( style -- style' )
|
||||||
R/ font-size: \d+pt;/ [
|
R/ font-size: \d+pt;/ [
|
||||||
"font-size: " ?head drop "pt;" ?tail drop
|
"font-size: " ?head drop "pt;" ?tail drop
|
||||||
string>number 12 /f number>string
|
string>number default-font-size /f
|
||||||
"font-size: " "rem; " surround
|
"font-size: %.3frem;" sprintf
|
||||||
|
] re-replace-with
|
||||||
|
|
||||||
|
R/ padding: \d+px;/ [
|
||||||
|
"padding: " ?head drop "px;" ?tail drop
|
||||||
|
string>number dup even? [ 1 + ] when 2 * number>string
|
||||||
|
"padding: " "px;" surround
|
||||||
] re-replace-with ;
|
] re-replace-with ;
|
||||||
|
|
||||||
: css-classes ( classes -- stylesheet )
|
: css-classes ( classes -- stylesheet )
|
||||||
|
@ -112,7 +118,7 @@ M: pathname url-of
|
||||||
[ "style" attr ]
|
[ "style" attr ]
|
||||||
[ "class" attr not ]
|
[ "class" attr not ]
|
||||||
} 1&& [
|
} 1&& [
|
||||||
attrs>> [ V{ } like ] change-alist
|
[ clone [ V{ } like ] change-alist ] change-attrs
|
||||||
"style" over delete-at* drop classes css-class
|
"style" over delete-at* drop classes css-class
|
||||||
"class" rot set-at
|
"class" rot set-at
|
||||||
] [ drop ] if
|
] [ drop ] if
|
||||||
|
|
Loading…
Reference in New Issue