hledger-lib
Safe HaskellNone
LanguageGHC2021

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

Documentation

type Html = Markup #

toHtml :: ToMarkup a => a -> Html #

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

Instances details
Lines NumLines Source # 
Instance details

Defined in Hledger.Write.Html

Methods

borderClass :: NumLines -> Maybe Text Source #

Lines () Source # 
Instance details

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.

formatCell :: Lines border => Cell border Html -> Html Source #

formatRow :: Lines border => [Cell border Html] -> Html Source #

formatTitle :: Text -> Html Source #

Render a report title as an HTML heading.

htmlAsText :: Html -> Text Source #

nl :: Html 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.