Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: render docs with jsonnet native impl #13

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ test:

.PHONY: docs
docs:
docsonnet main.libsonnet
@rm -rf ./docs; \
jb install; \
jsonnet -J ./vendor -S -c -m ./docs \
--exec "(import 'doc-util/main.libsonnet').render(import 'main.libsonnet')"
2 changes: 0 additions & 2 deletions docs/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions docs/Gemfile

This file was deleted.

35 changes: 20 additions & 15 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
---
permalink: /
---

# package xtd

```jsonnet
local xtd = import "github.com/jsonnet-libs/xtd/main.libsonnet"
```
# xtd

`xtd` aims to collect useful functions not included in the Jsonnet standard library (`std`).

This package serves as a test field for functions intended to be contributed to `std`
in the future, but also provides a place for less general, yet useful utilities.


## Install

```
jb install github.com/jsonnet-libs/xtd/main.libsonnet@master
```

## Usage

```jsonnet
local xtd = import "github.com/jsonnet-libs/xtd/main.libsonnet"
```

## Subpackages

* [aggregate](aggregate.md)
* [ascii](ascii.md)
* [camelcase](camelcase.md)
* [date](date.md)
* [inspect](inspect.md)
* [url](url.md)
* [aggregate](xtd/aggregate.md)
* [ascii](xtd/ascii.md)
* [camelcase](xtd/camelcase.md)
* [date](xtd/date.md)
* [inspect](xtd/inspect.md)
* [url](xtd/url.md)

2 changes: 0 additions & 2 deletions docs/_config.yml

This file was deleted.

23 changes: 14 additions & 9 deletions docs/aggregate.md → docs/xtd/aggregate.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
---
permalink: /aggregate/
---

# package aggregate

```jsonnet
local aggregate = import "github.com/jsonnet-libs/xtd/aggregate.libsonnet"
```
# aggregate

`aggregate` implements helper functions to aggregate arrays of objects into objects with arrays.

Expand Down Expand Up @@ -48,6 +40,18 @@ Output:
```


## Install

```
jb install github.com/jsonnet-libs/xtd/aggregate.libsonnet@master
```

## Usage

```jsonnet
local aggregate = import "github.com/jsonnet-libs/xtd/aggregate.libsonnet"
```

## Index

* [`fn byKey(arr, key)`](#fn-bykey)
Expand All @@ -72,3 +76,4 @@ byKeys(arr, keys)

`byKey` aggregates an array by iterating over `keys`, each item in `keys` nests the
aggregate one layer deeper.

18 changes: 11 additions & 7 deletions docs/ascii.md → docs/xtd/ascii.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
---
permalink: /ascii/
---
# ascii

# package ascii
`ascii` implements helper functions for ascii characters

## Install

```
jb install github.com/jsonnet-libs/xtd/ascii.libsonnet@master
```

## Usage

```jsonnet
local ascii = import "github.com/jsonnet-libs/xtd/ascii.libsonnet"
```

`ascii` implements helper functions for ascii characters

## Index

* [`fn isLower(c)`](#fn-islower)
Expand Down Expand Up @@ -40,4 +44,4 @@ isNumber(c)
isUpper(c)
```

`isUpper` reports whether ASCII character `c` is a upper case letter
`isUpper` reports whether ASCII character `c` is a upper case letter
17 changes: 11 additions & 6 deletions docs/camelcase.md → docs/xtd/camelcase.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
---
permalink: /camelcase/
---
# camelcase

# package camelcase
`camelcase` can split camelCase words into an array of words.

## Install

```
jb install github.com/jsonnet-libs/xtd/camelcase.libsonnet@master
```

## Usage

```jsonnet
local camelcase = import "github.com/jsonnet-libs/xtd/camelcase.libsonnet"
```

`camelcase` can split camelCase words into an array of words.

## Index

* [`fn split(src)`](#fn-split)
Expand All @@ -27,3 +31,4 @@ digits. Both lower camel case and upper camel case are supported. It only suppor
ASCII characters.
For more info please check: http://en.wikipedia.org/wiki/CamelCase
Based on https://github.com/fatih/camelcase/

18 changes: 11 additions & 7 deletions docs/date.md → docs/xtd/date.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
---
permalink: /date/
---
# date

# package date
`time` provides various date related functions.

## Install

```
jb install github.com/jsonnet-libs/xtd/date.libsonnet@master
```

## Usage

```jsonnet
local date = import "github.com/jsonnet-libs/xtd/date.libsonnet"
```

`time` provides various date related functions.

## Index

* [`fn dayOfWeek(year, month, day)`](#fn-dayofweek)
Expand Down Expand Up @@ -42,4 +46,4 @@ for common years, and 1-366 for leap years.
isLeapYear(year)
```

`isLeapYear` returns true if the given year is a leap year.
`isLeapYear` returns true if the given year is a leap year.
8 changes: 8 additions & 0 deletions docs/xtd/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# xtd

* [aggregate](aggregate.md)
* [ascii](ascii.md)
* [camelcase](camelcase.md)
* [date](date.md)
* [inspect](inspect.md)
* [url](url.md)
17 changes: 11 additions & 6 deletions docs/inspect.md → docs/xtd/inspect.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
---
permalink: /inspect/
---
# inspect

# package inspect
`inspect` implements helper functions for inspecting Jsonnet

## Install

```
jb install github.com/jsonnet-libs/xtd/inspect.libsonnet@master
```

## Usage

```jsonnet
local inspect = import "github.com/jsonnet-libs/xtd/inspect.libsonnet"
```

`inspect` implements helper functions for inspecting Jsonnet

## Index

* [`fn diff(input1, input2)`](#fn-diff)
Expand Down Expand Up @@ -62,3 +66,4 @@ inspect(object, maxDepth)

`inspect` reports the structure of a Jsonnet object with a recursion depth of
`maxDepth` (default maxDepth=10).

18 changes: 11 additions & 7 deletions docs/url.md → docs/xtd/url.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
---
permalink: /url/
---
# url

# package url
`url` implements URL escaping and query building

## Install

```
jb install github.com/jsonnet-libs/xtd/url.libsonnet@master
```

## Usage

```jsonnet
local url = import "github.com/jsonnet-libs/xtd/url.libsonnet"
```

`url` implements URL escaping and query building

## Index

* [`fn encodeQuery(params)`](#fn-encodequery)
Expand All @@ -31,4 +35,4 @@ encodeQuery(params)
escapeString(str, excludedChars)
```

`escapeString` escapes the given string so it can be safely placed inside an URL, replacing special characters with `%XX` sequences
`escapeString` escapes the given string so it can be safely placed inside an URL, replacing special characters with `%XX` sequences
15 changes: 15 additions & 0 deletions jsonnetfile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": 1,
"dependencies": [
{
"source": {
"git": {
"remote": "https://github.com/jsonnet-libs/docsonnet.git",
"subdir": "doc-util"
}
},
"version": "master"
}
],
"legacyImports": true
}