Skip to content

Commit

Permalink
docs: adding basic configuration for haddock + static site
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanhay committed Oct 12, 2021
1 parent 41c13cc commit dc469be
Show file tree
Hide file tree
Showing 17 changed files with 400 additions and 0 deletions.
211 changes: 211 additions & 0 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
load("@rules_haskell//haskell:defs.bzl", "haskell_doc")
load(
"@build_stack_rules_hugo//hugo:rules.bzl",
"hugo_serve",
"hugo_site",
"hugo_theme",
)

# FIXME: automate, gazelle, genquery, etc.
# The deps attribute is the result of:
# bazel query 'kind("haskell_library", //... -gen/... -test/...)').
haskell_doc(
# Target name is important, otherwise `hugo_site` won't copy over the files
# if they don't have an expected directory prefix. This could be made more
# robust by using `rules_pkg/mappings.bzl:pkg_files` to assemble the directory.
name = "static",
visibility = ["//visibility:public"],
deps = [
"//amazonka",
"//amazonka-alexa-business",
"//amazonka-apigateway",
"//amazonka-apigatewaymanagementapi",
"//amazonka-application-autoscaling",
"//amazonka-appstream",
"//amazonka-appsync",
"//amazonka-athena",
"//amazonka-autoscaling",
"//amazonka-autoscaling-plans",
"//amazonka-batch",
"//amazonka-budgets",
"//amazonka-certificatemanager",
"//amazonka-certificatemanager-pca",
"//amazonka-cloud9",
"//amazonka-clouddirectory",
"//amazonka-cloudformation",
"//amazonka-cloudfront",
"//amazonka-cloudhsm",
"//amazonka-cloudhsmv2",
"//amazonka-cloudsearch",
"//amazonka-cloudsearch-domains",
"//amazonka-cloudtrail",
"//amazonka-cloudwatch",
"//amazonka-cloudwatch-events",
"//amazonka-cloudwatch-logs",
"//amazonka-codebuild",
"//amazonka-codecommit",
"//amazonka-codedeploy",
"//amazonka-codepipeline",
"//amazonka-codestar",
"//amazonka-cognito-identity",
"//amazonka-cognito-idp",
"//amazonka-cognito-sync",
"//amazonka-comprehend",
"//amazonka-config",
"//amazonka-connect",
"//amazonka-cost-explorer",
"//amazonka-cur",
"//amazonka-datapipeline",
"//amazonka-devicefarm",
"//amazonka-directconnect",
"//amazonka-discovery",
"//amazonka-dms",
"//amazonka-ds",
"//amazonka-dynamodb",
"//amazonka-dynamodb-dax",
"//amazonka-dynamodb-streams",
"//amazonka-ec2",
"//amazonka-ecr",
"//amazonka-ecs",
"//amazonka-efs",
"//amazonka-eks",
"//amazonka-elasticache",
"//amazonka-elasticbeanstalk",
"//amazonka-elasticsearch",
"//amazonka-elastictranscoder",
"//amazonka-elb",
"//amazonka-elbv2",
"//amazonka-emr",
"//amazonka-fms",
"//amazonka-gamelift",
"//amazonka-glacier",
"//amazonka-glue",
"//amazonka-greengrass",
"//amazonka-guardduty",
"//amazonka-health",
"//amazonka-iam",
"//amazonka-importexport",
"//amazonka-inspector",
"//amazonka-iot",
"//amazonka-iot-analytics",
"//amazonka-iot-dataplane",
"//amazonka-iot-jobs-dataplane",
"//amazonka-kinesis",
"//amazonka-kinesis-analytics",
"//amazonka-kinesis-firehose",
"//amazonka-kinesis-video",
"//amazonka-kinesis-video-archived-media",
"//amazonka-kinesis-video-media",
"//amazonka-kms",
"//amazonka-lambda",
"//amazonka-lex-models",
"//amazonka-lex-runtime",
"//amazonka-lightsail",
"//amazonka-marketplace-analytics",
"//amazonka-marketplace-entitlement",
"//amazonka-marketplace-metering",
"//amazonka-mechanicalturk",
"//amazonka-mediaconvert",
"//amazonka-medialive",
"//amazonka-mediapackage",
"//amazonka-mediastore",
"//amazonka-mediastore-dataplane",
"//amazonka-migrationhub",
"//amazonka-ml",
"//amazonka-mobile",
"//amazonka-mq",
"//amazonka-opsworks",
"//amazonka-opsworks-cm",
"//amazonka-organizations",
"//amazonka-pinpoint",
"//amazonka-polly",
"//amazonka-pricing",
"//amazonka-qldb",
"//amazonka-rds",
"//amazonka-redshift",
"//amazonka-rekognition",
"//amazonka-resourcegroups",
"//amazonka-resourcegroupstagging",
"//amazonka-route53",
"//amazonka-route53-autonaming",
"//amazonka-route53-domains",
"//amazonka-s3",
"//amazonka-s3-encryption",
"//amazonka-sagemaker",
"//amazonka-sagemaker-runtime",
"//amazonka-sdb",
"//amazonka-secretsmanager",
"//amazonka-serverlessrepo",
"//amazonka-servicecatalog",
"//amazonka-ses",
"//amazonka-sesv2",
"//amazonka-shield",
"//amazonka-sms",
"//amazonka-snowball",
"//amazonka-sns",
"//amazonka-sqs",
"//amazonka-ssm",
"//amazonka-stepfunctions",
"//amazonka-storagegateway",
"//amazonka-sts",
"//amazonka-support",
"//amazonka-swf",
"//amazonka-textract",
"//amazonka-transcribe",
"//amazonka-translate",
"//amazonka-waf",
"//amazonka-waf-regional",
"//amazonka-workdocs",
"//amazonka-workmail",
"//amazonka-workspaces",
"//amazonka-xray",
],
)

