diff --git a/Makefile b/Makefile index 7ffe3aa..f14dbca 100644 --- a/Makefile +++ b/Makefile @@ -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')" diff --git a/docs/.gitignore b/docs/.gitignore deleted file mode 100644 index d7951d9..0000000 --- a/docs/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -Gemfile.lock -_site diff --git a/docs/Gemfile b/docs/Gemfile deleted file mode 100644 index 75d9835..0000000 --- a/docs/Gemfile +++ /dev/null @@ -1,2 +0,0 @@ -source "https://rubygems.org" -gem "github-pages", group: :jekyll_plugins diff --git a/docs/README.md b/docs/README.md index e8eea63..e86c8fd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,12 +1,4 @@ ---- -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`). @@ -14,11 +6,24 @@ This package serves as a test field for functions intended to be contributed to 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) \ No newline at end of file +* [aggregate](xtd/aggregate.md) +* [ascii](xtd/ascii.md) +* [camelcase](xtd/camelcase.md) +* [date](xtd/date.md) +* [inspect](xtd/inspect.md) +* [url](xtd/url.md) + diff --git a/docs/_config.yml b/docs/_config.yml deleted file mode 100644 index d18a288..0000000 --- a/docs/_config.yml +++ /dev/null @@ -1,2 +0,0 @@ -theme: jekyll-theme-cayman -baseurl: /xtd diff --git a/docs/aggregate.md b/docs/xtd/aggregate.md similarity index 89% rename from docs/aggregate.md rename to docs/xtd/aggregate.md index aba530d..41dd345 100644 --- a/docs/aggregate.md +++ b/docs/xtd/aggregate.md @@ -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. @@ -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) @@ -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. + diff --git a/docs/ascii.md b/docs/xtd/ascii.md similarity index 84% rename from docs/ascii.md rename to docs/xtd/ascii.md index 37d7ed7..eaaa8cc 100644 --- a/docs/ascii.md +++ b/docs/xtd/ascii.md @@ -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) @@ -40,4 +44,4 @@ isNumber(c) isUpper(c) ``` -`isUpper` reports whether ASCII character `c` is a upper case letter \ No newline at end of file +`isUpper` reports whether ASCII character `c` is a upper case letter diff --git a/docs/camelcase.md b/docs/xtd/camelcase.md similarity index 83% rename from docs/camelcase.md rename to docs/xtd/camelcase.md index 0634fa9..5005fb2 100644 --- a/docs/camelcase.md +++ b/docs/xtd/camelcase.md @@ -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) @@ -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/ + diff --git a/docs/date.md b/docs/xtd/date.md similarity index 81% rename from docs/date.md rename to docs/xtd/date.md index e2c9295..29c614d 100644 --- a/docs/date.md +++ b/docs/xtd/date.md @@ -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) @@ -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. \ No newline at end of file +`isLeapYear` returns true if the given year is a leap year. diff --git a/docs/xtd/index.md b/docs/xtd/index.md new file mode 100644 index 0000000..5f268f3 --- /dev/null +++ b/docs/xtd/index.md @@ -0,0 +1,8 @@ +# xtd + +* [aggregate](aggregate.md) +* [ascii](ascii.md) +* [camelcase](camelcase.md) +* [date](date.md) +* [inspect](inspect.md) +* [url](url.md) diff --git a/docs/inspect.md b/docs/xtd/inspect.md similarity index 89% rename from docs/inspect.md rename to docs/xtd/inspect.md index 1ec3605..fbbc0a9 100644 --- a/docs/inspect.md +++ b/docs/xtd/inspect.md @@ -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) @@ -62,3 +66,4 @@ inspect(object, maxDepth) `inspect` reports the structure of a Jsonnet object with a recursion depth of `maxDepth` (default maxDepth=10). + diff --git a/docs/url.md b/docs/xtd/url.md similarity index 85% rename from docs/url.md rename to docs/xtd/url.md index 5529d5b..367f2cd 100644 --- a/docs/url.md +++ b/docs/xtd/url.md @@ -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) @@ -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 \ No newline at end of file +`escapeString` escapes the given string so it can be safely placed inside an URL, replacing special characters with `%XX` sequences diff --git a/jsonnetfile.json b/jsonnetfile.json new file mode 100644 index 0000000..a8232b3 --- /dev/null +++ b/jsonnetfile.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "dependencies": [ + { + "source": { + "git": { + "remote": "https://github.com/jsonnet-libs/docsonnet.git", + "subdir": "doc-util" + } + }, + "version": "master" + } + ], + "legacyImports": true +}