diff --git a/.gitignore b/.gitignore index 62ccd0b..1531189 100644 --- a/.gitignore +++ b/.gitignore @@ -12,5 +12,6 @@ Test* !Content.html Content.jira +.venv .envrc node_modules diff --git a/.vscode/settings.json b/.vscode/settings.json index e3f9641..78de575 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,5 @@ { + "PandocCiter.DefaultBib": "literature/bibliography.bib", "editor.formatOnPaste": true, "editor.formatOnType": true, "editor.tabSize": 4, @@ -36,8 +37,8 @@ "name": "latexmk" } ], - "PandocCiter.DefaultBib": "literature/bibliography.bib", "prettier.configPath": "tools/.prettierrc", + "python.defaultInterpreterPath": "${workspaceFolder}/.venv", "python.formatting.provider": "yapf", "python.formatting.yapfArgs": [ "--style", @@ -48,6 +49,7 @@ "python.linting.pycodestyleEnabled": false, "python.linting.pylamaEnabled": true, "python.linting.pylintEnabled": false, + "python.terminal.activateEnvironment": true, "search.exclude": { "**/node_modules": true }, diff --git a/Content.html b/Content.html index e169bfc..79f5c0e 100644 --- a/Content.html +++ b/Content.html @@ -524,7 +524,7 @@

References

-
[1]
G. Nützi, ‘Non-smooth granular rigid body dynamics with applications to chute flows’, PhD thesis, ETH Zurich; ETH Zürich, Zürich, 2016.
+
[1]
G. Nützi, Non-smooth granular rigid body dynamics with applications to chute flows, PhD thesis, ETH Zurich; ETH Zürich, Zürich, 2016.
[2]
R. T. Rockafellar, Convex analysis. Princeton: Princeton University Press, 2015 [Online]. Available: https://www.degruyter.com/view/title/516543
diff --git a/Content.pdf b/Content.pdf deleted file mode 100644 index db68660..0000000 Binary files a/Content.pdf and /dev/null differ diff --git a/Readme.md b/Readme.md index aa03c07..12827e2 100644 --- a/Readme.md +++ b/Readme.md @@ -103,25 +103,20 @@ choco install pandoc ### Python -Install a recent `python3` (>= 3.6) and the following packages: +Install a recent `python3` (>= 3.9) and the following packages. + +Setup a python environment in `.venv` with +`python -m venv --system-site-packages ./.venv` and install the packages: ```shell +python -m venv --system-site-packages .venv # or simply symlink to an existing one. +source .venv/bin/activate pip3 install -r tools/.requirements ``` -The best way is to setup a python environment `python venv` since `pandoc`. The VS Code config `python.pythonPath` path needs to be set. - -The VS Code tasks get the `${config:python.pythonPath}` -directly as an argument and modify the environement and `pandoc` will use the right python when launching the filters. - -You can also start VS Code like this to have the proper `python` enabled: - -```bash -# Activate your python env. -source ~/.env/myPython3.8Env/activate -# Start code -cd TechnicalMarkdown && code -n . -``` +The VS Code tasks pass the config `${config:python.pythonEnv}` +directly as an argument to `gradlew` (if not set `python` is the default). The tasks are run in a shell where `./.venv/bin/activate` has been called. +Then, `pandoc` will use the correct python when launching the filters. You can also use the ignored [.envrc](.envrc) file with [direnv](https://github.com/direnv/direnv). diff --git a/build.gradle.kts b/build.gradle.kts index d3ef20f..ad8618a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -98,7 +98,7 @@ val defineEnvironment by tasks.register("defineEnvironment") { outputs.upToDateWhen({true}) doLast({ - + pythonPaths.forEach { if(!it.exists()) { throw RuntimeException( @@ -117,10 +117,10 @@ val defineEnvironment by tasks.register("defineEnvironment") { checkCmd(arrayOf(pythonExe, "--version"), null) checkPandocInstall(pandocExe) - logger.quiet("Pandoc Exe: $pandocExe") - logger.quiet("Python Exe: $pythonExe") - logger.quiet("Python Path: ${pythonPaths.contentToString()}") - logger.quiet("Lua Path: ${luaPaths.contentToString()}") + logger.info("Pandoc Exe: $pandocExe") + logger.info("Python Exe: $pythonExe") + logger.info("Python Path: ${pythonPaths.contentToString()}") + logger.info("Lua Path: ${luaPaths.contentToString()}") }) } @@ -131,20 +131,21 @@ val compileLess by tasks.register("compileLess") { description = "Compile Less" dependsOn(initBuild, defineEnvironment) - val lessFile = fileTree("${project.rootDir}/convert/css/src/"){ include("main.less") }.getFiles().elementAt(0) + val lessMainFile = fileTree("${project.rootDir}/convert/css/src/"){ include("main.less") }.getFiles().elementAt(0) + val lessFiles = fileTree("${project.rootDir}/convert/css/src/"){ include("*.less") }.getFiles() val cssFile = file("${project.rootDir}/convert/css/main.css") - inputs.files(lessFile) + inputs.files(lessMainFile, lessFiles) outputs.file(cssFile) val lessCompiler = file("$binDir/lessc") doFirst({ - println("Executing Less Compilation: '$lessFile' -> '$cssFile'") + println("Executing Less Compilation: '$lessMainFile' -> '$cssFile'") }) executable(lessCompiler) - args("--include-path=convert/css/src", lessFile, cssFile) + args("--include-path=convert/css/src", lessMainFile, cssFile) workingDir(project.rootDir) } @@ -161,8 +162,9 @@ data class PandocSettings( fun createPandocSettings(): PandocSettings { var env = globalEnv.toMutableMap() - env.addExecutableDirToPath(pandocExe) - env.addExecutableDirToPath(pythonExe) + logger.quiet("First PATH: '${env["PATH"]}") + //env.addExecutableDirToPath(pythonExe) + //env.addExecutableDirToPath(pandocExe) env["ROOT_DIR"] = "${project.rootDir}" env["PYTHON_PATH"] = env.getOrDefault("PYTHON_PATH", "") + pathSep + pythonPaths.joinToString(separator = pathSep) env["LUA_PATH"] = env.getOrDefault("LUA_PATH", "") + pathSep + luaPaths.flatMap({v -> listOf("$v/?", "$v/?.lua") }).joinToString(separator=";") @@ -193,6 +195,8 @@ abstract class PandocTask @Inject constructor() : Exec() { @get:InputDirectory abstract val assetFiles: Property @get:InputDirectory + abstract val literatureFiles: Property + @get:InputDirectory abstract val convertFiles: Property @get:OutputFile @@ -218,12 +222,13 @@ abstract class PandocTask @Inject constructor() : Exec() { additionalArgs.convention(arrayOf()) markdownFiles.convention(project.fileTree("${project.rootDir}/chapters/"){include("**/*.md", "**/*.html")}) assetFiles.convention(project.fileTree("${project.rootDir}/files/"){ include("**/*") }) + literatureFiles.convention(project.fileTree("${project.rootDir}/literature/"){ include("**/*") }) convertFiles.convention(project.fileTree("${project.rootDir}/convert/"){ include("pandoc/**/*") include("scripts/**/*") }) - inputs.files(inputFile, markdownFiles, assetFiles, convertFiles) + inputs.files(inputFile, markdownFiles, assetFiles, convertFiles, literatureFiles) outputs.file(outputFile) executable(settings.pandocExe) diff --git a/convert/css/main.css b/convert/css/main.css index 4b4ac3c..f41542f 100644 --- a/convert/css/main.css +++ b/convert/css/main.css @@ -790,6 +790,10 @@ html #main-markdown .centered { html #main-markdown code { font-family: Fira Code; font-size: 11pt; + padding-left: 3pt; + padding-right: 3pt; + border-radius: 3pt; + background-color: #f5f5f5; } html #main-markdown div.sourceCode { background-color: #f5f5f5; @@ -798,7 +802,12 @@ html #main-markdown div.sourceCode { border-color: #e9e9e9; border-width: 1.5pt; margin: 0.5ex; - border-radius: 4pt; + border-radius: 5pt; +} +html #main-markdown div.sourceCode code { + padding-left: 0pt; + padding-right: 0pt; + background-color: transparent; } html #main-markdown pre.numberSource { margin-left: 2em; @@ -1274,6 +1283,10 @@ html #main-markdown-numbered .centered { html #main-markdown-numbered code { font-family: Fira Code; font-size: 11pt; + padding-left: 3pt; + padding-right: 3pt; + border-radius: 3pt; + background-color: #f5f5f5; } html #main-markdown-numbered div.sourceCode { background-color: #f5f5f5; @@ -1282,7 +1295,12 @@ html #main-markdown-numbered div.sourceCode { border-color: #e9e9e9; border-width: 1.5pt; margin: 0.5ex; - border-radius: 4pt; + border-radius: 5pt; +} +html #main-markdown-numbered div.sourceCode code { + padding-left: 0pt; + padding-right: 0pt; + background-color: transparent; } html #main-markdown-numbered pre.numberSource { margin-left: 2em; diff --git a/convert/css/src/code.less b/convert/css/src/code.less index 36b2f94..406b9e8 100644 --- a/convert/css/src/code.less +++ b/convert/css/src/code.less @@ -1,10 +1,13 @@ @import "defines.less"; .define-code() { - - code{ + code { font-family: Fira Code; font-size: 11pt; + padding-left: 3pt; + padding-right: 3pt; + border-radius: 3pt; + background-color: @main-float-background-color; } div.sourceCode { @@ -14,7 +17,13 @@ border-color: @main-float-border-color; border-width: 1.5pt; margin: 0.5ex; - border-radius: 4pt; + border-radius: 5pt; + + code { + padding-left: 0pt; + padding-right: 0pt; + background-color: transparent + } } pre.numberSource {