Adjust to personal needs
This commit is contained in:
parent
cf6cb99174
commit
2e703347d6
20
build.sh
Executable file → Normal file
20
build.sh
Executable file → Normal file
|
@ -3,24 +3,24 @@
|
|||
function run_clean {
|
||||
latexmk -C
|
||||
|
||||
if [ -f main.bbl ]
|
||||
if [ -f out/main.bbl ]
|
||||
then
|
||||
rm main.bbl
|
||||
rm out/main.bbl
|
||||
fi
|
||||
|
||||
if [ -f main.lol ]
|
||||
if [ -f out/main.lol ]
|
||||
then
|
||||
rm main.lol
|
||||
rm out/main.lol
|
||||
fi
|
||||
|
||||
if [ -f main.ptc ]
|
||||
if [ -f out/main.ptc ]
|
||||
then
|
||||
rm main.ptc
|
||||
rm out/main.ptc
|
||||
fi
|
||||
|
||||
if [ -f main.run.xml ]
|
||||
if [ -f out/main.run.xml ]
|
||||
then
|
||||
rm main.run.xml
|
||||
rm out/main.run.xml
|
||||
fi
|
||||
|
||||
if [ -f chapter/out.tex ]
|
||||
|
@ -51,7 +51,7 @@ function run_pandoc {
|
|||
}
|
||||
|
||||
function run_latexmk {
|
||||
latexmk -latexoption="-shell-escape" main.tex
|
||||
latexmk -quiet -latexoption="-shell-escape" -outdir=out main.tex
|
||||
}
|
||||
|
||||
function run_pandoc_appendix {
|
||||
|
@ -91,4 +91,4 @@ case $1 in
|
|||
*)
|
||||
echo $"Usage: $0 {clean|pandoc|latex}"
|
||||
exit 1
|
||||
esac
|
||||
esac
|
12
setup.sh
12
setup.sh
|
@ -14,13 +14,15 @@ fi
|
|||
|
||||
if [ $1 == "markdown" ]
|
||||
then
|
||||
cp templates/markdown.gitlab-ci.yml ./.gitlab-ci.yml
|
||||
cp templates/markdown.azure-pipelines.yml ./azure-pipelines.yml
|
||||
cp templates/markdown.tasks.json ./.vscode/tasks.json
|
||||
cp templates/markdown.main.tex ./main.tex
|
||||
#cp templates/markdown.gitlab-ci.yml ./.gitlab-ci.yml
|
||||
cp templates/markdown/.drone.yml ./.drone.yml
|
||||
#cp templates/markdown/github-workflow.yml ./.github/workflows/latex.yml
|
||||
cp templates/markdown/azure-pipelines.yml ./azure-pipelines.yml
|
||||
cp templates/markdown/tasks.json ./.vscode/tasks.json
|
||||
cp templates/markdown/main.tex ./main.tex
|
||||
elif [ $1 == "latex" ]
|
||||
then
|
||||
cp templates/latex.gitlab-ci.yml ./.gitlab-ci.yml
|
||||
#cp templates/latex.gitlab-ci.yml ./.gitlab-ci.yml
|
||||
cp templates/latex.azure-pipelines.yml ./azure-pipelines.yml
|
||||
cp templates/latex.tasks.json ./.vscode/tasks.json
|
||||
else
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "latexmk",
|
||||
"type": "shell",
|
||||
"command": "${workspaceFolder}/build.sh pandoc",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"dependsOrder": "sequence",
|
||||
"dependsOn": ["clean"]
|
||||
},
|
||||
{
|
||||
"label": "clean",
|
||||
"type": "shell",
|
||||
"command": "${workspaceFolder}/build.sh clean",
|
||||
"group": "none",
|
||||
}
|
||||
]
|
||||
}
|
46
templates/markdown/.drone.yml
Normal file
46
templates/markdown/.drone.yml
Normal file
|
@ -0,0 +1,46 @@
|
|||
kind: pipeline
|
||||
type: docker
|
||||
name: test
|
||||
|
||||
steps:
|
||||
- name: hunspell_chapters
|
||||
image: fastexitlane/hunspell:latest
|
||||
commands:
|
||||
- export HUNSPELL_FINDINGS=`for filename in chapter/*.md; do hunspell -l -d de_DE_frami,en_US -p ./.hunspellignore $filename; done | sort | uniq`
|
||||
- echo $HUNSPELL_FINDINGS
|
||||
- '[ -z "$HUNSPELL_FINDINGS" ] && exit 0 || exit 1'
|
||||
failure: ignore
|
||||
- name: hunspell_appendix
|
||||
image: fastexitlane/hunspell:latest
|
||||
commands:
|
||||
- export HUNSPELL_FINDINGS=`for filename in appendix/*.tex; do hunspell -l -d de_DE_frami,en_US -p ./.hunspellignore -t $filename; done | sort | uniq`
|
||||
- echo $HUNSPELL_FINDINGS
|
||||
- '[ -z "$HUNSPELL_FINDINGS" ] && exit 0 || exit 1'
|
||||
failure: ignore
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build
|
||||
|
||||
steps:
|
||||
- name: pandoc
|
||||
image: fastexitlane/pandoc-latex:latest
|
||||
commands:
|
||||
- ./build.sh pandoc
|
||||
- ci_commit_sha_short=`git rev-parse --short $CI_COMMIT_SHA`
|
||||
- name: gitea_release
|
||||
image: plugins/gitea-release
|
||||
settings:
|
||||
api_key:
|
||||
from_secret: gitea_token
|
||||
base_url: https://git.kingofdog.de
|
||||
files:
|
||||
- main.pdf
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
0
templates/markdown/github-workflow.yml
Normal file
0
templates/markdown/github-workflow.yml
Normal file
43
templates/markdown/tasks.json
Normal file
43
templates/markdown/tasks.json
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "latexmk",
|
||||
"type": "shell",
|
||||
"command": "docker run --rm -u 1000 -v '${workspaceFolder}:/work/' -w /work/ fastexitlane/pandoc-latex:latest ./build.sh pandoc",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"dependsOrder": "sequence",
|
||||
"dependsOn": [
|
||||
"clean"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "clean",
|
||||
"type": "shell",
|
||||
"command": "docker run --rm -u 1000 -v '${workspaceFolder}:/work/' -w /work/ fastexitlane/pandoc-latex:latest ./build.sh clean",
|
||||
"group": "none"
|
||||
},
|
||||
{
|
||||
"label": "wordcount",
|
||||
"type": "shell",
|
||||
"command": "docker run --rm -u 1000 -v '${workspaceFolder}:/work/' -w /work/ fastexitlane/pandoc-latex:latest pandoc --lua-filter=/work/wordcount.lua /work/chapter/out.md",
|
||||
"group": "none",
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "overusedwords",
|
||||
"type": "shell",
|
||||
"command": "cat chapter/out.md | tr 'A-ZÄÖÜ' 'a-zäöü' | sed --regexp-extended 's/\\\\acf?s?p?\\{([^}]+)\\}/\\1/g' | sed 's/-/ /g' | sed 's/[^a-zäöü ]//g' | tr -s '[[:space:]]' '\\n' | sort | uniq -c | sort -nr | head -n100 > words.txt",
|
||||
"windows": {
|
||||
"command": "wsl cat chapter/out.md `| tr 'A-ZÄÖÜ' 'a-zäöü' `| sed 's/-/ /g' `| sed 's/[^a-zäöü]//g' `> words.txt"
|
||||
},
|
||||
"group": "none",
|
||||
"problemMatcher": []
|
||||
}
|
||||
]
|
||||
}
|
29
wordcount.lua
Normal file
29
wordcount.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
-- counts words in a document
|
||||
|
||||
words = 0
|
||||
|
||||
wordcount = {
|
||||
Str = function(el)
|
||||
-- we don't count a word if it's entirely punctuation:
|
||||
if el.text:match("%P") then
|
||||
words = words + 1
|
||||
end
|
||||
end,
|
||||
|
||||
Code = function(el)
|
||||
_,n = el.text:gsub("%S+","")
|
||||
words = words + n
|
||||
end,
|
||||
|
||||
CodeBlock = function(el)
|
||||
_,n = el.text:gsub("%S+","")
|
||||
words = words + n
|
||||
end
|
||||
}
|
||||
|
||||
function Pandoc(el)
|
||||
-- skip metadata, just count body:
|
||||
pandoc.walk_block(pandoc.Div(el.blocks), wordcount)
|
||||
print(words .. " words in body")
|
||||
os.exit(0)
|
||||
end
|
Loading…
Reference in New Issue
Block a user