html-presentation-text (empty) → 0.1.0.0
raw patch · 5 files changed
+108/−0 lines, 5 filesdep +basedep +cli-argumentsdep +lists-flinessetup-changed
Dependencies added: base, cli-arguments, lists-flines
Files
- CHANGELOG.md +5/−0
- LICENSE +20/−0
- Main.hs +55/−0
- Setup.hs +2/−0
- html-presentation-text.cabal +26/−0
+ CHANGELOG.md view
@@ -0,0 +1,5 @@+# Revision history for html-presentation-text++## 0.1.0.0 -- 2022-01-18++* First version. Released on an unsuspecting world.
+ LICENSE view
@@ -0,0 +1,20 @@+Copyright (c) 2022 OleksandrZhabenko++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be included+in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ Main.hs view
@@ -0,0 +1,55 @@+-- |+-- Module : Main+-- Copyright : (c) OleksandrZhabenko 2022+-- License : MIT+-- Stability : Experimental+-- Maintainer : olexandr543@yahoo.com+--+-- Simple tool to create html presentation for text. The html and css template is taken from different tutorials+-- in the Internet (with changes). The idea is to post some text on the background partially transparent image.++module Main where++import Data.Lists.FLines (newLineEnding)+import System.Environment (getArgs)+import CLI.Arguments+import CLI.Arguments.Parsing+import CLI.Arguments.Get+import Data.Monoid (mconcat,mappend)++main :: IO ()+main = do+ args <- getArgs+ let argsB = fst . takeBsR bSpecs $ args+ file = mconcat . getB "f" $ argsB+ image = mconcat . getB "i" $ argsB+ header = (\ts -> if null ts then "Заголовок" else ts) . mconcat . getB "h" $ argsB+ top = (\ts -> if null ts then "20" else ts) . mconcat . getB "t" $ argsB+ right = (\ts -> if null ts then "20" else ts) . mconcat . getB "r" $ argsB+ paddingleftright = (\ts -> if null ts then "15" else ts) . mconcat . getB "p" $ argsB+ fontsize = (\ts -> if null ts then "100" else ts) . mconcat . getB "s" $ argsB+ opacity = (\ts -> if null ts then "0.5" else ts) . mconcat . getB "o" $ argsB+ width = (\ts -> if null ts then "1080" else ts) . mconcat . getB "w" $ argsB+ maxwidth = (\ts -> if null ts then "100" else ts) . mconcat . getB "m" $ argsB+ 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 ["<!DOCTYPE html>", newLineEnding, "<html>", newLineEnding,+ "<head>", newLineEnding, "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">",+ newLineEnding, "<style>", newLineEnding, ".container {", newLineEnding, " position: relative;",+ newLineEnding, " font-family: Helvetica, sans-serif;", newLineEnding, "}", newLineEnding, newLineEnding,+ ".text-block {", newLineEnding, " position: absolute;", newLineEnding, " top: ", top, "px;",+ newLineEnding, " right: ", right, "px;", newLineEnding, " background-color: ",+ backgroundcolor, ";", newLineEnding, " color: ",+ color, ";", newLineEnding, " line-height: 161.8%;", newLineEnding,+ " padding-left: ", paddingleftright, "px;", newLineEnding, " padding-right: ", paddingleftright,+ "px;", newLineEnding, " font-size: ", fontsize, "%;", newLineEnding, "}", newLineEnding, "</style>",+ newLineEnding, "</head>", newLineEnding, "<body>", newLineEnding, "", newLineEnding, "<h2>", header,+ "</h2>", newLineEnding, "<div class=\"container\">", newLineEnding, " <img src=", show image, " alt=",+ show header, " style=\"opacity: ", opacity, "; max-width: ", maxwidth, "%;\">", newLineEnding,+ " <div class=\"text-block\">", newLineEnding, " <h4>", header, "</h4>", newLineEnding, " <p>",+ newLineEnding] `mappend` lineS `mappend` mconcat [" </p>", newLineEnding, " </div>", newLineEnding,+ "</div>", newLineEnding, "", newLineEnding, "</body>", newLineEnding, "</html>", newLineEnding]++bSpecs = zip ["f","i","h","t","r","p","s","o","w","m","b","c"] . cycle $ [1]
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ html-presentation-text.cabal view
@@ -0,0 +1,26 @@+cabal-version: >=1.10+-- Initial package description 'html-presentation-text.cabal' generated by+-- 'cabal init'. For further documentation, see+-- http://haskell.org/cabal/users-guide/++name: html-presentation-text+version: 0.1.0.0+synopsis: Simple tool to create html presentation for text.+description: The html and css template is taken from different tutorials in the Internet (with changes). The idea is to post some text on the background partially transparent image.+-- bug-reports:+license: MIT+license-file: LICENSE+author: OleksandrZhabenko+maintainer: olexandr543@yahoo.com+copyright: 2022 Oleksandr Zhabenko+category: Web+build-type: Simple+extra-source-files: CHANGELOG.md++executable htmlpt+ main-is: Main.hs+ -- other-modules:+ -- other-extensions:+ build-depends: base >=4.8 && <5, lists-flines >=0.1.1 && <1, cli-arguments >=0.6 && <1+ -- hs-source-dirs:+ default-language: Haskell2010