Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update styles 2021-04-14 #338

Merged
merged 42 commits into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1d32319
add image-with-shadow class
tobyhodges Nov 5, 2020
d021e1f
add patch to clean gh-pages before committing (#545)
zkamvar Feb 10, 2021
f419f9c
Fix Kramdown parser crash
maxim-belkin Feb 15, 2021
ec29c6b
Merge pull request #546 from maxim-belkin/fix543
zkamvar Feb 16, 2021
2a550c7
bin/util.py: Change ruby executable to "bundle exec ruby"
reid-a Feb 22, 2021
a4e53f9
Change link colours (#549)
baileythegreen Feb 22, 2021
03fb1a0
bin/workshop_check.py: update default contact email address
tobyhodges Mar 4, 2021
a841a56
Gemfile: add 'webrick' dependency for Ruby 3.0.0 and above
josephmje Mar 5, 2021
32f7bd1
lesson_check.py allow for missing life_cycle
zkamvar Mar 10, 2021
b2f42c2
update with Maxim's suggestion
zkamvar Mar 10, 2021
a283c4b
Merge pull request #557 from zkamvar/znk-fix-556
zkamvar Mar 10, 2021
0554a8d
Add catch for None type code block in lesson_check
zkamvar Mar 11, 2021
cce6a66
fix syntax
zkamvar Mar 11, 2021
091d31a
Merge pull request #558 from zkamvar/znk-fix-550
zkamvar Mar 11, 2021
905d24a
Makefile: fix 'bundle config' command flags
maxim-belkin Mar 16, 2021
4e81182
Merge pull request #559 from maxim-belkin/bundle-config-fix
zkamvar Mar 17, 2021
b43257a
Makefile: clean target: remove .vendor, .bundle, Gemfile.lock
maxim-belkin Mar 18, 2021
39a32f6
Makefile: silence Docker commands
maxim-belkin Mar 18, 2021
588f2af
Merge pull request #561 from maxim-belkin/silence-docker-commands
zkamvar Mar 18, 2021
ed77eda
use Ruby's official GH Actions
fmichonneau Mar 19, 2021
b46187f
Makefile: use SHELL to call bin/knit_lesson.sh
maxim-belkin Mar 19, 2021
b1ca20a
Makefile: fix up PHONY targets
maxim-belkin Mar 19, 2021
943c8d9
Fix GitHub actions for lessons in Rmarkdown
maxim-belkin Mar 19, 2021
13d218a
Merge pull request #565 from maxim-belkin/attempt-to-fix-r-on-windows
zkamvar Mar 19, 2021
625c55e
Merge pull request #563 from maxim-belkin/phony-targets
zkamvar Mar 19, 2021
d6c86ba
Merge branch 'gh-pages' into image-with-shadow-class
tobyhodges Mar 22, 2021
4df32a8
apply single shadow to image class
tobyhodges Mar 22, 2021
93dfc15
use grey shadow instead of transparent black
tobyhodges Mar 22, 2021
4b20368
expand image-with-shadow selection
tobyhodges Mar 23, 2021
d0c90ee
Merge pull request carpentries/styles#514
maxim-belkin Mar 23, 2021
5a010ab
Makefile: don't fail when Python isn't found
maxim-belkin Mar 23, 2021
50fd61f
Merge pull request carpentries/styles#566
maxim-belkin Mar 24, 2021
1bad008
bin/dependencies.R: handle 'no packages were specified' error
maxim-belkin Mar 27, 2021
4b3d44a
Merge pull request #567 from maxim-belkin/no-missing-dependencies
zkamvar Mar 29, 2021
4df5052
Don't check links.md in lessons that use remote theme
maxim-belkin Apr 14, 2021
9a73007
add link references to code_of_conduct.md (#572)
tobyhodges Apr 14, 2021
ced2244
Update links.md
alanocallaghan Apr 15, 2021
72d2b85
Merge pull request #575 from Alanocallaghan/patch-1
zkamvar Apr 15, 2021
7b19545
Merge https://github.com/carpentries/styles into update-styles
zkamvar Apr 15, 2021
494e2d6
add source_dir argument
zkamvar Apr 15, 2021
efe8c04
lesson_check.py: add 'source_dir' as an argument to using_remote_theme()
maxim-belkin Apr 15, 2021
e2c2d8c
Merge https://github.com/carpentries/styles into update-styles
zkamvar Apr 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ jobs:
RSPM: 'https://packagemanager.rstudio.com/cran/__linux__/focal/latest'
steps:
- name: Set up Ruby
uses: actions/setup-ruby@v1
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true

- name: Set up Python
uses: actions/setup-python@v2
Expand All @@ -44,7 +45,7 @@ jobs:

- name: Install GitHub Pages, Bundler, and kramdown gems
run: |
gem install github-pages bundler kramdown
gem install github-pages bundler kramdown kramdown-parser-gfm

- name: Install Python modules
run: |
Expand Down Expand Up @@ -96,7 +97,8 @@ jobs:
- name: Install needed packages
if: steps.check-rmd.outputs.count != 0
run: |
install.packages(setdiff(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'), rownames(installed.packages())))
packages = setdiff(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'), rownames(installed.packages()))
install.packages(packages, repo="https://cran.rstudio.com/")
shell: Rscript {0}

- name: Query dependencies
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ jobs:
shell: bash
steps:
- name: Set up Ruby
uses: actions/setup-ruby@v1
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true

- name: Set up Python
uses: actions/setup-python@v2
Expand All @@ -28,7 +29,7 @@ jobs:

- name: Install GitHub Pages, Bundler, and kramdown gems
run: |
gem install github-pages bundler kramdown
gem install github-pages bundler kramdown kramdown-parser-gfm

- name: Install Python modules
run: |
Expand Down Expand Up @@ -62,7 +63,8 @@ jobs:
- name: Install needed packages
if: steps.check-rmd.outputs.count != 0
run: |
install.packages(setdiff(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'), rownames(installed.packages())))
packages = setdiff(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'), rownames(installed.packages()))
install.packages(packages, repo="https://cran.rstudio.com/")
shell: Rscript {0}

- name: Query dependencies
Expand Down Expand Up @@ -97,6 +99,11 @@ jobs:
- name: Commit and Push
if: ${{ github.event_name == 'push' && steps.check-rmd.outputs.count != 0 && github.ref != 'refs/heads/gh-pages'}}
run: |
# clean up gh-pages
cd gh-pages
git rm -rf . # remove all previous files
git restore --staged . # remove things from the stage
cd ..
# copy everything into gh-pages site
cp -r `ls -A | grep -v 'gh-pages' | grep -v '.git' | grep -v '.bundle/' | grep -v '_site'` gh-pages
# move into gh-pages, add, commit, and push
Expand All @@ -105,7 +112,7 @@ jobs:
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add -A .
git commit --allow-empty -m "[Github Actions] render website (via ${{ github.sha }}"
git commit --allow-empty -m "[Github Actions] render website (via ${{ github.sha }})"
git push origin gh-pages
# return
cd ..
Expand Down
3 changes: 2 additions & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ we pledge to follow the [Carpentry Code of Conduct][coc].
Instances of abusive, harassing, or otherwise unacceptable behavior
may be reported by following our [reporting guidelines][coc-reporting].

{% include links.md %}
[coc]: https://docs.carpentries.org/topic_folders/policies/code-of-conduct.html
[coc-reporting]: https://docs.carpentries.org/topic_folders/policies/incident-reporting.html
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
ruby '>=2.7.1'

gem 'github-pages', group: :jekyll_plugins

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0.0')
gem 'webrick', '>= 1.6.1'
end
46 changes: 29 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Settings
MAKEFILES=Makefile $(wildcard *.mk)
JEKYLL=bundle config --local set path .vendor/bundle && bundle install && bundle update && bundle exec jekyll
JEKYLL=bundle config set --local path .vendor/bundle && bundle install && bundle update && bundle exec jekyll
PARSER=bin/markdown_ast.rb
DST=_site

Expand All @@ -12,7 +12,7 @@ DST=_site
PYTHON3_EXE := $(shell which python3 2>/dev/null)
ifneq (, $(PYTHON3_EXE))
ifeq (,$(findstring Microsoft/WindowsApps/python3,$(subst \,/,$(PYTHON3_EXE))))
PYTHON := python3
PYTHON := $(PYTHON3_EXE)
endif
endif

Expand All @@ -21,25 +21,25 @@ ifeq (,$(PYTHON))
ifneq (, $(PYTHON_EXE))
PYTHON_VERSION_FULL := $(wordlist 2,4,$(subst ., ,$(shell python --version 2>&1)))
PYTHON_VERSION_MAJOR := $(word 1,${PYTHON_VERSION_FULL})
ifneq (3, ${PYTHON_VERSION_MAJOR})
$(error "Your system does not appear to have Python 3 installed.")
ifeq (3, ${PYTHON_VERSION_MAJOR})
PYTHON := $(PYTHON_EXE)
else
PYTHON_NOTE = "Your system does not appear to have Python 3 installed."
endif
PYTHON := python
else
$(error "Your system does not appear to have any Python installed.")
PYTHON_NOTE = "Your system does not appear to have any Python installed."
endif
endif


# Controls
.PHONY : commands clean files

# Default target
.DEFAULT_GOAL := commands

## I. Commands for both workshop and lesson websites
## =================================================

.PHONY: site docker-serve repo-check clean clean-rmd

## * serve : render website and run a local server
serve : lesson-md
${JEKYLL} serve
Expand All @@ -50,8 +50,8 @@ site : lesson-md

## * docker-serve : use Docker to serve the site
docker-serve :
docker pull carpentries/lesson-docker:latest
docker run --rm -it \
@docker pull carpentries/lesson-docker:latest
@docker run --rm -it \
-v $${PWD}:/home/rstudio \
-p 4000:4000 \
-p 8787:8787 \
Expand All @@ -60,14 +60,17 @@ docker-serve :
carpentries/lesson-docker:latest

## * repo-check : check repository settings
repo-check :
repo-check : python
@${PYTHON} bin/repo_check.py -s .

## * clean : clean up junk files
clean :
@rm -rf ${DST}
@rm -rf .sass-cache
@rm -rf bin/__pycache__
@rm -rf .vendor
@rm -rf .bundle
@rm -f Gemfile.lock
@find . -name .DS_Store -exec rm {} \;
@find . -name '*~' -exec rm {} \;
@find . -name '*.pyc' -exec rm {} \;
Expand All @@ -85,7 +88,7 @@ clean-rmd :
.PHONY : workshop-check

## * workshop-check : check workshop homepage
workshop-check :
workshop-check : python
@${PYTHON} bin/workshop_check.py .


Expand Down Expand Up @@ -128,18 +131,18 @@ lesson-md : ${RMD_DST}

_episodes/%.md: _episodes_rmd/%.Rmd install-rmd-deps
@mkdir -p _episodes
@bin/knit_lessons.sh $< $@
@$(SHELL) bin/knit_lessons.sh $< $@

## * lesson-check : validate lesson Markdown
lesson-check : lesson-fixme
lesson-check : python lesson-fixme
@${PYTHON} bin/lesson_check.py -s . -p ${PARSER} -r _includes/links.md

## * lesson-check-all : validate lesson Markdown, checking line lengths and trailing whitespace
lesson-check-all :
lesson-check-all : python
@${PYTHON} bin/lesson_check.py -s . -p ${PARSER} -r _includes/links.md -l -w --permissive

## * unittest : run unit tests on checking tools
unittest :
unittest : python
@${PYTHON} bin/test_lesson_check.py

## * lesson-files : show expected names of generated files for debugging
Expand All @@ -157,6 +160,15 @@ lesson-fixme :
## IV. Auxililary (plumbing) commands
## =================================================

.PHONY : commands python

## * commands : show all commands.
commands :
@sed -n -e '/^##/s|^##[[:space:]]*||p' $(MAKEFILE_LIST)

python :
ifeq (, $(PYTHON))
$(error $(PYTHON_NOTE))
else
@:
endif
2 changes: 1 addition & 1 deletion _includes/links.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[cran-stringr]: https://cran.r-project.org/package=stringr
[dc-lessons]: http://www.datacarpentry.org/lessons/
[email]: mailto:team@carpentries.org
[github-importer]: https://import.github.com/
[github-importer]: https://import2.github.com/
[importer]: https://github.com/new/import
[jekyll-collection]: https://jekyllrb.com/docs/collections/
[jekyll-install]: https://jekyllrb.com/docs/installation/
Expand Down
19 changes: 19 additions & 0 deletions assets/css/lesson.scss
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,20 @@ a code {
color: #006cad;
}

a:link {
color: #196EBD;
}

a:active,
a:hover {
outline: 0;
text-decoration: underline;
}

a:visited {
color: #1AA4DA;
}

code {
white-space: nowrap;
padding: 2px 5px;
Expand Down Expand Up @@ -287,6 +301,11 @@ span.fold-unfold {
}


p.image-with-shadow img,
img.image-with-shadow {
box-shadow: 0 6px 24px 0 #888;
}

//----------------------------------------
// Life cycle box
//----------------------------------------
Expand Down
13 changes: 7 additions & 6 deletions bin/dependencies.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@ install_required_packages <- function(lib = NULL, repos = getOption("repos", def
}

message("lib paths: ", paste(lib, collapse = ", "))
missing_pkgs <- setdiff(
c("rprojroot", "desc", "remotes", "renv"),
rownames(installed.packages(lib.loc = lib))
)
required_pkgs <- c("rprojroot", "desc", "remotes", "renv")
installed_pkgs <- rownames(installed.packages(lib.loc = lib))
missing_pkgs <- setdiff(required_pkgs, installed_pkgs)

# The default installation of R will have "@CRAN@" as the default repository, which directs contrib.url() to either
# force the user to choose a mirror if interactive or fail if not. Since we are not interactve, we need to force the
# mirror here.
if ("@CRAN@" %in% repos) {
repos <- c(CRAN = "https://cran.rstudio.com/")
}

install.packages(missing_pkgs, lib = lib, repos = repos)

if (length(missing_pkgs) != 0) {
install.packages(missing_pkgs, lib = lib, repos = repos)
}
}

find_root <- function() {
Expand Down
17 changes: 14 additions & 3 deletions bin/lesson_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ def main():
if life_cycle == "pre-alpha":
args.permissive = True
check_source_rmd(args.reporter, args.source_dir, args.parser)
args.references = read_references(args.reporter, args.reference_path)

args.references = {}
if not using_remote_theme(args.source_dir):
args.references = read_references(args.reporter, args.reference_path)

docs = read_all_markdown(args.source_dir, args.parser)
check_fileset(args.source_dir, args.reporter, list(docs.keys()))
Expand Down Expand Up @@ -167,6 +170,10 @@ def parse_args():

return args

def using_remote_theme(source_dir):
config_file = os.path.join(source_dir, '_config.yml')
config = load_yaml(config_file)
return 'remote_theme' in config

def check_config(reporter, source_dir):
"""Check configuration file."""
Expand All @@ -188,6 +195,8 @@ def check_config(reporter, source_dir):
reporter.check(defaults in config.get('defaults', []),
'configuration',
'"root" not set to "." in configuration')
if 'life_cycle' not in config:
config['life_cycle'] = None
return config['life_cycle']

def check_source_rmd(reporter, source_dir, parser):
Expand Down Expand Up @@ -390,7 +399,8 @@ def check_codeblock_classes(self):

for node in self.find_all(self.doc, {'type': 'codeblock'}):
cls = self.get_val(node, 'attr', 'class')
self.reporter.check(cls in KNOWN_CODEBLOCKS or cls.startswith('language-'),
self.reporter.check(cls is not None and (cls in KNOWN_CODEBLOCKS or
cls.startswith('language-')),
(self.filename, self.get_loc(node)),
'Unknown or missing code block type {0}',
cls)
Expand Down Expand Up @@ -490,7 +500,8 @@ def check(self):
"""Run extra tests."""

super().check()
self.check_reference_inclusion()
if not using_remote_theme():
self.check_reference_inclusion()

def check_metadata(self):
super().check_metadata()
Expand Down
3 changes: 2 additions & 1 deletion bin/markdown_ast.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
require "bundler/inline"

require 'kramdown'
require 'kramdown-parser-gfm'
require 'json'

markdown = $stdin.read
doc = Kramdown::Document.new(markdown)
doc = Kramdown::Document.new(markdown, input: 'GFM', hard_wrap: false)
tree = doc.to_hash_a_s_t
puts JSON.pretty_generate(tree)
2 changes: 1 addition & 1 deletion bin/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def read_markdown(parser, path):
for (i, line) in enumerate(body.split('\n'))]

# Parse Markdown.
cmd = 'ruby {0}'.format(parser)
cmd = 'bundle exec ruby {0}'.format(parser)
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE,
close_fds=True, universal_newlines=True, encoding='utf-8')
stdout_data, stderr_data = p.communicate(body)
Expand Down
2 changes: 1 addition & 1 deletion bin/workshop_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# Defaults.
CARPENTRIES = ("dc", "swc", "lc", "cp")
DEFAULT_CONTACT_EMAIL = 'admin@software-carpentry.org'
DEFAULT_CONTACT_EMAIL = 'team@carpentries.org'

USAGE = 'Usage: "workshop_check.py path/to/root/directory"'

Expand Down