Skip to content

Commit

Permalink
Upgrade to latest master of upstream lord/slate
Browse files Browse the repository at this point in the history
For files that git log'd back to the last Slate upgrade in scoutapp#4 / 63f4722 , I picked the upstream versions. In others I tried to sensibly merge, for example the README is all about Scout so I didn't take anything from upstream, whilst for the Gemfile there was only minimal Scout customization so I made the two more similar.

The upstream ToC behaviour changed a lot in slatedocs#701, and Scout's had diverged with Derek's fix to scrolling in a8f2b7c. I took the upstream. This meant removing the ToC style overrides in `screen_overrides.css.scss` because the div has changed.

`layout.erb` had obviously been customized but I think I managed to correctly merge.

In `_variables.scss`, some changes affect the design:

* `$nav-active-parent-bg` - This was added upstream as a grey related to `$nav-active-bg`; I did the same here and picked a grey related to the custom blue Scout uses for `$nav-active-bg` by reducing its saturation and value in GIMP.
* `$nav-active-parent-text` is new, but it and its peers are all white, so I left it as-is.
* `$nav-active-shadow`, `$nav-embossed-border-top`, `$nav-embossed-border-bottom`, and `$main-embossed-text-shadow` were removed. Notably the embossing was removed in slatedocs@5d0bef6#diff-f9212fb5aed21de00ff3495a78afb71d for a "more 2017 look." Could add that back if you want to preserve the style, though Scout had removed some of the text shadows already in 9c89ce3.

I tested with `vagrant destroy` then `vagrant up`, and checked it out in my browser. Before/after screenshots attached to PR. Also during startup there was this error during `bundle install`:

```
default: middleman-core (4.2.1) has dependency bundler (~> 1.1), which is unsatisfied by the current bundler version 2.0.2, so the dependency is being ignored
default: Following files may not be writable, so sudo is needed:
default:   /usr/local/bin
default:   /var/lib/gems/2.4.0
default:   /var/lib/gems/2.4.0/build_info
default:   /var/lib/gems/2.4.0/cache
default:   /var/lib/gems/2.4.0/doc
default:   /var/lib/gems/2.4.0/extensions
default:   /var/lib/gems/2.4.0/gems
default:   /var/lib/gems/2.4.0/specifications
```

However I think this is fine, bundler is installed as a newer version so that's okay?
  • Loading branch information
adamchainz committed Jul 4, 2019
2 parents bbf42d1 + de49684 commit 635f935
Show file tree
Hide file tree
Showing 34 changed files with 9,784 additions and 10,511 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# EditorConfig is awesome: http://EditorConfig.org

# Top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.rb]
charset = utf-8

[*.md]
trim_trailing_whitespace = false
21 changes: 15 additions & 6 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
If this is a question or feature request, make sure to:
<!--
⚠️ READ THIS BEFORE SUBMITTING ⚠️
- [ ] The title starts with `Question:` or `Feature:`.
Thanks for submitting a bug to Slate! If you've got a question about how to implement some feature, are encountering some unusual behavior in your fork of Slate, or if you want to chat, please start a new thread in our Spectrum community here! I monitor it for new threads, and it makes it easy for knowledgeable members of the community to help solve problems.
If this is an bug report, not a question, make sure to:
-> https://spectrum.chat/slate <-
- [ ] 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.
If you've found a bug with Slate upstream that you're still encountering even in a lightly modified Slate, you're in the right place! Please fill out the form below with the issue you're having and we'll take a look. :)
-->

Operating system: ✍️ TODO
Last upstream commit (run `git log --author="Robert Lord" | head -n 1`): ✍️ TODO
Browser version(s): ✍️ TODO
Ruby version (run `ruby -v`): ✍️ TODO

---

✍️ TODO write your issue here
8 changes: 4 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
!!!!! STOP AND READ !!!!!
<!--
⚠️ 🚨 ⚠️ STOP AND READ THIS ⚠️ 🚨 ⚠️
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.
👆👆 see that 'base fork' dropdown above? You should change it! The default value of "lord/slate" submits your change to ALL USERS OF SLATE, not just your company. This is PROBABLY NOT WHAT YOU WANT.
-->
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ sudo: false
language: ruby

rvm:
- 2.2.5
- 2.3.3
- 2.4.0

Expand Down
69 changes: 67 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,71 @@
# Changelog

## Version 1.5.0
## Version 2.3.1

*July 5, 2018*

