Skip to content

Commit 9867b7c

Browse files
Initial slate files
0 parents  commit 9867b7c

33 files changed

+5044
-0
lines changed

Diff for: .editorconfig

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
indent_size = 4
8+
tab_width = 4
9+
indent_style = tab
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
13+
[*.md]
14+
trim_trailing_whitespace = false
15+
16+
[*.txt]
17+
trim_trailing_whitespace = false
18+
19+
[*.json]
20+
insert_final_newline = false
21+
indent_size = 2
22+
tab_width = 2

Diff for: .gitignore

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
*.DS_STORE
15+
build/
16+
.cache
17+
18+
# YARD artifacts
19+
.yardoc
20+
_yardoc
21+
doc/
22+
.idea/

Diff for: CONTRIBUTING.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# How to contribute
2+
3+
* Fork the repository on GitHub.
4+
* Make the changes to your forked repository.
5+
* Ensure you use LF line endings - no crazy windows line endings. :)
6+
* When committing, reference your issue (#1234) and include a note about the fix.
7+
* Push the changes to your fork and submit a pull request on the **master branch** of the WooCommerce REST API repository. Existing maintenance branches will be maintained of by WooCommerce developers.
8+
9+
At this point you're waiting on us to merge your pull request. We'll review all pull requests, and make suggestions and changes if necessary.
10+
11+
Thanks for contributing to WooCommerce REST API!

Diff for: Dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM ubuntu:trusty
2+
3+
RUN apt-get update
4+
RUN apt-get install -yq ruby ruby-dev build-essential
5+
RUN gem install --no-ri --no-rdoc bundler
6+
ADD Gemfile /app/Gemfile
7+
ADD Gemfile.lock /app/Gemfile.lock
8+
RUN cd /app; bundle install
9+
ADD . /app
10+
EXPOSE 4567
11+
WORKDIR /app
12+
CMD ["bundle", "exec", "middleman", "server"]

Diff for: Gemfile

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# If you have OpenSSL installed, we recommend updating
2+
# the following line to use "https"
3+
source 'http://rubygems.org'
4+
5+
gem "middleman", "~>3.3.0"
6+
7+
# For syntax highlighting
8+
gem "middleman-syntax"
9+
10+
# Plugin for middleman to generate Github pages
11+
gem 'middleman-gh-pages'
12+
13+
# Live-reloading plugin
14+
gem "middleman-livereload", "~> 3.3.0"
15+
16+
gem 'redcarpet', '~> 3.1.1'
17+
18+
# For faster file watcher updates on Windows:
19+
gem "wdm", "~> 0.1.0", :platforms => [:mswin, :mingw]
20+
21+
# Cross-templating language block fix for Ruby 1.8
22+
platforms :mri_18 do
23+
gem "ruby18_source_location"
24+
end
25+
26+
gem "rake", "~> 10.3.0"
27+
28+
gem 'therubyracer', :platforms => :ruby

Diff for: README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# WooCommerce REST API Docs #
2+
3+
Repository of documentation REST API WooCommerce.
4+
5+
This project is based on [Slate](https://github.com/tripit/slate).

Diff for: Rakefile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
require 'middleman-gh-pages'
2+
3+
task :default => [:build]

Diff for: config.rb

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
require './lib/redcarpet_header_fix'
2+
3+
set :css_dir, 'stylesheets'
4+
5+
set :js_dir, 'javascripts'
6+
7+
set :images_dir, 'images'
8+
9+
set :fonts_dir, 'fonts'
10+
11+
set :markdown_engine, :redcarpet
12+
13+
set :markdown, :fenced_code_blocks => true, :smartypants => true, :disable_indented_code_blocks => true, :prettify => true, :tables => true, :with_toc_data => true, :no_intra_emphasis => true
14+
15+
# Activate the syntax highlighter
16+
activate :syntax
17+
18+
# This is needed for Github pages, since they're hosted on a subdomain
19+
activate :relative_assets
20+
set :relative_links, true
21+
22+
# Build-specific configuration
23+
configure :build do
24+
# For example, change the Compass output style for deployment
25+
activate :minify_css
26+
27+
# Minify Javascript on build
28+
activate :minify_javascript
29+
30+
# Enable cache buster
31+
# activate :asset_hash
32+
33+
# Use relative URLs
34+
# activate :relative_assets
35+
36+
# Or use a different image path
37+
# set :http_prefix, "/Content/images/"
38+
end
39+

Diff for: lib/redcarpet_header_fix.rb

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module RedcarpetHeaderFix
2+
def header(text, level)
3+
clean_id = text.downcase.gsub(/( +|\.+)/, '-').gsub(/[^a-zA-Z0-9\-_]/, '')
4+
"<h#{level} id='#{clean_id}'>#{text}</h#{level}>"
5+
end
6+
end
7+
8+
require 'middleman-core/renderers/redcarpet'
9+
Middleman::Renderers::MiddlemanRedcarpetHTML.send :include, RedcarpetHeaderFix

Diff for: source/fonts/icomoon.eot

2.71 KB
Binary file not shown.

Diff for: source/fonts/icomoon.svg

+18
Loading

Diff for: source/fonts/icomoon.ttf

2.55 KB
Binary file not shown.

Diff for: source/fonts/icomoon.woff

2.75 KB
Binary file not shown.

Diff for: source/images/logo.png

4.68 KB
Loading

Diff for: source/images/navbar.png

2.72 KB
Loading

Diff for: source/index.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: API Reference
3+
4+
language_tabs:
5+
- json: JSON
6+
- shell: cURL
7+
8+
toc_footers:
9+
- <a href="https://github.com/woothemes/woocommerce-rest-api-docs">Contributing to WooCommerce REST API Docs</a>
10+
- <a href="https://github.com/woothemes/woocommerce">WooCommerce Repository</a>
11+
- <a href="http://github.com/tripit/slate">Documentation Powered by Slate</a>
12+
13+
includes:
14+
15+
search: true
16+
---

Diff for: source/javascripts/all.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
//= require_tree ./lib
2+
//= require_tree ./app

Diff for: source/javascripts/all_nosearch.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//= require_tree ./lib
2+
//= require_tree ./app
3+
//= stub ./app/search.js
4+
//= stub ./lib/lunr.js

Diff for: source/javascripts/app/lang.js

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
Copyright 2008-2013 Concur Technologies, Inc.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License"); you may
5+
not use this file except in compliance with the License. You may obtain
6+
a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
License for the specific language governing permissions and limitations
14+
under the License.
15+
*/
16+
(function (global) {
17+
var languages = [];
18+
19+
global.setupLanguages = setupLanguages;
20+
global.activateLanguage = activateLanguage;
21+
22+
function activateLanguage(language) {
23+
if (!language) return;
24+
if (language === "") return;
25+
26+
$(".lang-selector a").removeClass('active');
27+
$(".lang-selector a[data-language-name='" + language + "']").addClass('active');
28+
for (var i=0; i < languages.length; i++) {
29+
$(".highlight." + languages[i]).parent().hide();
30+
}
31+
$(".highlight." + language).parent().show();
32+
33+
global.toc.calculateHeights();
34+
35+
// scroll to the new location of the position
36+
$(window.location.hash).get(0).scrollIntoView(true);
37+
}
38+
39+
// if a button is clicked, add the state to the history
40+
function pushURL(language) {
41+
if (!history) { return; }
42+
var hash = window.location.hash;
43+
if (hash) {
44+
hash = hash.replace(/^#+/, '');
45+
}
46+
history.pushState({}, '', '?' + language + '#' + hash);
47+
48+
// save language as next default
49+
localStorage.setItem("language", language);
50+
}
51+
52+
function setupLanguages(l) {
53+
var currentLanguage = l[0];
54+
var defaultLanguage = localStorage.getItem("language");
55+
56+
languages = l;
57+
58+
if ((location.search.substr(1) !== "") && (jQuery.inArray(location.search.substr(1), languages)) != -1) {
59+
// the language is in the URL, so use that language!
60+
activateLanguage(location.search.substr(1));
61+
62+
localStorage.setItem("language", location.search.substr(1));
63+
} else if ((defaultLanguage !== null) && (jQuery.inArray(defaultLanguage, languages) != -1)) {
64+
// the language was the last selected one saved in localstorage, so use that language!
65+
activateLanguage(defaultLanguage);
66+
} else {
67+
// no language selected, so use the default
68+
activateLanguage(languages[0]);
69+
}
70+
}
71+
72+
// if we click on a language tab, activate that language
73+
$(function() {
74+
$(".lang-selector a").on("click", function() {
75+
var language = $(this).data("language-name");
76+
pushURL(language);
77+
activateLanguage(language);
78+
return false;
79+
});
80+
window.onpopstate = function(event) {
81+
activateLanguage(window.location.search.substr(1));
82+
};
83+
});
84+
})(window);

Diff for: source/javascripts/app/search.js

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
(function (global) {
2+
3+
var $global = $(global);
4+
var content, darkBox, searchResults;
5+
var highlightOpts = { element: 'span', className: 'search-highlight' };
6+
7+
var index = new lunr.Index();
8+
9+
index.ref('id');
10+
index.field('title', { boost: 10 });
11+
index.field('body');
12+
index.pipeline.add(lunr.trimmer, lunr.stopWordFilter);
13+
14+
$(populate);
15+
$(bind);
16+
17+
function populate() {
18+
$('h1, h2').each(function() {
19+
var title = $(this);
20+
var body = title.nextUntil('h1, h2');
21+
index.add({
22+
id: title.prop('id'),
23+
title: title.text(),
24+
body: body.text()
25+
});
26+
});
27+
}
28+
29+
function bind() {
30+
content = $('.content');
31+
darkBox = $('.dark-box');
32+
searchResults = $('.search-results');
33+
34+
$('#input-search').on('keyup', search);
35+
}
36+
37+
function search(event) {
38+
unhighlight();
39+
searchResults.addClass('visible');
40+
41+
// ESC clears the field
42+
if (event.keyCode === 27) this.value = '';
43+
44+
if (this.value) {
45+
var results = index.search(this.value).filter(function(r) {
46+
return r.score > 0.0001;
47+
});
48+
49+
if (results.length) {
50+
searchResults.empty();
51+
$.each(results, function (index, result) {
52+
searchResults.append("<li><a href='#" + result.ref + "'>" + $('#'+result.ref).text() + "</a></li>");
53+
});
54+
highlight.call(this);
55+
} else {
56+
searchResults.html('<li></li>');
57+
$('.search-results li').text('No Results Found for "' + this.value + '"');
58+
}
59+
} else {
60+
unhighlight();
61+
searchResults.removeClass('visible');
62+
}
63+
}
64+
65+
function highlight() {
66+
if (this.value) content.highlight(this.value, highlightOpts);
67+
}
68+
69+
function unhighlight() {
70+
content.unhighlight(highlightOpts);
71+
}
72+
73+
})(window);

0 commit comments

Comments
 (0)