{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ViewPatterns #-} -- | Render analyzed tokens into HTML table. module Render.HTML(htmlFromColSpans, htmlInline) where import Prelude hiding(span, id) import Data.Text(Text) import qualified Data.Text as T import qualified Data.Text.Lazy as LT import Text.Blaze.Html5 ( toHtml, Html, ToValue(toValue), (!), b, html, i, span, table, tbody, td, tr ) import Text.Blaze.Html5.Attributes(colspan, style, id) import Text.Blaze.Html.Renderer.Text(renderHtml) import Alignment ( Align(..) ) import Render.Common(TokensWithColSpan) import Token (MyTok(..)) import Util ( preformatTokens, unbrace ) -- | Given a list of lists of colspans in each table row, return an HTML text. htmlFromColSpans :: [[TokensWithColSpan]] -> Text htmlFromColSpans = LT.toStrict . renderHtml . table . tbody . mapM_ renderTr -- | Given a list of colspans within a single table row, render it to HTML tree -- of `