! HA.id ("rref."<>attrify to<>maybe "" (\Anchor{..} -> "."<>attrify count) anchor) $$
html5ify to
"]"
-
instance Html5ify [Title] where
html5ify =
html5ify . fold . List.intersperse sep . toList
where sep = Title $ Seq.singleton $ tree0 $ PlainText " — "
instance Html5ify About where
- html5ify About{..} =
- html5CommasDot $ concat $
- [ html5Titles titles
- , html5ify <$> authors
- , html5ify <$> maybeToList date
- , html5ify <$> maybeToList editor
- , html5ify <$> series
+ html5ify About{..} = do
+ html5Lines
+ [ html5CommasDot $ concat $
+ [ html5Titles titles
+ , html5ify <$> authors
+ , html5ify <$> maybeToList date
+ , html5ify <$> maybeToList editor
+ , html5ify <$> series
+ ]
+ , forM_ url $ \u ->
+ H.span ! HA.class_ "print-only" $$ do
+ "<"::Html5
+ html5ify u
+ ">"
]
where
html5Titles :: [Title] -> [Html5]
]
instance Html5ify Entity where
html5ify Entity{..} = do
- html5ify $
- case () of
- _ | not (TL.null email) ->
- Tree (PlainEref $ URL $ "mailto:"<>email) $
- pure $ tree0 $ PlainText name
- _ | Just u <- url ->
+ case () of
+ _ | not (TL.null email) -> do
+ H.span ! HA.class_ "no-print" $$
+ html5ify $
+ Tree (PlainEref $ URL $ "mailto:"<>email) $
+ pure $ tree0 $ PlainText name
+ H.span ! HA.class_ "print-only" $$
+ html5ify $
+ Tree PlainGroup $ Seq.fromList
+ [ tree0 $ PlainText name
+ , tree0 $ PlainText " <"
+ , Tree (PlainEref $ URL $ "mailto:"<>email) $
+ pure $ tree0 $ PlainText email
+ , tree0 $ PlainText ">"
+ ]
+ _ | Just u <- url ->
+ html5ify $
Tree (PlainEref u) $
pure $ tree0 $ PlainText name
- _ -> tree0 $ PlainText name
+ _ ->
+ html5ify $
+ tree0 $ PlainText name
forM_ org $ \o -> do
" ("::Html5
html5ify o
sequence_ $ List.intersperse ", " hs
"."
+html5Lines :: [Html5] -> Html5
+html5Lines hs = sequence_ $ List.intersperse (html5ify H.br) hs
+
+html5Words :: [Html5] -> Html5
+html5Words hs = sequence_ $ List.intersperse " " hs
+
html5AttrClass :: [TL.Text] -> Html5 -> Html5
html5AttrClass = \case
[] -> Cat.id