| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Hledger.Write.Html
Description
HTML writing helpers, using blaze-html, whose markup type is also the one hledger-web's pages are made of.
They render Hledger.Write.Spreadsheet tables as HTML tables: the CLI's
-O html output uses styledTableHtml and titledTableHtml, and
hledger-web's report pages use formatCell inside their own table markup.
blaze's text renderer writes everything on one line, so for human readability
we inject raw newlines between elements (see nl).
Synopsis
- type Html = Markup
- toHtml :: ToMarkup a => a -> Html
- class Lines border => Lines border where
- borderClass :: border -> Maybe Text
- borderClasses :: Lines border => Cell border text -> [Text]
- formatCell :: Lines border => Cell border Html -> Html
- formatRow :: Lines border => [Cell border Html] -> Html
- formatTitle :: Text -> Html
- htmlAsText :: Html -> Text
- htmlAsLazyText :: Html -> Text
- nl :: Html
- styledTableHtml :: Lines border => [[Cell border Html]] -> Html
- titledTableHtml :: Lines border => Text -> [[Cell border Html]] -> Html
- tests_Hledger_Write_Html :: TestTree
Documentation
class Lines border => Lines border where Source #
Methods
borderClass :: border -> Maybe Text Source #
The class suffix naming this kind of border line, if it is drawn.
Instances
| Lines NumLines Source # | |
Defined in Hledger.Write.Html Methods borderClass :: NumLines -> Maybe Text Source # | |
| Lines () Source # | |
Defined in Hledger.Write.Html Methods borderClass :: () -> Maybe Text Source # | |
borderClasses :: Lines border => Cell border text -> [Text] Source #
The CSS classes marking a cell's borders, eg border-top-double.
Borders are expressed as classes rather than inline styles so that the
HTML can be served under a Content Security Policy which forbids inline
styles; the matching rules are in Hledger.Write.Html.Attribute.
formatTitle :: Text -> Html Source #
Render a report title as an HTML heading.
htmlAsText :: Html -> Text Source #
htmlAsLazyText :: Html -> Text Source #
A literal newline, to make the HTML output more human-readable. Emit it only between elements, never inside cell content, so it doesn't affect rendering.
styledTableHtml :: Lines border => [[Cell border Html]] -> Html Source #
Export spreadsheet table data as HTML table. This is derived from https://hackage.haskell.org/package/classify-frog-0.2.4.3/src/src/Spreadsheet/Format.hs
titledTableHtml :: Lines border => Text -> [[Cell border Html]] -> Html Source #
Like styledTableHtml, but with the given report title, if non-empty,
as a heading above the table.