diff --git a/content/includes/form.html b/content/includes/form.html index 62ffec3..9f14136 100644 --- a/content/includes/form.html +++ b/content/includes/form.html @@ -1,4 +1,4 @@ -
+ diff --git a/content/includes/style.css b/content/includes/style.css index cdec3ae..611319d 100644 --- a/content/includes/style.css +++ b/content/includes/style.css @@ -69,12 +69,16 @@ main p { margin: 1.5em 0; } +main ol, main ul { - list-style-type: square; margin: 1.5em 0; padding: 0 0 0 1em; } +main ul { + list-style-type: square; +} + main blockquote { border-left: thin solid #d3d7cf; margin: 0; @@ -86,7 +90,7 @@ main aside { margin: 1.5em 0; } -main form { +.subscribe { border: thin solid #d3d7cf; display: flex; line-height: 3em; @@ -94,7 +98,7 @@ main form { max-width: 20em; } -main input { +.subscribe input { border: none; font: inherit; padding: 0 0.5em; @@ -102,7 +106,7 @@ main input { min-width: 0; } -main button { +.subscribe button { background: #3465a4; border: none; color: #ffffff; @@ -111,6 +115,26 @@ main button { padding: 0 0.5em; } +.survey .question { + margin: 1.5em 0; +} + +.survey input, +.survey textarea { + font: inherit; +} + +.survey textarea { + display: block; + width: 100%; +} + +.survey ul { + list-style: none; + margin: 0; + padding: 0; +} + footer { border-top: thin solid #d3d7cf; margin: 1.5em 0 3em 0; diff --git a/content/surveys/2017.html b/content/surveys/2017.html new file mode 100644 index 0000000..18f38ba --- /dev/null +++ b/content/surveys/2017.html @@ -0,0 +1,600 @@ +

+ Pssst, don't submit this! + This survey is a work in progress. + It's only here to collect feedback before we publish it. + github.com/haskellweekly/haskellweekly.github.io +

+ + +
    +
  1. + +
  2. + +
  3. + Do you use Haskell? +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
  4. + +
  5. + If you stopped using Haskell, how long did you use it before you stopped? +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
  6. + +
  7. + +
  8. + +
  9. + +
  10. + +
  11. + How long have you been using Haskell? +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
  12. + +
  13. + How frequently do you use Haskell? +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
  14. + +
  15. + How do you primarily use Haskell? +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
  16. + +
  17. + Do you use Haskell at work? +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
  18. + +
  19. + What is the total size of all the Haskell projects you work on? +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
  20. + +
  21. + Which platforms do you develop on? +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
  22. + +
  23. + Which platforms do you target? +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
  24. + +
  25. + Which Haskell compilers do you use? +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
  26. + +
  27. + If you use GHC, how do you install it? +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
  28. + +
  29. + If you use GHC, has upgrading GHC broken your code in the last year? +
      +
    • + +
    • +
    • + +
    • +
    +
  30. + +
  31. + If you use GHC, which versions of it do you use? +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
  32. + +
  33. + Which build tools do you use? +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
  34. + +
  35. + How do you edit Haskell code? +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
  36. + +
  37. + Where do you get packages from? +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
  38. + +
  39. + + + +
  40. + + +
+ + +
diff --git a/content/templates/survey.html b/content/templates/survey.html new file mode 100644 index 0000000..b9aa96b --- /dev/null +++ b/content/templates/survey.html @@ -0,0 +1,7 @@ +
+

+ $title$ +

+ + $body$ +
diff --git a/executables/haskell-weekly.hs b/executables/haskell-weekly.hs index 04e4d69..807f8b7 100644 --- a/executables/haskell-weekly.hs +++ b/executables/haskell-weekly.hs @@ -34,6 +34,7 @@ main = do [ [output] , [output, "images"] , [output, "issues"] + , [output, "surveys"] ] -- Copy over static files. @@ -64,6 +65,7 @@ main = do issueTemplate <- readFileAt [input, "templates", "issue.html"] rssItemTemplate <- readFileAt [input, "templates", "rss-item.xml"] snippetTemplate <- readFileAt [input, "templates", "snippet.html"] + surveyTemplate <- readFileAt [input, "templates", "survey.html"] -- Read page templates. advertisingTemplate <- readFileAt [input, "pages", "advertising.html"] @@ -71,6 +73,16 @@ main = do indexTemplate <- readFileAt [input, "pages", "index.html"] rssTemplate <- readFileAt [input, "pages", "rss.xml"] + -- Read survey templates. + surveyFiles <- listDirectoryAt [input, "surveys"] + surveysByYear <- surveyFiles + & filter (hasExtension "html") + & map FilePath.takeBaseName + & Maybe.mapMaybe Read.readMaybe + & mapM (\ year -> do + template <- readFileAt [input, "surveys", FilePath.addExtension (show year) "html"] + pure (year, template)) + -- Load issues. issueFiles <- listDirectoryAt [input, "issues"] issuesByNumber <- issueFiles @@ -105,6 +117,11 @@ main = do contents <- renderAdvertising baseTemplate advertisingTemplate context writeFileAt [output, "advertising.html"] contents + -- Create survey pages. + Monad.forM_ surveysByYear (\ (year, template) -> do + contents <- renderSurvey baseTemplate surveyTemplate template context year + writeFileAt [output, "surveys", FilePath.addExtension (show year) "html"] contents) + -- Create home page. do contents <- renderIndex baseTemplate indexTemplate snippetTemplate context issues @@ -207,11 +224,29 @@ sortIssues :: [Issue] -> [Issue] sortIssues issues = List.sortBy (Ord.comparing (\ issue -> Ord.Down (issueDay issue))) issues -summary :: Text -summary = - "Haskell Weekly is a free email newsletter about the Haskell programming \ - \language. Each issue features several hand-picked links to interesting \ - \content about Haskell from around the web." +surveyContext :: Integer -> Context +surveyContext year = + [ ("year", showText year) + ] + +surveySummary :: Monad m => Integer -> m Text +surveySummary year = + renderTemplate + "The $year$ survey of Haskell users by Haskell Weekly, a free email \ + \newsletter about the Haskell programming language." + (surveyContext year) + +surveyTitle :: Monad m => Integer -> m Text +surveyTitle year = + renderTemplate + "$year$ survey" + (surveyContext year) + +surveyUrl :: Monad m => Integer -> m Text +surveyUrl year = + renderTemplate + "/surveys/$year$.html" + (surveyContext year) -- Rendering helpers @@ -245,6 +280,12 @@ renderIndex :: Monad m => Text -> Text -> Text -> Context -> [Issue] -> m Text renderIndex baseTemplate template snippetTemplate context issues = do snippets <- mapM (renderSnippet snippetTemplate context) issues body <- renderTemplate template (("issues", mconcat snippets) : context) + let + summary :: Text + summary = + "Haskell Weekly is a free email newsletter about the Haskell \ + \programming language. Each issue features several hand-picked links to \ + \interesting content about Haskell from around the web." renderTemplate baseTemplate (context ++ [ ("body", body) , ("summary", summary) @@ -304,6 +345,24 @@ renderSnippet template context issue = , ("url", issueUrl issue) ]) +renderSurvey :: Monad m => Text -> Text -> Text -> Context -> Integer -> m Text +renderSurvey baseTemplate surveyTemplate template context year = do + partialBody <- renderTemplate template context + partialTitle <- surveyTitle year + body <- renderTemplate surveyTemplate (context ++ + [ ("body", partialBody) + , ("title", partialTitle) + ]) + summary <- surveySummary year + let title = pageTitle (Just partialTitle) + url <- surveyUrl year + renderTemplate baseTemplate (context ++ + [ ("body", body) + , ("summary", summary) + , ("title", title) + , ("url", url) + ]) + renderTemplate :: Monad m => Text -> Context -> m Text renderTemplate template context = renderPieces context (toPieces template)