help.html: change fixed font-size to relative.

flac
John Benediktsson 2020-02-17 14:50:30 -08:00 committed by Steve Ayerhart
parent c8aa5a9ae8
commit bd7cf53e62
No known key found for this signature in database
GPG Key ID: 5BFD39C5359E967D
1 changed files with 11 additions and 6 deletions

View File

@ -1,13 +1,12 @@
! 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 formatting fry help help.home help.topics help.vocabs
html.streams io.directories io.encodings.binary 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 sequences locals make math math.parser memoize namespaces regexp sequences
sequences.deep serialize sorting splitting tools.completion sequences.deep serialize sorting splitting tools.completion
vocabs vocabs.hierarchy words xml.data xml.syntax xml.traversal vocabs vocabs.hierarchy words xml.data xml.syntax xml.writer ;
xml.writer ;
FROM: io.encodings.ascii => ascii ; FROM: io.encodings.ascii => ascii ;
FROM: ascii => ascii? ; FROM: ascii => ascii? ;
IN: help.html IN: help.html
@ -91,9 +90,15 @@ M: pathname url-of
: css-class ( style classes -- name ) : css-class ( style classes -- name )
dup '[ drop _ assoc-size 1 + bijective-base26 ] cache ; dup '[ drop _ assoc-size 1 + bijective-base26 ] cache ;
: css-style ( style -- style' )
R/ font-size: \d+pt;/ [
"font-size: " ?head drop "pt;" ?tail drop
string>number 12 / "font-size: %frem;" sprintf
] re-replace-with ;
: css-classes ( classes -- stylesheet ) : css-classes ( classes -- stylesheet )
[ [
[ " { " "}" surround ] [ "." prepend ] bi* prepend [ css-style " { " "}" surround ] [ "." prepend ] bi* prepend
] { } assoc>map "\n" join ; ] { } assoc>map "\n" join ;
:: css-styles-to-classes ( body -- stylesheet body ) :: css-styles-to-classes ( body -- stylesheet body )