forked from vieter-v/vieter
Merge pull request 'First part of Slate API docs' (#221) from Chewing_Bever/vieter:slate-docs into dev
Reviewed-on: vieter/vieter#221main
commit
7c2f892162
|
@ -9,7 +9,6 @@ pipeline:
|
||||||
commands:
|
commands:
|
||||||
- apk add git
|
- apk add git
|
||||||
- make docs
|
- make docs
|
||||||
- 'cd docs/public && tar czvf ../../docs.tar.gz *'
|
|
||||||
|
|
||||||
api-docs:
|
api-docs:
|
||||||
image: 'chewingbever/vlang:latest'
|
image: 'chewingbever/vlang:latest'
|
||||||
|
@ -17,25 +16,30 @@ pipeline:
|
||||||
group: 'generate'
|
group: 'generate'
|
||||||
commands:
|
commands:
|
||||||
- make api-docs
|
- make api-docs
|
||||||
- 'cd src/_docs && tar czvf ../../api-docs.tar.gz *'
|
|
||||||
|
|
||||||
deploy-docs:
|
slate-docs:
|
||||||
|
image: 'slatedocs/slate'
|
||||||
|
group: 'generate'
|
||||||
|
commands:
|
||||||
|
- cd docs/api
|
||||||
|
- bundle exec middleman build --clean
|
||||||
|
|
||||||
|
archive:
|
||||||
|
image: 'alpine'
|
||||||
|
commands:
|
||||||
|
- cp -r docs/api/build docs/public/api
|
||||||
|
- 'cd docs/public && tar czvf ../../docs.tar.gz *'
|
||||||
|
- 'cd src/_docs && tar czvf ../../api-docs.tar.gz *'
|
||||||
|
when:
|
||||||
|
event: push
|
||||||
|
branch: dev
|
||||||
|
|
||||||
|
deploy:
|
||||||
image: 'curlimages/curl'
|
image: 'curlimages/curl'
|
||||||
group: 'deploy'
|
|
||||||
secrets:
|
secrets:
|
||||||
- 'site_api_key'
|
- 'site_api_key'
|
||||||
commands:
|
commands:
|
||||||
- 'curl -XPOST --fail -s -H "Authorization: Bearer $SITE_API_KEY" -T docs.tar.gz https://rustybever.be/api/deploy?dir=docs-vieter'
|
- 'curl -XPOST --fail -s -H "Authorization: Bearer $SITE_API_KEY" -T docs.tar.gz https://rustybever.be/api/deploy?dir=docs-vieter'
|
||||||
when:
|
|
||||||
event: push
|
|
||||||
branch: dev
|
|
||||||
|
|
||||||
deploy-api-docs:
|
|
||||||
image: 'curlimages/curl'
|
|
||||||
group: 'deploy'
|
|
||||||
secrets:
|
|
||||||
- 'site_api_key'
|
|
||||||
commands:
|
|
||||||
- 'curl -XPOST --fail -s -H "Authorization: Bearer $SITE_API_KEY" -T api-docs.tar.gz https://rustybever.be/api/deploy?dir=api-docs-vieter'
|
- 'curl -XPOST --fail -s -H "Authorization: Bearer $SITE_API_KEY" -T api-docs.tar.gz https://rustybever.be/api/deploy?dir=api-docs-vieter'
|
||||||
when:
|
when:
|
||||||
event: push
|
event: push
|
||||||
|
|
34
README.md
34
README.md
|
@ -65,3 +65,37 @@ If you wish to contribute to the project, please take note of the following:
|
||||||
* Please follow the
|
* Please follow the
|
||||||
[Conventional Commits](https://www.conventionalcommits.org/) style for your
|
[Conventional Commits](https://www.conventionalcommits.org/) style for your
|
||||||
commit messages.
|
commit messages.
|
||||||
|
|
||||||
|
### Writing documentation
|
||||||
|
|
||||||
|
The `docs` directory contains a Hugo site consisting of all user &
|
||||||
|
administrator documentation. `docs/api` on the other hand is a
|
||||||
|
[slate](https://github.com/slatedocs/slate) project describing the HTTP web
|
||||||
|
API.
|
||||||
|
|
||||||
|
To modify the Hugo documentation, you'll need to install Hugo. Afterwards, you
|
||||||
|
can use the following commands inside the `docs` directory:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Build the documentation
|
||||||
|
hugo
|
||||||
|
|
||||||
|
# Host an auto-refreshing web server with the documentation. Important to note
|
||||||
|
is that the files will be at `http://localhost:1313/docs/vieter` instead of
|
||||||
|
just `http://localhost:1313/docs/vieter`
|
||||||
|
hugo server
|
||||||
|
```
|
||||||
|
|
||||||
|
For the Slate docs, I personally just start a docker container:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run \
|
||||||
|
--rm \
|
||||||
|
-p 4567:4567 \
|
||||||
|
--name slate \
|
||||||
|
-v $(pwd)/docs/api/source:/srv/slate/source slatedocs/slate serve
|
||||||
|
```
|
||||||
|
|
||||||
|
This'll make the slate docs available at http://localhost:4567. Sadly, this
|
||||||
|
server doesn't auto-refresh, so you'll have to manually refresh your browser
|
||||||
|
every time you make a change.
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
.git/
|
||||||
|
.github/
|
||||||
|
build/
|
||||||
|
.editorconfig
|
||||||
|
.gitattributes
|
||||||
|
.gitignore
|
||||||
|
CHANGELOG.md
|
||||||
|
CODE_OF_CONDUCT.md
|
||||||
|
deploy.sh
|
||||||
|
font-selection.json
|
||||||
|
README.md
|
||||||
|
Vagrantfile
|
|
@ -0,0 +1,18 @@
|
||||||
|
# EditorConfig is awesome: https://EditorConfig.org
|
||||||
|
|
||||||
|
# Top-most EditorConfig file
|
||||||
|
root = true
|
||||||
|
|
||||||
|
# Unix-style newlines with a newline ending every file
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.rb]
|
||||||
|
charset = utf-8
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
|
@ -0,0 +1 @@
|
||||||
|
source/javascripts/lib/* linguist-vendored
|
|
@ -0,0 +1,27 @@
|
||||||
|
*.gem
|
||||||
|
*.rbc
|
||||||
|
.bundle
|
||||||
|
.config
|
||||||
|
coverage
|
||||||
|
InstalledFiles
|
||||||
|
lib/bundler/man
|
||||||
|
pkg
|
||||||
|
rdoc
|
||||||
|
spec/reports
|
||||||
|
test/tmp
|
||||||
|
test/version_tmp
|
||||||
|
tmp
|
||||||
|
*.DS_STORE
|
||||||
|
build/
|
||||||
|
.cache
|
||||||
|
.vagrant
|
||||||
|
.sass-cache
|
||||||
|
|
||||||
|
# YARD artifacts
|
||||||
|
.yardoc
|
||||||
|
_yardoc
|
||||||
|
doc/
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Vagrant artifacts
|
||||||
|
ubuntu-*-console.log
|
|
@ -0,0 +1,13 @@
|
||||||
|
ruby '>= 2.6'
|
||||||
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
|
# Middleman
|
||||||
|
gem 'middleman', '~> 4.4'
|
||||||
|
gem 'middleman-syntax', '~> 3.2'
|
||||||
|
gem 'middleman-autoprefixer', '~> 3.0'
|
||||||
|
gem 'middleman-sprockets', '~> 4.1'
|
||||||
|
gem 'rouge', '~> 3.21'
|
||||||
|
gem 'redcarpet', '~> 3.5.0'
|
||||||
|
gem 'nokogiri', '~> 1.13.3'
|
||||||
|
gem 'sass'
|
||||||
|
gem 'webrick'
|
|
@ -0,0 +1,145 @@
|
||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
activesupport (6.1.4.1)
|
||||||
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
|
i18n (>= 1.6, < 2)
|
||||||
|
minitest (>= 5.1)
|
||||||
|
tzinfo (~> 2.0)
|
||||||
|
zeitwerk (~> 2.3)
|
||||||
|
addressable (2.8.0)
|
||||||
|
public_suffix (>= 2.0.2, < 5.0)
|
||||||
|
autoprefixer-rails (10.2.5.0)
|
||||||
|
execjs (< 2.8.0)
|
||||||
|
backports (3.21.0)
|
||||||
|
coffee-script (2.4.1)
|
||||||
|
coffee-script-source
|
||||||
|
execjs
|
||||||
|
coffee-script-source (1.12.2)
|
||||||
|
concurrent-ruby (1.1.9)
|
||||||
|
contracts (0.13.0)
|
||||||
|
dotenv (2.7.6)
|
||||||
|
erubis (2.7.0)
|
||||||
|
execjs (2.7.0)
|
||||||
|
fast_blank (1.0.1)
|
||||||
|
fastimage (2.2.5)
|
||||||
|
ffi (1.15.4)
|
||||||
|
haml (5.2.2)
|
||||||
|
temple (>= 0.8.0)
|
||||||
|
tilt
|
||||||
|
hamster (3.0.0)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
|
hashie (3.6.0)
|
||||||
|
i18n (1.6.0)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
|
kramdown (2.3.1)
|
||||||
|
rexml
|
||||||
|
listen (3.0.8)
|
||||||
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||||
|
rb-inotify (~> 0.9, >= 0.9.7)
|
||||||
|
memoist (0.16.2)
|
||||||
|
middleman (4.4.2)
|
||||||
|
coffee-script (~> 2.2)
|
||||||
|
haml (>= 4.0.5)
|
||||||
|
kramdown (>= 2.3.0)
|
||||||
|
middleman-cli (= 4.4.2)
|
||||||
|
middleman-core (= 4.4.2)
|
||||||
|
middleman-autoprefixer (3.0.0)
|
||||||
|
autoprefixer-rails (~> 10.0)
|
||||||
|
middleman-core (>= 4.0.0)
|
||||||
|
middleman-cli (4.4.2)
|
||||||
|
thor (>= 0.17.0, < 2.0)
|
||||||
|
middleman-core (4.4.2)
|
||||||
|
activesupport (>= 6.1, < 7.0)
|
||||||
|
addressable (~> 2.4)
|
||||||
|
backports (~> 3.6)
|
||||||
|
bundler (~> 2.0)
|
||||||
|
contracts (~> 0.13.0)
|
||||||
|
dotenv
|
||||||
|
erubis
|
||||||
|
execjs (~> 2.0)
|
||||||
|
fast_blank
|
||||||
|
fastimage (~> 2.0)
|
||||||
|
hamster (~> 3.0)
|
||||||
|
hashie (~> 3.4)
|
||||||
|
i18n (~> 1.6.0)
|
||||||
|
listen (~> 3.0.0)
|
||||||
|
memoist (~> 0.14)
|
||||||
|
padrino-helpers (~> 0.15.0)
|
||||||
|
parallel
|
||||||
|
rack (>= 1.4.5, < 3)
|
||||||
|
sassc (~> 2.0)
|
||||||
|
servolux
|
||||||
|
tilt (~> 2.0.9)
|
||||||
|
toml
|
||||||
|
uglifier (~> 3.0)
|
||||||
|
webrick
|
||||||
|
middleman-sprockets (4.1.1)
|
||||||
|
middleman-core (~> 4.0)
|
||||||
|
sprockets (>= 3.0)
|
||||||
|
middleman-syntax (3.2.0)
|
||||||
|
middleman-core (>= 3.2)
|
||||||
|
rouge (~> 3.2)
|
||||||
|
mini_portile2 (2.8.0)
|
||||||
|
minitest (5.14.4)
|
||||||
|
nokogiri (1.13.4)
|
||||||
|
mini_portile2 (~> 2.8.0)
|
||||||
|
racc (~> 1.4)
|
||||||
|
padrino-helpers (0.15.1)
|
||||||
|
i18n (>= 0.6.7, < 2)
|
||||||
|
padrino-support (= 0.15.1)
|
||||||
|
tilt (>= 1.4.1, < 3)
|
||||||
|
padrino-support (0.15.1)
|
||||||
|
parallel (1.21.0)
|
||||||
|
parslet (2.0.0)
|
||||||
|
public_suffix (4.0.6)
|
||||||
|
racc (1.6.0)
|
||||||
|
rack (2.2.3)
|
||||||
|
rb-fsevent (0.11.0)
|
||||||
|
rb-inotify (0.10.1)
|
||||||
|
ffi (~> 1.0)
|
||||||
|
redcarpet (3.5.1)
|
||||||
|
rexml (3.2.5)
|
||||||
|
rouge (3.28.0)
|
||||||
|
sass (3.7.4)
|
||||||
|
sass-listen (~> 4.0.0)
|
||||||
|
sass-listen (4.0.0)
|
||||||
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||||
|
rb-inotify (~> 0.9, >= 0.9.7)
|
||||||
|
sassc (2.4.0)
|
||||||
|
ffi (~> 1.9)
|
||||||
|
servolux (0.13.0)
|
||||||
|
sprockets (3.7.2)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
|
rack (> 1, < 3)
|
||||||
|
temple (0.8.2)
|
||||||
|
thor (1.1.0)
|
||||||
|
tilt (2.0.10)
|
||||||
|
toml (0.3.0)
|
||||||
|
parslet (>= 1.8.0, < 3.0.0)
|
||||||
|
tzinfo (2.0.4)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
|
uglifier (3.2.0)
|
||||||
|
execjs (>= 0.3.0, < 3)
|
||||||
|
webrick (1.7.0)
|
||||||
|
zeitwerk (2.5.1)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
ruby
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
middleman (~> 4.4)
|
||||||
|
middleman-autoprefixer (~> 3.0)
|
||||||
|
middleman-sprockets (~> 4.1)
|
||||||
|
middleman-syntax (~> 3.2)
|
||||||
|
nokogiri (~> 1.13.3)
|
||||||
|
redcarpet (~> 3.5.0)
|
||||||
|
rouge (~> 3.21)
|
||||||
|
sass
|
||||||
|
webrick
|
||||||
|
|
||||||
|
RUBY VERSION
|
||||||
|
ruby 2.7.2p137
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
2.2.22
|
|
@ -0,0 +1,63 @@
|
||||||
|
# Unique header generation
|
||||||
|
require './lib/unique_head.rb'
|
||||||
|
|
||||||
|
# Markdown
|
||||||
|
set :markdown_engine, :redcarpet
|
||||||
|
set :markdown,
|
||||||
|
fenced_code_blocks: true,
|
||||||
|
smartypants: true,
|
||||||
|
disable_indented_code_blocks: true,
|
||||||
|
prettify: true,
|
||||||
|
strikethrough: true,
|
||||||
|
tables: true,
|
||||||
|
with_toc_data: true,
|
||||||
|
no_intra_emphasis: true,
|
||||||
|
renderer: UniqueHeadCounter
|
||||||
|
|
||||||
|
# Assets
|
||||||
|
set :css_dir, 'stylesheets'
|
||||||
|
set :js_dir, 'javascripts'
|
||||||
|
set :images_dir, 'images'
|
||||||
|
set :fonts_dir, 'fonts'
|
||||||
|
|
||||||
|
# Activate the syntax highlighter
|
||||||
|
activate :syntax
|
||||||
|
ready do
|
||||||
|
require './lib/monokai_sublime_slate.rb'
|
||||||
|
require './lib/multilang.rb'
|
||||||
|
end
|
||||||
|
|
||||||
|
activate :sprockets
|
||||||
|
|
||||||
|
activate :autoprefixer do |config|
|
||||||
|
config.browsers = ['last 2 version', 'Firefox ESR']
|
||||||
|
config.cascade = false
|
||||||
|
config.inline = true
|
||||||
|
end
|
||||||
|
|
||||||
|
# Github pages require relative links
|
||||||
|
activate :relative_assets
|
||||||
|
set :relative_links, true
|
||||||
|
|
||||||
|
# Build Configuration
|
||||||
|
configure :build do
|
||||||
|
# We do want to hash woff and woff2 as there's a bug where woff2 will use
|
||||||
|
# woff asset hash which breaks things. Trying to use a combination of ignore and
|
||||||
|
# rewrite_ignore does not work as it conflicts weirdly with relative_assets. Disabling
|
||||||
|
# the .woff2 extension only does not work as .woff will still activate it so have to
|
||||||
|
# have both. See https://github.com/slatedocs/slate/issues/1171 for more details.
|
||||||
|
activate :asset_hash, :exts => app.config[:asset_extensions] - %w[.woff .woff2]
|
||||||
|
# If you're having trouble with Middleman hanging, commenting
|
||||||
|
# out the following two lines has been known to help
|
||||||
|
activate :minify_css
|
||||||
|
activate :minify_javascript
|
||||||
|
# activate :gzip
|
||||||
|
end
|
||||||
|
|
||||||
|
# Deploy Configuration
|
||||||
|
# If you want Middleman to listen on a different port, you can set that below
|
||||||
|
set :port, 4567
|
||||||
|
|
||||||
|
helpers do
|
||||||
|
require './lib/toc_data.rb'
|
||||||
|
end
|
|
@ -0,0 +1,148 @@
|
||||||
|
{
|
||||||
|
"IcoMoonType": "selection",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"icon": {
|
||||||
|
"paths": [
|
||||||
|
"M438.857 73.143q119.429 0 220.286 58.857t159.714 159.714 58.857 220.286-58.857 220.286-159.714 159.714-220.286 58.857-220.286-58.857-159.714-159.714-58.857-220.286 58.857-220.286 159.714-159.714 220.286-58.857zM512 785.714v-108.571q0-8-5.143-13.429t-12.571-5.429h-109.714q-7.429 0-13.143 5.714t-5.714 13.143v108.571q0 7.429 5.714 13.143t13.143 5.714h109.714q7.429 0 12.571-5.429t5.143-13.429zM510.857 589.143l10.286-354.857q0-6.857-5.714-10.286-5.714-4.571-13.714-4.571h-125.714q-8 0-13.714 4.571-5.714 3.429-5.714 10.286l9.714 354.857q0 5.714 5.714 10t13.714 4.286h105.714q8 0 13.429-4.286t6-10z"
|
||||||
|
],
|
||||||
|
"attrs": [],
|
||||||
|
"isMulticolor": false,
|
||||||
|
"tags": [
|
||||||
|
"exclamation-circle"
|
||||||
|
],
|
||||||
|
"defaultCode": 61546,
|
||||||
|
"grid": 14
|
||||||
|
},
|
||||||
|
"attrs": [],
|
||||||
|
"properties": {
|
||||||
|
"id": 100,
|
||||||
|
"order": 4,
|
||||||
|
"prevSize": 28,
|
||||||
|
"code": 58880,
|
||||||
|
"name": "exclamation-sign",
|
||||||
|
"ligatures": ""
|
||||||
|
},
|
||||||
|
"setIdx": 0,
|
||||||
|
"iconIdx": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"icon": {
|
||||||
|
"paths": [
|
||||||
|
"M585.143 786.286v-91.429q0-8-5.143-13.143t-13.143-5.143h-54.857v-292.571q0-8-5.143-13.143t-13.143-5.143h-182.857q-8 0-13.143 5.143t-5.143 13.143v91.429q0 8 5.143 13.143t13.143 5.143h54.857v182.857h-54.857q-8 0-13.143 5.143t-5.143 13.143v91.429q0 8 5.143 13.143t13.143 5.143h256q8 0 13.143-5.143t5.143-13.143zM512 274.286v-91.429q0-8-5.143-13.143t-13.143-5.143h-109.714q-8 0-13.143 5.143t-5.143 13.143v91.429q0 8 5.143 13.143t13.143 5.143h109.714q8 0 13.143-5.143t5.143-13.143zM877.714 512q0 119.429-58.857 220.286t-159.714 159.714-220.286 58.857-220.286-58.857-159.714-159.714-58.857-220.286 58.857-220.286 159.714-159.714 220.286-58.857 220.286 58.857 159.714 159.714 58.857 220.286z"
|
||||||
|
],
|
||||||
|
"attrs": [],
|
||||||
|
"isMulticolor": false,
|
||||||
|
"tags": [
|
||||||
|
"info-circle"
|
||||||
|
],
|
||||||
|
"defaultCode": 61530,
|
||||||
|
"grid": 14
|
||||||
|
},
|
||||||
|
"attrs": [],
|
||||||
|
"properties": {
|
||||||
|
"id": 85,
|
||||||
|
"order": 3,
|
||||||
|
"name": "info-sign",
|
||||||
|
"prevSize": 28,
|
||||||
|
"code": 58882
|
||||||
|
},
|
||||||
|
"setIdx": 0,
|
||||||
|
"iconIdx": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"icon": {
|
||||||
|
"paths": [
|
||||||
|
"M733.714 419.429q0-16-10.286-26.286l-52-51.429q-10.857-10.857-25.714-10.857t-25.714 10.857l-233.143 232.571-129.143-129.143q-10.857-10.857-25.714-10.857t-25.714 10.857l-52 51.429q-10.286 10.286-10.286 26.286 0 15.429 10.286 25.714l206.857 206.857q10.857 10.857 25.714 10.857 15.429 0 26.286-10.857l310.286-310.286q10.286-10.286 10.286-25.714zM877.714 512q0 119.429-58.857 220.286t-159.714 159.714-220.286 58.857-220.286-58.857-159.714-159.714-58.857-220.286 58.857-220.286 159.714-159.714 220.286-58.857 220.286 58.857 159.714 159.714 58.857 220.286z"
|
||||||
|
],
|
||||||
|
"attrs": [],
|
||||||
|
"isMulticolor": false,
|
||||||
|
"tags": [
|
||||||
|
"check-circle"
|
||||||
|
],
|
||||||
|
"defaultCode": 61528,
|
||||||
|
"grid": 14
|
||||||
|
},
|
||||||
|
"attrs": [],
|
||||||
|
"properties": {
|
||||||
|
"id": 83,
|
||||||
|
"order": 9,
|
||||||
|
"prevSize": 28,
|
||||||
|
"code": 58886,
|
||||||
|
"name": "ok-sign"
|
||||||
|
},
|
||||||
|
"setIdx": 0,
|
||||||
|
"iconIdx": 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"icon": {
|
||||||
|
"paths": [
|
||||||
|
"M658.286 475.429q0-105.714-75.143-180.857t-180.857-75.143-180.857 75.143-75.143 180.857 75.143 180.857 180.857 75.143 180.857-75.143 75.143-180.857zM950.857 950.857q0 29.714-21.714 51.429t-51.429 21.714q-30.857 0-51.429-21.714l-196-195.429q-102.286 70.857-228 70.857-81.714 0-156.286-31.714t-128.571-85.714-85.714-128.571-31.714-156.286 31.714-156.286 85.714-128.571 128.571-85.714 156.286-31.714 156.286 31.714 128.571 85.714 85.714 128.571 31.714 156.286q0 125.714-70.857 228l196 196q21.143 21.143 21.143 51.429z"
|
||||||
|
],
|
||||||
|
"width": 951,
|
||||||
|
"attrs": [],
|
||||||
|
"isMulticolor": false,
|
||||||
|
"tags": [
|
||||||
|
"search"
|
||||||
|
],
|
||||||
|
"defaultCode": 61442,
|
||||||
|
"grid": 14
|
||||||
|
},
|
||||||
|
"attrs": [],
|
||||||
|
"properties": {
|
||||||
|
"id": 2,
|
||||||
|
"order": 1,
|
||||||
|
"prevSize": 28,
|
||||||
|
"code": 58887,
|
||||||
|
"name": "icon-search"
|
||||||
|
},
|
||||||
|
"setIdx": 0,
|
||||||
|
"iconIdx": 7
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"height": 1024,
|
||||||
|
"metadata": {
|
||||||
|
"name": "slate",
|
||||||
|
"license": "SIL OFL 1.1"
|
||||||
|
},
|
||||||
|
"preferences": {
|
||||||
|
"showGlyphs": true,
|
||||||
|
"showQuickUse": true,
|
||||||
|
"showQuickUse2": true,
|
||||||
|
"showSVGs": true,
|
||||||
|
"fontPref": {
|
||||||
|
"prefix": "icon-",
|
||||||
|
"metadata": {
|
||||||
|
"fontFamily": "slate",
|
||||||
|
"majorVersion": 1,
|
||||||
|
"minorVersion": 0,
|
||||||
|
"description": "Based on FontAwesome",
|
||||||
|
"license": "SIL OFL 1.1"
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"emSize": 1024,
|
||||||
|
"baseline": 6.25,
|
||||||
|
"whitespace": 50
|
||||||
|
},
|
||||||
|
"resetPoint": 58880,
|
||||||
|
"showSelector": false,
|
||||||
|
"selector": "class",
|
||||||
|
"classSelector": ".icon",
|
||||||
|
"showMetrics": false,
|
||||||
|
"showMetadata": true,
|
||||||
|
"showVersion": true,
|
||||||
|
"ie7": false
|
||||||
|
},
|
||||||
|
"imagePref": {
|
||||||
|
"prefix": "icon-",
|
||||||
|
"png": true,
|
||||||
|
"useClassSelector": true,
|
||||||
|
"color": 4473924,
|
||||||
|
"bgColor": 16777215
|
||||||
|
},
|
||||||
|
"historySize": 100,
|
||||||
|
"showCodes": true,
|
||||||
|
"gridSize": 16,
|
||||||
|
"showLiga": false
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
# -*- coding: utf-8 -*- #
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# this is based on https://github.com/rouge-ruby/rouge/blob/master/lib/rouge/themes/monokai_sublime.rb
|
||||||
|
# but without the added background, and changed styling for JSON keys to be soft_yellow instead of white
|
||||||
|
|
||||||
|
module Rouge
|
||||||
|
module Themes
|
||||||
|
class MonokaiSublimeSlate < CSSTheme
|
||||||
|
name 'monokai.sublime.slate'
|
||||||
|
|
||||||
|
palette :black => '#000000'
|
||||||
|
palette :bright_green => '#a6e22e'
|
||||||
|
palette :bright_pink => '#f92672'
|
||||||
|
palette :carmine => '#960050'
|
||||||
|
palette :dark => '#49483e'
|
||||||
|
palette :dark_grey => '#888888'
|
||||||
|
palette :dark_red => '#aa0000'
|
||||||
|
palette :dimgrey => '#75715e'
|
||||||
|
palette :emperor => '#555555'
|
||||||
|
palette :grey => '#999999'
|
||||||
|
palette :light_grey => '#aaaaaa'
|
||||||
|
palette :light_violet => '#ae81ff'
|
||||||
|
palette :soft_cyan => '#66d9ef'
|
||||||
|
palette :soft_yellow => '#e6db74'
|
||||||
|
palette :very_dark => '#1e0010'
|
||||||
|
palette :whitish => '#f8f8f2'
|
||||||
|
palette :orange => '#f6aa11'
|
||||||
|
palette :white => '#ffffff'
|
||||||
|
|
||||||
|
style Generic::Heading, :fg => :grey
|
||||||
|
style Literal::String::Regex, :fg => :orange
|
||||||
|
style Generic::Output, :fg => :dark_grey
|
||||||
|
style Generic::Prompt, :fg => :emperor
|
||||||
|
style Generic::Strong, :bold => false
|
||||||
|
style Generic::Subheading, :fg => :light_grey
|
||||||
|
style Name::Builtin, :fg => :orange
|
||||||
|
style Comment::Multiline,
|
||||||
|
Comment::Preproc,
|
||||||
|
Comment::Single,
|
||||||
|
Comment::Special,
|
||||||
|
Comment, :fg => :dimgrey
|
||||||
|
style Error,
|
||||||
|
Generic::Error,
|
||||||
|
Generic::Traceback, :fg => :carmine
|
||||||
|
style Generic::Deleted,
|
||||||
|
Generic::Inserted,
|
||||||
|
Generic::Emph, :fg => :dark
|
||||||
|
style Keyword::Constant,
|
||||||
|
Keyword::Declaration,
|
||||||
|
Keyword::Reserved,
|
||||||
|
Name::Constant,
|
||||||
|
Keyword::Type, :fg => :soft_cyan
|
||||||
|
style Literal::Number::Float,
|
||||||
|
Literal::Number::Hex,
|
||||||
|
Literal::Number::Integer::Long,
|
||||||
|
Literal::Number::Integer,
|
||||||
|
Literal::Number::Oct,
|
||||||
|
Literal::Number,
|
||||||
|
Literal::String::Char,
|
||||||
|
Literal::String::Escape,
|
||||||
|
Literal::String::Symbol, :fg => :light_violet
|
||||||
|
style Literal::String::Doc,
|
||||||
|
Literal::String::Double,
|
||||||
|
Literal::String::Backtick,
|
||||||
|
Literal::String::Heredoc,
|
||||||
|
Literal::String::Interpol,
|
||||||
|
Literal::String::Other,
|
||||||
|
Literal::String::Single,
|
||||||
|
Literal::String, :fg => :soft_yellow
|
||||||
|
style Name::Attribute,
|
||||||
|
Name::Class,
|
||||||
|
Name::Decorator,
|
||||||
|
Name::Exception,
|
||||||
|
Name::Function, :fg => :bright_green
|
||||||
|
style Name::Variable::Class,
|
||||||
|
Name::Namespace,
|
||||||
|
Name::Entity,
|
||||||
|
Name::Builtin::Pseudo,
|
||||||
|
Name::Variable::Global,
|
||||||
|
Name::Variable::Instance,
|
||||||
|
Name::Variable,
|
||||||
|
Text::Whitespace,
|
||||||
|
Text,
|
||||||
|
Name, :fg => :white
|
||||||
|
style Name::Label, :fg => :bright_pink
|
||||||
|
style Operator::Word,
|
||||||
|
Name::Tag,
|
||||||
|
Keyword,
|
||||||
|
Keyword::Namespace,
|
||||||
|
Keyword::Pseudo,
|
||||||
|
Operator, :fg => :bright_pink
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,16 @@
|
||||||
|
module Multilang
|
||||||
|
def block_code(code, full_lang_name)
|
||||||
|
if full_lang_name
|
||||||
|
parts = full_lang_name.split('--')
|
||||||
|
rouge_lang_name = (parts) ? parts[0] : "" # just parts[0] here causes null ref exception when no language specified
|
||||||
|
super(code, rouge_lang_name).sub("highlight #{rouge_lang_name}") do |match|
|
||||||
|
match + " tab-" + full_lang_name
|
||||||
|
end
|
||||||
|
else
|
||||||
|
super(code, full_lang_name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
require 'middleman-core/renderers/redcarpet'
|
||||||
|
Middleman::Renderers::MiddlemanRedcarpetHTML.send :include, Multilang
|
|
@ -0,0 +1,22 @@
|
||||||
|
# Nested unique header generation
|
||||||
|
require 'middleman-core/renderers/redcarpet'
|
||||||
|
|
||||||
|
class NestingUniqueHeadCounter < Middleman::Renderers::MiddlemanRedcarpetHTML
|
||||||
|
def initialize
|
||||||
|
super
|
||||||
|
@@headers_history = {} if !defined?(@@headers_history)
|
||||||
|
end
|
||||||
|
|
||||||
|
def header(text, header_level)
|
||||||
|
friendly_text = text.gsub(/<[^>]*>/,"").parameterize
|
||||||
|
@@headers_history[header_level] = text.parameterize
|
||||||
|
|
||||||
|
if header_level > 1
|
||||||
|
for i in (header_level - 1).downto(1)
|
||||||
|
friendly_text.prepend("#{@@headers_history[i]}-") if @@headers_history.key?(i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return "<h#{header_level} id='#{friendly_text}'>#{text}</h#{header_level}>"
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,31 @@
|
||||||
|
require 'nokogiri'
|
||||||
|
|
||||||
|
def toc_data(page_content)
|
||||||
|
html_doc = Nokogiri::HTML::DocumentFragment.parse(page_content)
|
||||||
|
|
||||||
|
# get a flat list of headers
|
||||||
|
headers = []
|
||||||
|
html_doc.css('h1, h2, h3').each do |header|
|
||||||
|
headers.push({
|
||||||
|
id: header.attribute('id').to_s,
|
||||||
|
content: header.children,
|
||||||
|
title: header.children.to_s.gsub(/<[^>]*>/, ''),
|
||||||
|
level: header.name[1].to_i,
|
||||||
|
children: []
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
[3,2].each do |header_level|
|
||||||
|
header_to_nest = nil
|
||||||
|
headers = headers.reject do |header|
|
||||||
|
if header[:level] == header_level
|
||||||
|
header_to_nest[:children].push header if header_to_nest
|
||||||
|
true
|
||||||
|
else
|
||||||
|
header_to_nest = header if header[:level] < header_level
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
headers
|
||||||
|
end
|
|
@ -0,0 +1,24 @@
|
||||||
|
# Unique header generation
|
||||||
|
require 'middleman-core/renderers/redcarpet'
|
||||||
|
require 'digest'
|
||||||
|
class UniqueHeadCounter < Middleman::Renderers::MiddlemanRedcarpetHTML
|
||||||
|
def initialize
|
||||||
|
super
|
||||||
|
@head_count = {}
|
||||||
|
end
|
||||||
|
def header(text, header_level)
|
||||||
|
friendly_text = text.gsub(/<[^>]*>/,"").parameterize
|
||||||
|
if friendly_text.strip.length == 0
|
||||||
|
# Looks like parameterize removed the whole thing! It removes many unicode
|
||||||
|
# characters like Chinese and Russian. To get a unique URL, let's just
|
||||||
|
# URI escape the whole header
|
||||||
|
friendly_text = Digest::SHA1.hexdigest(text)[0,10]
|
||||||
|
end
|
||||||
|
@head_count[friendly_text] ||= 0
|
||||||
|
@head_count[friendly_text] += 1
|
||||||
|
if @head_count[friendly_text] > 1
|
||||||
|
friendly_text += "-#{@head_count[friendly_text]}"
|
||||||
|
end
|
||||||
|
return "<h#{header_level} id='#{friendly_text}'>#{text}</h#{header_level}>"
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,248 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -o errexit #abort if any command fails
|
||||||
|
|
||||||
|
me=$(basename "$0")
|
||||||
|
|
||||||
|
help_message="\
|
||||||
|
Usage: $me [<options>] <command> [<command-options>]
|
||||||
|
Run commands related to the slate process.
|
||||||
|
|
||||||
|
Commands:
|
||||||
|
|
||||||
|
serve Run the middleman server process, useful for
|
||||||
|
development.
|
||||||
|
build Run the build process.
|
||||||
|
deploy Will build and deploy files to branch. Use
|
||||||
|
--no-build to only deploy.
|
||||||
|
|
||||||
|
Global Options:
|
||||||
|
|
||||||
|
-h, --help Show this help information.
|
||||||
|
-v, --verbose Increase verbosity. Useful for debugging.
|
||||||
|
|
||||||
|
Deploy options:
|
||||||
|
-e, --allow-empty Allow deployment of an empty directory.
|
||||||
|
-m, --message MESSAGE Specify the message used when committing on the
|
||||||
|
deploy branch.
|
||||||
|
-n, --no-hash Don't append the source commit's hash to the deploy
|
||||||
|
commit's message.
|
||||||
|
--no-build Do not build the source files.
|
||||||
|
"
|
||||||
|
|
||||||
|
|
||||||
|
run_serve() {
|
||||||
|
exec bundle exec middleman serve --watcher-force-polling
|
||||||
|
}
|
||||||
|
|
||||||
|
run_build() {
|
||||||
|
bundle exec middleman build --clean
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_args() {
|
||||||
|
# Set args from a local environment file.
|
||||||
|
if [ -e ".env" ]; then
|
||||||
|
source .env
|
||||||
|
fi
|
||||||
|
|
||||||
|
command=
|
||||||
|
|
||||||
|
# Parse arg flags
|
||||||
|
# If something is exposed as an environment variable, set/overwrite it
|
||||||
|
# here. Otherwise, set/overwrite the internal variable instead.
|
||||||
|
while : ; do
|
||||||
|
if [[ $1 = "-h" || $1 = "--help" ]]; then
|
||||||
|
echo "$help_message"
|
||||||
|
exit 0
|
||||||
|
elif [[ $1 = "-v" || $1 = "--verbose" ]]; then
|
||||||
|
verbose=true
|
||||||
|
shift
|
||||||
|
elif [[ $1 = "-e" || $1 = "--allow-empty" ]]; then
|
||||||
|
allow_empty=true
|
||||||
|
shift
|
||||||
|
elif [[ ( $1 = "-m" || $1 = "--message" ) && -n $2 ]]; then
|
||||||
|
commit_message=$2
|
||||||
|
shift 2
|
||||||
|
elif [[ $1 = "-n" || $1 = "--no-hash" ]]; then
|
||||||
|
GIT_DEPLOY_APPEND_HASH=false
|
||||||
|
shift
|
||||||
|
elif [[ $1 = "--no-build" ]]; then
|
||||||
|
no_build=true
|
||||||
|
shift
|
||||||
|
elif [[ $1 = "serve" || $1 = "build" || $1 = "deploy" ]]; then
|
||||||
|
if [ ! -z "${command}" ]; then
|
||||||
|
>&2 echo "You can only specify one command."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
command=$1
|
||||||
|
shift
|
||||||
|
elif [ -z $1 ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "${command}" ]; then
|
||||||
|
>&2 echo "Command not specified."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set internal option vars from the environment and arg flags. All internal
|
||||||
|
# vars should be declared here, with sane defaults if applicable.
|
||||||
|
|
||||||
|
# Source directory & target branch.
|
||||||
|
deploy_directory=build
|
||||||
|
deploy_branch=gh-pages
|
||||||
|
|
||||||
|
#if no user identity is already set in the current git environment, use this:
|
||||||
|
default_username=${GIT_DEPLOY_USERNAME:-deploy.sh}
|
||||||
|
default_email=${GIT_DEPLOY_EMAIL:-}
|
||||||
|
|
||||||
|
#repository to deploy to. must be readable and writable.
|
||||||
|
repo=origin
|
||||||
|
|
||||||
|
#append commit hash to the end of message by default
|
||||||
|
append_hash=${GIT_DEPLOY_APPEND_HASH:-true}
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
enable_expanded_output
|
||||||
|
|
||||||
|
if ! git diff --exit-code --quiet --cached; then
|
||||||
|
echo Aborting due to uncommitted changes in the index >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
commit_title=`git log -n 1 --format="%s" HEAD`
|
||||||
|
commit_hash=` git log -n 1 --format="%H" HEAD`
|
||||||
|
|
||||||
|
#default commit message uses last title if a custom one is not supplied
|
||||||
|
if [[ -z $commit_message ]]; then
|
||||||
|
commit_message="publish: $commit_title"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#append hash to commit message unless no hash flag was found
|
||||||
|
if [ $append_hash = true ]; then
|
||||||
|
commit_message="$commit_message"$'\n\n'"generated from commit $commit_hash"
|
||||||
|
fi
|
||||||
|
|
||||||
|
previous_branch=`git rev-parse --abbrev-ref HEAD`
|
||||||
|
|
||||||
|
if [ ! -d "$deploy_directory" ]; then
|
||||||
|
echo "Deploy directory '$deploy_directory' does not exist. Aborting." >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# must use short form of flag in ls for compatibility with macOS and BSD
|
||||||
|
if [[ -z `ls -A "$deploy_directory" 2> /dev/null` && -z $allow_empty ]]; then
|
||||||
|
echo "Deploy directory '$deploy_directory' is empty. Aborting. If you're sure you want to deploy an empty tree, use the --allow-empty / -e flag." >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if git ls-remote --exit-code $repo "refs/heads/$deploy_branch" ; then
|
||||||
|
# deploy_branch exists in $repo; make sure we have the latest version
|
||||||
|
|
||||||
|
disable_expanded_output
|
||||||
|
git fetch --force $repo $deploy_branch:$deploy_branch
|
||||||
|
enable_expanded_output
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check if deploy_branch exists locally
|
||||||
|
if git show-ref --verify --quiet "refs/heads/$deploy_branch"
|
||||||
|
then incremental_deploy
|
||||||
|
else initial_deploy
|
||||||
|
fi
|
||||||
|
|
||||||
|
restore_head
|
||||||
|
}
|
||||||
|
|
||||||
|
initial_deploy() {
|
||||||
|
git --work-tree "$deploy_directory" checkout --orphan $deploy_branch
|
||||||
|
git --work-tree "$deploy_directory" add --all
|
||||||
|
commit+push
|
||||||
|
}
|
||||||
|
|
||||||
|
incremental_deploy() {
|
||||||
|
#make deploy_branch the current branch
|
||||||
|
git symbolic-ref HEAD refs/heads/$deploy_branch
|
||||||
|
#put the previously committed contents of deploy_branch into the index
|
||||||
|
git --work-tree "$deploy_directory" reset --mixed --quiet
|
||||||
|
git --work-tree "$deploy_directory" add --all
|
||||||
|
|
||||||
|
set +o errexit
|
||||||
|
diff=$(git --work-tree "$deploy_directory" diff --exit-code --quiet HEAD --)$?
|
||||||
|
set -o errexit
|
||||||
|
case $diff in
|
||||||
|
0) echo No changes to files in $deploy_directory. Skipping commit.;;
|
||||||
|
1) commit+push;;
|
||||||
|
*)
|
||||||
|
echo git diff exited with code $diff. Aborting. Staying on branch $deploy_branch so you can debug. To switch back to main, use: git symbolic-ref HEAD refs/heads/main && git reset --mixed >&2
|
||||||
|
return $diff
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
commit+push() {
|
||||||
|
set_user_id
|
||||||
|
git --work-tree "$deploy_directory" commit -m "$commit_message"
|
||||||
|
|
||||||
|
disable_expanded_output
|
||||||
|
#--quiet is important here to avoid outputting the repo URL, which may contain a secret token
|
||||||
|
git push --quiet $repo $deploy_branch
|
||||||
|
enable_expanded_output
|
||||||
|
}
|
||||||
|
|
||||||
|
#echo expanded commands as they are executed (for debugging)
|
||||||
|
enable_expanded_output() {
|
||||||
|
if [ $verbose ]; then
|
||||||
|
set -o xtrace
|
||||||
|
set +o verbose
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#this is used to avoid outputting the repo URL, which may contain a secret token
|
||||||
|
disable_expanded_output() {
|
||||||
|
if [ $verbose ]; then
|
||||||
|
set +o xtrace
|
||||||
|
set -o verbose
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set_user_id() {
|
||||||
|
if [[ -z `git config user.name` ]]; then
|
||||||
|
git config user.name "$default_username"
|
||||||
|
fi
|
||||||
|
if [[ -z `git config user.email` ]]; then
|
||||||
|
git config user.email "$default_email"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
restore_head() {
|
||||||
|
if [[ $previous_branch = "HEAD" ]]; then
|
||||||
|
#we weren't on any branch before, so just set HEAD back to the commit it was on
|
||||||
|
git update-ref --no-deref HEAD $commit_hash $deploy_branch
|
||||||
|
else
|
||||||
|
git symbolic-ref HEAD refs/heads/$previous_branch
|
||||||
|
fi
|
||||||
|
|
||||||
|
git reset --mixed
|
||||||
|
}
|
||||||
|
|
||||||
|
filter() {
|
||||||
|
sed -e "s|$repo|\$repo|g"
|
||||||
|
}
|
||||||
|
|
||||||
|
sanitize() {
|
||||||
|
"$@" 2> >(filter 1>&2) | filter
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_args "$@"
|
||||||
|
|
||||||
|
if [ "${command}" = "serve" ]; then
|
||||||
|
run_serve
|
||||||
|
elif [[ "${command}" = "build" ]]; then
|
||||||
|
run_build
|
||||||
|
elif [[ ${command} = "deploy" ]]; then
|
||||||
|
if [[ ${no_build} != true ]]; then
|
||||||
|
run_build
|
||||||
|
fi
|
||||||
|
main "$@"
|
||||||
|
fi
|
Binary file not shown.
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<metadata>Generated by IcoMoon</metadata>
|
||||||
|
<defs>
|
||||||
|
<font id="slate" horiz-adv-x="1024">
|
||||||
|
<font-face units-per-em="1024" ascent="960" descent="-64" />
|
||||||
|
<missing-glyph horiz-adv-x="1024" />
|
||||||
|
<glyph unicode=" " d="" horiz-adv-x="512" />
|
||||||
|
<glyph unicode="" d="M438.857 877.714q119.429 0 220.286-58.857t159.714-159.714 58.857-220.286-58.857-220.286-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857zM512 165.143v108.571q0 8-5.143 13.429t-12.571 5.429h-109.714q-7.429 0-13.143-5.714t-5.714-13.143v-108.571q0-7.429 5.714-13.143t13.143-5.714h109.714q7.429 0 12.571 5.429t5.143 13.429zM510.857 361.714l10.286 354.857q0 6.857-5.714 10.286-5.714 4.571-13.714 4.571h-125.714q-8 0-13.714-4.571-5.714-3.429-5.714-10.286l9.714-354.857q0-5.714 5.714-10t13.714-4.286h105.714q8 0 13.429 4.286t6 10z" />
|
||||||
|
<glyph unicode="" d="M585.143 164.571v91.429q0 8-5.143 13.143t-13.143 5.143h-54.857v292.571q0 8-5.143 13.143t-13.143 5.143h-182.857q-8 0-13.143-5.143t-5.143-13.143v-91.429q0-8 5.143-13.143t13.143-5.143h54.857v-182.857h-54.857q-8 0-13.143-5.143t-5.143-13.143v-91.429q0-8 5.143-13.143t13.143-5.143h256q8 0 13.143 5.143t5.143 13.143zM512 676.571v91.429q0 8-5.143 13.143t-13.143 5.143h-109.714q-8 0-13.143-5.143t-5.143-13.143v-91.429q0-8 5.143-13.143t13.143-5.143h109.714q8 0 13.143 5.143t5.143 13.143zM877.714 438.857q0-119.429-58.857-220.286t-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857 220.286-58.857 159.714-159.714 58.857-220.286z" />
|
||||||
|
<glyph unicode="" d="M733.714 531.428q0 16-10.286 26.286l-52 51.429q-10.857 10.857-25.714 10.857t-25.714-10.857l-233.143-232.571-129.143 129.143q-10.857 10.857-25.714 10.857t-25.714-10.857l-52-51.429q-10.286-10.286-10.286-26.286 0-15.429 10.286-25.714l206.857-206.857q10.857-10.857 25.714-10.857 15.429 0 26.286 10.857l310.286 310.286q10.286 10.286 10.286 25.714zM877.714 438.857q0-119.429-58.857-220.286t-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857 220.286-58.857 159.714-159.714 58.857-220.286z" />
|
||||||
|
<glyph unicode="" d="M658.286 475.428q0 105.714-75.143 180.857t-180.857 75.143-180.857-75.143-75.143-180.857 75.143-180.857 180.857-75.143 180.857 75.143 75.143 180.857zM950.857 0q0-29.714-21.714-51.429t-51.429-21.714q-30.857 0-51.429 21.714l-196 195.429q-102.286-70.857-228-70.857-81.714 0-156.286 31.714t-128.571 85.714-85.714 128.571-31.714 156.286 31.714 156.286 85.714 128.571 128.571 85.714 156.286 31.714 156.286-31.714 128.571-85.714 85.714-128.571 31.714-156.286q0-125.714-70.857-228l196-196q21.143-21.143 21.143-51.429z" horiz-adv-x="951" />
|
||||||
|
</font></defs></svg>
|
After Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 96 B |
|
@ -0,0 +1,148 @@
|
||||||
|
# Git Repositories
|
||||||
|
|
||||||
|
<aside class="notice">
|
||||||
|
|
||||||
|
All routes in this section require authentication.
|
||||||
|
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
Endpoints for interacting with the list of Git repositories stored on the
|
||||||
|
server.
|
||||||
|
|
||||||
|
## List repos
|
||||||
|
|
||||||
|
```shell
|
||||||
|
curl \
|
||||||
|
-H 'X-Api-Key: secret' \
|
||||||
|
https://example.com/api/repos?offset=10&limit=20
|
||||||
|
```
|
||||||
|
|
||||||
|
> JSON Output format
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"message": "",
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"url": "https://aur.archlinux.org/discord-ptb.git",
|
||||||
|
"branch": "master",
|
||||||
|
"repo": "bur",
|
||||||
|
"schedule": "",
|
||||||
|
"arch": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"repo_id": 1,
|
||||||
|
"value": "x86_64"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Retrieve a list of Git repositories.
|
||||||
|
|
||||||
|
### HTTP Request
|
||||||
|
|
||||||
|
`GET /api/repos`
|
||||||
|
|
||||||
|
### Query Parameters
|
||||||
|
|
||||||
|
Parameter | Description
|
||||||
|
--------- | -----------
|
||||||
|
limit | Maximum amount of results to return.
|
||||||
|
offset | Offset of results.
|
||||||
|
repo | Limit results to repositories that publish to the given repo.
|
||||||
|
|
||||||
|
## Get a repo
|
||||||
|
|
||||||
|
```shell
|
||||||
|
curl \
|
||||||
|
-H 'X-Api-Key: secret' \
|
||||||
|
https://example.com/api/repos/15
|
||||||
|
```
|
||||||
|
|
||||||
|
> JSON Output format
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"message": "",
|
||||||
|
"data": {
|
||||||
|
"id": 1,
|
||||||
|
"url": "https://aur.archlinux.org/discord-ptb.git",
|
||||||
|
"branch": "master",
|
||||||
|
"repo": "bur",
|
||||||
|
"schedule": " 0 3",
|
||||||
|
"arch": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"repo_id": 1,
|
||||||
|
"value": "x86_64"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Get info about a specific Git repository.
|
||||||
|
|
||||||
|
### HTTP Request
|
||||||
|
|
||||||
|
`GET /api/repos/:id`
|
||||||
|
|
||||||
|
### URL Parameters
|
||||||
|
|
||||||
|
Parameter | Description
|
||||||
|
--------- | -----------
|
||||||
|
repo | ID of requested repo
|
||||||
|
|
||||||
|
## Create a new repo
|
||||||
|
|
||||||
|
Create a new Git repository with the given data.
|
||||||
|
|
||||||
|
### HTTP Request
|
||||||
|
|
||||||
|
`POST /api/repos`
|
||||||
|
|
||||||
|
### Query Parameters
|
||||||
|
|
||||||
|
Parameter | Description
|
||||||
|
--------- | -----------
|
||||||
|
url | URL of the Git repository.
|
||||||
|
branch | Branch of the Git repository.
|
||||||
|
repo | Vieter repository to publish built packages to.
|
||||||
|
schedule | Cron build schedule
|
||||||
|
arch | Comma-separated list of architectures to build package on.
|
||||||
|
|
||||||
|
## Modify a repo
|
||||||
|
|
||||||
|
Modify the data of an existing Git repository.
|
||||||
|
|
||||||
|
### HTTP Request
|
||||||
|
|
||||||
|
`PATCH /api/repos`
|
||||||
|
|
||||||
|
### Query Parameters
|
||||||
|
|
||||||
|
Parameter | Description
|
||||||
|
--------- | -----------
|
||||||
|
url | URL of the Git repository.
|
||||||
|
branch | Branch of the Git repository.
|
||||||
|
repo | Vieter repository to publish built packages to.
|
||||||
|
schedule | Cron build schedule
|
||||||
|
arch | Comma-separated list of architectures to build package on.
|
||||||
|
|
||||||
|
## Remove a repo
|
||||||
|
|
||||||
|
Remove a Git repository from the server.
|
||||||
|
|
||||||
|
### HTTP Request
|
||||||
|
|
||||||
|
`DELETE /api/repos/:id`
|
||||||
|
|
||||||
|
### URL Parameters
|
||||||
|
|
||||||
|
Parameter | Description
|
||||||
|
--------- | -----------
|
||||||
|
repo | ID of repo to remove
|
|
@ -0,0 +1,95 @@
|
||||||
|
# Repository
|
||||||
|
|
||||||
|
Besides providing a RESTful API, the Vieter server is also a Pacman-compatible
|
||||||
|
repository server. This section describes the various routes that make this
|
||||||
|
possible.
|
||||||
|
|
||||||
|
## Get a package archive or database file
|
||||||
|
|
||||||
|
```shell
|
||||||
|
curl -L https://example.com/bur/x86_64/tuxedo-keyboard-3.0.10-1-x86_64.pkg.tar.zst
|
||||||
|
```
|
||||||
|
|
||||||
|
This endpoint is really the entire repository. It serves both the package
|
||||||
|
archives & the database files for a specific arch-repo. It has three different
|
||||||
|
behaviors, depending on `filename`:
|
||||||
|
|
||||||
|
* If the file extension is one of `.db`, `.files`, `.db.tar.gz` or
|
||||||
|
`.files.tar.gz`, it tries to serve the requested database file.
|
||||||
|
* If the filename contains `.pkg`, it serves the package file.
|
||||||
|
* Otherwise, it assumes `filename` is the name & version of a package inside
|
||||||
|
the repository (e.g. `vieter-0.3.0_alpha.2-1`) & serves that package's `desc`
|
||||||
|
file from inside the database archive.
|
||||||
|
|
||||||
|
<aside class="notice">
|
||||||
|
|
||||||
|
The final option might sound a little strange, but it's used by the build
|
||||||
|
system to determine whether a package needs to be rebuilt.
|
||||||
|
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
### HTTP Request
|
||||||
|
|
||||||
|
`GET /:repo/:arch/:filename`
|
||||||
|
|
||||||
|
### URL Parameters
|
||||||
|
|
||||||
|
Parameter | Description
|
||||||
|
--------- | -----------
|
||||||
|
repo | Repository containing the package
|
||||||
|
arch | Arch-repo containing the package
|
||||||
|
filename | actual filename to request
|
||||||
|
|
||||||
|
## Check whether file exists
|
||||||
|
|
||||||
|
```shell
|
||||||
|
curl -L https://example.com/bur/x86_64/tuxedo-keyboard-3.0.10-1-x86_64.pkg.tar.zst
|
||||||
|
```
|
||||||
|
|
||||||
|
The above request can also be performed as a HEAD request. The behavior is the
|
||||||
|
same, except no data is returned besides an error 404 if the file doesn't exist
|
||||||
|
& an error 200 otherwise.
|
||||||
|
|
||||||
|
### HTTP Request
|
||||||
|
|
||||||
|
`GET /:repo/:arch/:filename`
|
||||||
|
|
||||||
|
### URL Parameters
|
||||||
|
|
||||||
|
Parameter | Description
|
||||||
|
--------- | -----------
|
||||||
|
repo | Repository containing the package
|
||||||
|
arch | Arch-repo containing the package
|
||||||
|
filename | actual filename to request
|
||||||
|
|
||||||
|
## Publish package
|
||||||
|
|
||||||
|
<aside class="notice">
|
||||||
|
|
||||||
|
This endpoint requests authentication.
|
||||||
|
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
```shell
|
||||||
|
curl \
|
||||||
|
-H 'X-Api-Key: secret' \
|
||||||
|
-XPOST \
|
||||||
|
-T tuxedo-keyboard-3.0.10-1-x86_64.pkg.tar.zst \
|
||||||
|
https://example.com/some-repo/publish
|
||||||
|
```
|
||||||
|
|
||||||
|
This endpoint allows you to publish a new package archive to a given repo.
|
||||||
|
|
||||||
|
If the package's architecture is not `any`, it is added to that specific
|
||||||
|
arch-repo. Otherwise, it is added to the configured default architecture & any
|
||||||
|
other already present arch-repos.
|
||||||
|
|
||||||
|
### HTTP Request
|
||||||
|
|
||||||
|
`POST /:repo/publish`
|
||||||
|
|
||||||
|
### URL Parameters
|
||||||
|
|
||||||
|
Parameter | Description
|
||||||
|
--------- | -----------
|
||||||
|
repo | Repository to publish package to
|
|
@ -0,0 +1,39 @@
|
||||||
|
---
|
||||||
|
title: API Reference
|
||||||
|
|
||||||
|
language_tabs: # must be one of https://git.io/vQNgJ
|
||||||
|
- shell: cURL
|
||||||
|
|
||||||
|
toc_footers:
|
||||||
|
- <a href='https://github.com/slatedocs/slate'>Documentation Powered by Slate</a>
|
||||||
|
|
||||||
|
includes:
|
||||||
|
- repository
|
||||||
|
- git
|
||||||
|
- logs
|
||||||
|
|
||||||
|
search: true
|
||||||
|
|
||||||
|
code_clipboard: true
|
||||||
|
|
||||||
|
meta:
|
||||||
|
- name: description
|
||||||
|
content: Documentation for the Vieter API
|
||||||
|
---
|
||||||
|
|
||||||
|
# Introduction
|
||||||
|
|
||||||
|
Welcome to the Vieter API documentation! Here, you can find everything related
|
||||||
|
to interacting with Vieter's HTTP API.
|
||||||
|
|
||||||
|
# Authentication
|
||||||
|
|
||||||
|
```shell
|
||||||
|
curl -H 'X-Api-Key: secret' https://example.com/api/some/path
|
||||||
|
```
|
||||||
|
|
||||||
|
> Don't forget to replace `secret` with your Vieter instance's secret.
|
||||||
|
|
||||||
|
Authentication is done by passing the HTTP header `X-Api-Key: secret` along
|
||||||
|
with each request, where `secret` is replaced with your Vieter server's
|
||||||
|
configured secret.
|
|
@ -0,0 +1,2 @@
|
||||||
|
//= require ./all_nosearch
|
||||||
|
//= require ./app/_search
|
|
@ -0,0 +1,27 @@
|
||||||
|
//= require ./lib/_energize
|
||||||
|
//= require ./app/_copy
|
||||||
|
//= require ./app/_toc
|
||||||
|
//= require ./app/_lang
|
||||||
|
|
||||||
|
function adjustLanguageSelectorWidth() {
|
||||||
|
const elem = $('.dark-box > .lang-selector');
|
||||||
|
elem.width(elem.parent().width());
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
loadToc($('#toc'), '.toc-link', '.toc-list-h2', 10);
|
||||||
|
setupLanguages($('body').data('languages'));
|
||||||
|
$('.content').imagesLoaded( function() {
|
||||||
|
window.recacheHeights();
|
||||||
|
window.refreshToc();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(window).resize(function() {
|
||||||
|
adjustLanguageSelectorWidth();
|
||||||
|
});
|
||||||
|
adjustLanguageSelectorWidth();
|
||||||
|
});
|
||||||
|
|
||||||
|
window.onpopstate = function() {
|
||||||
|
activateLanguage(getLanguageFromQueryString());
|
||||||
|
};
|
|
@ -0,0 +1,15 @@
|
||||||
|
function copyToClipboard(container) {
|
||||||
|
const el = document.createElement('textarea');
|
||||||
|
el.value = container.textContent.replace(/\n$/, '');
|
||||||
|
document.body.appendChild(el);
|
||||||
|
el.select();
|
||||||
|
document.execCommand('copy');
|
||||||
|
document.body.removeChild(el);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupCodeCopy() {
|
||||||
|
$('pre.highlight').prepend('<div class="copy-clipboard"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>Copy to Clipboard</title><path d="M18 6v-6h-18v18h6v6h18v-18h-6zm-12 10h-4v-14h14v4h-10v10zm16 6h-14v-14h14v14z"></path></svg></div>');
|
||||||
|
$('.copy-clipboard').on('click', function() {
|
||||||
|
copyToClipboard(this.parentNode.children[1]);
|
||||||
|
});
|
||||||
|
}
|
|
@ -0,0 +1,171 @@
|
||||||
|
//= require ../lib/_jquery
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright 2008-2013 Concur Technologies, Inc.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
not use this file except in compliance with the License. You may obtain
|
||||||
|
a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
License for the specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
*/
|
||||||
|
;(function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var languages = [];
|
||||||
|
|
||||||
|
window.setupLanguages = setupLanguages;
|
||||||
|
window.activateLanguage = activateLanguage;
|
||||||
|
window.getLanguageFromQueryString = getLanguageFromQueryString;
|
||||||
|
|
||||||
|
function activateLanguage(language) {
|
||||||
|
if (!language) return;
|
||||||
|
if (language === "") return;
|
||||||
|
|
||||||
|
$(".lang-selector a").removeClass('active');
|
||||||
|
$(".lang-selector a[data-language-name='" + language + "']").addClass('active');
|
||||||
|
for (var i=0; i < languages.length; i++) {
|
||||||
|
$(".highlight.tab-" + languages[i]).hide();
|
||||||
|
$(".lang-specific." + languages[i]).hide();
|
||||||
|
}
|
||||||
|
$(".highlight.tab-" + language).show();
|
||||||
|
$(".lang-specific." + language).show();
|
||||||
|
|
||||||
|
window.recacheHeights();
|
||||||
|
|
||||||
|
// scroll to the new location of the position
|
||||||
|
if ($(window.location.hash).get(0)) {
|
||||||
|
$(window.location.hash).get(0).scrollIntoView(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// parseURL and stringifyURL are from https://github.com/sindresorhus/query-string
|
||||||
|
// MIT licensed
|
||||||
|
// https://github.com/sindresorhus/query-string/blob/7bee64c16f2da1a326579e96977b9227bf6da9e6/license
|
||||||
|
function parseURL(str) {
|
||||||
|
if (typeof str !== 'string') {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
str = str.trim().replace(/^(\?|#|&)/, '');
|
||||||
|
|
||||||
|
if (!str) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return str.split('&').reduce(function (ret, param) {
|
||||||
|
var parts = param.replace(/\+/g, ' ').split('=');
|
||||||
|
var key = parts[0];
|
||||||
|
var val = parts[1];
|
||||||
|
|
||||||
|
key = decodeURIComponent(key);
|
||||||
|
// missing `=` should be `null`:
|
||||||
|
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
|
||||||
|
val = val === undefined ? null : decodeURIComponent(val);
|
||||||
|
|
||||||
|
if (!ret.hasOwnProperty(key)) {
|
||||||
|
ret[key] = val;
|
||||||
|
} else if (Array.isArray(ret[key])) {
|
||||||
|
ret[key].push(val);
|
||||||
|
} else {
|
||||||
|
ret[key] = [ret[key], val];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}, {});
|
||||||
|
};
|
||||||
|
|
||||||
|
function stringifyURL(obj) {
|
||||||
|
return obj ? Object.keys(obj).sort().map(function (key) {
|
||||||
|
var val = obj[key];
|
||||||
|
|
||||||
|
if (Array.isArray(val)) {
|
||||||
|
return val.sort().map(function (val2) {
|
||||||
|
return encodeURIComponent(key) + '=' + encodeURIComponent(val2);
|
||||||
|
}).join('&');
|
||||||
|
}
|
||||||
|
|
||||||
|
return encodeURIComponent(key) + '=' + encodeURIComponent(val);
|
||||||
|
}).join('&') : '';
|
||||||
|
};
|
||||||
|
|
||||||
|
// gets the language set in the query string
|
||||||
|
function getLanguageFromQueryString() {
|
||||||
|
if (location.search.length >= 1) {
|
||||||
|
var language = parseURL(location.search).language;
|
||||||
|
if (language) {
|
||||||
|
return language;
|
||||||
|
} else if (jQuery.inArray(location.search.substr(1), languages) != -1) {
|
||||||
|
return location.search.substr(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns a new query string with the new language in it
|
||||||
|
function generateNewQueryString(language) {
|
||||||
|
var url = parseURL(location.search);
|
||||||
|
if (url.language) {
|
||||||
|
url.language = language;
|
||||||
|
return stringifyURL(url);
|
||||||
|
}
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if a button is clicked, add the state to the history
|
||||||
|
function pushURL(language) {
|
||||||
|
if (!history) { return; }
|
||||||
|
var hash = window.location.hash;
|
||||||
|
if (hash) {
|
||||||
|
hash = hash.replace(/^#+/, '');
|
||||||
|
}
|
||||||
|
history.pushState({}, '', '?' + generateNewQueryString(language) + '#' + hash);
|
||||||
|
|
||||||
|
// save language as next default
|
||||||
|
if (localStorage) {
|
||||||
|
localStorage.setItem("language", language);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupLanguages(l) {
|
||||||
|
var defaultLanguage = null;
|
||||||
|
if (localStorage) {
|
||||||
|
defaultLanguage = localStorage.getItem("language");
|
||||||
|
}
|
||||||
|
|
||||||
|
languages = l;
|
||||||
|
|
||||||
|
var presetLanguage = getLanguageFromQueryString();
|
||||||
|
if (presetLanguage) {
|
||||||
|
// the language is in the URL, so use that language!
|
||||||
|
activateLanguage(presetLanguage);
|
||||||
|
|
||||||
|
if (localStorage) {
|
||||||
|
localStorage.setItem("language", presetLanguage);
|
||||||
|
}
|
||||||
|
} else if ((defaultLanguage !== null) && (jQuery.inArray(defaultLanguage, languages) != -1)) {
|
||||||
|
// the language was the last selected one saved in localstorage, so use that language!
|
||||||
|
activateLanguage(defaultLanguage);
|
||||||
|
} else {
|
||||||
|
// no language selected, so use the default
|
||||||
|
activateLanguage(languages[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we click on a language tab, activate that language
|
||||||
|
$(function() {
|
||||||
|
$(".lang-selector a").on("click", function() {
|
||||||
|
var language = $(this).data("language-name");
|
||||||
|
pushURL(language);
|
||||||
|
activateLanguage(language);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})();
|
|
@ -0,0 +1,102 @@
|
||||||
|
//= require ../lib/_lunr
|
||||||
|
//= require ../lib/_jquery
|
||||||
|
//= require ../lib/_jquery.highlight
|
||||||
|
;(function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var content, searchResults;
|
||||||
|
var highlightOpts = { element: 'span', className: 'search-highlight' };
|
||||||
|
var searchDelay = 0;
|
||||||
|
var timeoutHandle = 0;
|
||||||
|
var index;
|
||||||
|
|
||||||
|
function populate() {
|
||||||
|
index = lunr(function(){
|
||||||
|
|
||||||
|
this.ref('id');
|
||||||
|
this.field('title', { boost: 10 });
|
||||||
|
this.field('body');
|
||||||
|
this.pipeline.add(lunr.trimmer, lunr.stopWordFilter);
|
||||||
|
var lunrConfig = this;
|
||||||
|
|
||||||
|
$('h1, h2').each(function() {
|
||||||
|
var title = $(this);
|
||||||
|
var body = title.nextUntil('h1, h2');
|
||||||
|
lunrConfig.add({
|
||||||
|
id: title.prop('id'),
|
||||||
|
title: title.text(),
|
||||||
|
body: body.text()
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
determineSearchDelay();
|
||||||
|
}
|
||||||
|
|
||||||
|
$(populate);
|
||||||
|
$(bind);
|
||||||
|
|
||||||
|
function determineSearchDelay() {
|
||||||
|
if (index.tokenSet.toArray().length>5000) {
|
||||||
|
searchDelay = 300;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function bind() {
|
||||||
|
content = $('.content');
|
||||||
|
searchResults = $('.search-results');
|
||||||
|
|
||||||
|
$('#input-search').on('keyup',function(e) {
|
||||||
|
var wait = function() {
|
||||||
|
return function(executingFunction, waitTime){
|
||||||
|
clearTimeout(timeoutHandle);
|
||||||
|
timeoutHandle = setTimeout(executingFunction, waitTime);
|
||||||
|
};
|
||||||
|
}();
|
||||||
|
wait(function(){
|
||||||
|
search(e);
|
||||||
|
}, searchDelay);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function search(event) {
|
||||||
|
|
||||||
|
var searchInput = $('#input-search')[0];
|
||||||
|
|
||||||
|
unhighlight();
|
||||||
|
searchResults.addClass('visible');
|
||||||
|
|
||||||
|
// ESC clears the field
|
||||||
|
if (event.keyCode === 27) searchInput.value = '';
|
||||||
|
|
||||||
|
if (searchInput.value) {
|
||||||
|
var results = index.search(searchInput.value).filter(function(r) {
|
||||||
|
return r.score > 0.0001;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (results.length) {
|
||||||
|
searchResults.empty();
|
||||||
|
$.each(results, function (index, result) {
|
||||||
|
var elem = document.getElementById(result.ref);
|
||||||
|
searchResults.append("<li><a href='#" + result.ref + "'>" + $(elem).text() + "</a></li>");
|
||||||
|
});
|
||||||
|
highlight.call(searchInput);
|
||||||
|
} else {
|
||||||
|
searchResults.html('<li></li>');
|
||||||
|
$('.search-results li').text('No Results Found for "' + searchInput.value + '"');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unhighlight();
|
||||||
|
searchResults.removeClass('visible');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function highlight() {
|
||||||
|
if (this.value) content.highlight(this.value, highlightOpts);
|
||||||
|
}
|
||||||
|
|
||||||
|
function unhighlight() {
|
||||||
|
content.unhighlight(highlightOpts);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
|
@ -0,0 +1,122 @@
|
||||||
|
//= require ../lib/_jquery
|
||||||
|
//= require ../lib/_imagesloaded.min
|
||||||
|
;(function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var htmlPattern = /<[^>]*>/g;
|
||||||
|
var loaded = false;
|
||||||
|
|
||||||
|
var debounce = function(func, waitTime) {
|
||||||
|
var timeout = false;
|
||||||
|
return function() {
|
||||||
|
if (timeout === false) {
|
||||||
|
setTimeout(function() {
|
||||||
|
func();
|
||||||
|
timeout = false;
|
||||||
|
}, waitTime);
|
||||||
|
timeout = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var closeToc = function() {
|
||||||
|
$(".toc-wrapper").removeClass('open');
|
||||||
|
$("#nav-button").removeClass('open');
|
||||||
|
};
|
||||||
|
|
||||||
|
function loadToc($toc, tocLinkSelector, tocListSelector, scrollOffset) {
|
||||||
|
var headerHeights = {};
|
||||||
|
var pageHeight = 0;
|
||||||
|
var windowHeight = 0;
|
||||||
|
var originalTitle = document.title;
|
||||||
|
|
||||||
|
var recacheHeights = function() {
|
||||||
|
headerHeights = {};
|
||||||
|
pageHeight = $(document).height();
|
||||||
|
windowHeight = $(window).height();
|
||||||
|
|
||||||
|
$toc.find(tocLinkSelector).each(function() {
|
||||||
|
var targetId = $(this).attr('href');
|
||||||
|
if (targetId[0] === "#") {
|
||||||
|
headerHeights[targetId] = $("#" + $.escapeSelector(targetId.substring(1))).offset().top;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var refreshToc = function() {
|
||||||
|
var currentTop = $(document).scrollTop() + scrollOffset;
|
||||||
|
|
||||||
|
if (currentTop + windowHeight >= pageHeight) {
|
||||||
|
// at bottom of page, so just select last header by making currentTop very large
|
||||||
|
// this fixes the problem where the last header won't ever show as active if its content
|
||||||
|
// is shorter than the window height
|
||||||
|
currentTop = pageHeight + 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
var best = null;
|
||||||
|
for (var name in headerHeights) {
|
||||||
|
if ((headerHeights[name] < currentTop && headerHeights[name] > headerHeights[best]) || best === null) {
|
||||||
|
best = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Catch the initial load case
|
||||||
|
if (currentTop == scrollOffset && !loaded) {
|
||||||
|
best = window.location.hash;
|
||||||
|
loaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var $best = $toc.find("[href='" + best + "']").first();
|
||||||
|
if (!$best.hasClass("active")) {
|
||||||
|
// .active is applied to the ToC link we're currently on, and its parent <ul>s selected by tocListSelector
|
||||||
|
// .active-expanded is applied to the ToC links that are parents of this one
|
||||||
|
$toc.find(".active").removeClass("active");
|
||||||
|
$toc.find(".active-parent").removeClass("active-parent");
|
||||||
|
$best.addClass("active");
|
||||||
|
$best.parents(tocListSelector).addClass("active").siblings(tocLinkSelector).addClass('active-parent');
|
||||||
|
$best.siblings(tocListSelector).addClass("active");
|
||||||
|
$toc.find(tocListSelector).filter(":not(.active)").slideUp(150);
|
||||||
|
$toc.find(tocListSelector).filter(".active").slideDown(150);
|
||||||
|
if (window.history.replaceState) {
|
||||||
|
window.history.replaceState(null, "", best);
|
||||||
|
}
|
||||||
|
var thisTitle = $best.data("title");
|
||||||
|
if (thisTitle !== undefined && thisTitle.length > 0) {
|
||||||
|
document.title = thisTitle.replace(htmlPattern, "") + " – " + originalTitle;
|
||||||
|
} else {
|
||||||
|
document.title = originalTitle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var makeToc = function() {
|
||||||
|
recacheHeights();
|
||||||
|
refreshToc();
|
||||||
|
|
||||||
|
$("#nav-button").click(function() {
|
||||||
|
$(".toc-wrapper").toggleClass('open');
|
||||||
|
$("#nav-button").toggleClass('open');
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$(".page-wrapper").click(closeToc);
|
||||||
|
$(".toc-link").click(closeToc);
|
||||||
|
|
||||||
|
// reload immediately after scrolling on toc click
|
||||||
|
$toc.find(tocLinkSelector).click(function() {
|
||||||
|
setTimeout(function() {
|
||||||
|
refreshToc();
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
$(window).scroll(debounce(refreshToc, 200));
|
||||||
|
$(window).resize(debounce(recacheHeights, 200));
|
||||||
|
};
|
||||||
|
|
||||||
|
makeToc();
|
||||||
|
|
||||||
|
window.recacheHeights = recacheHeights;
|
||||||
|
window.refreshToc = refreshToc;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.loadToc = loadToc;
|
||||||
|
})();
|
|
@ -0,0 +1,169 @@
|
||||||
|
/**
|
||||||
|
* energize.js v0.1.0
|
||||||
|
*
|
||||||
|
* Speeds up click events on mobile devices.
|
||||||
|
* https://github.com/davidcalhoun/energize.js
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function() { // Sandbox
|
||||||
|
/**
|
||||||
|
* Don't add to non-touch devices, which don't need to be sped up
|
||||||
|
*/
|
||||||
|
if(!('ontouchstart' in window)) return;
|
||||||
|
|
||||||
|
var lastClick = {},
|
||||||
|
isThresholdReached, touchstart, touchmove, touchend,
|
||||||
|
click, closest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* isThresholdReached
|
||||||
|
*
|
||||||
|
* Compare touchstart with touchend xy coordinates,
|
||||||
|
* and only fire simulated click event if the coordinates
|
||||||
|
* are nearby. (don't want clicking to be confused with a swipe)
|
||||||
|
*/
|
||||||
|
isThresholdReached = function(startXY, xy) {
|
||||||
|
return Math.abs(startXY[0] - xy[0]) > 5 || Math.abs(startXY[1] - xy[1]) > 5;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* touchstart
|
||||||
|
*
|
||||||
|
* Save xy coordinates when the user starts touching the screen
|
||||||
|
*/
|
||||||
|
touchstart = function(e) {
|
||||||
|
this.startXY = [e.touches[0].clientX, e.touches[0].clientY];
|
||||||
|
this.threshold = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* touchmove
|
||||||
|
*
|
||||||
|
* Check if the user is scrolling past the threshold.
|
||||||
|
* Have to check here because touchend will not always fire
|
||||||
|
* on some tested devices (Kindle Fire?)
|
||||||
|
*/
|
||||||
|
touchmove = function(e) {
|
||||||
|
// NOOP if the threshold has already been reached
|
||||||
|
if(this.threshold) return false;
|
||||||
|
|
||||||
|
this.threshold = isThresholdReached(this.startXY, [e.touches[0].clientX, e.touches[0].clientY]);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* touchend
|
||||||
|
*
|
||||||
|
* If the user didn't scroll past the threshold between
|
||||||
|
* touchstart and touchend, fire a simulated click.
|
||||||
|
*
|
||||||
|
* (This will fire before a native click)
|
||||||
|
*/
|
||||||
|
touchend = function(e) {
|
||||||
|
// Don't fire a click if the user scrolled past the threshold
|
||||||
|
if(this.threshold || isThresholdReached(this.startXY, [e.changedTouches[0].clientX, e.changedTouches[0].clientY])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create and fire a click event on the target element
|
||||||
|
* https://developer.mozilla.org/en/DOM/event.initMouseEvent
|
||||||
|
*/
|
||||||
|
var touch = e.changedTouches[0],
|
||||||
|
evt = document.createEvent('MouseEvents');
|
||||||
|
evt.initMouseEvent('click', true, true, window, 0, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);
|
||||||
|
evt.simulated = true; // distinguish from a normal (nonsimulated) click
|
||||||
|
e.target.dispatchEvent(evt);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* click
|
||||||
|
*
|
||||||
|
* Because we've already fired a click event in touchend,
|
||||||
|
* we need to listed for all native click events here
|
||||||
|
* and suppress them as necessary.
|
||||||
|
*/
|
||||||
|
click = function(e) {
|
||||||
|
/**
|
||||||
|
* Prevent ghost clicks by only allowing clicks we created
|
||||||
|
* in the click event we fired (look for e.simulated)
|
||||||
|
*/
|
||||||
|
var time = Date.now(),
|
||||||
|
timeDiff = time - lastClick.time,
|
||||||
|
x = e.clientX,
|
||||||
|
y = e.clientY,
|
||||||
|
xyDiff = [Math.abs(lastClick.x - x), Math.abs(lastClick.y - y)],
|
||||||
|
target = closest(e.target, 'A') || e.target, // needed for standalone apps
|
||||||
|
nodeName = target.nodeName,
|
||||||
|
isLink = nodeName === 'A',
|
||||||
|
standAlone = window.navigator.standalone && isLink && e.target.getAttribute("href");
|
||||||
|
|
||||||
|
lastClick.time = time;
|
||||||
|
lastClick.x = x;
|
||||||
|
lastClick.y = y;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unfortunately Android sometimes fires click events without touch events (seen on Kindle Fire),
|
||||||
|
* so we have to add more logic to determine the time of the last click. Not perfect...
|
||||||
|
*
|
||||||
|
* Older, simpler check: if((!e.simulated) || standAlone)
|
||||||
|
*/
|
||||||
|
if((!e.simulated && (timeDiff < 500 || (timeDiff < 1500 && xyDiff[0] < 50 && xyDiff[1] < 50))) || standAlone) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
if(!standAlone) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Special logic for standalone web apps
|
||||||
|
* See http://stackoverflow.com/questions/2898740/iphone-safari-web-app-opens-links-in-new-window
|
||||||
|
*/
|
||||||
|
if(standAlone) {
|
||||||
|
window.location = target.getAttribute("href");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an energize-focus class to the targeted link (mimics :focus behavior)
|
||||||
|
* TODO: test and/or remove? Does this work?
|
||||||
|
*/
|
||||||
|
if(!target || !target.classList) return;
|
||||||
|
target.classList.add("energize-focus");
|
||||||
|
window.setTimeout(function(){
|
||||||
|
target.classList.remove("energize-focus");
|
||||||
|
}, 150);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* closest
|
||||||
|
* @param {HTMLElement} node current node to start searching from.
|
||||||
|
* @param {string} tagName the (uppercase) name of the tag you're looking for.
|
||||||
|
*
|
||||||
|
* Find the closest ancestor tag of a given node.
|
||||||
|
*
|
||||||
|
* Starts at node and goes up the DOM tree looking for a
|
||||||
|
* matching nodeName, continuing until hitting document.body
|
||||||
|
*/
|
||||||
|
closest = function(node, tagName){
|
||||||
|
var curNode = node;
|
||||||
|
|
||||||
|
while(curNode !== document.body) { // go up the dom until we find the tag we're after
|
||||||
|
if(!curNode || curNode.nodeName === tagName) { return curNode; } // found
|
||||||
|
curNode = curNode.parentNode; // not found, so keep going up
|
||||||
|
}
|
||||||
|
|
||||||
|
return null; // not found
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add all delegated event listeners
|
||||||
|
*
|
||||||
|
* All the events we care about bubble up to document,
|
||||||
|
* so we can take advantage of event delegation.
|
||||||
|
*
|
||||||
|
* Note: no need to wait for DOMContentLoaded here
|
||||||
|
*/
|
||||||
|
document.addEventListener('touchstart', touchstart, false);
|
||||||
|
document.addEventListener('touchmove', touchmove, false);
|
||||||
|
document.addEventListener('touchend', touchend, false);
|
||||||
|
document.addEventListener('click', click, true); // TODO: why does this use capture?
|
||||||
|
|
||||||
|
})();
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,108 @@
|
||||||
|
/*
|
||||||
|
* jQuery Highlight plugin
|
||||||
|
*
|
||||||
|
* Based on highlight v3 by Johann Burkard
|
||||||
|
* http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html
|
||||||
|
*
|
||||||
|
* Code a little bit refactored and cleaned (in my humble opinion).
|
||||||
|
* Most important changes:
|
||||||
|
* - has an option to highlight only entire words (wordsOnly - false by default),
|
||||||
|
* - has an option to be case sensitive (caseSensitive - false by default)
|
||||||
|
* - highlight element tag and class names can be specified in options
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* // wrap every occurrance of text 'lorem' in content
|
||||||
|
* // with <span class='highlight'> (default options)
|
||||||
|
* $('#content').highlight('lorem');
|
||||||
|
*
|
||||||
|
* // search for and highlight more terms at once
|
||||||
|
* // so you can save some time on traversing DOM
|
||||||
|
* $('#content').highlight(['lorem', 'ipsum']);
|
||||||
|
* $('#content').highlight('lorem ipsum');
|
||||||
|
*
|
||||||
|
* // search only for entire word 'lorem'
|
||||||
|
* $('#content').highlight('lorem', { wordsOnly: true });
|
||||||
|
*
|
||||||
|
* // don't ignore case during search of term 'lorem'
|
||||||
|
* $('#content').highlight('lorem', { caseSensitive: true });
|
||||||
|
*
|
||||||
|
* // wrap every occurrance of term 'ipsum' in content
|
||||||
|
* // with <em class='important'>
|
||||||
|
* $('#content').highlight('ipsum', { element: 'em', className: 'important' });
|
||||||
|
*
|
||||||
|
* // remove default highlight
|
||||||
|
* $('#content').unhighlight();
|
||||||
|
*
|
||||||
|
* // remove custom highlight
|
||||||
|
* $('#content').unhighlight({ element: 'em', className: 'important' });
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009 Bartek Szopka
|
||||||
|
*
|
||||||
|
* Licensed under MIT license.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
jQuery.extend({
|
||||||
|
highlight: function (node, re, nodeName, className) {
|
||||||
|
if (node.nodeType === 3) {
|
||||||
|
var match = node.data.match(re);
|
||||||
|
if (match) {
|
||||||
|
var highlight = document.createElement(nodeName || 'span');
|
||||||
|
highlight.className = className || 'highlight';
|
||||||
|
var wordNode = node.splitText(match.index);
|
||||||
|
wordNode.splitText(match[0].length);
|
||||||
|
var wordClone = wordNode.cloneNode(true);
|
||||||
|
highlight.appendChild(wordClone);
|
||||||
|
wordNode.parentNode.replaceChild(highlight, wordNode);
|
||||||
|
return 1; //skip added node in parent
|
||||||
|
}
|
||||||
|
} else if ((node.nodeType === 1 && node.childNodes) && // only element nodes that have children
|
||||||
|
!/(script|style)/i.test(node.tagName) && // ignore script and style nodes
|
||||||
|
!(node.tagName === nodeName.toUpperCase() && node.className === className)) { // skip if already highlighted
|
||||||
|
for (var i = 0; i < node.childNodes.length; i++) {
|
||||||
|
i += jQuery.highlight(node.childNodes[i], re, nodeName, className);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
jQuery.fn.unhighlight = function (options) {
|
||||||
|
var settings = { className: 'highlight', element: 'span' };
|
||||||
|
jQuery.extend(settings, options);
|
||||||
|
|
||||||
|
return this.find(settings.element + "." + settings.className).each(function () {
|
||||||
|
var parent = this.parentNode;
|
||||||
|
parent.replaceChild(this.firstChild, this);
|
||||||
|
parent.normalize();
|
||||||
|
}).end();
|
||||||
|
};
|
||||||
|
|
||||||
|
jQuery.fn.highlight = function (words, options) {
|
||||||
|
var settings = { className: 'highlight', element: 'span', caseSensitive: false, wordsOnly: false };
|
||||||
|
jQuery.extend(settings, options);
|
||||||
|
|
||||||
|
if (words.constructor === String) {
|
||||||
|
words = [words];
|
||||||
|
}
|
||||||
|
words = jQuery.grep(words, function(word, i){
|
||||||
|
return word != '';
|
||||||
|
});
|
||||||
|
words = jQuery.map(words, function(word, i) {
|
||||||
|
return word.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
||||||
|
});
|
||||||
|
if (words.length == 0) { return this; };
|
||||||
|
|
||||||
|
var flag = settings.caseSensitive ? "" : "i";
|
||||||
|
var pattern = "(" + words.join("|") + ")";
|
||||||
|
if (settings.wordsOnly) {
|
||||||
|
pattern = "\\b" + pattern + "\\b";
|
||||||
|
}
|
||||||
|
var re = new RegExp(pattern, flag);
|
||||||
|
|
||||||
|
return this.each(function () {
|
||||||
|
jQuery.highlight(this, re, settings.element, settings.className);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,137 @@
|
||||||
|
<%#
|
||||||
|
Copyright 2008-2013 Concur Technologies, Inc.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
not use this file except in compliance with the License. You may obtain
|
||||||
|
a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
License for the specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
%>
|
||||||
|
<% language_tabs = current_page.data.language_tabs || [] %>
|
||||||
|
<% page_content = yield %>
|
||||||
|
<%
|
||||||
|
if current_page.data.includes
|
||||||
|
current_page.data.includes.each do |include|
|
||||||
|
page_content += partial("includes/#{include}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
<% if current_page.data.key?('meta') %>
|
||||||
|
<% current_page.data.meta.each do |meta| %>
|
||||||
|
<meta
|
||||||
|
<% meta.each do |key, value| %>
|
||||||
|
<%= "#{key}=\"#{value}\"" %>
|
||||||
|
<% end %>
|
||||||
|
>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<title><%= current_page.data.title || "API Documentation" %></title>
|
||||||
|
|
||||||
|
<style media="screen">
|
||||||
|
<%= Rouge::Themes::MonokaiSublimeSlate.render(:scope => '.highlight') %>
|
||||||
|
</style>
|
||||||
|
<style media="print">
|
||||||
|
* {
|
||||||
|
transition:none!important;
|
||||||
|
}
|
||||||
|
<%= Rouge::Themes::Base16::Solarized.render(:scope => '.highlight') %>
|
||||||
|
</style>
|
||||||
|
<%= stylesheet_link_tag :screen, media: :screen %>
|
||||||
|
<%= stylesheet_link_tag :print, media: :print %>
|
||||||
|
<% if current_page.data.search %>
|
||||||
|
<%= javascript_include_tag "all" %>
|
||||||
|
<% else %>
|
||||||
|
<%= javascript_include_tag "all_nosearch" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if current_page.data.code_clipboard %>
|
||||||
|
<script>
|
||||||
|
$(function() { setupCodeCopy(); });
|
||||||
|
</script>
|
||||||
|
<% end %>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="<%= page_classes %>" data-languages="<%=h language_tabs.map{ |lang| lang.is_a?(Hash) ? lang.keys.first : lang }.to_json %>">
|
||||||
|
<a href="#" id="nav-button">
|
||||||
|
<span>
|
||||||
|
NAV
|
||||||
|
<%= image_tag('navbar.png') %>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
<div class="toc-wrapper">
|
||||||
|
<%= image_tag "logo.png", class: 'logo' %>
|
||||||
|
<% if language_tabs.any? %>
|
||||||
|
<div class="lang-selector">
|
||||||
|
<% language_tabs.each do |lang| %>
|
||||||
|
<% if lang.is_a? Hash %>
|
||||||
|
<a href="#" data-language-name="<%= lang.keys.first %>"><%= lang.values.first %></a>
|
||||||
|
<% else %>
|
||||||
|
<a href="#" data-language-name="<%= lang %>"><%= lang %></a>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% if current_page.data.search %>
|
||||||
|
<div class="search">
|
||||||
|
<input type="text" class="search" id="input-search" placeholder="Search">
|
||||||
|
</div>
|
||||||
|
<ul class="search-results"></ul>
|
||||||
|
<% end %>
|
||||||
|
<ul id="toc" class="toc-list-h1">
|
||||||
|
<% toc_data(page_content).each do |h1| %>
|
||||||
|
<li>
|
||||||
|
<a href="#<%= h1[:id] %>" class="toc-h1 toc-link" data-title="<%= h1[:title] %>"><%= h1[:content] %></a>
|
||||||
|
<% if h1[:children].length > 0 %>
|
||||||
|
<ul class="toc-list-h2">
|
||||||
|
<% h1[:children].each do |h2| %>
|
||||||
|
<li>
|
||||||
|
<a href="#<%= h2[:id] %>" class="toc-h2 toc-link" data-title="<%= h2[:title] %>"><%= h2[:content] %></a>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% if current_page.data.toc_footers %>
|
||||||
|
<ul class="toc-footer">
|
||||||
|
<% current_page.data.toc_footers.each do |footer| %>
|
||||||
|
<li><%= footer %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="page-wrapper">
|
||||||
|
<div class="dark-box"></div>
|
||||||
|
<div class="content">
|
||||||
|
<%= page_content %>
|
||||||
|
</div>
|
||||||
|
<div class="dark-box">
|
||||||
|
<% if language_tabs.any? %>
|
||||||
|
<div class="lang-selector">
|
||||||
|
<% language_tabs.each do |lang| %>
|
||||||
|
<% if lang.is_a? Hash %>
|
||||||
|
<a href="#" data-language-name="<%= lang.keys.first %>"><%= lang.values.first %></a>
|
||||||
|
<% else %>
|
||||||
|
<a href="#" data-language-name="<%= lang %>"><%= lang %></a>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,38 @@
|
||||||
|
@font-face {
|
||||||
|
font-family: 'slate';
|
||||||
|
src:font-url('slate.eot?-syv14m');
|
||||||
|
src:font-url('slate.eot?#iefix-syv14m') format('embedded-opentype'),
|
||||||
|
font-url('slate.woff2?-syv14m') format('woff2'),
|
||||||
|
font-url('slate.woff?-syv14m') format('woff'),
|
||||||
|
font-url('slate.ttf?-syv14m') format('truetype'),
|
||||||
|
font-url('slate.svg?-syv14m#slate') format('svg');
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
%icon {
|
||||||
|
font-family: 'slate';
|
||||||
|
speak: none;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: normal;
|
||||||
|
font-variant: normal;
|
||||||
|
text-transform: none;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
%icon-exclamation-sign {
|
||||||
|
@extend %icon;
|
||||||
|
content: "\e600";
|
||||||
|
}
|
||||||
|
%icon-info-sign {
|
||||||
|
@extend %icon;
|
||||||
|
content: "\e602";
|
||||||
|
}
|
||||||
|
%icon-ok-sign {
|
||||||
|
@extend %icon;
|
||||||
|
content: "\e606";
|
||||||
|
}
|
||||||
|
%icon-search {
|
||||||
|
@extend %icon;
|
||||||
|
content: "\e607";
|
||||||
|
}
|
|
@ -0,0 +1,427 @@
|
||||||
|
/*! normalize.css v3.0.2 | MIT License | git.io/normalize */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Set default font family to sans-serif.
|
||||||
|
* 2. Prevent iOS text size adjust after orientation change, without disabling
|
||||||
|
* user zoom.
|
||||||
|
*/
|
||||||
|
|
||||||
|
html {
|
||||||
|
font-family: sans-serif; /* 1 */
|
||||||
|
-ms-text-size-adjust: 100%; /* 2 */
|
||||||
|
-webkit-text-size-adjust: 100%; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove default margin.
|
||||||
|
*/
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* HTML5 display definitions
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Correct `block` display not defined for any HTML5 element in IE 8/9.
|
||||||
|
* Correct `block` display not defined for `details` or `summary` in IE 10/11
|
||||||
|
* and Firefox.
|
||||||
|
* Correct `block` display not defined for `main` in IE 11.
|
||||||
|
*/
|
||||||
|
|
||||||
|
article,
|
||||||
|
aside,
|
||||||
|
details,
|
||||||
|
figcaption,
|
||||||
|
figure,
|
||||||
|
footer,
|
||||||
|
header,
|
||||||
|
hgroup,
|
||||||
|
main,
|
||||||
|
menu,
|
||||||
|
nav,
|
||||||
|
section,
|
||||||
|
summary {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Correct `inline-block` display not defined in IE 8/9.
|
||||||
|
* 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
|
||||||
|
*/
|
||||||
|
|
||||||
|
audio,
|
||||||
|
canvas,
|
||||||
|
progress,
|
||||||
|
video {
|
||||||
|
display: inline-block; /* 1 */
|
||||||
|
vertical-align: baseline; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevent modern browsers from displaying `audio` without controls.
|
||||||
|
* Remove excess height in iOS 5 devices.
|
||||||
|
*/
|
||||||
|
|
||||||
|
audio:not([controls]) {
|
||||||
|
display: none;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address `[hidden]` styling not present in IE 8/9/10.
|
||||||
|
* Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.
|
||||||
|
*/
|
||||||
|
|
||||||
|
[hidden],
|
||||||
|
template {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Links
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the gray background color from active links in IE 10.
|
||||||
|
*/
|
||||||
|
|
||||||
|
a {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Improve readability when focused and also mouse hovered in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
a:active,
|
||||||
|
a:hover {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Text-level semantics
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address styling not present in IE 8/9/10/11, Safari, and Chrome.
|
||||||
|
*/
|
||||||
|
|
||||||
|
abbr[title] {
|
||||||
|
border-bottom: 1px dotted;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
|
||||||
|
*/
|
||||||
|
|
||||||
|
b,
|
||||||
|
strong {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address styling not present in Safari and Chrome.
|
||||||
|
*/
|
||||||
|
|
||||||
|
dfn {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address variable `h1` font-size and margin within `section` and `article`
|
||||||
|
* contexts in Firefox 4+, Safari, and Chrome.
|
||||||
|
*/
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 2em;
|
||||||
|
margin: 0.67em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address styling not present in IE 8/9.
|
||||||
|
*/
|
||||||
|
|
||||||
|
mark {
|
||||||
|
background: #ff0;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address inconsistent and variable font size in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
small {
|
||||||
|
font-size: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevent `sub` and `sup` affecting `line-height` in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sub,
|
||||||
|
sup {
|
||||||
|
font-size: 75%;
|
||||||
|
line-height: 0;
|
||||||
|
position: relative;
|
||||||
|
vertical-align: baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
sup {
|
||||||
|
top: -0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub {
|
||||||
|
bottom: -0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Embedded content
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove border when inside `a` element in IE 8/9/10.
|
||||||
|
*/
|
||||||
|
|
||||||
|
img {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Correct overflow not hidden in IE 9/10/11.
|
||||||
|
*/
|
||||||
|
|
||||||
|
svg:not(:root) {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Grouping content
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address margin not present in IE 8/9 and Safari.
|
||||||
|
*/
|
||||||
|
|
||||||
|
figure {
|
||||||
|
margin: 1em 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address differences between Firefox and other browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
hr {
|
||||||
|
-moz-box-sizing: content-box;
|
||||||
|
box-sizing: content-box;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contain overflow in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
pre {
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address odd `em`-unit font size rendering in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
code,
|
||||||
|
kbd,
|
||||||
|
pre,
|
||||||
|
samp {
|
||||||
|
font-family: monospace, monospace;
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Forms
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Known limitation: by default, Chrome and Safari on OS X allow very limited
|
||||||
|
* styling of `select`, unless a `border` property is set.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Correct color not being inherited.
|
||||||
|
* Known issue: affects color of disabled elements.
|
||||||
|
* 2. Correct font properties not being inherited.
|
||||||
|
* 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
input,
|
||||||
|
optgroup,
|
||||||
|
select,
|
||||||
|
textarea {
|
||||||
|
color: inherit; /* 1 */
|
||||||
|
font: inherit; /* 2 */
|
||||||
|
margin: 0; /* 3 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address `overflow` set to `hidden` in IE 8/9/10/11.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button {
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address inconsistent `text-transform` inheritance for `button` and `select`.
|
||||||
|
* All other form control elements do not inherit `text-transform` values.
|
||||||
|
* Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
|
||||||
|
* Correct `select` style inheritance in Firefox.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
select {
|
||||||
|
text-transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
|
||||||
|
* and `video` controls.
|
||||||
|
* 2. Correct inability to style clickable `input` types in iOS.
|
||||||
|
* 3. Improve usability and consistency of cursor style between image-type
|
||||||
|
* `input` and others.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
html input[type="button"], /* 1 */
|
||||||
|
input[type="reset"],
|
||||||
|
input[type="submit"] {
|
||||||
|
-webkit-appearance: button; /* 2 */
|
||||||
|
cursor: pointer; /* 3 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Re-set default cursor for disabled elements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button[disabled],
|
||||||
|
html input[disabled] {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove inner padding and border in Firefox 4+.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button::-moz-focus-inner,
|
||||||
|
input::-moz-focus-inner {
|
||||||
|
border: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
|
||||||
|
* the UA stylesheet.
|
||||||
|
*/
|
||||||
|
|
||||||
|
input {
|
||||||
|
line-height: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It's recommended that you don't attempt to style these elements.
|
||||||
|
* Firefox's implementation doesn't respect box-sizing, padding, or width.
|
||||||
|
*
|
||||||
|
* 1. Address box sizing set to `content-box` in IE 8/9/10.
|
||||||
|
* 2. Remove excess padding in IE 8/9/10.
|
||||||
|
*/
|
||||||
|
|
||||||
|
input[type="checkbox"],
|
||||||
|
input[type="radio"] {
|
||||||
|
box-sizing: border-box; /* 1 */
|
||||||
|
padding: 0; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fix the cursor style for Chrome's increment/decrement buttons. For certain
|
||||||
|
* `font-size` values of the `input`, it causes the cursor style of the
|
||||||
|
* decrement button to change from `default` to `text`.
|
||||||
|
*/
|
||||||
|
|
||||||
|
input[type="number"]::-webkit-inner-spin-button,
|
||||||
|
input[type="number"]::-webkit-outer-spin-button {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Address `appearance` set to `searchfield` in Safari and Chrome.
|
||||||
|
* 2. Address `box-sizing` set to `border-box` in Safari and Chrome
|
||||||
|
* (include `-moz` to future-proof).
|
||||||
|
*/
|
||||||
|
|
||||||
|
input[type="search"] {
|
||||||
|
-webkit-appearance: textfield; /* 1 */
|
||||||
|
-moz-box-sizing: content-box;
|
||||||
|
-webkit-box-sizing: content-box; /* 2 */
|
||||||
|
box-sizing: content-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove inner padding and search cancel button in Safari and Chrome on OS X.
|
||||||
|
* Safari (but not Chrome) clips the cancel button when the search input has
|
||||||
|
* padding (and `textfield` appearance).
|
||||||
|
*/
|
||||||
|
|
||||||
|
input[type="search"]::-webkit-search-cancel-button,
|
||||||
|
input[type="search"]::-webkit-search-decoration {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define consistent border, margin, and padding.
|
||||||
|
*/
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
border: 1px solid #c0c0c0;
|
||||||
|
margin: 0 2px;
|
||||||
|
padding: 0.35em 0.625em 0.75em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Correct `color` not being inherited in IE 8/9/10/11.
|
||||||
|
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
|
||||||
|
*/
|
||||||
|
|
||||||
|
legend {
|
||||||
|
border: 0; /* 1 */
|
||||||
|
padding: 0; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove default vertical scrollbar in IE 8/9/10/11.
|
||||||
|
*/
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Don't inherit the `font-weight` (applied by a rule above).
|
||||||
|
* NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
|
||||||
|
*/
|
||||||
|
|
||||||
|
optgroup {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tables
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove most spacing between table cells.
|
||||||
|
*/
|
||||||
|
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
border-spacing: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
td,
|
||||||
|
th {
|
||||||
|
padding: 0;
|
||||||
|
}
|
|
@ -0,0 +1,140 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// RTL Styles Variables
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
$default: auto;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// TABLE OF CONTENTS
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#toc>ul>li>a>span {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toc-wrapper {
|
||||||
|
transition: right 0.3s ease-in-out !important;
|
||||||
|
left: $default !important;
|
||||||
|
#{right}: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toc-h2 {
|
||||||
|
padding-#{right}: $nav-padding + $nav-indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav-button {
|
||||||
|
#{right}: 0;
|
||||||
|
transition: right 0.3s ease-in-out;
|
||||||
|
&.open {
|
||||||
|
right: $nav-width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// PAGE LAYOUT AND CODE SAMPLE BACKGROUND
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
.page-wrapper {
|
||||||
|
margin-#{left}: $default !important;
|
||||||
|
margin-#{right}: $nav-width;
|
||||||
|
.dark-box {
|
||||||
|
#{right}: $default;
|
||||||
|
#{left}: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.lang-selector {
|
||||||
|
width: $default !important;
|
||||||
|
a {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CODE SAMPLE STYLES
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
.content {
|
||||||
|
&>h1,
|
||||||
|
&>h2,
|
||||||
|
&>h3,
|
||||||
|
&>h4,
|
||||||
|
&>h5,
|
||||||
|
&>h6,
|
||||||
|
&>p,
|
||||||
|
&>table,
|
||||||
|
&>ul,
|
||||||
|
&>ol,
|
||||||
|
&>aside,
|
||||||
|
&>dl {
|
||||||
|
margin-#{left}: $examples-width;
|
||||||
|
margin-#{right}: $default !important;
|
||||||
|
}
|
||||||
|
&>ul,
|
||||||
|
&>ol {
|
||||||
|
padding-#{right}: $main-padding + 15px;
|
||||||
|
}
|
||||||
|
table {
|
||||||
|
th,
|
||||||
|
td {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd {
|
||||||
|
margin-#{right}: 15px;
|
||||||
|
}
|
||||||
|
aside {
|
||||||
|
aside:before {
|
||||||
|
padding-#{left}: 0.5em;
|
||||||
|
}
|
||||||
|
.search-highlight {
|
||||||
|
background: linear-gradient(to top right, #F7E633 0%, #F1D32F 100%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pre,
|
||||||
|
blockquote {
|
||||||
|
float: left !important;
|
||||||
|
clear: left !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// TYPOGRAPHY
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
h4,
|
||||||
|
h5,
|
||||||
|
h6,
|
||||||
|
p,
|
||||||
|
aside {
|
||||||
|
text-align: right;
|
||||||
|
direction: rtl;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toc-wrapper {
|
||||||
|
text-align: right;
|
||||||
|
direction: rtl;
|
||||||
|
font-weight: 100 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// RESPONSIVE DESIGN
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@media (max-width: $tablet-width) {
|
||||||
|
.toc-wrapper {
|
||||||
|
#{right}: -$nav-width;
|
||||||
|
&.open {
|
||||||
|
#{right}: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.page-wrapper {
|
||||||
|
margin-#{right}: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: $phone-width) {
|
||||||
|
%left-col {
|
||||||
|
margin-#{left}: 0;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*
|
||||||
|
Copyright 2008-2013 Concur Technologies, Inc.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
not use this file except in compliance with the License. You may obtain
|
||||||
|
a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
License for the specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CUSTOMIZE SLATE
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Use these settings to help adjust the appearance of Slate
|
||||||
|
|
||||||
|
|
||||||
|
// BACKGROUND COLORS
|
||||||
|
////////////////////
|
||||||
|
$nav-bg: #2E3336 !default;
|
||||||
|
$examples-bg: #2E3336 !default;
|
||||||
|
$code-bg: #1E2224 !default;
|
||||||
|
$code-annotation-bg: #191D1F !default;
|
||||||
|
$nav-subitem-bg: #1E2224 !default;
|
||||||
|
$nav-active-bg: #0F75D4 !default;
|
||||||
|
$nav-active-parent-bg: #1E2224 !default; // parent links of the current section
|
||||||
|
$lang-select-border: #000 !default;
|
||||||
|
$lang-select-bg: #1E2224 !default;
|
||||||
|
$lang-select-active-bg: $examples-bg !default; // feel free to change this to blue or something
|
||||||
|
$lang-select-pressed-bg: #111 !default; // color of language tab bg when mouse is pressed
|
||||||
|
$main-bg: #F3F7F9 !default;
|
||||||
|
$aside-notice-bg: #8fbcd4 !default;
|
||||||
|
$aside-warning-bg: #c97a7e !default;
|
||||||
|
$aside-success-bg: #6ac174 !default;
|
||||||
|
$search-notice-bg: #c97a7e !default;
|
||||||
|
|
||||||
|
|
||||||
|
// TEXT COLORS
|
||||||
|
////////////////////
|
||||||
|
$main-text: #333 !default; // main content text color
|
||||||
|
$nav-text: #fff !default;
|
||||||
|
$nav-active-text: #fff !default;
|
||||||
|
$nav-active-parent-text: #fff !default; // parent links of the current section
|
||||||
|
$lang-select-text: #fff !default; // color of unselected language tab text
|
||||||
|
$lang-select-active-text: #fff !default; // color of selected language tab text
|
||||||
|
$lang-select-pressed-text: #fff !default; // color of language tab text when mouse is pressed
|
||||||
|
|
||||||
|
|
||||||
|
// SIZES
|
||||||
|
////////////////////
|
||||||
|
$nav-width: 230px !default; // width of the navbar
|
||||||
|
$examples-width: 50% !default; // portion of the screen taken up by code examples
|
||||||
|
$logo-margin: 0px !default; // margin below logo
|
||||||
|
$main-padding: 28px !default; // padding to left and right of content & examples
|
||||||
|
$nav-padding: 15px !default; // padding to left and right of navbar
|
||||||
|
$nav-v-padding: 10px !default; // padding used vertically around search boxes and results
|
||||||
|
$nav-indent: 10px !default; // extra padding for ToC subitems
|
||||||
|
$code-annotation-padding: 13px !default; // padding inside code annotations
|
||||||
|
$h1-margin-bottom: 21px !default; // padding under the largest header tags
|
||||||
|
$tablet-width: 930px !default; // min width before reverting to tablet size
|
||||||
|
$phone-width: $tablet-width - $nav-width !default; // min width before reverting to mobile size
|
||||||
|
|
||||||
|
|
||||||
|
// FONTS
|
||||||
|
////////////////////
|
||||||
|
%default-font {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
%header-font {
|
||||||
|
@extend %default-font;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
%code-font {
|
||||||
|
font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, serif;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// OTHER
|
||||||
|
////////////////////
|
||||||
|
$nav-footer-border-color: #666 !default;
|
||||||
|
$search-box-border-color: #666 !default;
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// INTERNAL
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// These settings are probably best left alone.
|
||||||
|
|
||||||
|
%break-words {
|
||||||
|
word-break: break-all;
|
||||||
|
hyphens: auto;
|
||||||
|
}
|
|
@ -0,0 +1,153 @@
|
||||||
|
@charset "utf-8";
|
||||||
|
@import 'normalize';
|
||||||
|
@import 'variables';
|
||||||
|
@import 'icon-font';
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright 2008-2013 Concur Technologies, Inc.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
not use this file except in compliance with the License. You may obtain
|
||||||
|
a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
License for the specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$print-color: #999;
|
||||||
|
$print-color-light: #ccc;
|
||||||
|
$print-font-size: 12px;
|
||||||
|
|
||||||
|
body {
|
||||||
|
@extend %default-font;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tocify, .toc-footer, .lang-selector, .search, #nav-button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tocify-wrapper>img {
|
||||||
|
margin: 0 auto;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
font-size: 12px;
|
||||||
|
|
||||||
|
pre, code {
|
||||||
|
@extend %code-font;
|
||||||
|
@extend %break-words;
|
||||||
|
border: 1px solid $print-color;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-size: 0.8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
code {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
padding: 1.3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
padding: 0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
border: 1px solid $print-color;
|
||||||
|
tr {
|
||||||
|
border-bottom: 1px solid $print-color;
|
||||||
|
}
|
||||||
|
td,th {
|
||||||
|
padding: 0.7em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
@extend %header-font;
|
||||||
|
font-size: 2.5em;
|
||||||
|
padding-top: 0.5em;
|
||||||
|
padding-bottom: 0.5em;
|
||||||
|
margin-top: 1em;
|
||||||
|
margin-bottom: $h1-margin-bottom;
|
||||||
|
border: 2px solid $print-color-light;
|
||||||
|
border-width: 2px 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
@extend %header-font;
|
||||||
|
font-size: 1.8em;
|
||||||
|
margin-top: 2em;
|
||||||
|
border-top: 2px solid $print-color-light;
|
||||||
|
padding-top: 0.8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1+h2, h1+div+h2 {
|
||||||
|
border-top: none;
|
||||||
|
padding-top: 0;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3, h4 {
|
||||||
|
@extend %header-font;
|
||||||
|
font-size: 0.8em;
|
||||||
|
margin-top: 1.5em;
|
||||||
|
margin-bottom: 0.8em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
h5, h6 {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
aside {
|
||||||
|
padding: 1em;
|
||||||
|
border: 1px solid $print-color-light;
|
||||||
|
border-radius: 5px;
|
||||||
|
margin-top: 1.5em;
|
||||||
|
margin-bottom: 1.5em;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
aside:before {
|
||||||
|
vertical-align: middle;
|
||||||
|
padding-right: 0.5em;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
aside.notice:before {
|
||||||
|
@extend %icon-info-sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
aside.warning:before {
|
||||||
|
@extend %icon-exclamation-sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
aside.success:before {
|
||||||
|
@extend %icon-ok-sign;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.copy-clipboard {
|
||||||
|
@media print {
|
||||||
|
display: none
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,633 @@
|
||||||
|
@charset "utf-8";
|
||||||
|
@import 'normalize';
|
||||||
|
@import 'variables';
|
||||||
|
@import 'icon-font';
|
||||||
|
// @import 'rtl'; // uncomment to switch to RTL format
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright 2008-2013 Concur Technologies, Inc.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
not use this file except in compliance with the License. You may obtain
|
||||||
|
a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
License for the specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// GENERAL STUFF
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
html, body {
|
||||||
|
color: $main-text;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
@extend %default-font;
|
||||||
|
background-color: $main-bg;
|
||||||
|
height: 100%;
|
||||||
|
-webkit-text-size-adjust: none; /* Never autoresize text */
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// TABLE OF CONTENTS
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#toc > ul > li > a > span {
|
||||||
|
float: right;
|
||||||
|
background-color: #2484FF;
|
||||||
|
border-radius: 40px;
|
||||||
|
width: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toc-wrapper {
|
||||||
|
transition: left 0.3s ease-in-out;
|
||||||
|
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
position: fixed;
|
||||||
|
z-index: 30;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: $nav-width;
|
||||||
|
background-color: $nav-bg;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
// language selector for mobile devices
|
||||||
|
.lang-selector {
|
||||||
|
display: none;
|
||||||
|
a {
|
||||||
|
padding-top: 0.5em;
|
||||||
|
padding-bottom: 0.5em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is the logo at the top of the ToC
|
||||||
|
.logo {
|
||||||
|
display: block;
|
||||||
|
max-width: 100%;
|
||||||
|
margin-bottom: $logo-margin;
|
||||||
|
}
|
||||||
|
|
||||||
|
&>.search {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
input {
|
||||||
|
background: $nav-bg;
|
||||||
|
border-width: 0 0 1px 0;
|
||||||
|
border-color: $search-box-border-color;
|
||||||
|
padding: 6px 0 6px 20px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: $nav-v-padding $nav-padding;
|
||||||
|
width: $nav-width - ($nav-padding*2);
|
||||||
|
outline: none;
|
||||||
|
color: $nav-text;
|
||||||
|
border-radius: 0; /* ios has a default border radius */
|
||||||
|
}
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
position: absolute;
|
||||||
|
top: 17px;
|
||||||
|
left: $nav-padding;
|
||||||
|
color: $nav-text;
|
||||||
|
@extend %icon-search;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-results {
|
||||||
|
margin-top: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
transition-property: height, margin;
|
||||||
|
transition-duration: 180ms;
|
||||||
|
transition-timing-function: ease-in-out;
|
||||||
|
background: $nav-subitem-bg;
|
||||||
|
&.visible {
|
||||||
|
height: 30%;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin: 1em $nav-padding;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: $nav-text;
|
||||||
|
text-decoration: none;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// The Table of Contents is composed of multiple nested
|
||||||
|
// unordered lists. These styles remove the default
|
||||||
|
// styling of an unordered list because it is ugly.
|
||||||
|
ul, li {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
line-height: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
color: $nav-text;
|
||||||
|
transition-property: background;
|
||||||
|
transition-timing-function: linear;
|
||||||
|
transition-duration: 200ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is the currently selected ToC entry
|
||||||
|
.toc-link.active {
|
||||||
|
background-color: $nav-active-bg;
|
||||||
|
color: $nav-active-text;
|
||||||
|
}
|
||||||
|
|
||||||
|
// this is parent links of the currently selected ToC entry
|
||||||
|
.toc-link.active-parent {
|
||||||
|
background-color: $nav-active-parent-bg;
|
||||||
|
color: $nav-active-parent-text;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toc-list-h2 {
|
||||||
|
display: none;
|
||||||
|
background-color: $nav-subitem-bg;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toc-h2 {
|
||||||
|
padding-left: $nav-padding + $nav-indent;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toc-footer {
|
||||||
|
padding: 1em 0;
|
||||||
|
margin-top: 1em;
|
||||||
|
border-top: 1px dashed $nav-footer-border-color;
|
||||||
|
|
||||||
|
li,a {
|
||||||
|
color: $nav-text;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
font-size: 0.8em;
|
||||||
|
line-height: 1.7;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.toc-link, .toc-footer li {
|
||||||
|
padding: 0 $nav-padding 0 $nav-padding;
|
||||||
|
display: block;
|
||||||
|
overflow-x: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
text-decoration: none;
|
||||||
|
color: $nav-text;
|
||||||
|
transition-property: background;
|
||||||
|
transition-timing-function: linear;
|
||||||
|
transition-duration: 130ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
// button to show navigation on mobile devices
|
||||||
|
#nav-button {
|
||||||
|
span {
|
||||||
|
display: block;
|
||||||
|
$side-pad: $main-padding / 2 - 8px;
|
||||||
|
padding: $side-pad $side-pad $side-pad;
|
||||||
|
background-color: rgba($main-bg, 0.7);
|
||||||
|
transform-origin: 0 0;
|
||||||
|
transform: rotate(-90deg) translate(-100%, 0);
|
||||||
|
border-radius: 0 0 0 5px;
|
||||||
|
}
|
||||||
|
padding: 0 1.5em 5em 0; // increase touch size area
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 100;
|
||||||
|
color: #000;
|
||||||
|
text-decoration: none;
|
||||||
|
font-weight: bold;
|
||||||
|
opacity: 0.7;
|
||||||
|
line-height: 16px;
|
||||||
|
img {
|
||||||
|
height: 16px;
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
transition: left 0.3s ease-in-out;
|
||||||
|
|
||||||
|
&:hover { opacity: 1; }
|
||||||
|
&.open {left: $nav-width}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// PAGE LAYOUT AND CODE SAMPLE BACKGROUND
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
.page-wrapper {
|
||||||
|
margin-left: $nav-width;
|
||||||
|
position: relative;
|
||||||
|
z-index: 10;
|
||||||
|
background-color: $main-bg;
|
||||||
|
min-height: 100%;
|
||||||
|
|
||||||
|
padding-bottom: 1px; // prevent margin overflow
|
||||||
|
|
||||||
|
// The dark box is what gives the code samples their dark background.
|
||||||
|
// It sits essentially under the actual content block, which has a
|
||||||
|
// transparent background.
|
||||||
|
// I know, it's hackish, but it's the simplist way to make the left
|
||||||
|
// half of the content always this background color.
|
||||||
|
.dark-box {
|
||||||
|
width: $examples-width;
|
||||||
|
background-color: $examples-bg;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lang-selector {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 50;
|
||||||
|
border-bottom: 5px solid $lang-select-active-bg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.lang-selector {
|
||||||
|
display: flex;
|
||||||
|
background-color: $lang-select-bg;
|
||||||
|
width: 100%;
|
||||||
|
font-weight: bold;
|
||||||
|
overflow-x: auto;
|
||||||
|
a {
|
||||||
|
display: inline;
|
||||||
|
color: $lang-select-text;
|
||||||
|
text-decoration: none;
|
||||||
|
padding: 0 10px;
|
||||||
|
line-height: 30px;
|
||||||
|
outline: 0;
|
||||||
|
|
||||||
|
&:active, &:focus {
|
||||||
|
background-color: $lang-select-pressed-bg;
|
||||||
|
color: $lang-select-pressed-text;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background-color: $lang-select-active-bg;
|
||||||
|
color: $lang-select-active-text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:after {
|
||||||
|
content: '';
|
||||||
|
clear: both;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CONTENT STYLES
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// This is all the stuff with the light background in the left half of the page
|
||||||
|
|
||||||
|
.content {
|
||||||
|
// fixes webkit rendering bug for some: see #538
|
||||||
|
-webkit-transform: translateZ(0);
|
||||||
|
// to place content above the dark box
|
||||||
|
position: relative;
|
||||||
|
z-index: 30;
|
||||||
|
|
||||||
|
&:after {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
&>h1, &>h2, &>h3, &>h4, &>h5, &>h6, &>p, &>table, &>ul, &>ol, &>aside, &>dl {
|
||||||
|
margin-right: $examples-width;
|
||||||
|
padding: 0 $main-padding;
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: block;
|
||||||
|
|
||||||
|
@extend %left-col;
|
||||||
|
}
|
||||||
|
|
||||||
|
&>ul, &>ol {
|
||||||
|
padding-left: $main-padding + 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
// the div is the tocify hidden div for placeholding stuff
|
||||||
|
&>h1, &>h2, &>div {
|
||||||
|
clear:both;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
@extend %header-font;
|
||||||
|
font-size: 25px;
|
||||||
|
padding-top: 0.5em;
|
||||||
|
padding-bottom: 0.5em;
|
||||||
|
margin-bottom: $h1-margin-bottom;
|
||||||
|
margin-top: 2em;
|
||||||
|
border-top: 1px solid #ccc;
|
||||||
|
border-bottom: 1px solid #ccc;
|
||||||
|
background-color: #fdfdfd;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1:first-child, div:first-child + h1 {
|
||||||
|
border-top-width: 0;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
@extend %header-font;
|
||||||
|
font-size: 19px;
|
||||||
|
margin-top: 4em;
|
||||||
|
margin-bottom: 0;
|
||||||
|
border-top: 1px solid #ccc;
|
||||||
|
padding-top: 1.2em;
|
||||||
|
padding-bottom: 1.2em;
|
||||||
|
background-image: linear-gradient(to bottom, rgba(#fff, 0.2), rgba(#fff, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
// h2s right after h1s should bump right up
|
||||||
|
// against the h1s.
|
||||||
|
h1 + h2, h1 + div + h2 {
|
||||||
|
margin-top: $h1-margin-bottom * -1;
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3, h4, h5, h6 {
|
||||||
|
@extend %header-font;
|
||||||
|
font-size: 15px;
|
||||||
|
margin-top: 2.5em;
|
||||||
|
margin-bottom: 0.8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
h4, h5, h6 {
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
margin: 2em 0;
|
||||||
|
border-top: 2px solid $examples-bg;
|
||||||
|
border-bottom: 2px solid $main-bg;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
overflow: auto;
|
||||||
|
th,td {
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: top;
|
||||||
|
line-height: 1.6;
|
||||||
|
code {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
padding: 5px 10px;
|
||||||
|
border-bottom: 1px solid #ccc;
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:last-child {
|
||||||
|
border-bottom: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:nth-child(odd)>td {
|
||||||
|
background-color: lighten($main-bg,4.2%);
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:nth-child(even)>td {
|
||||||
|
background-color: lighten($main-bg,2.4%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dt {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
dd {
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
p, li, dt, dd {
|
||||||
|
line-height: 1.6;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
background-color: rgba(0,0,0,0.05);
|
||||||
|
padding: 3px;
|
||||||
|
border-radius: 3px;
|
||||||
|
@extend %break-words;
|
||||||
|
@extend %code-font;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre>code {
|
||||||
|
background-color: transparent;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
aside {
|
||||||
|
padding-top: 1em;
|
||||||
|
padding-bottom: 1em;
|
||||||
|
margin-top: 1.5em;
|
||||||
|
margin-bottom: 1.5em;
|
||||||
|
background: $aside-notice-bg;
|
||||||
|
line-height: 1.6;
|
||||||
|
|
||||||
|
&.warning {
|
||||||
|
background-color: $aside-warning-bg;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.success {
|
||||||
|
background-color: $aside-success-bg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
aside:before {
|
||||||
|
vertical-align: middle;
|
||||||
|
padding-right: 0.5em;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
aside.notice:before {
|
||||||
|
@extend %icon-info-sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
aside.warning:before {
|
||||||
|
@extend %icon-exclamation-sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
aside.success:before {
|
||||||
|
@extend %icon-ok-sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-highlight {
|
||||||
|
padding: 2px;
|
||||||
|
margin: -3px;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid #F7E633;
|
||||||
|
background: linear-gradient(to top left, #F7E633 0%, #F1D32F 100%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CODE SAMPLE STYLES
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// This is all the stuff that appears in the right half of the page
|
||||||
|
|
||||||
|
.content {
|
||||||
|
&>div.highlight {
|
||||||
|
clear:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre, blockquote {
|
||||||
|
background-color: $code-bg;
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
|
margin: 0;
|
||||||
|
width: $examples-width;
|
||||||
|
|
||||||
|
float:right;
|
||||||
|
clear:right;
|
||||||
|
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
@extend %right-col;
|
||||||
|
|
||||||
|
&>p { margin: 0; }
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
border-bottom: dashed 1px #ccc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
@extend %code-font;
|
||||||
|
padding-top: 2em;
|
||||||
|
padding-bottom: 2em;
|
||||||
|
padding: 2em $main-padding;
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote {
|
||||||
|
&>p {
|
||||||
|
background-color: $code-annotation-bg;
|
||||||
|
padding: $code-annotation-padding 2em;
|
||||||
|
color: #eee;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// RESPONSIVE DESIGN
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// These are the styles for phones and tablets
|
||||||
|
// There are also a couple styles disperesed
|
||||||
|
|
||||||
|
@media (max-width: $tablet-width) {
|
||||||
|
.toc-wrapper {
|
||||||
|
left: -$nav-width;
|
||||||
|
|
||||||
|
&.open {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-wrapper {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav-button {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toc-link {
|
||||||
|
padding-top: 0.3em;
|
||||||
|
padding-bottom: 0.3em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: $phone-width) {
|
||||||
|
.dark-box {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
%left-col {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toc-wrapper .lang-selector {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-wrapper .lang-selector {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
%right-col {
|
||||||
|
width: auto;
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
%right-col + %left-col {
|
||||||
|
margin-top: $main-padding;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.highlight .c, .highlight .cm, .highlight .c1, .highlight .cs {
|
||||||
|
color: #909090;
|
||||||
|
}
|
||||||
|
|
||||||
|
.highlight, .highlight .w {
|
||||||
|
background-color: $code-bg;
|
||||||
|
}
|
||||||
|
|
||||||
|
.copy-clipboard {
|
||||||
|
float: right;
|
||||||
|
fill: #9DAAB6;
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0.4;
|
||||||
|
height: 18px;
|
||||||
|
width: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.copy-clipboard:hover {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
|
@ -27,16 +27,22 @@ enableGitInfo = true
|
||||||
weight = 1
|
weight = 1
|
||||||
|
|
||||||
[menu]
|
[menu]
|
||||||
# [[menu.before]]
|
[[menu.after]]
|
||||||
|
name = "API Documentation"
|
||||||
|
url = "https://rustybever.be/docs/vieter/api"
|
||||||
|
weight = 10
|
||||||
|
[[menu.after]]
|
||||||
|
name = "Man Pages"
|
||||||
|
url = "https://rustybever.be/man/vieter/vieter.1.html"
|
||||||
|
weight = 20
|
||||||
[[menu.after]]
|
[[menu.after]]
|
||||||
name = "Source"
|
name = "Source"
|
||||||
url = "https://git.rustybever.be/Chewing_Bever/docs"
|
url = "https://git.rustybever.be/Chewing_Bever/docs"
|
||||||
weight = 10
|
weight = 30
|
||||||
|
|
||||||
[[menu.after]]
|
[[menu.after]]
|
||||||
name = "Hugo Theme"
|
name = "Hugo Theme"
|
||||||
url = "https://github.com/alex-shpak/hugo-book"
|
url = "https://github.com/alex-shpak/hugo-book"
|
||||||
weight = 20
|
weight = 40
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
# (Optional, default light) Sets color theme: light, dark or auto.
|
# (Optional, default light) Sets color theme: light, dark or auto.
|
||||||
|
|
|
@ -1,89 +0,0 @@
|
||||||
# API Reference
|
|
||||||
|
|
||||||
All routes that return JSON use the following shape:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"message": "some message",
|
|
||||||
"data": {}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Here, data can be any JSON object, so it's not guaranteed to be a struct.
|
|
||||||
|
|
||||||
### `GET /<repo>/<arch>/<filename>`
|
|
||||||
|
|
||||||
This route serves the contents of a specific architecture' repo.
|
|
||||||
|
|
||||||
If `<filename>` is one of `<repo>.db`, `<repo>.files`, `<repo>.db.tar.gz` or
|
|
||||||
`<repo>.files.tar.gz`, it will serve the respective archive file from the
|
|
||||||
repository.
|
|
||||||
|
|
||||||
If `<filename>` contains `.pkg`, it assumes the request to be for a package
|
|
||||||
archive & will serve that file from the specific arch-repo's package directory.
|
|
||||||
|
|
||||||
Finally, if none of the above are true, Vieter assumes it to be request for a
|
|
||||||
package version's desc file & tries to serve this instead. This functionality
|
|
||||||
is very useful for the build system for checking whether a package needs to be
|
|
||||||
rebuilt or not.
|
|
||||||
|
|
||||||
### `HEAD /<repo>/<arch>/<filename>`
|
|
||||||
|
|
||||||
Behaves the same as the above route, but instead of returning actual data, it
|
|
||||||
returns either 200 or 404, depending on whether the file exists. This route is
|
|
||||||
used by the build system to determine whether a package needs to be rebuilt.
|
|
||||||
|
|
||||||
### `POST /<repo>/publish`
|
|
||||||
|
|
||||||
This route is used to upload packages to a repository. It requires the API
|
|
||||||
key to be provided using the `X-Api-Key` HTTP header. Vieter will parse the
|
|
||||||
package's contents & update the repository files accordingely. I find the
|
|
||||||
easiest way to use this route is using cURL:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
curl -XPOST -T "path-to-package.pkg.tar.zst" -H "X-API-KEY: your-api-key" https://example.com/somerepo/publish
|
|
||||||
```
|
|
||||||
|
|
||||||
Packages are automatically added to the correct arch-repo. If a package type is
|
|
||||||
`any`, the package is added to the configured `default_arch`, as well as all
|
|
||||||
already present arch-repos. To prevent unnecessary duplication of package
|
|
||||||
files, these packages are shared between arch-repos' package directories using
|
|
||||||
hard links.
|
|
||||||
|
|
||||||
{{< hint info >}}
|
|
||||||
**Note**
|
|
||||||
Vieter only supports uploading archives compressed using either gzip, zstd or
|
|
||||||
xz at the moment.
|
|
||||||
{{< /hint >}}
|
|
||||||
|
|
||||||
### `GET /health`
|
|
||||||
|
|
||||||
This endpoint's only use is to be used with healthchecks. It returns a JSON
|
|
||||||
response with the message "Healthy.".
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
All API routes require the API key to provided using the `X-Api-Key` header.
|
|
||||||
Otherwise, they'll return a status code 401.
|
|
||||||
|
|
||||||
### `GET /api/repos`
|
|
||||||
|
|
||||||
Returns the current list of Git repositories.
|
|
||||||
|
|
||||||
### `GET /api/repos/<id>`
|
|
||||||
|
|
||||||
Get the information for the Git repo with the given ID.
|
|
||||||
|
|
||||||
### `POST /api/repos?<url>&<branch>&<arch>&<repo>`
|
|
||||||
|
|
||||||
Adds a new Git repository with the provided URL, Git branch & comma-separated
|
|
||||||
list of architectures.
|
|
||||||
|
|
||||||
### `DELETE /api/repos/<id>`
|
|
||||||
|
|
||||||
Deletes the Git repository with the provided ID.
|
|
||||||
|
|
||||||
### `PATCH /api/repos/<id>?<url>&<branch>&<arch>&<repo>`
|
|
||||||
|
|
||||||
Updates the provided parameters for the repo with the given ID. All arguments
|
|
||||||
are optional.
|
|
Loading…
Reference in New Issue