- Update `sprockets` in `Gemfile.lock` to fix security warnings

## Version 2.3

*July 5, 2018*

- Allows strikethrough in markdown by default.
- Upgrades jQuery to 3.2.1, thanks to [Tomi Takussaari](https://github.com/TomiTakussaari)
- Fixes invalid HTML in `layout.erb`, thanks to [Eric Scouten](https://github.com/scouten) for pointing out
- Hopefully fixes Vagrant memory issues, thanks to [Petter Blomberg](https://github.com/p-blomberg) for the suggestion
- Cleans HTML in headers before setting `document.title`, thanks to [Dan Levy](https://github.com/justsml)
- Allows trailing whitespace in markdown files, thanks to [Samuel Cousin](https://github.com/kuzyn)
- Fixes pushState/replaceState problems with scrolling not changing the document hash, thanks to [Andrey Fedorov](https://github.com/anfedorov)
- 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)
- Fixes `nav-padding` bug, thanks [Jerome Dahdah](https://github.com/jdahdah)
- Code style fixes thanks to [Sebastian Zaremba](https://github.com/vassyz)
- Nokogiri version bump thanks to [Grey Baker](https://github.com/greysteil)
- Fix to default `index.md` text thanks to [Nick Busey](https://github.com/NickBusey)

Thanks to everyone who contributed to this release!

## Version 2.2

*January 19, 2018*

- Fixes bugs with some non-roman languages not generating unique headers
- Adds editorconfig, thanks to [Jay Thomas](https://github.com/jaythomas)
- Adds optional `NestingUniqueHeadCounter`, thanks to [Vladimir Morozov](https://github.com/greenhost87)
- 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)!
- Adds links to Spectrum chat for questions in README and ISSUE_TEMPLATE

## Version 2.1

*October 30, 2017*

- Right-to-left text stylesheet option, thanks to [Mohammad Hossein Rabiee](https://github.com/mhrabiee)
- Fix for HTML5 history state bug, thanks to [Zach Toolson](https://github.com/ztoolson)
- 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)

Thanks to everyone who submitted PRs for this version!

## Version 2.0

*July 17, 2017*

- All-new statically generated table of contents
- Should be much faster loading and scrolling for large pages
- Smaller Javascript file sizes
- Avoids the problem with the last link in the ToC not ever highlighting if the section was shorter than the page
- Fixes control-click not opening in a new page
- Automatically updates the HTML title as you scroll
- Updated design
- New default colors!
- New spacings and sizes!
- System-default typefaces, just like GitHub
- Added search input delay on large corpuses to reduce lag
- We even bumped the major version cause hey, why not?
- Various small bug fixes

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.

## Version 1.5

*February 23, 2017*

Expand All @@ -9,7 +74,7 @@
- Switch default code highlighting color scheme to better highlight JSON
- Various small typo and bug fixes

## Version 1.4.0
## Version 1.4

*November 24, 2016*

Expand Down
46 changes: 46 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

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.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

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.

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.

## Scope

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.

## Enforcement

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.

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.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ruby '>=2.3.1'
source 'https://rubygems.org'

# Middleman
gem 'middleman', '~>4.2.1'
gem 'middleman-syntax', '~> 3.0.0'
gem 'middleman-autoprefixer', '~> 2.7.0'
gem "middleman-sprockets", "~> 4.1.0"
gem 'middleman-gh-pages', '~> 0.3.1'
gem 'middleman-sprockets', '~> 4.1.0'
gem 'rouge', '~> 2.0.5'
gem 'redcarpet', '~> 3.4.0'

gem 'middleman-gh-pages', '~> 0.3.1'

gem 'nokogiri', '~> 1.8.2'
11 changes: 9 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ GEM
middleman-syntax (3.0.0)
middleman-core (>= 3.2)
rouge (~> 2.0)
mini_portile2 (2.3.0)
minitest (5.10.2)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
padrino-helpers (0.13.3.3)
i18n (~> 0.6, >= 0.6.7)
padrino-support (= 0.13.3.3)
Expand All @@ -99,7 +102,7 @@ GEM
rouge (2.0.7)
sass (3.4.23)
servolux (0.13.0)
sprockets (3.7.1)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
temple (0.8.0)
Expand All @@ -120,8 +123,12 @@ DEPENDENCIES
middleman-gh-pages (~> 0.3.1)
middleman-sprockets (~> 4.1.0)
middleman-syntax (~> 3.0.0)
nokogiri (~> 1.8.2)
redcarpet (~> 3.4.0)
rouge (~> 2.0.5)

RUBY VERSION
ruby 2.3.3p222

BUNDLED WITH
1.10.6
1.15.4
11 changes: 8 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network :forwarded_port, guest: 4567, host: 4567
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end

config.vm.provision "bootstrap",
type: "shell",
inline: <<-SHELL
sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get update
sudo apt-get install -yq ruby2.0 ruby2.0-dev pkg-config build-essential nodejs git libxml2-dev libxslt-dev
sudo apt-get install -yq ruby2.4 ruby2.4-dev
sudo apt-get install -yq pkg-config build-essential nodejs git libxml2-dev libxslt-dev
sudo apt-get autoremove -yq
gem2.0 install --no-ri --no-rdoc bundler
gem2.4 install --no-ri --no-rdoc bundler
SHELL

# add the local user git config to the vm
Expand All @@ -34,6 +39,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 --latency=1 &> ~/middleman.log &
bundle exec middleman server --watcher-force-polling --watcher-latency=1 &> ~/middleman.log &
SHELL
end
11 changes: 10 additions & 1 deletion config.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# Unique header generation
require './lib/unique_head.rb'

# Markdown
set :markdown_engine, :redcarpet
set :markdown,
fenced_code_blocks: true,
smartypants: true,
disable_indented_code_blocks: true,
prettify: true,
strikethrough: true,
tables: true,
with_toc_data: true,
no_intra_emphasis: true
no_intra_emphasis: true,
renderer: UniqueHeadCounter

# Assets
set :css_dir, 'stylesheets'
Expand Down Expand Up @@ -47,3 +52,7 @@
# Deploy Configuration
# If you want Middleman to listen on a different port, you can set that below
set :port, 4567

helpers do
require './lib/toc_data.rb'
end
18 changes: 15 additions & 3 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ Options:
deploy branch.
-n, --no-hash Don't append the source commit's hash to the deploy
commit's message.
--source-only Only build but not push
--push-only Only push but not build
"

bundle exec middleman build --clean

run_build() {
bundle exec middleman build --clean
}

parse_args() {
# Set args from a local environment file.
Expand Down Expand Up @@ -97,7 +102,7 @@ main() {
return 1
fi

# must use short form of flag in ls for compatibility with OS X and BSD
# must use short form of flag in ls for compatibility with macOS and BSD
if [[ -z `ls -A "$deploy_directory" 2> /dev/null` && -z $allow_empty ]]; then
echo "Deploy directory '$deploy_directory' is empty. Aborting. If you're sure you want to deploy an empty tree, use the --allow-empty / -e flag." >&2
return 1
Expand Down Expand Up @@ -200,4 +205,11 @@ sanitize() {
"$@" 2> >(filter 1>&2) | filter
}

[[ $1 = --source-only ]] || main "$@"
if [[ $1 = --source-only ]]; then
run_build
elif [[ $1 = --push-only ]]; then
main "$@"
else
run_build
main "$@"
fi
18 changes: 8 additions & 10 deletions lib/multilang.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
module Multilang
def block_code(code, full_lang_name)
# Tweeked to allow a nil full_lang_name, which I believe is the default for code blocks.
if full_lang_name.nil?
full_lang_name = ""
if full_lang_name
parts = full_lang_name.split('--')
rouge_lang_name = (parts) ? parts[0] : "" # just parts[0] here causes null ref exception when no language specified
super(code, rouge_lang_name).sub("highlight #{rouge_lang_name}") do |match|
match + " tab-" + full_lang_name
end
else
super(code, full_lang_name)
end
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
rescue
raise
end
end

Expand Down
22 changes: 22 additions & 0 deletions lib/nesting_unique_head.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Nested unique header generation
require 'middleman-core/renderers/redcarpet'

class NestingUniqueHeadCounter < Middleman::Renderers::MiddlemanRedcarpetHTML
def initialize
super
@@headers_history = {} if !defined?(@@headers_history)
end

def header(text, header_level)
friendly_text = text.gsub(/<[^>]*>/,"").parameterize
@@headers_history[header_level] = text.parameterize

if header_level > 1
for i in (header_level - 1).downto(1)
friendly_text.prepend("#{@@headers_history[i]}-") if @@headers_history.key?(i)
end
end

return "<h#{header_level} id='#{friendly_text}'>#{text}</h#{header_level}>"
end
end
Loading

0 comments on commit 635f935

Please sign in to comment.