├── .editorconfig ├── .github ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .ruby-version ├── .travis.yml ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── README.md ├── Vagrantfile ├── build ├── assets │ ├── fonts │ │ ├── slate.eot │ │ ├── slate.svg │ │ ├── slate.ttf │ │ ├── slate.woff │ │ └── slate.woff2 │ ├── images │ │ ├── favicon.ico │ │ ├── logo.png │ │ └── navbar.png │ ├── javascripts │ │ ├── all.js │ │ └── all_nosearch.js │ └── stylesheets │ │ ├── print.css │ │ └── screen.css └── index.html ├── config.rb ├── deploy.sh ├── font-selection.json ├── lib ├── multilang.rb ├── nesting_unique_head.rb ├── toc_data.rb └── unique_head.rb └── source ├── assets ├── fonts │ ├── slate.eot │ ├── slate.svg │ ├── slate.ttf │ ├── slate.woff │ └── slate.woff2 ├── images │ ├── favicon.ico │ ├── logo.png │ └── navbar.png ├── javascripts │ ├── all.js │ ├── all_nosearch.js │ ├── app │ │ ├── _lang.js │ │ ├── _search.js │ │ └── _toc.js │ └── lib │ │ ├── _energize.js │ │ ├── _imagesloaded.min.js │ │ ├── _jquery.highlight.js │ │ ├── _jquery.js │ │ └── _lunr.js └── stylesheets │ ├── _icon-font.scss │ ├── _normalize.scss │ ├── _rtl.scss │ ├── _variables.scss │ ├── print.css.scss │ └── screen.css.scss ├── includes ├── _anonymous_channels.md ├── _auth_channels.md ├── _rest_endpoints.md └── _retail_gateway.md ├── index.html.md └── layouts └── layout.erb /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # Top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | indent_style = space 11 | indent_size = 2 12 | trim_trailing_whitespace = true 13 | 14 | [*.rb] 15 | charset = utf-8 16 | 17 | [*.md] 18 | trim_trailing_whitespace = false 19 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 10 | 11 | Operating system: ✍️ TODO 12 | Last upstream commit (run `git log --author="Robert Lord" | head -n 1`): ✍️ TODO 13 | Browser version(s): ✍️ TODO 14 | Ruby version (run `ruby -v`): ✍️ TODO 15 | 16 | --- 17 | 18 | ✍️ TODO write your issue here 19 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | *.rbc 3 | .bundle 4 | .config 5 | coverage 6 | InstalledFiles 7 | lib/bundler/man 8 | pkg 9 | rdoc 10 | spec/reports 11 | test/tmp 12 | test/version_tmp 13 | tmp 14 | vendor/ 15 | *.DS_STORE 16 | .cache 17 | .vagrant 18 | .sass-cache 19 | 20 | # YARD artifacts 21 | .yardoc 22 | _yardoc 23 | doc/ 24 | .idea/ 25 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.7.4 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: ruby 4 | 5 | rvm: 6 | - 2.3.3 7 | - 2.4.0 8 | 9 | cache: bundler 10 | script: bundle exec middleman build 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## Version 2.3.1 4 | 5 | *July 5, 2018* 6 | 7 | - Update `sprockets` in `Gemfile.lock` to fix security warnings 8 | 9 | ## Version 2.3 10 | 11 | *July 5, 2018* 12 | 13 | - Allows strikethrough in markdown by default. 14 | - Upgrades jQuery to 3.2.1, thanks to [Tomi Takussaari](https://github.com/TomiTakussaari) 15 | - Fixes invalid HTML in `layout.erb`, thanks to [Eric Scouten](https://github.com/scouten) for pointing out 16 | - Hopefully fixes Vagrant memory issues, thanks to [Petter Blomberg](https://github.com/p-blomberg) for the suggestion 17 | - Cleans HTML in headers before setting `document.title`, thanks to [Dan Levy](https://github.com/justsml) 18 | - Allows trailing whitespace in markdown files, thanks to [Samuel Cousin](https://github.com/kuzyn) 19 | - Fixes pushState/replaceState problems with scrolling not changing the document hash, thanks to [Andrey Fedorov](https://github.com/anfedorov) 20 | - Removes some outdated examples, thanks [@al-tr](https://github.com/al-tr), [Jerome Dahdah](https://github.com/jdahdah), and [Ricardo Castro](https://github.com/mccricardo) 21 | - Fixes `nav-padding` bug, thanks [Jerome Dahdah](https://github.com/jdahdah) 22 | - Code style fixes thanks to [Sebastian Zaremba](https://github.com/vassyz) 23 | - Nokogiri version bump thanks to [Grey Baker](https://github.com/greysteil) 24 | - Fix to default `index.md` text thanks to [Nick Busey](https://github.com/NickBusey) 25 | 26 | Thanks to everyone who contributed to this release! 27 | 28 | ## Version 2.2 29 | 30 | *January 19, 2018* 31 | 32 | - Fixes bugs with some non-roman languages not generating unique headers 33 | - Adds editorconfig, thanks to [Jay Thomas](https://github.com/jaythomas) 34 | - Adds optional `NestingUniqueHeadCounter`, thanks to [Vladimir Morozov](https://github.com/greenhost87) 35 | - Small fixes to typos and language, thx [Emir Ribić](https://github.com/ribice), [Gregor Martynus](https://github.com/gr2m), and [Martius](https://github.com/martiuslim)! 36 | - Adds links to Spectrum chat for questions in README and ISSUE_TEMPLATE 37 | 38 | ## Version 2.1 39 | 40 | *October 30, 2017* 41 | 42 | - Right-to-left text stylesheet option, thanks to [Mohammad Hossein Rabiee](https://github.com/mhrabiee) 43 | - Fix for HTML5 history state bug, thanks to [Zach Toolson](https://github.com/ztoolson) 44 | - Small styling changes, typo fixes, small bug fixes from [Marian Friedmann](https://github.com/rnarian), [Ben Wilhelm](https://github.com/benwilhelm), [Fouad Matin](https://github.com/fouad), [Nicolas Bonduel](https://github.com/NicolasBonduel), [Christian Oliff](https://github.com/coliff) 45 | 46 | Thanks to everyone who submitted PRs for this version! 47 | 48 | ## Version 2.0 49 | 50 | *July 17, 2017* 51 | 52 | - All-new statically generated table of contents 53 | - Should be much faster loading and scrolling for large pages 54 | - Smaller Javascript file sizes 55 | - Avoids the problem with the last link in the ToC not ever highlighting if the section was shorter than the page 56 | - Fixes control-click not opening in a new page 57 | - Automatically updates the HTML title as you scroll 58 | - Updated design 59 | - New default colors! 60 | - New spacings and sizes! 61 | - System-default typefaces, just like GitHub 62 | - Added search input delay on large corpuses to reduce lag 63 | - We even bumped the major version cause hey, why not? 64 | - Various small bug fixes 65 | 66 | Thanks to everyone who helped debug or wrote code for this version! It was a serious community effort, and I couldn't have done it alone. 67 | 68 | ## Version 1.5 69 | 70 | *February 23, 2017* 71 | 72 | - Add [multiple tabs per programming language](https://github.com/lord/slate/wiki/Multiple-language-tabs-per-programming-language) feature 73 | - Upgrade Middleman to add Ruby 1.4.0 compatibility 74 | - Switch default code highlighting color scheme to better highlight JSON 75 | - Various small typo and bug fixes 76 | 77 | ## Version 1.4 78 | 79 | *November 24, 2016* 80 | 81 | - Upgrade Middleman and Rouge gems, should hopefully solve a number of bugs 82 | - Update some links in README 83 | - Fix broken Vagrant startup script 84 | - Fix some problems with deploy.sh help message 85 | - Fix bug with language tabs not hiding properly if no error 86 | - Add `!default` to SASS variables 87 | - Fix bug with logo margin 88 | - Bump tested Ruby versions in .travis.yml 89 | 90 | ## Version 1.3.3 91 | 92 | *June 11, 2016* 93 | 94 | Documentation and example changes. 95 | 96 | ## Version 1.3.2 97 | 98 | *February 3, 2016* 99 | 100 | A small bugfix for slightly incorrect background colors on code samples in some cases. 101 | 102 | ## Version 1.3.1 103 | 104 | *January 31, 2016* 105 | 106 | A small bugfix for incorrect whitespace in code blocks. 107 | 108 | ## Version 1.3 109 | 110 | *January 27, 2016* 111 | 112 | We've upgraded Middleman and a number of other dependencies, which should fix quite a few bugs. 113 | 114 | Instead of `rake build` and `rake deploy`, you should now run `bundle exec middleman build --clean` to build your server, and `./deploy.sh` to deploy it to Github Pages. 115 | 116 | ## Version 1.2 117 | 118 | *June 20, 2015* 119 | 120 | **Fixes:** 121 | 122 | - Remove crash on invalid languages 123 | - Update Tocify to scroll to the highlighted header in the Table of Contents 124 | - Fix variable leak and update search algorithms 125 | - Update Python examples to be valid Python 126 | - Update gems 127 | - More misc. bugfixes of Javascript errors 128 | - Add Dockerfile 129 | - Remove unused gems 130 | - Optimize images, fonts, and generated asset files 131 | - Add chinese font support 132 | - Remove RedCarpet header ID patch 133 | - Update language tabs to not disturb existing query strings 134 | 135 | ## Version 1.1 136 | 137 | *July 27, 2014* 138 | 139 | **Fixes:** 140 | 141 | - Finally, a fix for the redcarpet upgrade bug 142 | 143 | ## Version 1.0 144 | 145 | *July 2, 2014* 146 | 147 | [View Issues](https://github.com/tripit/slate/issues?milestone=1&state=closed) 148 | 149 | **Features:** 150 | 151 | - Responsive designs for phones and tablets 152 | - Started tagging versions 153 | 154 | **Fixes:** 155 | 156 | - Fixed 'unrecognized expression' error 157 | - Fixed #undefined hash bug 158 | - Fixed bug where the current language tab would be unselected 159 | - Fixed bug where tocify wouldn't highlight the current section while searching 160 | - Fixed bug where ids of header tags would have special characters that caused problems 161 | - Updated layout so that pages with disabled search wouldn't load search.js 162 | - Cleaned up Javascript 163 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at hello@lord.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | ruby '>=2.3.1' 2 | source 'https://rubygems.org' 3 | 4 | # Middleman 5 | gem 'middleman', '~>4.2.1' 6 | gem 'middleman-syntax', '~> 3.0.0' 7 | gem 'middleman-autoprefixer', '~> 2.7.0' 8 | gem 'middleman-sprockets', '~> 4.1.0' 9 | gem 'rouge', '~> 2.0.5' 10 | gem 'redcarpet', '~> 3.4.0' 11 | gem 'nokogiri', '~> 1.8.2' 12 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | activesupport (5.0.1) 5 | concurrent-ruby (~> 1.0, >= 1.0.2) 6 | i18n (~> 0.7) 7 | minitest (~> 5.1) 8 | tzinfo (~> 1.1) 9 | addressable (2.5.0) 10 | public_suffix (~> 2.0, >= 2.0.2) 11 | autoprefixer-rails (6.6.1) 12 | execjs 13 | backports (3.6.8) 14 | coffee-script (2.4.1) 15 | coffee-script-source 16 | execjs 17 | coffee-script-source (1.12.2) 18 | compass-import-once (1.0.5) 19 | sass (>= 3.2, < 3.5) 20 | concurrent-ruby (1.0.5) 21 | contracts (0.13.0) 22 | dotenv (2.2.0) 23 | erubis (2.7.0) 24 | execjs (2.7.0) 25 | fast_blank (1.0.0) 26 | fastimage (2.0.1) 27 | addressable (~> 2) 28 | ffi (1.15.5) 29 | haml (4.0.7) 30 | tilt 31 | hamster (3.0.0) 32 | concurrent-ruby (~> 1.0) 33 | hashie (3.5.1) 34 | i18n (0.7.0) 35 | kramdown (1.13.2) 36 | listen (3.0.8) 37 | rb-fsevent (~> 0.9, >= 0.9.4) 38 | rb-inotify (~> 0.9, >= 0.9.7) 39 | memoist (0.15.0) 40 | middleman (4.2.1) 41 | coffee-script (~> 2.2) 42 | compass-import-once (= 1.0.5) 43 | haml (>= 4.0.5) 44 | kramdown (~> 1.2) 45 | middleman-cli (= 4.2.1) 46 | middleman-core (= 4.2.1) 47 | sass (>= 3.4.0, < 4.0) 48 | middleman-autoprefixer (2.7.1) 49 | autoprefixer-rails (>= 6.5.2, < 7.0.0) 50 | middleman-core (>= 3.3.3) 51 | middleman-cli (4.2.1) 52 | thor (>= 0.17.0, < 2.0) 53 | middleman-core (4.2.1) 54 | activesupport (>= 4.2, < 5.1) 55 | addressable (~> 2.3) 56 | backports (~> 3.6) 57 | bundler (~> 1.1) 58 | contracts (~> 0.13.0) 59 | dotenv 60 | erubis 61 | execjs (~> 2.0) 62 | fast_blank 63 | fastimage (~> 2.0) 64 | hamster (~> 3.0) 65 | hashie (~> 3.4) 66 | i18n (~> 0.7.0) 67 | listen (~> 3.0.0) 68 | memoist (~> 0.14) 69 | padrino-helpers (~> 0.13.0) 70 | parallel 71 | rack (>= 1.4.5, < 3) 72 | sass (>= 3.4) 73 | servolux 74 | tilt (~> 2.0) 75 | uglifier (~> 3.0) 76 | middleman-sprockets (4.1.0) 77 | middleman-core (~> 4.0) 78 | sprockets (>= 3.0) 79 | middleman-syntax (3.0.0) 80 | middleman-core (>= 3.2) 81 | rouge (~> 2.0) 82 | mini_portile2 (2.3.0) 83 | minitest (5.10.1) 84 | nokogiri (1.8.2) 85 | mini_portile2 (~> 2.3.0) 86 | padrino-helpers (0.13.3.3) 87 | i18n (~> 0.6, >= 0.6.7) 88 | padrino-support (= 0.13.3.3) 89 | tilt (>= 1.4.1, < 3) 90 | padrino-support (0.13.3.3) 91 | activesupport (>= 3.1) 92 | parallel (1.10.0) 93 | public_suffix (2.0.5) 94 | rack (2.0.5) 95 | rb-fsevent (0.9.8) 96 | rb-inotify (0.9.8) 97 | ffi (>= 0.5.0) 98 | redcarpet (3.4.0) 99 | rouge (2.0.7) 100 | sass (3.4.23) 101 | servolux (0.12.0) 102 | sprockets (3.7.2) 103 | concurrent-ruby (~> 1.0) 104 | rack (> 1, < 3) 105 | thor (0.19.4) 106 | thread_safe (0.3.5) 107 | tilt (2.0.6) 108 | tzinfo (1.2.2) 109 | thread_safe (~> 0.1) 110 | uglifier (3.0.4) 111 | execjs (>= 0.3.0, < 3) 112 | 113 | PLATFORMS 114 | ruby 115 | 116 | DEPENDENCIES 117 | middleman (~> 4.2.1) 118 | middleman-autoprefixer (~> 2.7.0) 119 | middleman-sprockets (~> 4.1.0) 120 | middleman-syntax (~> 3.0.0) 121 | nokogiri (~> 1.8.2) 122 | redcarpet (~> 3.4.0) 123 | rouge (~> 2.0.5) 124 | 125 | RUBY VERSION 126 | ruby 2.3.3p222 127 | 128 | BUNDLED WITH 129 | 1.15.4 130 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008-2013 Concur Technologies, Inc. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | not use this file except in compliance with the License. You may obtain 5 | a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | License for the specific language governing permissions and limitations 13 | under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Getting Started 2 | 3 | ### Prerequisites 4 | 5 | You're going to need: 6 | 7 | - **Linux or macOS** — Windows may work, but is unsupported. 8 | - **Ruby, version 2.3.1 or newer** 9 | - **Bundler** — If Ruby is already installed, but the `bundle` command doesn't work, just run `gem install bundler` in a terminal. 10 | 11 | ### Getting Set Up 12 | 13 | Initialize and start Slate. You can either do this locally, or with Vagrant: 14 | 15 | ```shell 16 | # either run this to run locally 17 | bundle install 18 | bundle exec middleman server 19 | 20 | # OR run this to run with vagrant 21 | vagrant up 22 | ``` 23 | 24 | You can now see the docs at http://localhost:4567. Whoa! That was fast! 25 | 26 | ### Pushing 27 | 28 | Remember to build before pushing 29 | 30 | ``` 31 | bundle exec middleman build --clean 32 | ``` 33 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure(2) do |config| 2 | config.vm.box = "ubuntu/trusty64" 3 | config.vm.network :forwarded_port, guest: 4567, host: 4567 4 | config.vm.provider "virtualbox" do |vb| 5 | vb.memory = "2048" 6 | end 7 | 8 | config.vm.provision "bootstrap", 9 | type: "shell", 10 | inline: <<-SHELL 11 | sudo apt-add-repository ppa:brightbox/ruby-ng 12 | sudo apt-get update 13 | sudo apt-get install -yq ruby2.4 ruby2.4-dev 14 | sudo apt-get install -yq pkg-config build-essential nodejs git libxml2-dev libxslt-dev 15 | sudo apt-get autoremove -yq 16 | gem2.4 install --no-ri --no-rdoc bundler 17 | SHELL 18 | 19 | # add the local user git config to the vm 20 | config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig" 21 | 22 | config.vm.provision "install", 23 | type: "shell", 24 | privileged: false, 25 | inline: <<-SHELL 26 | echo "==============================================" 27 | echo "Installing app dependencies" 28 | cd /vagrant 29 | bundle config build.nokogiri --use-system-libraries 30 | bundle install 31 | SHELL 32 | 33 | config.vm.provision "run", 34 | type: "shell", 35 | privileged: false, 36 | run: "always", 37 | inline: <<-SHELL 38 | echo "==============================================" 39 | echo "Starting up middleman at http://localhost:4567" 40 | echo "If it does not come up, check the ~/middleman.log file for any error messages" 41 | cd /vagrant 42 | bundle exec middleman server --watcher-force-polling --watcher-latency=1 &> ~/middleman.log & 43 | SHELL 44 | end 45 | -------------------------------------------------------------------------------- /build/assets/fonts/slate.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blockchain/docs-exchange-api/1c7a038214904ff29a0857957e0412fb26b6bd0b/build/assets/fonts/slate.eot -------------------------------------------------------------------------------- /build/assets/fonts/slate.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Generated by IcoMoon 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /build/assets/fonts/slate.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blockchain/docs-exchange-api/1c7a038214904ff29a0857957e0412fb26b6bd0b/build/assets/fonts/slate.ttf -------------------------------------------------------------------------------- /build/assets/fonts/slate.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blockchain/docs-exchange-api/1c7a038214904ff29a0857957e0412fb26b6bd0b/build/assets/fonts/slate.woff -------------------------------------------------------------------------------- /build/assets/fonts/slate.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blockchain/docs-exchange-api/1c7a038214904ff29a0857957e0412fb26b6bd0b/build/assets/fonts/slate.woff2 -------------------------------------------------------------------------------- /build/assets/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blockchain/docs-exchange-api/1c7a038214904ff29a0857957e0412fb26b6bd0b/build/assets/images/favicon.ico -------------------------------------------------------------------------------- /build/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blockchain/docs-exchange-api/1c7a038214904ff29a0857957e0412fb26b6bd0b/build/assets/images/logo.png -------------------------------------------------------------------------------- /build/assets/images/navbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blockchain/docs-exchange-api/1c7a038214904ff29a0857957e0412fb26b6bd0b/build/assets/images/navbar.png -------------------------------------------------------------------------------- /build/assets/stylesheets/print.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}.content h1,.content h2,.content h3,.content h4,body{font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";font-size:14px}.content h1,.content h2,.content h3,.content h4{font-weight:bold}.content pre,.content code{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}.content pre,.content code{word-break:break-all;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto}@font-face{font-family:'slate';src:url(../fonts/slate.eot?-syv14m);src:url(../fonts/slate.eot?#iefix-syv14m) format("embedded-opentype"),url(../fonts/slate.woff2?-syv14m) format("woff2"),url(../fonts/slate.woff?-syv14m) format("woff"),url(../fonts/slate.ttf?-syv14m) format("truetype"),url(../fonts/slate.svg?-syv14m#slate) format("svg");font-weight:normal;font-style:normal}.content aside.warning:before,.content aside.notice:before,.content aside.success:before{font-family:'slate';speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1}.content aside.warning:before{content:"\e600"}.content aside.notice:before{content:"\e602"}.content aside.success:before{content:"\e606"}.tocify,.toc-footer,.lang-selector,.search,#nav-button{display:none}.tocify-wrapper>img{margin:0 auto;display:block}.content{font-size:12px}.content pre,.content code{border:1px solid #999;border-radius:5px;font-size:0.8em}.content pre code{border:0}.content pre{padding:1.3em}.content code{padding:0.2em}.content table{border:1px solid #999}.content table tr{border-bottom:1px solid #999}.content table td,.content table th{padding:0.7em}.content p{line-height:1.5}.content a{text-decoration:none;color:#000}.content h1{font-size:2.5em;padding-top:0.5em;padding-bottom:0.5em;margin-top:1em;margin-bottom:21px;border:2px solid #ccc;border-width:2px 0;text-align:center}.content h2{font-size:1.8em;margin-top:2em;border-top:2px solid #ccc;padding-top:0.8em}.content h1+h2,.content h1+div+h2{border-top:none;padding-top:0;margin-top:0}.content h3,.content h4{font-size:0.8em;margin-top:1.5em;margin-bottom:0.8em;text-transform:uppercase}.content h5,.content h6{text-transform:uppercase}.content aside{padding:1em;border:1px solid #ccc;border-radius:5px;margin-top:1.5em;margin-bottom:1.5em;line-height:1.6}.content aside:before{vertical-align:middle;padding-right:0.5em;font-size:14px} -------------------------------------------------------------------------------- /build/assets/stylesheets/screen.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}.content h1,.content h2,.content h3,.content h4,.content h5,.content h6,html,body{font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";font-size:14px}.content h1,.content h2,.content h3,.content h4,.content h5,.content h6{font-weight:bold}.content code,.content pre{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}.content code{word-break:break-all;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto}@font-face{font-family:'slate';src:url(../fonts/slate.eot?-syv14m);src:url(../fonts/slate.eot?#iefix-syv14m) format("embedded-opentype"),url(../fonts/slate.woff2?-syv14m) format("woff2"),url(../fonts/slate.woff?-syv14m) format("woff"),url(../fonts/slate.ttf?-syv14m) format("truetype"),url(../fonts/slate.svg?-syv14m#slate) format("svg");font-weight:normal;font-style:normal}.content aside.warning:before,.content aside.notice:before,.content aside.success:before{font-family:'slate';speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1}.content aside.warning:before{content:"\e600"}.content aside.notice:before{content:"\e602"}.content aside.success:before{content:"\e606"}html,body{color:#030e26;padding:0;margin:0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-color:white;height:100%;-webkit-text-size-adjust:none}#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:270px;background-color:#f4f6f7;font-size:16px;font-weight:400;border-right:1px solid rgba(0,0,0,0.1)}.toc-wrapper .lang-selector{display:none}.toc-wrapper .lang-selector a{padding-top:0.5em;padding-bottom:0.5em}.toc-wrapper .logo{display:block;max-width:100%;margin:2rem auto;height:10rem}.toc-wrapper>.search{position:relative}.toc-wrapper>.search input{border:none;background:#dedede;padding:10px;box-sizing:border-box;margin:10px 32px;width:206px;outline:none;color:#030e26;border-radius:2px;transition:padding 0.5s ease}.toc-wrapper .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:inherit}.toc-wrapper .search-results.visible{height:30%;margin-bottom:1em;border-bottom:1px solid rgba(0,0,0,0.1)}.toc-wrapper .search-results li{margin:1em 32px}.toc-wrapper .search-results a{color:#030e26;text-decoration:none}.toc-wrapper .search-results a:hover{text-decoration:underline}.toc-wrapper ul,.toc-wrapper li{list-style:none;margin:0;padding:0;line-height:28px}.toc-wrapper li{color:#030e26;transition-property:background;transition-timing-function:linear;transition-duration:200ms;margin:10px 0;line-height:40px}.toc-wrapper .toc-link.active{background-color:#3558a8;color:#fff;font-weight:500}.toc-wrapper .toc-link.active-parent{background-color:none;color:inherit;border-left:6px solid #3558a8;font-weight:500}.toc-wrapper .toc-list-h2{display:none;background-color:#f4f6f7;font-weight:400}.toc-wrapper .toc-h2:hover{text-decoration:underline}.toc-wrapper .toc-h2{padding-left:42px;font-size:14px}.toc-wrapper .toc-list-h3{display:none;background-color:#f4f6f7}.toc-wrapper .toc-h3{padding-left:74px;font-size:12px}.toc-wrapper .toc-list-h4{display:none;background-color:#f4f6f7}.toc-wrapper .toc-h4{padding-left:106px;font-size:12px}.toc-wrapper .toc-footer{padding:1em 0;margin-top:1em;border-top:1px solid rgba(0,0,0,0.1)}.toc-wrapper .toc-footer li,.toc-wrapper .toc-footer a{color:#3558a8;font-weight:500;text-decoration:none}.toc-wrapper .toc-footer a:hover{text-decoration:underline}.toc-wrapper .toc-footer li{font-size:1em;line-height:2;text-decoration:none}.toc-link,.toc-footer li{padding:0 32px 0 32px;display:block;overflow-x:hidden;white-space:nowrap;text-overflow:ellipsis;text-decoration:none;color:#030e26;transition-property:background;transition-timing-function:linear;transition-duration:130ms}#nav-button{padding:0 1.5em 5em 0;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;transition:left 0.3s ease-in-out}#nav-button span{display:block;padding:6px 6px 6px;background-color:rgba(255,255,255,0.7);transform-origin:0 0;transform:rotate(-90deg) translate(-100%, 0);border-radius:0 0 0 5px}#nav-button img{height:16px;vertical-align:bottom}#nav-button:hover{opacity:1}#nav-button.open{left:270px}.page-wrapper{margin-left:270px;position:relative;z-index:10;background-color:white;min-height:100%;padding-bottom:1px}.page-wrapper .dark-box{width:50%;background-color:#2e3336;position:absolute;right:0;top:0;bottom:0}.page-wrapper .lang-selector{position:fixed;z-index:50;border-bottom:5px solid #2e3336}.lang-selector{background-color:#1e2224;width:100%;font-weight:bold}.lang-selector a{display:block;float:left;color:#fff;text-decoration:none;padding:0 10px;line-height:30px;outline:0}.lang-selector a:active,.lang-selector a:focus{background-color:#111;color:#fff}.lang-selector a.active{background-color:#2e3336;color:#fff}.lang-selector:after{content:"";clear:both;display:block}.content{-webkit-transform:translateZ(0);position:relative;z-index:30}.content:after{content:"";display:block;clear:both}.content>h1,.content>h2,.content>h3,.content>h4,.content>h5,.content>h6,.content>p,.content>table,.content>ul,.content>ol,.content>aside,.content>dl{margin-right:50%;padding:0 28px;box-sizing:border-box;display:block}.content>ul,.content>ol{padding-left:43px}.content>h1,.content>h2,.content>h3,.content>h4,.content>div{clear:both}.content a{color:#3558a8}.content h1{font-size:25px;padding-top:0.5em;padding-bottom:0.5em;margin-bottom:21px;margin-top:2em;border-top:1px solid #ccc;border-bottom:1px solid #ccc;background-color:#fdfdfd}.content h1:first-child,.content div:first-child+h1{border-top-width:0;margin-top:0}.content h2{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(255,255,255,0.2), rgba(255,255,255,0))}.content h3{font-size:16px;margin-top:0.5em;margin-bottom:0;padding-top:1.2em;padding-bottom:1.2em;background-image:linear-gradient(to bottom, rgba(255,255,255,0.2), rgba(255,255,255,0))}.content h4{font-size:13px;margin-top:0.5em;margin-bottom:0;padding-top:1.2em;padding-bottom:1.2em;background-image:linear-gradient(to bottom, rgba(255,255,255,0.2), rgba(255,255,255,0))}.content h1+h2,.content h1+div+h2{margin-top:-21px;border-top:none}.content h5,.content h6{font-size:15px;margin-top:2.5em;margin-bottom:0.8em}.content h5,.content h6{font-size:10px}.content hr{margin:2em 0;border-top:2px solid #2e3336;border-bottom:2px solid white}.content table{margin-bottom:1em;overflow:auto}.content table th,.content table td{text-align:left;vertical-align:top;line-height:1.6}.content table th code,.content table td code{white-space:nowrap}.content table th{padding:5px 10px;border-bottom:1px solid #ccc;vertical-align:bottom}.content table td{padding:10px}.content table tr:last-child{border-bottom:1px solid #ccc}.content table tr:nth-child(odd)>td{background-color:white}.content table tr:nth-child(even)>td{background-color:white}.content dt{font-weight:bold}.content dd{margin-left:15px}.content p,.content li,.content dt,.content dd{line-height:1.6;margin-top:0}.content img{max-width:100%}.content code{background-color:rgba(0,0,0,0.05);padding:3px;border-radius:3px}.content pre>code{background-color:transparent;padding:0}.content aside{padding-top:1em;padding-bottom:1em;margin-top:1.5em;margin-bottom:1.5em;background:#ffe6b4;line-height:1.6}.content aside.warning{background-color:#cb3940;color:white}.content aside.success{background-color:#00a76f}.content aside:before{vertical-align:middle;padding-right:0.5em;font-size:14px}.content .search-highlight{padding:2px;margin:-3px;border-radius:4px;border:1px solid #f7e633;background:linear-gradient(to top left, #f7e633 0%, #f1d32f 100%)}.content pre,.content blockquote{background-color:#1e2224;color:#fff;margin:0;width:50%;float:right;clear:right;box-sizing:border-box}.content pre>p,.content blockquote>p{margin:0}.content pre a,.content blockquote a{color:#fff;text-decoration:none;border-bottom:dashed 1px #ccc}.content pre{padding-top:2em;padding-bottom:2em;padding:2em 28px}.content blockquote>p{background-color:#191d1f;padding:13px 2em;color:#eee}@media (max-width: 930px){.toc-wrapper{left:-270px}.toc-wrapper.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: 660px){.dark-box{display:none}.content>h1,.content>h2,.content>h3,.content>h4,.content>h5,.content>h6,.content>p,.content>table,.content>ul,.content>ol,.content>aside,.content>dl{margin-right:0}.toc-wrapper .lang-selector{display:block}.page-wrapper .lang-selector{display:none}.content pre,.content blockquote{width:auto;float:none}.content>pre+h1,.content>blockquote+h1,.content>pre+h2,.content>blockquote+h2,.content>pre+h3,.content>blockquote+h3,.content>pre+h4,.content>blockquote+h4,.content>pre+h5,.content>blockquote+h5,.content>pre+h6,.content>blockquote+h6,.content>pre+p,.content>blockquote+p,.content>pre+table,.content>blockquote+table,.content>pre+ul,.content>blockquote+ul,.content>pre+ol,.content>blockquote+ol,.content>pre+aside,.content>blockquote+aside,.content>pre+dl,.content>blockquote+dl{margin-top:28px}}.highlight .c,.highlight .cm,.highlight .c1,.highlight .cs{color:#909090}.highlight,.highlight .w{background-color:#1e2224} -------------------------------------------------------------------------------- /config.rb: -------------------------------------------------------------------------------- 1 | # Unique header generation 2 | require './lib/unique_head.rb' 3 | 4 | # Markdown 5 | set :markdown_engine, :redcarpet 6 | set :markdown, 7 | fenced_code_blocks: true, 8 | smartypants: true, 9 | disable_indented_code_blocks: true, 10 | prettify: true, 11 | strikethrough: true, 12 | tables: true, 13 | with_toc_data: true, 14 | no_intra_emphasis: true, 15 | renderer: UniqueHeadCounter 16 | 17 | # Assets 18 | set :css_dir, 'assets/stylesheets' 19 | set :js_dir, 'assets/javascripts' 20 | set :images_dir, 'assets/images' 21 | set :fonts_dir, 'assets/fonts' 22 | 23 | # Activate the syntax highlighter 24 | activate :syntax 25 | ready do 26 | require './lib/multilang.rb' 27 | end 28 | 29 | activate :sprockets 30 | 31 | activate :autoprefixer do |config| 32 | config.browsers = ['last 2 version', 'Firefox ESR'] 33 | config.cascade = false 34 | config.inline = true 35 | end 36 | 37 | # Github pages require relative links 38 | activate :relative_assets 39 | set :relative_links, true 40 | 41 | # Build Configuration 42 | configure :build do 43 | # If you're having trouble with Middleman hanging, commenting 44 | # out the following two lines has been known to help 45 | activate :minify_css 46 | activate :minify_javascript 47 | # activate :relative_assets 48 | # activate :asset_hash 49 | # activate :gzip 50 | end 51 | 52 | # Deploy Configuration 53 | # If you want Middleman to listen on a different port, you can set that below 54 | set :port, 4567 55 | 56 | helpers do 57 | require './lib/toc_data.rb' 58 | end 59 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -o errexit #abort if any command fails 3 | me=$(basename "$0") 4 | 5 | help_message="\ 6 | Usage: $me [-c FILE] [] 7 | Deploy generated files to a git branch. 8 | 9 | Options: 10 | 11 | -h, --help Show this help information. 12 | -v, --verbose Increase verbosity. Useful for debugging. 13 | -e, --allow-empty Allow deployment of an empty directory. 14 | -m, --message MESSAGE Specify the message used when committing on the 15 | deploy branch. 16 | -n, --no-hash Don't append the source commit's hash to the deploy 17 | commit's message. 18 | --source-only Only build but not push 19 | --push-only Only push but not build 20 | " 21 | 22 | 23 | run_build() { 24 | bundle exec middleman build --clean 25 | } 26 | 27 | parse_args() { 28 | # Set args from a local environment file. 29 | if [ -e ".env" ]; then 30 | source .env 31 | fi 32 | 33 | # Parse arg flags 34 | # If something is exposed as an environment variable, set/overwrite it 35 | # here. Otherwise, set/overwrite the internal variable instead. 36 | while : ; do 37 | if [[ $1 = "-h" || $1 = "--help" ]]; then 38 | echo "$help_message" 39 | return 0 40 | elif [[ $1 = "-v" || $1 = "--verbose" ]]; then 41 | verbose=true 42 | shift 43 | elif [[ $1 = "-e" || $1 = "--allow-empty" ]]; then 44 | allow_empty=true 45 | shift 46 | elif [[ ( $1 = "-m" || $1 = "--message" ) && -n $2 ]]; then 47 | commit_message=$2 48 | shift 2 49 | elif [[ $1 = "-n" || $1 = "--no-hash" ]]; then 50 | GIT_DEPLOY_APPEND_HASH=false 51 | shift 52 | else 53 | break 54 | fi 55 | done 56 | 57 | # Set internal option vars from the environment and arg flags. All internal 58 | # vars should be declared here, with sane defaults if applicable. 59 | 60 | # Source directory & target branch. 61 | deploy_directory=build 62 | deploy_branch=gh-pages 63 | 64 | #if no user identity is already set in the current git environment, use this: 65 | default_username=${GIT_DEPLOY_USERNAME:-deploy.sh} 66 | default_email=${GIT_DEPLOY_EMAIL:-} 67 | 68 | #repository to deploy to. must be readable and writable. 69 | repo=origin 70 | 71 | #append commit hash to the end of message by default 72 | append_hash=${GIT_DEPLOY_APPEND_HASH:-true} 73 | } 74 | 75 | main() { 76 | parse_args "$@" 77 | 78 | enable_expanded_output 79 | 80 | if ! git diff --exit-code --quiet --cached; then 81 | echo Aborting due to uncommitted changes in the index >&2 82 | return 1 83 | fi 84 | 85 | commit_title=`git log -n 1 --format="%s" HEAD` 86 | commit_hash=` git log -n 1 --format="%H" HEAD` 87 | 88 | #default commit message uses last title if a custom one is not supplied 89 | if [[ -z $commit_message ]]; then 90 | commit_message="publish: $commit_title" 91 | fi 92 | 93 | #append hash to commit message unless no hash flag was found 94 | if [ $append_hash = true ]; then 95 | commit_message="$commit_message"$'\n\n'"generated from commit $commit_hash" 96 | fi 97 | 98 | previous_branch=`git rev-parse --abbrev-ref HEAD` 99 | 100 | if [ ! -d "$deploy_directory" ]; then 101 | echo "Deploy directory '$deploy_directory' does not exist. Aborting." >&2 102 | return 1 103 | fi 104 | 105 | # must use short form of flag in ls for compatibility with macOS and BSD 106 | if [[ -z `ls -A "$deploy_directory" 2> /dev/null` && -z $allow_empty ]]; then 107 | 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 108 | return 1 109 | fi 110 | 111 | if git ls-remote --exit-code $repo "refs/heads/$deploy_branch" ; then 112 | # deploy_branch exists in $repo; make sure we have the latest version 113 | 114 | disable_expanded_output 115 | git fetch --force $repo $deploy_branch:$deploy_branch 116 | enable_expanded_output 117 | fi 118 | 119 | # check if deploy_branch exists locally 120 | if git show-ref --verify --quiet "refs/heads/$deploy_branch" 121 | then incremental_deploy 122 | else initial_deploy 123 | fi 124 | 125 | restore_head 126 | } 127 | 128 | initial_deploy() { 129 | git --work-tree "$deploy_directory" checkout --orphan $deploy_branch 130 | git --work-tree "$deploy_directory" add --all 131 | commit+push 132 | } 133 | 134 | incremental_deploy() { 135 | #make deploy_branch the current branch 136 | git symbolic-ref HEAD refs/heads/$deploy_branch 137 | #put the previously committed contents of deploy_branch into the index 138 | git --work-tree "$deploy_directory" reset --mixed --quiet 139 | git --work-tree "$deploy_directory" add --all 140 | 141 | set +o errexit 142 | diff=$(git --work-tree "$deploy_directory" diff --exit-code --quiet HEAD --)$? 143 | set -o errexit 144 | case $diff in 145 | 0) echo No changes to files in $deploy_directory. Skipping commit.;; 146 | 1) commit+push;; 147 | *) 148 | echo git diff exited with code $diff. Aborting. Staying on branch $deploy_branch so you can debug. To switch back to master, use: git symbolic-ref HEAD refs/heads/master && git reset --mixed >&2 149 | return $diff 150 | ;; 151 | esac 152 | } 153 | 154 | commit+push() { 155 | set_user_id 156 | git --work-tree "$deploy_directory" commit -m "$commit_message" 157 | 158 | disable_expanded_output 159 | #--quiet is important here to avoid outputting the repo URL, which may contain a secret token 160 | git push --quiet $repo $deploy_branch 161 | enable_expanded_output 162 | } 163 | 164 | #echo expanded commands as they are executed (for debugging) 165 | enable_expanded_output() { 166 | if [ $verbose ]; then 167 | set -o xtrace 168 | set +o verbose 169 | fi 170 | } 171 | 172 | #this is used to avoid outputting the repo URL, which may contain a secret token 173 | disable_expanded_output() { 174 | if [ $verbose ]; then 175 | set +o xtrace 176 | set -o verbose 177 | fi 178 | } 179 | 180 | set_user_id() { 181 | if [[ -z `git config user.name` ]]; then 182 | git config user.name "$default_username" 183 | fi 184 | if [[ -z `git config user.email` ]]; then 185 | git config user.email "$default_email" 186 | fi 187 | } 188 | 189 | restore_head() { 190 | if [[ $previous_branch = "HEAD" ]]; then 191 | #we weren't on any branch before, so just set HEAD back to the commit it was on 192 | git update-ref --no-deref HEAD $commit_hash $deploy_branch 193 | else 194 | git symbolic-ref HEAD refs/heads/$previous_branch 195 | fi 196 | 197 | git reset --mixed 198 | } 199 | 200 | filter() { 201 | sed -e "s|$repo|\$repo|g" 202 | } 203 | 204 | sanitize() { 205 | "$@" 2> >(filter 1>&2) | filter 206 | } 207 | 208 | if [[ $1 = --source-only ]]; then 209 | run_build 210 | elif [[ $1 = --push-only ]]; then 211 | main "$@" 212 | else 213 | run_build 214 | main "$@" 215 | fi 216 | -------------------------------------------------------------------------------- /font-selection.json: -------------------------------------------------------------------------------- 1 | { 2 | "IcoMoonType": "selection", 3 | "icons": [ 4 | { 5 | "icon": { 6 | "paths": [ 7 | "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" 8 | ], 9 | "attrs": [], 10 | "isMulticolor": false, 11 | "tags": [ 12 | "exclamation-circle" 13 | ], 14 | "defaultCode": 61546, 15 | "grid": 14 16 | }, 17 | "attrs": [], 18 | "properties": { 19 | "id": 100, 20 | "order": 4, 21 | "prevSize": 28, 22 | "code": 58880, 23 | "name": "exclamation-sign", 24 | "ligatures": "" 25 | }, 26 | "setIdx": 0, 27 | "iconIdx": 0 28 | }, 29 | { 30 | "icon": { 31 | "paths": [ 32 | "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" 33 | ], 34 | "attrs": [], 35 | "isMulticolor": false, 36 | "tags": [ 37 | "info-circle" 38 | ], 39 | "defaultCode": 61530, 40 | "grid": 14 41 | }, 42 | "attrs": [], 43 | "properties": { 44 | "id": 85, 45 | "order": 3, 46 | "name": "info-sign", 47 | "prevSize": 28, 48 | "code": 58882 49 | }, 50 | "setIdx": 0, 51 | "iconIdx": 2 52 | }, 53 | { 54 | "icon": { 55 | "paths": [ 56 | "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" 57 | ], 58 | "attrs": [], 59 | "isMulticolor": false, 60 | "tags": [ 61 | "check-circle" 62 | ], 63 | "defaultCode": 61528, 64 | "grid": 14 65 | }, 66 | "attrs": [], 67 | "properties": { 68 | "id": 83, 69 | "order": 9, 70 | "prevSize": 28, 71 | "code": 58886, 72 | "name": "ok-sign" 73 | }, 74 | "setIdx": 0, 75 | "iconIdx": 6 76 | }, 77 | { 78 | "icon": { 79 | "paths": [ 80 | "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" 81 | ], 82 | "width": 951, 83 | "attrs": [], 84 | "isMulticolor": false, 85 | "tags": [ 86 | "search" 87 | ], 88 | "defaultCode": 61442, 89 | "grid": 14 90 | }, 91 | "attrs": [], 92 | "properties": { 93 | "id": 2, 94 | "order": 1, 95 | "prevSize": 28, 96 | "code": 58887, 97 | "name": "icon-search" 98 | }, 99 | "setIdx": 0, 100 | "iconIdx": 7 101 | } 102 | ], 103 | "height": 1024, 104 | "metadata": { 105 | "name": "slate", 106 | "license": "SIL OFL 1.1" 107 | }, 108 | "preferences": { 109 | "showGlyphs": true, 110 | "showQuickUse": true, 111 | "showQuickUse2": true, 112 | "showSVGs": true, 113 | "fontPref": { 114 | "prefix": "icon-", 115 | "metadata": { 116 | "fontFamily": "slate", 117 | "majorVersion": 1, 118 | "minorVersion": 0, 119 | "description": "Based on FontAwesome", 120 | "license": "SIL OFL 1.1" 121 | }, 122 | "metrics": { 123 | "emSize": 1024, 124 | "baseline": 6.25, 125 | "whitespace": 50 126 | }, 127 | "resetPoint": 58880, 128 | "showSelector": false, 129 | "selector": "class", 130 | "classSelector": ".icon", 131 | "showMetrics": false, 132 | "showMetadata": true, 133 | "showVersion": true, 134 | "ie7": false 135 | }, 136 | "imagePref": { 137 | "prefix": "icon-", 138 | "png": true, 139 | "useClassSelector": true, 140 | "color": 4473924, 141 | "bgColor": 16777215 142 | }, 143 | "historySize": 100, 144 | "showCodes": true, 145 | "gridSize": 16, 146 | "showLiga": false 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /lib/multilang.rb: -------------------------------------------------------------------------------- 1 | module Multilang 2 | def block_code(code, full_lang_name) 3 | if full_lang_name 4 | parts = full_lang_name.split('--') 5 | rouge_lang_name = (parts) ? parts[0] : "" # just parts[0] here causes null ref exception when no language specified 6 | super(code, rouge_lang_name).sub("highlight #{rouge_lang_name}") do |match| 7 | match + " tab-" + full_lang_name 8 | end 9 | else 10 | super(code, full_lang_name) 11 | end 12 | end 13 | end 14 | 15 | require 'middleman-core/renderers/redcarpet' 16 | Middleman::Renderers::MiddlemanRedcarpetHTML.send :include, Multilang 17 | -------------------------------------------------------------------------------- /lib/nesting_unique_head.rb: -------------------------------------------------------------------------------- 1 | # Nested unique header generation 2 | require 'middleman-core/renderers/redcarpet' 3 | 4 | class NestingUniqueHeadCounter < Middleman::Renderers::MiddlemanRedcarpetHTML 5 | def initialize 6 | super 7 | @@headers_history = {} if !defined?(@@headers_history) 8 | end 9 | 10 | def header(text, header_level) 11 | friendly_text = text.gsub(/<[^>]*>/,"").parameterize 12 | @@headers_history[header_level] = text.parameterize 13 | 14 | if header_level > 1 15 | for i in (header_level - 1).downto(1) 16 | friendly_text.prepend("#{@@headers_history[i]}-") if @@headers_history.key?(i) 17 | end 18 | end 19 | 20 | return "#{text}" 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /lib/toc_data.rb: -------------------------------------------------------------------------------- 1 | require 'nokogiri' 2 | 3 | def toc_data(page_content) 4 | html_doc = Nokogiri::HTML::DocumentFragment.parse(page_content) 5 | 6 | # get a flat list of headers 7 | headers = [] 8 | html_doc.css('h1, h2, h3, h4, h5').each do |header| 9 | headers.push({ 10 | id: header.attribute('id').to_s, 11 | content: header.children, 12 | title: header.children.to_s.gsub(/<[^>]*>/, ''), 13 | level: header.name[1].to_i, 14 | children: [] 15 | }) 16 | end 17 | 18 | [5,4,3,2].each do |header_level| 19 | header_to_nest = nil 20 | headers = headers.reject do |header| 21 | if header[:level] == header_level 22 | header_to_nest[:children].push header if header_to_nest 23 | true 24 | else 25 | header_to_nest = header if header[:level] < header_level 26 | false 27 | end 28 | end 29 | end 30 | headers 31 | end 32 | -------------------------------------------------------------------------------- /lib/unique_head.rb: -------------------------------------------------------------------------------- 1 | # Unique header generation 2 | require 'middleman-core/renderers/redcarpet' 3 | require 'digest' 4 | class UniqueHeadCounter < Middleman::Renderers::MiddlemanRedcarpetHTML 5 | def initialize 6 | super 7 | @head_count = {} 8 | end 9 | def header(text, header_level) 10 | friendly_text = text.gsub(/<[^>]*>/,"").parameterize 11 | if friendly_text.strip.length == 0 12 | # Looks like parameterize removed the whole thing! It removes many unicode 13 | # characters like Chinese and Russian. To get a unique URL, let's just 14 | # URI escape the whole header 15 | friendly_text = Digest::SHA1.hexdigest(text)[0,10] 16 | end 17 | @head_count[friendly_text] ||= 0 18 | @head_count[friendly_text] += 1 19 | if @head_count[friendly_text] > 1 20 | friendly_text += "-#{@head_count[friendly_text]}" 21 | end 22 | return "#{text}" 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /source/assets/fonts/slate.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blockchain/docs-exchange-api/1c7a038214904ff29a0857957e0412fb26b6bd0b/source/assets/fonts/slate.eot -------------------------------------------------------------------------------- /source/assets/fonts/slate.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Generated by IcoMoon 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /source/assets/fonts/slate.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blockchain/docs-exchange-api/1c7a038214904ff29a0857957e0412fb26b6bd0b/source/assets/fonts/slate.ttf -------------------------------------------------------------------------------- /source/assets/fonts/slate.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blockchain/docs-exchange-api/1c7a038214904ff29a0857957e0412fb26b6bd0b/source/assets/fonts/slate.woff -------------------------------------------------------------------------------- /source/assets/fonts/slate.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blockchain/docs-exchange-api/1c7a038214904ff29a0857957e0412fb26b6bd0b/source/assets/fonts/slate.woff2 -------------------------------------------------------------------------------- /source/assets/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blockchain/docs-exchange-api/1c7a038214904ff29a0857957e0412fb26b6bd0b/source/assets/images/favicon.ico -------------------------------------------------------------------------------- /source/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blockchain/docs-exchange-api/1c7a038214904ff29a0857957e0412fb26b6bd0b/source/assets/images/logo.png -------------------------------------------------------------------------------- /source/assets/images/navbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blockchain/docs-exchange-api/1c7a038214904ff29a0857957e0412fb26b6bd0b/source/assets/images/navbar.png -------------------------------------------------------------------------------- /source/assets/javascripts/all.js: -------------------------------------------------------------------------------- 1 | //= require ./all_nosearch 2 | //= require ./app/_search 3 | -------------------------------------------------------------------------------- /source/assets/javascripts/all_nosearch.js: -------------------------------------------------------------------------------- 1 | //= require ./lib/_energize 2 | //= require ./app/_toc 3 | //= require ./app/_lang 4 | 5 | $(function() { 6 | loadToc( 7 | $("#toc"), 8 | ".toc-link", 9 | ".toc-list-h2, .toc-list-h3, .toc-list-h4", 10 | 10 11 | ); 12 | setupLanguages($("body").data("languages")); 13 | $(".content").imagesLoaded(function() { 14 | window.recacheHeights(); 15 | window.refreshToc(); 16 | }); 17 | }); 18 | 19 | window.onpopstate = function() { 20 | activateLanguage(getLanguageFromQueryString()); 21 | }; 22 | -------------------------------------------------------------------------------- /source/assets/javascripts/app/_lang.js: -------------------------------------------------------------------------------- 1 | //= require ../lib/_jquery 2 | 3 | /* 4 | Copyright 2008-2013 Concur Technologies, Inc. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); you may 7 | not use this file except in compliance with the License. You may obtain 8 | a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | License for the specific language governing permissions and limitations 16 | under the License. 17 | */ 18 | ;(function () { 19 | 'use strict'; 20 | 21 | var languages = []; 22 | 23 | window.setupLanguages = setupLanguages; 24 | window.activateLanguage = activateLanguage; 25 | window.getLanguageFromQueryString = getLanguageFromQueryString; 26 | 27 | function activateLanguage(language) { 28 | if (!language) return; 29 | if (language === "") return; 30 | 31 | $(".lang-selector a").removeClass('active'); 32 | $(".lang-selector a[data-language-name='" + language + "']").addClass('active'); 33 | for (var i=0; i < languages.length; i++) { 34 | $(".highlight.tab-" + languages[i]).hide(); 35 | $(".lang-specific." + languages[i]).hide(); 36 | } 37 | $(".highlight.tab-" + language).show(); 38 | $(".lang-specific." + language).show(); 39 | 40 | window.recacheHeights(); 41 | 42 | // scroll to the new location of the position 43 | if ($(window.location.hash).get(0)) { 44 | $(window.location.hash).get(0).scrollIntoView(true); 45 | } 46 | } 47 | 48 | // parseURL and stringifyURL are from https://github.com/sindresorhus/query-string 49 | // MIT licensed 50 | // https://github.com/sindresorhus/query-string/blob/7bee64c16f2da1a326579e96977b9227bf6da9e6/license 51 | function parseURL(str) { 52 | if (typeof str !== 'string') { 53 | return {}; 54 | } 55 | 56 | str = str.trim().replace(/^(\?|#|&)/, ''); 57 | 58 | if (!str) { 59 | return {}; 60 | } 61 | 62 | return str.split('&').reduce(function (ret, param) { 63 | var parts = param.replace(/\+/g, ' ').split('='); 64 | var key = parts[0]; 65 | var val = parts[1]; 66 | 67 | key = decodeURIComponent(key); 68 | // missing `=` should be `null`: 69 | // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters 70 | val = val === undefined ? null : decodeURIComponent(val); 71 | 72 | if (!ret.hasOwnProperty(key)) { 73 | ret[key] = val; 74 | } else if (Array.isArray(ret[key])) { 75 | ret[key].push(val); 76 | } else { 77 | ret[key] = [ret[key], val]; 78 | } 79 | 80 | return ret; 81 | }, {}); 82 | }; 83 | 84 | function stringifyURL(obj) { 85 | return obj ? Object.keys(obj).sort().map(function (key) { 86 | var val = obj[key]; 87 | 88 | if (Array.isArray(val)) { 89 | return val.sort().map(function (val2) { 90 | return encodeURIComponent(key) + '=' + encodeURIComponent(val2); 91 | }).join('&'); 92 | } 93 | 94 | return encodeURIComponent(key) + '=' + encodeURIComponent(val); 95 | }).join('&') : ''; 96 | }; 97 | 98 | // gets the language set in the query string 99 | function getLanguageFromQueryString() { 100 | if (location.search.length >= 1) { 101 | var language = parseURL(location.search).language; 102 | if (language) { 103 | return language; 104 | } else if (jQuery.inArray(location.search.substr(1), languages) != -1) { 105 | return location.search.substr(1); 106 | } 107 | } 108 | 109 | return false; 110 | } 111 | 112 | // returns a new query string with the new language in it 113 | function generateNewQueryString(language) { 114 | var url = parseURL(location.search); 115 | if (url.language) { 116 | url.language = language; 117 | return stringifyURL(url); 118 | } 119 | return language; 120 | } 121 | 122 | // if a button is clicked, add the state to the history 123 | function pushURL(language) { 124 | if (!history) { return; } 125 | var hash = window.location.hash; 126 | if (hash) { 127 | hash = hash.replace(/^#+/, ''); 128 | } 129 | history.pushState({}, '', '?' + generateNewQueryString(language) + '#' + hash); 130 | 131 | // save language as next default 132 | localStorage.setItem("language", language); 133 | } 134 | 135 | function setupLanguages(l) { 136 | var defaultLanguage = localStorage.getItem("language"); 137 | 138 | languages = l; 139 | 140 | var presetLanguage = getLanguageFromQueryString(); 141 | if (presetLanguage) { 142 | // the language is in the URL, so use that language! 143 | activateLanguage(presetLanguage); 144 | 145 | localStorage.setItem("language", presetLanguage); 146 | } else if ((defaultLanguage !== null) && (jQuery.inArray(defaultLanguage, languages) != -1)) { 147 | // the language was the last selected one saved in localstorage, so use that language! 148 | activateLanguage(defaultLanguage); 149 | } else { 150 | // no language selected, so use the default 151 | activateLanguage(languages[0]); 152 | } 153 | } 154 | 155 | // if we click on a language tab, activate that language 156 | $(function() { 157 | $(".lang-selector a").on("click", function() { 158 | var language = $(this).data("language-name"); 159 | pushURL(language); 160 | activateLanguage(language); 161 | return false; 162 | }); 163 | }); 164 | })(); 165 | -------------------------------------------------------------------------------- /source/assets/javascripts/app/_search.js: -------------------------------------------------------------------------------- 1 | //= require ../lib/_lunr 2 | //= require ../lib/_jquery 3 | //= require ../lib/_jquery.highlight 4 | (function() { 5 | "use strict"; 6 | 7 | var content, searchResults; 8 | var highlightOpts = { element: "span", className: "search-highlight" }; 9 | var searchDelay = 0; 10 | var timeoutHandle = 0; 11 | 12 | var index = new lunr.Index(); 13 | 14 | index.ref("id"); 15 | index.field("title", { boost: 10 }); 16 | index.field("body"); 17 | index.pipeline.add(lunr.trimmer, lunr.stopWordFilter); 18 | 19 | $(populate); 20 | $(bind); 21 | 22 | function populate() { 23 | $("h1, h2, h3, h4").each(function() { 24 | var title = $(this); 25 | var body = title.nextUntil("h1, h2, h3, h4"); 26 | index.add({ 27 | id: title.prop("id"), 28 | title: title.text(), 29 | body: body.text() 30 | }); 31 | }); 32 | 33 | determineSearchDelay(); 34 | } 35 | function determineSearchDelay() { 36 | if (index.tokenStore.length > 5000) { 37 | searchDelay = 300; 38 | } 39 | } 40 | 41 | function bind() { 42 | content = $(".content"); 43 | searchResults = $(".search-results"); 44 | 45 | $("#input-search").on("keyup", function(e) { 46 | var wait = (function() { 47 | return function(executingFunction, waitTime) { 48 | clearTimeout(timeoutHandle); 49 | timeoutHandle = setTimeout(executingFunction, waitTime); 50 | }; 51 | })(); 52 | wait(function() { 53 | search(e); 54 | }, searchDelay); 55 | }); 56 | } 57 | 58 | function search(event) { 59 | var searchInput = $("#input-search")[0]; 60 | 61 | unhighlight(); 62 | searchResults.addClass("visible"); 63 | 64 | // ESC clears the field 65 | if (event.keyCode === 27) searchInput.value = ""; 66 | 67 | if (searchInput.value) { 68 | var results = index.search(searchInput.value).filter(function(r) { 69 | return r.score > 0.0001; 70 | }); 71 | 72 | if (results.length) { 73 | searchResults.empty(); 74 | $.each(results, function(index, result) { 75 | var elem = document.getElementById(result.ref); 76 | searchResults.append( 77 | "
  • " + $(elem).text() + "
  • " 78 | ); 79 | }); 80 | highlight.call(searchInput); 81 | } else { 82 | searchResults.html("
  • "); 83 | $(".search-results li").text( 84 | 'No Results Found for "' + searchInput.value + '"' 85 | ); 86 | } 87 | } else { 88 | unhighlight(); 89 | searchResults.removeClass("visible"); 90 | } 91 | } 92 | 93 | function highlight() { 94 | if (this.value) content.highlight(this.value, highlightOpts); 95 | } 96 | 97 | function unhighlight() { 98 | content.unhighlight(highlightOpts); 99 | } 100 | })(); 101 | -------------------------------------------------------------------------------- /source/assets/javascripts/app/_toc.js: -------------------------------------------------------------------------------- 1 | //= require ../lib/_jquery 2 | //= require ../lib/_imagesloaded.min 3 | ;(function () { 4 | 'use strict'; 5 | 6 | var htmlPattern = /<[^>]*>/g; 7 | var loaded = false; 8 | 9 | var debounce = function(func, waitTime) { 10 | var timeout = false; 11 | return function() { 12 | if (timeout === false) { 13 | setTimeout(function() { 14 | func(); 15 | timeout = false; 16 | }, waitTime); 17 | timeout = true; 18 | } 19 | }; 20 | }; 21 | 22 | var closeToc = function() { 23 | $(".toc-wrapper").removeClass('open'); 24 | $("#nav-button").removeClass('open'); 25 | }; 26 | 27 | function loadToc($toc, tocLinkSelector, tocListSelector, scrollOffset) { 28 | var headerHeights = {}; 29 | var pageHeight = 0; 30 | var windowHeight = 0; 31 | var originalTitle = document.title; 32 | 33 | var recacheHeights = function() { 34 | headerHeights = {}; 35 | pageHeight = $(document).height(); 36 | windowHeight = $(window).height(); 37 | 38 | $toc.find(tocLinkSelector).each(function() { 39 | var targetId = $(this).attr('href'); 40 | if (targetId[0] === "#") { 41 | headerHeights[targetId] = $(targetId).offset().top; 42 | } 43 | }); 44 | }; 45 | 46 | var refreshToc = function() { 47 | var currentTop = $(document).scrollTop() + scrollOffset; 48 | 49 | if (currentTop + windowHeight >= pageHeight) { 50 | // at bottom of page, so just select last header by making currentTop very large 51 | // this fixes the problem where the last header won't ever show as active if its content 52 | // is shorter than the window height 53 | currentTop = pageHeight + 1000; 54 | } 55 | 56 | var best = null; 57 | for (var name in headerHeights) { 58 | if ((headerHeights[name] < currentTop && headerHeights[name] > headerHeights[best]) || best === null) { 59 | best = name; 60 | } 61 | } 62 | 63 | // Catch the initial load case 64 | if (currentTop == scrollOffset && !loaded) { 65 | best = window.location.hash; 66 | loaded = true; 67 | } 68 | 69 | var $best = $toc.find("[href='" + best + "']").first(); 70 | if (!$best.hasClass("active")) { 71 | // .active is applied to the ToC link we're currently on, and its parent