From ab4e380c044eef30122d6a758aa49631fb3c5131 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Thu, 11 Apr 2013 14:47:57 -0700 Subject: [PATCH] html.streams: allow non-equal padding values. --- basis/html/streams/streams.factor | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/basis/html/streams/streams.factor b/basis/html/streams/streams.factor index 3e8f7c64a1..82f87f4f87 100644 --- a/basis/html/streams/streams.factor +++ b/basis/html/streams/streams.factor @@ -101,8 +101,15 @@ M: html-span-stream dispose : border-css, ( border -- ) "border: 1px solid #" % hex-color, "; " % ; +: (padding-css,) ( horizontal vertical -- ) + 2dup = [ + drop "padding: " % # "px; " % + ] [ + "padding: " % # "px " % # "px; " % + ] if ; + : padding-css, ( padding -- ) - first2 "padding: " % # "px " % # "px; " % ; + first2 (padding-css,) ; CONSTANT: pre-css "white-space: pre; font-family: monospace;" @@ -129,7 +136,7 @@ M: html-block-stream dispose end-sub-stream format-html-div ; : border-spacing-css, ( pair -- ) - first2 max 2 /i "padding: " % # "px; " % ; + first2 [ 2 /i ] bi@ (padding-css,) ; : table-style ( style -- str ) {