html-presentation-text 0.2.0.0 → 0.2.1.0
raw patch · 3 files changed
+52/−34 lines, 3 files
Files
- CHANGELOG.md +2/−0
- Main.hs +49/−33
- html-presentation-text.cabal +1/−1
CHANGELOG.md view
@@ -9,4 +9,6 @@ * Second version. Removed the unneeded material because of the license non-compliance with one of the tutorials used. Switched to the author's css and html model. +## 0.2.1.0 -- 2022-01-21 +* Second version revised A. Some code improvements.
Main.hs view
@@ -39,6 +39,7 @@ import CLI.Arguments.Parsing import CLI.Arguments.Get import Data.Monoid (mconcat,mappend)+import Data.List (intercalate) main :: IO () main = do@@ -56,38 +57,53 @@ backgroundcolor = (\ts -> if null ts then "#025abb" else ts) . mconcat . getB "b" $ argsB color = (\ts -> if null ts then "#fed501" else ts) . mconcat . getB "c" $ argsB text <- readFile file- let lineS = concatMap (\xs -> " " `mappend` xs `mappend` "<br>" `mappend` newLineEnding) . lines $ text- appendFile (header ++ ".html") $ mconcat ["<html>", newLineEnding, "<head>", newLineEnding,- "<meta charset=\"UTF-8\">", newLineEnding,- "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">", newLineEnding,- "<title>", header, "</title>", newLineEnding, "<author class=\"author\">",author,"</author>",- newLineEnding, "<style>", newLineEnding, ".header2 {", newLineEnding, " padding-left: 80px;",- newLineEnding, "}", newLineEnding, newLineEnding, ".main-container {", newLineEnding,- " width: 100%;", newLineEnding, " display: flex;", newLineEnding, " direction: row;",- newLineEnding, "}", newLineEnding, "", newLineEnding, ".main-body {", newLineEnding,- " width: ",width,"px;", newLineEnding, "}", newLineEnding, newLineEnding, ".header-container {",- newLineEnding, " width: ",widthH,"%;", newLineEnding, " padding-left: 40px;", newLineEnding,- " padding-right: 20px;", newLineEnding, "}", newLineEnding, "", newLineEnding, ".paragraph {",- newLineEnding, " font-family: Helvetica, sans-serif;",newLineEnding,- " width: ",widthP,"%;", newLineEnding, " padding-left: 40px;", newLineEnding,- " padding-right: 40px;", newLineEnding, " font-weight: 400;", newLineEnding, " font-size: 16pt;",- newLineEnding, " text-align: justify;", newLineEnding,- " line-height: 161.8%;", newLineEnding, " font-size: ", fontsize, "%;", newLineEnding,- " background-color: ",backgroundcolor,";",newLineEnding, " color: ",color,";",newLineEnding,"}",- newLineEnding, newLineEnding,- ".img {", newLineEnding, " opacity: ",opacity,";",newLineEnding,- " width: 200px;", newLineEnding, " padding: 20px;", newLineEnding, "}",- newLineEnding, "", newLineEnding, ".author {", newLineEnding, " font-size: 18pt;", newLineEnding,- " font-weight: 500;", newLineEnding, "}", newLineEnding, "</style>", newLineEnding, "</head>",- newLineEnding, "<body>", newLineEnding, " <div class=\"main-container\">", newLineEnding,- " <header>", newLineEnding, " <div class=\"header-container\">", newLineEnding,- " <img class=\"img\" src=",image,">", newLineEnding, " </div>", newLineEnding,- " </header>", newLineEnding, " <div class=\"main-body\">", newLineEnding,- " <div style=\"justify-content: center;\">", newLineEnding,- " <h2 class=\"header2\">",header,"</h2>", newLineEnding,- " <p class=\"paragraph\">", newLineEnding] `mappend` lineS `mappend`- mconcat [" </p>", newLineEnding,- " </div>", newLineEnding, " </div>", newLineEnding, " </div>", newLineEnding,- "</body>", newLineEnding, "</html>", newLineEnding]+ let lineS = concatMap (\xs -> mconcat [" ", xs, "<br>", newLineEnding]) . lines $ text+ appendFile (header `mappend` ".html") . {-+ mconcat $ [intercalate newLineEnding ["<html>", "<head>",+ "<meta charset=\"UTF-8\">", "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">",+ "<title>"], header, intercalate newLineEnding ["</title>", "<author class=\"author\">"]+ , author, intercalate newLineEnding ["</author>", "<style>", ".header2 {",+ " padding-left: 80px;", "}", ".main-container {", " width: 100%;", " display: flex;",+ " direction: row;", "}", "", ".main-body {", " width: "], width,+ intercalate newLineEnding ["px;", "}", "", ".header-container {", " width: "], widthH,+ intercalate newLineEnding ["%;", " padding-left: 40px;", " padding-right: 20px;", "}", "", ".paragraph {",+ " font-family: Helvetica, sans-serif;", " width: "], widthP,+ intercalate newLineEnding ["%;", " padding-left: 40px;", " padding-right: 40px;",+ " font-weight: 400;", " font-size: 16pt;", " text-align: justify;", " line-height: 161.8%;",+ " font-size: "], fontsize, intercalate newLineEnding ["%;", " background-color: "]+ , backgroundcolor, intercalate newLineEnding [";", ""," color: "]+ , color, intercalate newLineEnding [";","}", "", ".img {", " opacity: "]+ , opacity, intercalate newLineEnding [";", " width: 200px;", " padding: 20px;",+ "}", "", ".author {", " font-size: 18pt;", " font-weight: 500;", "}", "</style>", "</head>", "<body>",+ " <div class=\"main-container\">", " <header>", " <div class=\"header-container\">",+ " <img class=\"img\" src="], image, intercalate newLineEnding [">",+ " </div>", " </header>", " <div class=\"main-body\">",+ " <div style=\"justify-content: center;\">", " <h2 class=\"header2\">"]+ , header, intercalate newLineEnding ["</h2>", " <p class=\"paragraph\">",""]+ , lineS, intercalate newLineEnding [" </p>", " </div>",+ " </div>", " </div>", "</body>", "</html>", ""]]+ -} helper1 newLineEnding [header,author,width,widthH,widthP,fontsize,backgroundcolor,color,opacity,image,header,lineS] $ [+ ["<html>", "<head>", "<meta charset=\"UTF-8\">",+ "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">", "<title>"],+ ["</title>", "<author class=\"author\">"], ["</author>", "<style>", ".header2 {",+ " padding-left: 80px;", "}", ".main-container {", " width: 100%;", " display: flex;",+ " direction: row;", "}", "", ".main-body {", " width: "],+ ["px;", "}", "", ".header-container {", " width: "],["%;", " padding-left: 40px;",+ " padding-right: 20px;", "}", "", ".paragraph {", " font-family: Helvetica, sans-serif;",+ " width: "],["%;", " padding-left: 40px;", " padding-right: 40px;",+ " font-weight: 400;", " text-align: justify;", " line-height: 161.8%;",+ " font-size: "],["%;", " background-color: "],[";", " color: "],+ [";","}", "", ".img {", " opacity: "],[";", " width: 200px;", " padding: 20px;",+ "}", "", ".author {", " font-size: 18pt;", " font-weight: 500;", "}", "</style>", "</head>", "<body>",+ " <div class=\"main-container\">", " <header>", " <div class=\"header-container\">",+ " <img class=\"img\" src=\""],["\">"," </div>", " </header>",+ " <div class=\"main-body\">", " <div style=\"justify-content: center;\">",+ " <h2 class=\"header2\">"],["</h2>", " <p class=\"paragraph\">",""],+ [" </p>", " </div>", " </div>", " </div>", "</body>", "</html>", ""]] bSpecs = zip ["f","i","h","a","p","d","s","o","w","b","c"] . cycle $ [1]++helper1 :: [a] -> [[a]] -> [[[a]]] -> [a]+helper1 delim tss@(ys:yss) zsss@(zss:usss) = mconcat [intercalate delim zss, ys, helper1 delim yss usss]+helper1 delim _ (zss:usss) = intercalate delim zss+helper1 _ _ _ = []
html-presentation-text.cabal view
@@ -4,7 +4,7 @@ -- http://haskell.org/cabal/users-guide/ name: html-presentation-text-version: 0.2.0.0+version: 0.2.1.0 synopsis: Simple tool to create html presentation for text. description: The idea is to post some colored text on the background. -- bug-reports: