From 5de898d7a2d043a726d16a8e3adf77b0c56fc709 Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Sun, 22 Nov 2020 10:31:04 +0100 Subject: [PATCH] removed archive --- Shakefile.hs | 43 ++++++++++++++++++------- engine/org2gemini.sh | 20 ++++++++++-- engine/org2gemini_step1.sh | 9 ++++-- src/about-me.org | 34 +++++++++++--------- src/demo.org | 1 - src/index.org | 64 -------------------------------------- templates/menu.mustache | 1 - 7 files changed, 75 insertions(+), 97 deletions(-) delete mode 100644 src/index.org diff --git a/Shakefile.hs b/Shakefile.hs index ef59bad..b9370d6 100644 --- a/Shakefile.hs +++ b/Shakefile.hs @@ -113,13 +113,10 @@ getBlogpostFromMetas path toc pandoc@(Pandoc meta _) = do inlineToTxt (Str t) = t inlineToTxt _ = "" - - sortByPostDate :: [BlogPost] -> [BlogPost] sortByPostDate = sortBy (\a b-> compare (postDate b) (postDate a)) - build :: FilePath -> FilePath build = () siteDir @@ -145,7 +142,7 @@ buildRules = do let asset = dropDirectory1 out case (takeExtension asset) of ".html" -> do - if out == siteDir "archive.html" + if out == siteDir "index.html" then buildArchive getPosts getTemplate out else genHtmlAction getPost getTemplate out ".pdf" -> do @@ -157,7 +154,7 @@ buildRules = do fileExists <- doesFileExist (srcDir asset) if fileExists then copyFileChanged (srcDir asset) out - else if out == siteDir "archive.gmi" + else if out == siteDir "index.gmi" then buildGeminiArchive getPosts out else genGeminiAction out ".jpg" -> compressImage asset @@ -169,6 +166,11 @@ buildRules = do needAll command_[] "engine/pre-deploy.sh" [] +welcomeTxt :: Text +welcomeTxt = toS $ T.intercalate "\n" $ + [ "Welcome to my small place on the Internet." + ] + buildArchive :: (() -> Action [BlogPost]) -> (FilePath -> Action Template) -> [Char] -> Action () @@ -178,9 +180,9 @@ buildArchive getPosts getTemplate out = do need $ css <> map postSrc posts let title :: Text - title = "#+title: Posts" + title = "#+title: Yann Esposito's blog" articleList = toS $ T.intercalate "\n" $ map postInfo posts - fileContent = title <> "\n\n" <> articleList + fileContent = title <> "\n\n" <> welcomeTxt <> "\n\n" <> articleList eitherResult <- liftIO $ Pandoc.runIO $ Readers.readOrg (def { readerStandalone = True }) (toS fileContent) bp <- case eitherResult of Left _ -> fail "BAD" @@ -198,6 +200,18 @@ buildArchive getPosts getTemplate out = do ] writeFile' out (toS htmlContent) +geminiMenu :: Text +geminiMenu = T.intercalate "\n" + [ "=> /index.gmi Home" + , "=> /gem-atom.xml Feed" + , "=> /slides.gmi Slides" + , "=> /about-me.gmi About" + , "" + , "=> https://gitea.esy.fun code" + , "=> https://espial.esy.fun/u:yogsototh bookmarks" + , "=> https://espial.esy.fun/u:yogsototh/notes notes" + ] + buildGeminiArchive :: (() -> Action [BlogPost]) -> [Char] -> Action () @@ -206,9 +220,12 @@ buildGeminiArchive getPosts out = do need $ map postSrc posts let title :: Text - title = "# Posts" + title = "# Yann Esposito's posts" articleList = toS $ T.intercalate "\n" $ map postGeminiInfo posts - fileContent = title <> "\n\n" <> articleList + fileContent = title + <> "\n\n" <> welcomeTxt + <> "\n\n" <> articleList + <> "\n\n" <> geminiMenu writeFile' out (toS fileContent) postGeminiInfo :: BlogPost -> Text @@ -253,6 +270,7 @@ postamble now bp = , "@@html:Any comment? Click on my email below and I'll add it.@@" , "" , "| author | @@html:@@ [[mailto:Yann Esposito ?subject=yblog: " <> (postTitle bp) <> "][Yann Esposito ]] @@html:@@ |" + , "| gpg | [[file:files/publickey.txt][CB420F8005F1A662]] |" , "| tags | " <> T.intercalate " " (map ("#"<>) (postTags bp)) <> " |" , "| date | " <> postDate bp <> " |" , "| rss | [[file:/rss.xml][RSS]] ([[https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fher.esy.fun%2Frss.xml][validate]]) |" @@ -382,7 +400,7 @@ allGeminiAction :: Action () allGeminiAction = do allOrgFiles <- getDirectoryFiles srcDir ["//*.org"] let allGeminiFiles = map (-<.> "gmi") allOrgFiles - need (map build $ allGeminiFiles <> ["archive.gmi"]) + need (map build $ allGeminiFiles <> ["index.gmi"]) compressImage :: FilePath -> Action () compressImage img = do @@ -400,15 +418,16 @@ compressImage img = do , "-quality","85" , "-define","filter:blur=0.75" , "-filter","Gaussian" - , "-ordered-dither","o4x4,4" + -- , "-ordered-dither","o4x4,4" , dst ] needFast :: Action () needFast = do allAssets <- filter (/= ".DS_Store") <$> getDirectoryFiles srcDir ["**"] - need (map build $ allAssets <> ["archive.html"]) + need (map build $ allAssets <> ["index.html"]) allHtmlAction + allGeminiAction fastRule :: Rules () fastRule = diff --git a/engine/org2gemini.sh b/engine/org2gemini.sh index bfac9b8..ce49a5a 100755 --- a/engine/org2gemini.sh +++ b/engine/org2gemini.sh @@ -6,5 +6,21 @@ src="$1" dst="$2" ./engine/org2gemini_step1.sh "$src" | \ - perl -pe 's#\[\[([^]]*)\]\[([^]]*)\]\]#\n=> $1 $2#g;s#=> file:([^ ]*)\.org#=> $1.gmi#g;s#\[\[(file:)?([^]]*)\]\]#=> $2#g;' | \ - perl -pe 's#^\* *\n##' > "$dst" + perl -pe 's#^email:\s+yann\@esposito.host\s*#$&=> /files/publickey.txt gpg\n#g;' | \ + perl -pe 's#\[\[([^]]*)\]\[([^]]*)\]\]#\n=> $1 $2#g;' | \ + perl -pe 's#=> file:([^ ]*)\.org#=> $1.gmi#g;' | \ + perl -pe 's#\[\[(file:)?([^]]*)\]\]#=> $2#g;' | \ + perl -pe 's#^\* *\n##' | \ + perl -pe 's#^\**[ ]*:.*:$##' | \ + perl -pe 's#^\s[- ]*$##;' > "$dst" + +{ echo "" + echo "=> /index.gmi Home" + echo "=> /gem-atom.xml Feed" + echo "=> /slides.gmi Slides" + echo "=> /about-me.gmi About" + echo "" + echo "=> https://gitea.esy.fun code" + echo "=> https://espial.esy.fun/u:yogsototh bookmarks" + echo "=> https://espial.esy.fun/u:yogsototh/notes notes" +} >> "$dst" diff --git a/engine/org2gemini_step1.sh b/engine/org2gemini_step1.sh index 3450c1c..44d9ecb 100755 --- a/engine/org2gemini_step1.sh +++ b/engine/org2gemini_step1.sh @@ -6,15 +6,17 @@ BEGIN { IGNORECASE=1; } /^#\+(BEGIN|END)_SRC ?/i { gsub(/#\+(BEGIN|END)_SRC ?/,"```"); } /^#\+(BEGIN|END)_[^ ]* ?/i { gsub(/#\+(BEGIN|END)_([^ ]*) ?/,"______"); } + +/^#\+(macro|lang|language|options|startup):/ { skip=1; } +/{{{br}}}/ { gsub(/{{{br}}}/,""); } +/{{{pemail}}}/ { gsub(/{{{pemail}}}/,"yann@esposito.host"); } + /^#\+TITLE: / { gsub(/^#[^:]*: /,"# "); } /^ *:[a-zA-Z_0-9]*:/ { skip=1; } /^\* / { gsub(/^\* /,"# "); } /^\*\* / { gsub(/^\*\* /,"## "); } /^\*\*\* / { gsub(/^\*\*\* /,"### "); } -/^#\+(macro|lang|language|options|startup):/ { skip=1; } -/{{{br}}}/ { gsub(/{{{br}}}/,""); } -/{{{pemail}}}/ { gsub(/{{{pemail}}}/,"yann@esposito.host"); } /@@html:/ { htmlskip = 1; } !skip && /^#\+([^:]*):/ { @@ -29,3 +31,4 @@ BEGIN { IGNORECASE=1; } print; } /@@/ && !/@@html:/ { htmlskip = 0; } +/@@$/ { htmlskip = 0; } diff --git a/src/about-me.org b/src/about-me.org index f46ae95..5cf2833 100644 --- a/src/about-me.org +++ b/src/about-me.org @@ -9,7 +9,6 @@ @@html:@@ #+begin_notes -*Sorry for the late reply.* - +If you are still waiting a reply from me. +Don't take it personally. After reading Digital Minimalism[fn:dm] I decided to drastically protect myself against most real-time notifications. I try to look at my email everyday. -But sometime a few days could go without me checking them. +But it is not unusual I can skip a few days without checking any notification. So I'll answer, it can just take a lot of time. @@ -44,17 +43,24 @@ This will certainly be the best way for me to notice you among notifications. #+MACRO: pemail @@html: Yann Esposito <yann@esposito.host>@@ -| email | {{{pemail}}} | -| gpg | [[file:files/publickey.txt][CB420F8005F1A662]] | +- email: {{{pemail}}} +- gpg: [[file:files/publickey.txt][CB420F8005F1A662]] -| | self-hosted | web | -|----------------+------------------+----------------------| -| programs | [[https://gitea.esy.fun/yogsototh][gitea.esy.fun]] | [[https://github.com/yogsototh][github/yogsototh]] | -| bookmarks | [[https://espial.esy.fun/u:yogsototh][espial.esy.fun]] | [[https://pinboard.in/u:yogsototh][pinboard/u:yogsototh]] | -| microblog | [[https://espial.esy.fun/u:yogsototh/notes][espial.esy.fun]] | [[https://twitter.com/yogsototh][twitter/@yogsototh]] | -| lobste.rs | . . . . . . . . | [[https://lobste.rs/u/yogsototh][/u/yogsototh]] | -| reddit | . . . . . . . . | [[https://reddit.com/u/yogsototh][/u/yogsototh]] | -| stack overflow | . . . . . . . . | [[https://stackoverflow.com/users/40569/yogsototh][yogsototh]] | +** Social +:PROPERTIES: +:CUSTOM_ID: social +:END: + +- github: [[https://github.com/yogsototh][github/yogsototh]] +- my bookmarks: [[https://pinboard.in/u:yogsototh][pinboard/u:yogsototh]] +- microblog: [[https://twitter.com/yogsototh][@yogsototh]] +- lobste.rs: [[https://lobste.rs/u/yogsototh][/u/yogsototh]] + +With some self-hosted alternatives: + +- code: [[https://gitea.esy.fun/yogsototh][gitea.esy.fun]] +- bookmarks: [[https://espial.esy.fun/u:yogsototh][espial.esy.fun]] +- microblog: [[https://espial.esy.fun/u:yogsototh/notes][espial.esy.fun]] * Who am I? :PROPERTIES: diff --git a/src/demo.org b/src/demo.org index e80b366..645fa46 100644 --- a/src/demo.org +++ b/src/demo.org @@ -8,7 +8,6 @@ @@html: