Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Commit

Permalink
this looks better
Browse files Browse the repository at this point in the history
  • Loading branch information
maelle committed May 12, 2020
1 parent 1687d99 commit 7319ccb
Show file tree
Hide file tree
Showing 16 changed files with 1,130 additions and 891 deletions.
13 changes: 13 additions & 0 deletions assets/scss/slate/docuapi_overrides.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Overrides

// BACKGROUND COLORS
////////////////////
$nav-bg:#254E70 !default;
$examples-bg: #002642 !default;


// FONTS
////////////////////
@import url("https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700&display=swap");

$font-default-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
13 changes: 10 additions & 3 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ title = "CRAN checks API"
disableKinds = ["taxonomyTerm"]
enableEmoji = true

theme = "docuapi"
themesdir = "themes"

[module]
[[module.imports]]
path = "github.com/bep/docuapi"
[module.hugoVersion]
[[module.imports]]
# We include the theme by "../.." above, but we need one module import for Hugo to detect us as a Hugo Module.
path="github.com/bep/empty-hugo-module"

[languages.en]
languageName = "English"
Expand All @@ -20,14 +25,16 @@ toc_footers = [

[params]
search = true
custom_css = ["css/custom.css"]

# Configure the language example tabs.
[[params.language_tabs]]
key = "r"
name = "R"
[[params.language_tabs]]
key = "JavaScript"
key = "shell"
name = "Shell"
otherlangs = ["json", "xml"]
[[params.language_tabs]]
key = "yaml"
name = "Headers"
Expand Down
8 changes: 4 additions & 4 deletions content/badges.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ Get badge for CRAN checks summary by package name.

![Badges example, summary for the rhub package](https://cranchecks.info/badges/summary/rhub)

```JavaScript
```shell
curl https://cranchecks.info/badges/summary/rhub | jq .
```
```yaml
HTTP/2 200
cache-control: max-age=300, public
content-type: image/svg+xml; charset=utf-8
expires: Sat, 09 May 2020 15:34:59 GMT
expires: Tue, 12 May 2020 11:15:22 GMT
server: Caddy
x-content-type-options: nosniff
content-length: 855
date: Sat, 09 May 2020 15:29:59 GMT
date: Tue, 12 May 2020 11:10:22 GMT

```
```JavaScript
```xml
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="70" height="20">
<linearGradient id="b" x2="0" y2="100%">
Expand Down
6 changes: 3 additions & 3 deletions content/heartbeat.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Get heartbeat for the cranchecks API

[Function of the `cchecks` R package](https://docs.ropensci.org/cchecks/reference/cch_heartbeat.html).

```JavaScript
```shell
curl https://cranchecks.info/heartbeat | jq .
```
```yaml
Expand All @@ -26,10 +26,10 @@ content-type: application/json; charset=utf8
server: Caddy
x-content-type-options: nosniff
content-length: 246
date: Sat, 09 May 2020 15:25:44 GMT
date: Tue, 12 May 2020 11:10:29 GMT

```
```JavaScript
```json
{
"routes": [
"/",
Expand Down
8 changes: 4 additions & 4 deletions content/history.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Follow redirects to make sure that you are redirected to the link.

If you don't follow redirects, you'll get a JSON body telling you to redirect to the Location header link.

```JavaScript
```shell
curl https://cranchecks.info/history/2020-04-01 | jq .
```
```yaml
Expand All @@ -27,14 +27,14 @@ access-control-allow-methods: HEAD, GET
access-control-allow-origin: *
cache-control: public, must-revalidate, max-age=60
content-type: application/json; charset=utf8
location: https://cchecks-history.s3.us-west-2.amazonaws.com/2020-04-01.json.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIE65F6ZPF3JF7JTA%2F20200509%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20200509T152546Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=50d8afa441854cedf11ddcc77ab7ab877734f0275c4694d425a64928d4cc9225
location: https://cchecks-history.s3.us-west-2.amazonaws.com/2020-04-01.json.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIE65F6ZPF3JF7JTA%2F20200512%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20200512T111033Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=a13e4138d14b18b326094b092989a1a1ef7dc4550ee2a3cecceb08fa0758fc2d
server: Caddy
x-content-type-options: nosniff
content-length: 101
date: Sat, 09 May 2020 15:25:46 GMT
date: Tue, 12 May 2020 11:10:33 GMT

```
```JavaScript
```json
{
"error": null,
"message": "you hit a redirect. use the link in 'Location' header; or follow redirects"
Expand Down
12 changes: 10 additions & 2 deletions content/hooks.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ knitr::knit_hooks$set(
source = function(x, options) {
if(options$results == "asis") {
paste0(
"```JavaScript\n",
"```shell\n",
paste("curl",
gsub('\\"\\)*', "",
gsub('args <- c\\(\\"', "", x[1])
Expand Down Expand Up @@ -59,6 +59,14 @@ get_and_show <- function(args) {
return(cat(headers))
}

lang <- function(output) {
if (grepl("^<svg", output)) {
return("xml")
}

return("json")
}

transform_output <- function(output) {
if (grepl("^<svg", output)) {
cat(as.character(xml2::read_xml(output)))
Expand All @@ -76,7 +84,7 @@ get_and_show <- function(args) {
cat(
paste0(
headers,
"```JavaScript\n",
"```", lang(output),"\n",
paste0(
capture.output(transform_output(output)),
collapse = "\n"),
Expand Down
Loading

0 comments on commit 7319ccb

Please sign in to comment.