diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000000..88c77a9b01c --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,9 @@ +If this is a question or feature request, make sure to: + +- [ ] The title starts with `Question:` or `Feature:`. + +If this is an bug report, not a question, make sure to: + +- [ ] I'm not running Windows (which is unsupported), or if I am, I can confirm this issue appears on another platform, or Vagrant. +- [ ] This issue appears in the latest `dev` branch. +- [ ] I've included my browser and Ruby version in this issue. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000000..a4569f24145 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,5 @@ +!!!!! STOP AND READ !!!!! + +If the dropdown above says "base fork: lord/master", you are submitting your change to ALL USERS OF SLATE, not just your company. This is probably not what you want. Click "base fork" to change it to the right place. + +If you're actually trying to submit a change to upstream Slate, please submit to our dev branch, PRs sent to the master branch are generally rejected. diff --git a/.travis.yml b/.travis.yml index 451607caf02..542116929e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,9 @@ sudo: false language: ruby rvm: - - 2.0.0 - - 2.1.0 + - 2.2.5 + - 2.3.3 + - 2.4.0 cache: bundler script: bundle exec middleman build diff --git a/CHANGELOG.md b/CHANGELOG.md index 5551a7c4f74..be29842dc46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,33 @@ # Changelog +## Version 1.5.0 + +*February 23, 2017* + +- Add [multiple tabs per programming language](https://github.com/lord/slate/wiki/Multiple-language-tabs-per-programming-language) feature +- Upgrade Middleman to add Ruby 1.4.0 compatibility +- Switch default code highlighting color scheme to better highlight JSON +- Various small typo and bug fixes + +## Version 1.4.0 + +*November 24, 2016* + +- Upgrade Middleman and Rouge gems, should hopefully solve a number of bugs +- Update some links in README +- Fix broken Vagrant startup script +- Fix some problems with deploy.sh help message +- Fix bug with language tabs not hiding properly if no error +- Add `!default` to SASS variables +- Fix bug with logo margin +- Bump tested Ruby versions in .travis.yml + +## Version 1.3.3 + +*June 11, 2016* + +Documentation and example changes. + ## Version 1.3.2 *February 3, 2016* diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index cae4eeedddc..00000000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,16 +0,0 @@ -# Before You Submit an Issue - -- Are you using Windows? We unfortunately don't support Windows. You could try using Docker, as outlined in the `README`. -- Is your version of Slate out of date? We have [upgrade instructions](https://github.com/tripit/slate/wiki/Updating-Slate) in the wiki. You could also try seeing if your problem is reproducible on the latest version of Slate. - -If you answered "no" to each of the questions above, feel free to submit an issue! It's also helpful if you include a code example of your problem (if applicable), we can't help you if you just say "Slate stopped loading for me once I added my documentation" without telling us the problematic documentation. - -# Before You Submit a Pull Request - -Thanks for contributing to Slate! A couple of quick guidelines for submitting pull requests: - -- **Please point your pull requests at the `dev` branch.** We don't accept pull requests to `master`. -- Please make sure your contributions work in the most recent version of Chrome, Firefox, and IE. -- If you're implementing a new feature, even if it's relatively small, it's nice to open an issue before you start so that others know what you're working on and can help make sure you're on the right track. - -Thanks again! Happy coding. \ No newline at end of file diff --git a/Gemfile b/Gemfile index b87e111b9a6..1bff874249e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,9 @@ source 'https://rubygems.org' # Middleman -gem 'middleman', '~>4.0.0' -gem 'middleman-gh-pages', '~> 0.0.3' -gem 'middleman-syntax', '~> 2.1.0' +gem 'middleman', '~>4.2.1' +gem 'middleman-syntax', '~> 3.0.0' gem 'middleman-autoprefixer', '~> 2.7.0' -gem "middleman-sprockets", "~> 4.0.0.rc" -gem 'rouge', '~> 1.10.1' -gem 'redcarpet', '~> 3.3.2' +gem "middleman-sprockets", "~> 4.1.0" +gem 'rouge', '~> 2.0.5' +gem 'redcarpet', '~> 3.4.0' diff --git a/Gemfile.lock b/Gemfile.lock index ff0764b8354..adacad9a85a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,134 +1,122 @@ GEM remote: https://rubygems.org/ specs: - activesupport (4.2.5.1) + activesupport (5.0.1) + concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.4.0) - autoprefixer-rails (6.3.1) + addressable (2.5.0) + public_suffix (~> 2.0, >= 2.0.2) + autoprefixer-rails (6.6.1) execjs - json - backports (3.6.7) - capybara (2.5.0) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (~> 2.0) + backports (3.6.8) coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.10.0) + coffee-script-source (1.12.2) compass-import-once (1.0.5) sass (>= 3.2, < 3.5) - concurrent-ruby (0.9.2) - contracts (0.12.0) + concurrent-ruby (1.0.4) + contracts (0.13.0) + dotenv (2.2.0) erubis (2.7.0) - execjs (2.6.0) - fastimage (1.8.1) - addressable (~> 2.3, >= 2.3.5) - ffi (1.9.10) + execjs (2.7.0) + fast_blank (1.0.0) + fastimage (2.0.1) + addressable (~> 2) + ffi (1.9.17) haml (4.0.7) tilt - hamster (2.0.0) - concurrent-ruby (~> 0.8) - hashie (3.4.3) + hamster (3.0.0) + concurrent-ruby (~> 1.0) + hashie (3.5.1) i18n (0.7.0) - json (1.8.3) - kramdown (1.9.0) - listen (3.0.5) - rb-fsevent (>= 0.9.3) - rb-inotify (>= 0.9) - middleman (4.0.0) + kramdown (1.13.2) + listen (3.0.8) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + memoist (0.15.0) + middleman (4.2.1) coffee-script (~> 2.2) compass-import-once (= 1.0.5) haml (>= 4.0.5) kramdown (~> 1.2) - middleman-cli (= 4.0.0) - middleman-core (= 4.0.0) + middleman-cli (= 4.2.1) + middleman-core (= 4.2.1) sass (>= 3.4.0, < 4.0) - middleman-autoprefixer (2.7.0) - autoprefixer-rails (>= 6.3.1, < 7.0.0) + middleman-autoprefixer (2.7.1) + autoprefixer-rails (>= 6.5.2, < 7.0.0) middleman-core (>= 3.3.3) - middleman-cli (4.0.0) + middleman-cli (4.2.1) thor (>= 0.17.0, < 2.0) - middleman-core (4.0.0) - activesupport (~> 4.2) - addressable (~> 2.4.0) + middleman-core (4.2.1) + activesupport (>= 4.2, < 5.1) + addressable (~> 2.3) backports (~> 3.6) bundler (~> 1.1) - capybara (~> 2.5.0) - contracts (~> 0.12.0) + contracts (~> 0.13.0) + dotenv erubis execjs (~> 2.0) - fastimage (~> 1.8) - hamster (~> 2.0) + fast_blank + fastimage (~> 2.0) + hamster (~> 3.0) hashie (~> 3.4) i18n (~> 0.7.0) - listen (~> 3.0) + listen (~> 3.0.0) + memoist (~> 0.14) padrino-helpers (~> 0.13.0) - rack (>= 1.4.5, < 2.0) + parallel + rack (>= 1.4.5, < 3) sass (>= 3.4) - tilt (~> 1.4.1) - uglifier (~> 2.6) - middleman-gh-pages (0.0.3) - rake (> 0.9.3) - middleman-sprockets (4.0.0.rc.1) - middleman-core (>= 4.0.0.rc.1) - sprockets (~> 3.0) - middleman-syntax (2.1.0) + servolux + tilt (~> 2.0) + uglifier (~> 3.0) + middleman-sprockets (4.1.0) + middleman-core (~> 4.0) + sprockets (>= 3.0) + middleman-syntax (3.0.0) middleman-core (>= 3.2) - rouge (~> 1.0) - mime-types (3.0) - mime-types-data (~> 3.2015) - mime-types-data (3.2015.1120) - mini_portile2 (2.0.0) - minitest (5.8.4) - nokogiri (1.6.7.2) - mini_portile2 (~> 2.0.0.rc2) - padrino-helpers (0.13.1) + rouge (~> 2.0) + minitest (5.10.1) + padrino-helpers (0.13.3.3) i18n (~> 0.6, >= 0.6.7) - padrino-support (= 0.13.1) - tilt (~> 1.4.1) - padrino-support (0.13.1) + padrino-support (= 0.13.3.3) + tilt (>= 1.4.1, < 3) + padrino-support (0.13.3.3) activesupport (>= 3.1) - rack (1.6.4) - rack-test (0.6.3) - rack (>= 1.0) - rake (10.4.2) - rb-fsevent (0.9.7) - rb-inotify (0.9.5) + parallel (1.10.0) + public_suffix (2.0.5) + rack (2.0.1) + rb-fsevent (0.9.8) + rb-inotify (0.9.8) ffi (>= 0.5.0) - redcarpet (3.3.4) - rouge (1.10.1) - sass (3.4.21) - sprockets (3.4.1) + redcarpet (3.4.0) + rouge (2.0.7) + sass (3.4.23) + servolux (0.12.0) + sprockets (3.7.1) + concurrent-ruby (~> 1.0) rack (> 1, < 3) - thor (0.19.1) + thor (0.19.4) thread_safe (0.3.5) - tilt (1.4.1) + tilt (2.0.6) tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (2.7.2) - execjs (>= 0.3.0) - json (>= 1.8.0) - xpath (2.0.0) - nokogiri (~> 1.3) + uglifier (3.0.4) + execjs (>= 0.3.0, < 3) PLATFORMS ruby DEPENDENCIES - middleman (~> 4.0.0) + middleman (~> 4.2.1) middleman-autoprefixer (~> 2.7.0) - middleman-gh-pages (~> 0.0.3) - middleman-sprockets (~> 4.0.0.rc) - middleman-syntax (~> 2.1.0) - redcarpet (~> 3.3.2) - rouge (~> 1.10.1) + middleman-sprockets (~> 4.1.0) + middleman-syntax (~> 3.0.0) + redcarpet (~> 3.4.0) + rouge (~> 2.0.5) BUNDLED WITH - 1.10.6 + 1.14.3 diff --git a/README.md b/README.md index 667d0ffbd12..8055a99acf2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ - -The Elemeno Docs site is built with [Slate](https://tripit.github.io/slate/) +The Elemeno Docs site is built with [Slate](https://lord.github.io/slate/) Getting Started with Elemeno Docs ------------------------------ @@ -9,7 +8,7 @@ Getting Started with Elemeno Docs You're going to need: - **Linux or OS X** — Windows may work, but is unsupported. - - **Ruby, version 1.9.3 or newer** + - **Ruby, version 2.2.5 or newer** - **Bundler** — If Ruby is already installed, but the `bundle` command doesn't work, just run `gem install bundler` in a terminal. ### Getting Set Up @@ -30,6 +29,7 @@ vagrant up You can now see the docs at http://localhost:4567. Whoa! That was fast! + Now that Slate is all set up your machine, you'll probably want to learn more about [editing Slate markdown](https://github.com/tripit/slate/wiki/Markdown-Syntax) If you'd prefer to use Docker, instructions are available [in the wiki](https://github.com/tripit/slate/wiki/Docker). diff --git a/Vagrantfile b/Vagrantfile index 47227f8155e..43b1f995459 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -34,6 +34,6 @@ Vagrant.configure(2) do |config| echo "Starting up middleman at http://localhost:4567" echo "If it does not come up, check the ~/middleman.log file for any error messages" cd /vagrant - bundle exec middleman server --force-polling -l 1 &> ~/middleman.log & + bundle exec middleman server --force-polling --latency=1 &> ~/middleman.log & SHELL end diff --git a/config.rb b/config.rb index cac85f6ab20..b7df3586bec 100644 --- a/config.rb +++ b/config.rb @@ -17,6 +17,11 @@ # Activate the syntax highlighter activate :syntax +ready do + require './lib/multilang.rb' +end + +activate :sprockets activate :autoprefixer do |config| config.browsers = ['last 2 version', 'Firefox ESR'] @@ -38,3 +43,7 @@ # activate :asset_hash # activate :gzip end + +# Deploy Configuration +# If you want Middleman to listen on a different port, you can set that below +set :port, 4567 diff --git a/deploy.sh b/deploy.sh index 6d5ce0c2b54..909a9d9089d 100755 --- a/deploy.sh +++ b/deploy.sh @@ -15,20 +15,7 @@ Options: deploy branch. -n, --no-hash Don't append the source commit's hash to the deploy commit's message. - -c, --config-file PATH Override default & environment variables' values - with those in set in the file at 'PATH'. Must be the - first option specified. - -Variables: - - GIT_DEPLOY_DIR Folder path containing the files to deploy. - GIT_DEPLOY_BRANCH Commit deployable files to this branch. - GIT_DEPLOY_REPO Push the deploy branch to this repository. - -These variables have default values defined in the script. The defaults can be -overridden by environment variables. Any environment variables are overridden -by values set in a '.env' file (if it exists), and in turn by those set in a -file specified by the '--config-file' option." +" bundle exec middleman build --clean @@ -38,12 +25,6 @@ parse_args() { source .env fi - # Set args from file specified on the command-line. - if [[ $1 = "-c" || $1 = "--config-file" ]]; then - source "$2" - shift 2 - fi - # Parse arg flags # If something is exposed as an environment variable, set/overwrite it # here. Otherwise, set/overwrite the internal variable instead. @@ -98,24 +79,24 @@ main() { 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 OS X 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 @@ -124,7 +105,7 @@ main() { 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 @@ -207,7 +188,7 @@ restore_head() { else git symbolic-ref HEAD refs/heads/$previous_branch fi - + git reset --mixed } @@ -219,4 +200,4 @@ sanitize() { "$@" 2> >(filter 1>&2) | filter } -[[ $1 = --source-only ]] || main "$@" \ No newline at end of file +[[ $1 = --source-only ]] || main "$@" diff --git a/lib/multilang.rb b/lib/multilang.rb new file mode 100644 index 00000000000..624c6e495ef --- /dev/null +++ b/lib/multilang.rb @@ -0,0 +1,12 @@ +module Multilang + def block_code(code, full_lang_name) + parts = full_lang_name.split('--') + rouge_lang_name = parts[0] || "" + super(code, rouge_lang_name).sub("highlight #{rouge_lang_name}") do |match| + match + " tab-" + full_lang_name + end + end +end + +require 'middleman-core/renderers/redcarpet' +Middleman::Renderers::MiddlemanRedcarpetHTML.send :include, Multilang diff --git a/source/javascripts/app/_lang.js b/source/javascripts/app/_lang.js index 4c73da6e9c5..992180b7690 100644 --- a/source/javascripts/app/_lang.js +++ b/source/javascripts/app/_lang.js @@ -30,10 +30,10 @@ under the License. $(".lang-selector a").removeClass('active'); $(".lang-selector a[data-language-name='" + language + "']").addClass('active'); for (var i=0; i < languages.length; i++) { - $(".highlight." + languages[i]).hide(); + $(".highlight.tab-" + languages[i]).hide(); $(".lang-specific." + languages[i]).hide(); } - $(".highlight." + language).show(); + $(".highlight.tab-" + language).show(); $(".lang-specific." + language).show(); global.toc.calculateHeights(); diff --git a/source/layouts/layout.erb b/source/layouts/layout.erb index 9e69c987bb5..61bdb383f7d 100644 --- a/source/layouts/layout.erb +++ b/source/layouts/layout.erb @@ -32,7 +32,7 @@ under the License. <%= stylesheet_link_tag :screen, media: :screen %> <%= stylesheet_link_tag :print, media: :print %> @@ -58,7 +58,7 @@ under the License.
<%= image_tag "logo.png", height: '38', width: '227' %>
- <% if language_tabs %> + <% if language_tabs.any? %>
<% language_tabs.each do |lang| %> <% if lang.is_a? Hash %> @@ -94,7 +94,7 @@ under the License. <% end %>
- <% if language_tabs %> + <% if language_tabs.any? %>
<% language_tabs.each do |lang| %> <% if lang.is_a? Hash %> diff --git a/source/stylesheets/_variables.scss b/source/stylesheets/_variables.scss index 0f952862a3f..2c08188fe96 100644 --- a/source/stylesheets/_variables.scss +++ b/source/stylesheets/_variables.scss @@ -87,12 +87,12 @@ $phone-width: $tablet-width - $nav-width; // min width before reverting to mobil // OTHER //////////////////// -$nav-active-shadow: #000; -$nav-footer-border-color: #666; -$nav-embossed-border-top: #000; -$nav-embossed-border-bottom: #939393; -$main-embossed-text-shadow: 0px 1px 0px #fff; -$search-box-border-color: #666; +$nav-active-shadow: #000 !default; +$nav-footer-border-color: #666 !default; +$nav-embossed-border-top: #000 !default; +$nav-embossed-border-bottom: #939393 !default; +$main-embossed-text-shadow: 0px 1px 0px #fff !default; +$search-box-border-color: #666 !default; //////////////////////////////////////////////////////////////////////////////// diff --git a/source/stylesheets/screen.css.scss b/source/stylesheets/screen.css.scss index 0da26eebe81..d5bf12457d6 100644 --- a/source/stylesheets/screen.css.scss +++ b/source/stylesheets/screen.css.scss @@ -116,7 +116,7 @@ html, body { } } - img+.tocify { + img+.tocify, .lang-selector+.tocify { margin-top: $logo-margin; } @@ -637,4 +637,4 @@ html, body { .highlight, .highlight .w { background-color: $code-bg; -} \ No newline at end of file +}