-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
default_install_hook_types: | ||
- pre-commit | ||
- pre-push | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v5.0.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-merge-conflict | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
- repo: https://github.com/sirosen/texthooks | ||
rev: 0.6.7 | ||
hooks: | ||
- id: fix-smartquotes | ||
- id: fix-ligatures | ||
- id: fix-spaces | ||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.3.0 | ||
hooks: | ||
- id: codespell | ||
# args: | ||
# - "--write-changes" | ||
- repo: local | ||
hooks: | ||
- id: ghp-import | ||
name: Update Github Pages | ||
entry: .pre_commit_hooks/gh-pages.sh | ||
language: script | ||
require_serial: true | ||
stages: | ||
- pre-push | ||
verbose: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env bash | ||
# pre-commit hook using ghp-import to push HTML to Github Pages. | ||
# Assumes: | ||
# HTML exists in docs folder. | ||
# ghp-import in PATH, e.g., `python -m pip install ghp-import`. | ||
# `git config ghppages.pathhtml <absolute path>/docs`. Defaults to | ||
# "$GIT_WORK_TREE/docs". | ||
# `git config ghppages.push true`. Otherwise skip publishing. | ||
|
||
if git config --get-colorbool color.interactive | ||
then | ||
# See https://github.com/vimwiki/vimwiki/blob/master/doc/logo.svg | ||
say_prefix='\e[90mghp\e[92m|\e[37mimport\e[0m' | ||
else | ||
say_prefix='ghp-import' | ||
fi | ||
|
||
say () { | ||
printf '%b: %s' "$say_prefix" "$*" | ||
} | ||
|
||
say_done () { | ||
printf 'done.\n' | ||
} | ||
|
||
# Update gh-pages | ||
if test "$(git config --bool ghppages.push || echo false)" = true | ||
then | ||
pathhtml=$(git config ghppages.pathhtml || echo "$GIT_WORK_TREE/docs") | ||
say 'Pushing html to gh-pages...' | ||
make html | ||
ghp-import -n -o -p -f "$pathhtml" | ||
say_done | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
ghp-import | ||
MarkdownPP |