From 331195b0d690d89d43e7eca9565ea2b013e87f25 Mon Sep 17 00:00:00 2001 From: Miguel Date: Sun, 17 Mar 2019 13:34:44 +0100 Subject: many things --- .../00_pandoc_colors/index.md | 20 ++++ .../00_pandoc_colors/index_breezedark.html | 117 +++++++++++++++++++++ .../00_pandoc_colors/index_espresso.html | 113 ++++++++++++++++++++ .../00_pandoc_colors/index_haddock.html | 109 +++++++++++++++++++ .../00_pandoc_colors/index_kate.html | 117 +++++++++++++++++++++ .../00_pandoc_colors/index_monochrome.html | 96 +++++++++++++++++ .../00_pandoc_colors/index_pygments.html | 114 ++++++++++++++++++++ .../00_pandoc_colors/index_tango.html | 113 ++++++++++++++++++++ .../00_pandoc_colors/index_zenburn.html | 113 ++++++++++++++++++++ .../00200_Estatico-Page-Maker/index.md | 23 ++-- 10 files changed, 926 insertions(+), 9 deletions(-) create mode 100644 080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index.md create mode 100644 080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_breezedark.html create mode 100644 080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_espresso.html create mode 100644 080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_haddock.html create mode 100644 080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_kate.html create mode 100644 080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_monochrome.html create mode 100644 080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_pygments.html create mode 100644 080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_tango.html create mode 100644 080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_zenburn.html (limited to '080_blog/00040_Haskell/00200_Estatico-Page-Maker') diff --git a/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index.md b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index.md new file mode 100644 index 0000000..5060081 --- /dev/null +++ b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index.md @@ -0,0 +1,20 @@ +# Pandoc Color Themes + +Color-themes for syntax-highlighting obtained from Pandoc. +E.g. To get the pygments theme you need to have some source-code embedded +in your markdown and run: + + stack exec pandoc -- -s file.md --highlight-style pygments + +Then you can extract the css from the resulting standalone html file. +Here you can find my extracted html files for reference: + +* [breezedark](index_breezedark.html) +* [espresso](index_espresso.html) +* [haddock](index_haddock.html) +* [kate](index_kate.html) +* [monochrome](index_monochrome.html) +* [pygments](index_pygments.html) +* [tango](index_tango.html) +* [zenburn](index_zenburn.html) + diff --git a/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_breezedark.html b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_breezedark.html new file mode 100644 index 0000000..6b89b97 --- /dev/null +++ b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_breezedark.html @@ -0,0 +1,117 @@ + + + + + + + index + + + + + +
import Data.Array.Base(unsafeAt)
+import Data.Bits(shiftL,shiftR,(.&.))
+import Foreign.Ptr (plusPtr)
+import Foreign.Storable (peek, poke)
+import Foreign.ForeignPtr (withForeignPtr)
+import System.IO.Unsafe (unsafePerformIO)
+
+-- |Perform base64 encoding of data from standard input
+main :: IO()
+main = BL.getContents>>=BL.putStr.BL.fromChunks.map encode64.reChunk.BL.toChunks
+
+-- |Base64 index table 
+tab64 :: UArray Word32 Word8
+tab64 = array (0,63) $ zip [0..] $ map (BI.c2w) $ 
+        ['A'..'Z']++['a'..'z']++['0'..'9']++['+','/']
+
+-- |Encodes 3 octets into 4 sextets
+enc64 :: (Word8,Word8,Word8)->(Word8,Word8,Word8,Word8)
+enc64 (b1,b2,b3) = (t 3,t 2,t 1,t 0)
+    where t x   = tab64 `unsafeAt` (n `shiftR` (x*6) .&. 63)
+          f b n = fromIntegral b `shiftL` n
+          n     = f b1 16 + f b2 8 + f b3 0
+
+-- |Transforms list of ByteStrings to a new list of ByteStrings with 
+-- lengths guaranteed to be multiples of 3 (excepting the last one)
+-- Assumes that all input ByteStrings (excepting the last one) have 
+-- at least a length of 3.
+reChunk :: [BS.ByteString] -> [BS.ByteString]
+reChunk (y:[]) = [y]
+reChunk (y:z:zs) = let c = BS.length y `mod` 3 
+                    in BS.append y (BS.take 3 z):(reChunk $ (BS.drop 3 z):zs)
+ + diff --git a/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_espresso.html b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_espresso.html new file mode 100644 index 0000000..6b0d627 --- /dev/null +++ b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_espresso.html @@ -0,0 +1,113 @@ + + + + + + + index + + + + + +
import Data.Array.Base(unsafeAt)
+import Data.Bits(shiftL,shiftR,(.&.))
+import Foreign.Ptr (plusPtr)
+import Foreign.Storable (peek, poke)
+import Foreign.ForeignPtr (withForeignPtr)
+import System.IO.Unsafe (unsafePerformIO)
+
+-- |Perform base64 encoding of data from standard input
+main :: IO()
+main = BL.getContents>>=BL.putStr.BL.fromChunks.map encode64.reChunk.BL.toChunks
+
+-- |Base64 index table 
+tab64 :: UArray Word32 Word8
+tab64 = array (0,63) $ zip [0..] $ map (BI.c2w) $ 
+        ['A'..'Z']++['a'..'z']++['0'..'9']++['+','/']
+
+-- |Encodes 3 octets into 4 sextets
+enc64 :: (Word8,Word8,Word8)->(Word8,Word8,Word8,Word8)
+enc64 (b1,b2,b3) = (t 3,t 2,t 1,t 0)
+    where t x   = tab64 `unsafeAt` (n `shiftR` (x*6) .&. 63)
+          f b n = fromIntegral b `shiftL` n
+          n     = f b1 16 + f b2 8 + f b3 0
+
+-- |Transforms list of ByteStrings to a new list of ByteStrings with 
+-- lengths guaranteed to be multiples of 3 (excepting the last one)
+-- Assumes that all input ByteStrings (excepting the last one) have 
+-- at least a length of 3.
+reChunk :: [BS.ByteString] -> [BS.ByteString]
+reChunk (y:[]) = [y]
+reChunk (y:z:zs) = let c = BS.length y `mod` 3 
+                    in BS.append y (BS.take 3 z):(reChunk $ (BS.drop 3 z):zs)
+ + diff --git a/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_haddock.html b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_haddock.html new file mode 100644 index 0000000..5c5af29 --- /dev/null +++ b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_haddock.html @@ -0,0 +1,109 @@ + + + + + + + index + + + + + +
import Data.Array.Base(unsafeAt)
+import Data.Bits(shiftL,shiftR,(.&.))
+import Foreign.Ptr (plusPtr)
+import Foreign.Storable (peek, poke)
+import Foreign.ForeignPtr (withForeignPtr)
+import System.IO.Unsafe (unsafePerformIO)
+
+-- |Perform base64 encoding of data from standard input
+main :: IO()
+main = BL.getContents>>=BL.putStr.BL.fromChunks.map encode64.reChunk.BL.toChunks
+
+-- |Base64 index table 
+tab64 :: UArray Word32 Word8
+tab64 = array (0,63) $ zip [0..] $ map (BI.c2w) $ 
+        ['A'..'Z']++['a'..'z']++['0'..'9']++['+','/']
+
+-- |Encodes 3 octets into 4 sextets
+enc64 :: (Word8,Word8,Word8)->(Word8,Word8,Word8,Word8)
+enc64 (b1,b2,b3) = (t 3,t 2,t 1,t 0)
+    where t x   = tab64 `unsafeAt` (n `shiftR` (x*6) .&. 63)
+          f b n = fromIntegral b `shiftL` n
+          n     = f b1 16 + f b2 8 + f b3 0
+
+-- |Transforms list of ByteStrings to a new list of ByteStrings with 
+-- lengths guaranteed to be multiples of 3 (excepting the last one)
+-- Assumes that all input ByteStrings (excepting the last one) have 
+-- at least a length of 3.
+reChunk :: [BS.ByteString] -> [BS.ByteString]
+reChunk (y:[]) = [y]
+reChunk (y:z:zs) = let c = BS.length y `mod` 3 
+                    in BS.append y (BS.take 3 z):(reChunk $ (BS.drop 3 z):zs)
+ + diff --git a/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_kate.html b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_kate.html new file mode 100644 index 0000000..03aa0c6 --- /dev/null +++ b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_kate.html @@ -0,0 +1,117 @@ + + + + + + + index + + + + + +
import Data.Array.Base(unsafeAt)
+import Data.Bits(shiftL,shiftR,(.&.))
+import Foreign.Ptr (plusPtr)
+import Foreign.Storable (peek, poke)
+import Foreign.ForeignPtr (withForeignPtr)
+import System.IO.Unsafe (unsafePerformIO)
+
+-- |Perform base64 encoding of data from standard input
+main :: IO()
+main = BL.getContents>>=BL.putStr.BL.fromChunks.map encode64.reChunk.BL.toChunks
+
+-- |Base64 index table 
+tab64 :: UArray Word32 Word8
+tab64 = array (0,63) $ zip [0..] $ map (BI.c2w) $ 
+        ['A'..'Z']++['a'..'z']++['0'..'9']++['+','/']
+
+-- |Encodes 3 octets into 4 sextets
+enc64 :: (Word8,Word8,Word8)->(Word8,Word8,Word8,Word8)
+enc64 (b1,b2,b3) = (t 3,t 2,t 1,t 0)
+    where t x   = tab64 `unsafeAt` (n `shiftR` (x*6) .&. 63)
+          f b n = fromIntegral b `shiftL` n
+          n     = f b1 16 + f b2 8 + f b3 0
+
+-- |Transforms list of ByteStrings to a new list of ByteStrings with 
+-- lengths guaranteed to be multiples of 3 (excepting the last one)
+-- Assumes that all input ByteStrings (excepting the last one) have 
+-- at least a length of 3.
+reChunk :: [BS.ByteString] -> [BS.ByteString]
+reChunk (y:[]) = [y]
+reChunk (y:z:zs) = let c = BS.length y `mod` 3 
+                    in BS.append y (BS.take 3 z):(reChunk $ (BS.drop 3 z):zs)
+ + diff --git a/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_monochrome.html b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_monochrome.html new file mode 100644 index 0000000..60c229d --- /dev/null +++ b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_monochrome.html @@ -0,0 +1,96 @@ + + + + + + + index + + + + + +
import Data.Array.Base(unsafeAt)
+import Data.Bits(shiftL,shiftR,(.&.))
+import Foreign.Ptr (plusPtr)
+import Foreign.Storable (peek, poke)
+import Foreign.ForeignPtr (withForeignPtr)
+import System.IO.Unsafe (unsafePerformIO)
+
+-- |Perform base64 encoding of data from standard input
+main :: IO()
+main = BL.getContents>>=BL.putStr.BL.fromChunks.map encode64.reChunk.BL.toChunks
+
+-- |Base64 index table 
+tab64 :: UArray Word32 Word8
+tab64 = array (0,63) $ zip [0..] $ map (BI.c2w) $ 
+        ['A'..'Z']++['a'..'z']++['0'..'9']++['+','/']
+
+-- |Encodes 3 octets into 4 sextets
+enc64 :: (Word8,Word8,Word8)->(Word8,Word8,Word8,Word8)
+enc64 (b1,b2,b3) = (t 3,t 2,t 1,t 0)
+    where t x   = tab64 `unsafeAt` (n `shiftR` (x*6) .&. 63)
+          f b n = fromIntegral b `shiftL` n
+          n     = f b1 16 + f b2 8 + f b3 0
+
+-- |Transforms list of ByteStrings to a new list of ByteStrings with 
+-- lengths guaranteed to be multiples of 3 (excepting the last one)
+-- Assumes that all input ByteStrings (excepting the last one) have 
+-- at least a length of 3.
+reChunk :: [BS.ByteString] -> [BS.ByteString]
+reChunk (y:[]) = [y]
+reChunk (y:z:zs) = let c = BS.length y `mod` 3 
+                    in BS.append y (BS.take 3 z):(reChunk $ (BS.drop 3 z):zs)
+ + diff --git a/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_pygments.html b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_pygments.html new file mode 100644 index 0000000..e637f29 --- /dev/null +++ b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_pygments.html @@ -0,0 +1,114 @@ + + + + + + + index + + + + + +
import Data.Array.Base(unsafeAt)
+import Data.Bits(shiftL,shiftR,(.&.))
+import Foreign.Ptr (plusPtr)
+import Foreign.Storable (peek, poke)
+import Foreign.ForeignPtr (withForeignPtr)
+import System.IO.Unsafe (unsafePerformIO)
+
+-- |Perform base64 encoding of data from standard input
+main :: IO()
+main = BL.getContents>>=BL.putStr.BL.fromChunks.map encode64.reChunk.BL.toChunks
+
+-- |Base64 index table 
+tab64 :: UArray Word32 Word8
+tab64 = array (0,63) $ zip [0..] $ map (BI.c2w) $ 
+        ['A'..'Z']++['a'..'z']++['0'..'9']++['+','/']
+
+-- |Encodes 3 octets into 4 sextets
+enc64 :: (Word8,Word8,Word8)->(Word8,Word8,Word8,Word8)
+enc64 (b1,b2,b3) = (t 3,t 2,t 1,t 0)
+    where t x   = tab64 `unsafeAt` (n `shiftR` (x*6) .&. 63)
+          f b n = fromIntegral b `shiftL` n
+          n     = f b1 16 + f b2 8 + f b3 0
+
+-- |Transforms list of ByteStrings to a new list of ByteStrings with 
+-- lengths guaranteed to be multiples of 3 (excepting the last one)
+-- Assumes that all input ByteStrings (excepting the last one) have 
+-- at least a length of 3.
+reChunk :: [BS.ByteString] -> [BS.ByteString]
+reChunk (y:[]) = [y]
+reChunk (y:z:zs) = let c = BS.length y `mod` 3 
+                    in BS.append y (BS.take 3 z):(reChunk $ (BS.drop 3 z):zs)
+ + diff --git a/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_tango.html b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_tango.html new file mode 100644 index 0000000..f76564b --- /dev/null +++ b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_tango.html @@ -0,0 +1,113 @@ + + + + + + + index + + + + + +
import Data.Array.Base(unsafeAt)
+import Data.Bits(shiftL,shiftR,(.&.))
+import Foreign.Ptr (plusPtr)
+import Foreign.Storable (peek, poke)
+import Foreign.ForeignPtr (withForeignPtr)
+import System.IO.Unsafe (unsafePerformIO)
+
+-- |Perform base64 encoding of data from standard input
+main :: IO()
+main = BL.getContents>>=BL.putStr.BL.fromChunks.map encode64.reChunk.BL.toChunks
+
+-- |Base64 index table 
+tab64 :: UArray Word32 Word8
+tab64 = array (0,63) $ zip [0..] $ map (BI.c2w) $ 
+        ['A'..'Z']++['a'..'z']++['0'..'9']++['+','/']
+
+-- |Encodes 3 octets into 4 sextets
+enc64 :: (Word8,Word8,Word8)->(Word8,Word8,Word8,Word8)
+enc64 (b1,b2,b3) = (t 3,t 2,t 1,t 0)
+    where t x   = tab64 `unsafeAt` (n `shiftR` (x*6) .&. 63)
+          f b n = fromIntegral b `shiftL` n
+          n     = f b1 16 + f b2 8 + f b3 0
+
+-- |Transforms list of ByteStrings to a new list of ByteStrings with 
+-- lengths guaranteed to be multiples of 3 (excepting the last one)
+-- Assumes that all input ByteStrings (excepting the last one) have 
+-- at least a length of 3.
+reChunk :: [BS.ByteString] -> [BS.ByteString]
+reChunk (y:[]) = [y]
+reChunk (y:z:zs) = let c = BS.length y `mod` 3 
+                    in BS.append y (BS.take 3 z):(reChunk $ (BS.drop 3 z):zs)
+ + diff --git a/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_zenburn.html b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_zenburn.html new file mode 100644 index 0000000..f186f69 --- /dev/null +++ b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/00_pandoc_colors/index_zenburn.html @@ -0,0 +1,113 @@ + + + + + + + index + + + + + +
import Data.Array.Base(unsafeAt)
+import Data.Bits(shiftL,shiftR,(.&.))
+import Foreign.Ptr (plusPtr)
+import Foreign.Storable (peek, poke)
+import Foreign.ForeignPtr (withForeignPtr)
+import System.IO.Unsafe (unsafePerformIO)
+
+-- |Perform base64 encoding of data from standard input
+main :: IO()
+main = BL.getContents>>=BL.putStr.BL.fromChunks.map encode64.reChunk.BL.toChunks
+
+-- |Base64 index table 
+tab64 :: UArray Word32 Word8
+tab64 = array (0,63) $ zip [0..] $ map (BI.c2w) $ 
+        ['A'..'Z']++['a'..'z']++['0'..'9']++['+','/']
+
+-- |Encodes 3 octets into 4 sextets
+enc64 :: (Word8,Word8,Word8)->(Word8,Word8,Word8,Word8)
+enc64 (b1,b2,b3) = (t 3,t 2,t 1,t 0)
+    where t x   = tab64 `unsafeAt` (n `shiftR` (x*6) .&. 63)
+          f b n = fromIntegral b `shiftL` n
+          n     = f b1 16 + f b2 8 + f b3 0
+
+-- |Transforms list of ByteStrings to a new list of ByteStrings with 
+-- lengths guaranteed to be multiples of 3 (excepting the last one)
+-- Assumes that all input ByteStrings (excepting the last one) have 
+-- at least a length of 3.
+reChunk :: [BS.ByteString] -> [BS.ByteString]
+reChunk (y:[]) = [y]
+reChunk (y:z:zs) = let c = BS.length y `mod` 3 
+                    in BS.append y (BS.take 3 z):(reChunk $ (BS.drop 3 z):zs)
+ + diff --git a/080_blog/00040_Haskell/00200_Estatico-Page-Maker/index.md b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/index.md index 279c721..fe78da5 100644 --- a/080_blog/00040_Haskell/00200_Estatico-Page-Maker/index.md +++ b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/index.md @@ -1,13 +1,12 @@ + April 2018 # estático - static website generator - April 12, 2018 - -Two weeks ago I decided to switch my website from a well known PHP +A few weeks ago I decided to switch my website from a well known PHP driven CMS solution, to a light and static set of HTML pages. -And so I wrote a simple static website generator in -**Haskell**. Of course I know that there are already hundreds out there, -but I wanted my own masturbatory solution. +And so I wrote ... a simple static website generator in **Haskell**. +Of course I know that there is already plenty out there, but I wanted my +own masturbatory solution. I use **pandoc** et al. for most of the work anyway. @@ -30,7 +29,13 @@ Build it with _stack_ or use the docker images. * * -## Example Usage +## Pandoc Themes + +Here I put together the themes available for syntax-highlighting, extracted +from **pandoc**: [./pandoc\_colors](./pandoc_colors) + +## Example Usage (Docker) + __NOTE: make sure DIR\_OUT exists and is a free directory__ You can use the example websites inside the examples/ directory for a start. @@ -49,7 +54,7 @@ Or if you want to test it locally use some local DIR\_OUT and HTML\_ROOT instead DIR_OUT=/home/miguel/testpage HTML_ROOT=/home/miguel/testpage -The only real life example I know of, is this very page: _idziorek.net_ -You can find it's sources here: +This very page: _idziorek.net_ is a real-world example and you can find +it's sources here: * -- cgit v1.2.3