genrule(
name = "packages",
srcs = [":static"],
outs = ["data/packages.yaml"],
cmd = """
printf 'haddock:\n' >> $@
for dir in $(locations :static); do
dir="$${dir##*/}"
pkg="$${dir%ZS*}"
if [[ $$pkg != amazonka* ]]; then
continue
fi
printf ' %s: %s\n' "$$pkg" "$$dir" >> $@
done
""",
visibility = ["//visibility:public"],
)

hugo_theme(
name = "learn",
srcs = [
"@hugo_theme_learn//:files",
],
)

hugo_site(
name = "docs",
config = "config.toml",
content = glob(["content/**/*"]),
data = [":packages"],
hugo = "@nixpkgs_hugo//:bin/hugo",
layouts = glob(["layouts/**/*"]),
quiet = False,
static = [":static"] + glob(["static/**/*"]),
theme = ":learn",
verbose = True,
)

hugo_serve(
name = "serve",
dep = [":docs"],
disable_fast_render = True,
hugo = "@nixpkgs_hugo//:bin/hugo",
)
66 changes: 66 additions & 0 deletions docs/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
title = "Amazonka"
theme = "learn"
baseURL = "https://brendanhay.github.io/amazonka"
metaDataFormat = "yaml"
defaultContentLanguage = "en"
disablePathToLower = true
enableGitInfo = false

[Languages.en]
languageName = "English"
languageCode = "en-UK"
landingPageURL = "/"

[outputs]
home = ["HTML", "RSS", "JSON"]

[params]
# See the config.toml file from this documentation site to have an example.
editURL = ""
# Author of the site, will be used in meta information
author = "Brendan Hay"
# Description of the site, will be used in meta information
description = ""
# Shows a checkmark for visited pages on the menu
showVisitedLinks = false
# Disable search function. It will hide search bar
disableSearch = false
# Javascript and CSS cache are automatically busted when new version of site is generated.
# Set this to true to disable this behavior (some proxies don't handle well this optimization)
disableAssetsBusting = true
# Set this to true to disable copy-to-clipboard button for inline code.
disableInlineCopyToClipBoard = false
# A title for shortcuts in menu is set by default. Set this to true to disable it.
disableShortcutsTitle = true
# If set to false, a Home button will appear below the search bar on the menu.
# It is redirecting to the landing page of the current language if specified. (Default is "/")
disableLandingPageButton = true
# When using mulitlingual website, disable the switch language button.
disableLanguageSwitchingButton = true
# Hide breadcrumbs in the header and only show the current page title
disableBreadcrumb = false
# If set to true, prevents Hugo from including the mermaid module if not needed (will reduce load times and traffic)
disableMermaid = true
# Hide Next and Previous page buttons normally displayed full height beside content
disableNextPrev = true
# Order sections in menu by "weight" or "title". Default to "weight"
ordersectionsby = "weight"
# Provide a list of custom css files to load relative from the `static/` folder in the site root.
custom_css = ["css/custom.css"]
# Change the title separator. Default to "::".
titleSeparator = "-"

