backend-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

Language.Ltml.HTML.Util

Synopsis

ID Conversion

intToLower :: Int -> String Source #

Converts Int to corresponding lowercase letter in the alphabet. If Int is (0) or (= 27), it returns "?"

Examples

Expand
>>> intToLower 0
"?"
>>> intToLower 1
"a"
>>> intToLower 26
"z"
>>> intToLower 27
"a"

intToCapital :: Int -> String Source #

Converts Int to corresponding capital letter in the alphabet. If Int is (0) or (= 27), it returns "?"

Examples

Expand
>>> intToCapital 0
"?"
>>> intToCapital 1
"A"
>>> intToCapital 26
"Z"
>>> intToCapital 27
"A"

iToT :: Int -> Text Source #

Converts Int to Text

Monad Helpers

whenJust :: Applicative m => Maybe a -> (a -> m ()) -> m () Source #

If maybe value is Nothing returns (), else passes a into function

mapState :: Monad m => (s -> a -> m s) -> s -> [a] -> m () Source #

Applies functions to every item in the list and chains those calls together by propagating the state s from left to right; the final state is dropped

withModified :: MonadState GlobalState m => (GlobalState -> a) -> (GlobalState -> a -> GlobalState) -> a -> m b -> m b Source #

Saves state field and modifies it with a new temporary value for the span of the given monadic action (like local); restores old state field afterwards

nothingA2 :: Monad m => a -> b -> m () Source #

Ignores both arguments and does nothing; except returning ()

HTML Conversion

convertNewLine :: String -> Html () Source #

Replaces every 'n' with HTML br while maintaining toHtml input sanitization

Lucid Attributes

mId_ :: Maybe Label -> Attributes Source #

Adds Label as id, if it exists

mTextId_ :: Maybe Text -> Attributes Source #

Adds Text as id, if it exists

ToHtmlM Helpers

getNextRawTextTree :: [TextTree lbrk fnref style enum special] -> ([TextTree lbrk fnref style enum special], [TextTree lbrk fnref style enum special]) Source #

Splits list into raw text part until next enumeration (raw is everything except enums)

isSuper :: SectionBody -> Bool Source #

Is given section a super-section? (has sections as children)

isInserted :: SectionFormat -> Bool Source #

Is given Section an inserted Section?

FilePaths

disjointRelative :: FilePath -> FilePath -> FilePath Source #

Creates relative path from base to target; Will introduce ".." and should only be used for disjoint base and target paths; otherwise use makeRelative

Textual Headings

headingText :: [HeadingTextTree] -> Delayed Text Source #

Generate raw textual title from HeadingTextTree; Note: Footnotes are skipped and check for undefined Labels before using this function.