<commit_before><commit_msg>_filters: add qed.hs<commit_after>#!/usr/bin/env runhaskell
{-
  Pandoc filter to convert end-of-paragraph string "[QED]"
  into tombstone symbol. (HTML only)
-}
import Text.Pandoc.JSON
import System.IO

d :: Show a => a -> IO ()
d = hPutStrLn stderr . show

fmt :: Format
fmt = Format "html"

qed :: Block -> IO Block
qed b@(Para ins) =
  case last ins of
    Str "[QED]" ->
      return $ Para $ init ins ++ [ RawInline fmt $
                                    "<p style='text-align:right !important;" ++
                                    "text-indent:0 !important;" ++
                                    "position:relative;top:-1em'>&#9632;</p>" ]
    _ -> return b
qed x = return x

main :: IO ()
main = toJSONFilter qed
{'fraction_non_alphanumeric': 0.1403973509933775, 'fraction_numerical': 0.007947019867549669, 'mean_word_length': 2.0119521912350598, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4576093', 'n_tokens_mistral': 249, 'n_tokens_neox': 240, 'n_words': 70}