[[menu.shortcuts]]
name = "<i class='fab fa-fw fa-github'></i> Source code"
url = "https://github.com/brendanhay/amazonka"
weight = 10

[[menu.shortcuts]]
name = "<i class='fab fa-fw fa-dot-circle-o'></i> Issues"
url = "https://github.com/brendanhay/amazonka/issues"
weight = 20

[[menu.shortcuts]]
name = "<i class='fab fa-fw fa-amazon'></i> AWS documentation"
url = "https://docs.aws.amazon.com"
weight = 100
9 changes: 9 additions & 0 deletions docs/content/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Home
---

# Haskell Amazon Web Services SDK

{{% notice info %}}
TODO
{{% /notice %}}
7 changes: 7 additions & 0 deletions docs/content/contributors/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Contributors
weight: 100
disableToc: true
---

{{< contributors "https://api.github.com/repos/brendanhay/amazonka/contributors?per_page=100" >}}
7 changes: 7 additions & 0 deletions docs/content/documentation/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Documentation
weight: 10
disableToc: true
---

![Magic](/amazonka/images/magic.gif)
5 changes: 5 additions & 0 deletions docs/content/documentation/examples/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Examples
weight: 20
disableToc: true
---
5 changes: 5 additions & 0 deletions docs/content/documentation/usage/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Usage
weight: 10
disableToc: true
---
10 changes: 10 additions & 0 deletions docs/content/packages/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Packages
weight: 20
---

{{< center >}}
Auto-generated Haddock documentation for all packages.
{{< /center >}}

{{< packages >}}
1 change: 1 addition & 0 deletions docs/layouts/partials/logo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a id="logo" href='{{ (cond (ne .Site.Params.landingPageURL nil) .Site.Params.landingPageURL "/") }}'>Amazonka</a>
7 changes: 7 additions & 0 deletions docs/layouts/partials/menu-footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<center>
<a class="github-button" href="https://github.com/brendanhay/amazonka" data-icon="octicon-star" data-show-count="true" aria-label="Star brendanhay/amazonka on GitHub">Star</a>
<a class="github-button" href="https://github.com/brendanhay/amazonka/fork" data-icon="octicon-repo-forked" data-show-count="true" aria-label="Fork brendanhay/amazonka on GitHub">Fork</a>
<a class="github-button" href="https://github.com/sponsors/brendanhay" data-icon="octicon-heart" aria-label="Sponsor @brendanhay on GitHub">Sponsor</a>
</center>

<script async defer src="https://buttons.github.io/buttons.js"></script>
3 changes: 3 additions & 0 deletions docs/layouts/shortcodes/center.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div style="text-align: center;">
{{.Inner}}
</div>
33 changes: 33 additions & 0 deletions docs/layouts/shortcodes/contributors.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<style type="text/css">
.contributors {
display: flex;
flex-flow: wrap;
align-content: flex-start
}

.contributors > div {
width: 50%;
display: inline-flex;
margin-bottom: 5px;
}

.contributors > div label {
padding-left: 4px;
}

.contributors > div span {
font-size: x-small;
padding-left: 4px;
}
</style>

<div class="contributors">
{{ $url := .Get 0 }}
{{ range getJSON $url }}
<div>
<img src="{{.avatar_url}}" class="inline" width="32" height="32" style="height: 32px;height: 32px;margin-bottom:.25em; vertical-align:middle; ">
<label><a href="{{.html_url}}">@{{.login}}</a></label>
<!-- <span class="contributions">{{.contributions}} commits</span> -->
</div>
{{ end }}
</div>
8 changes: 8 additions & 0 deletions docs/layouts/shortcodes/packages.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<ul id="packages">
{{ range $key, $val := $.Site.Data.packages.haddock }}
<li>
<a href="{{ $val | absLangURL }}">{{ $key }}</a>
</li>
{{ end }}
</ul>

5 changes: 5 additions & 0 deletions docs/static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ul#packages {
list-style: none;
margin: 0;
padding: 0;
}
Binary file added docs/static/images/magic.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Loading

0 comments on commit dc469be

Please sign in to comment.