| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Language.Ltml.HTML.Util
Synopsis
- intToLower :: Int -> String
- intToCapital :: Int -> String
- iToT :: Int -> Text
- whenJust :: Applicative m => Maybe a -> (a -> m ()) -> m ()
- mapState :: Monad m => (s -> a -> m s) -> s -> [a] -> m ()
- withModified :: MonadState GlobalState m => (GlobalState -> a) -> (GlobalState -> a -> GlobalState) -> a -> m b -> m b
- nothingA2 :: Monad m => a -> b -> m ()
- convertNewLine :: String -> Html ()
- mId_ :: Maybe Label -> Attributes
- mTextId_ :: Maybe Text -> Attributes
- getNextRawTextTree :: [TextTree lbrk fnref style enum special] -> ([TextTree lbrk fnref style enum special], [TextTree lbrk fnref style enum special])
- isSuper :: SectionBody -> Bool
- isInserted :: SectionFormat -> Bool
- disjointRelative :: FilePath -> FilePath -> FilePath
- headingText :: [HeadingTextTree] -> Delayed Text
ID Conversion
intToLower :: Int -> String Source #
Converts Int to corresponding lowercase letter in the alphabet. If Int is (0) or (= 27), it returns "?"
Examples
>>>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
>>>intToCapital 0"?"
>>>intToCapital 1"A"
>>>intToCapital 26"Z"
>>>intToCapital 27"A"
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
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.