From 6e6b8893816b580b6a1a36f86cf2a4131e081e38 Mon Sep 17 00:00:00 2001 From: joten Date: Sat, 13 Jan 2018 22:19:16 +0100 Subject: [PATCH] Added creating a cheat sheet to the build process --- doc/Cheat_sheet/cheat_sheet.css | 18 +++++++------- tools/build.ahk | 43 ++++++++++++++++++++++++++++----- 2 files changed, 46 insertions(+), 15 deletions(-) diff --git a/doc/Cheat_sheet/cheat_sheet.css b/doc/Cheat_sheet/cheat_sheet.css index 1ffbfc4..883e9e4 100644 --- a/doc/Cheat_sheet/cheat_sheet.css +++ b/doc/Cheat_sheet/cheat_sheet.css @@ -3,10 +3,10 @@ background-color: white; font-family: Ubuntu, sans-serif; font-size: 12px; -/* position: absolute; top: 10mm; left: 10mm;*/ position: absolute; top: 0; left: 0; - height: 190mm; - width: 277mm; + height: 184.8mm; + width: 272mm; + /*margin: 12.5mm;*/ } em { font-weight: bold; } h2 { @@ -18,9 +18,9 @@ h2 { /* color: white;*/ font-size: 24px; font-weight: bold; - padding: 8px; + padding: 8px 0; text-align: center; - width: 85.6mm; + width: 90mm; } .level3 { @@ -59,12 +59,12 @@ sup { vertical-align: top; } #layout-management { position: absolute; top: 0; left: 0; } #monitor-management { position: absolute; bottom: 0; left: 0; } -h2 { position: absolute; top: 0; left: 93.5mm; } -#window-management { position: absolute; bottom: 0; left: 93.5mm; } +h2 { position: absolute; top: 0; left: 91.0mm; } /* 92.0mm - 90.0mm => 2.0mm / 2 */ +#window-management { position: absolute; bottom: 0; left: 91.0mm; } #view-tag-management { position: absolute; top: 0; right: 0; } -#gui-management { position: absolute; top: 34.7ex; right: 0; } -#administration { position: absolute; top: 70.2ex; right: 0; } /* 76.5ex - 57.5ex => 19ex / 3 */ +#gui-management { position: absolute; top: 29.4ex; right: 0; } /* 37.2ex - 25.4ex ~> 11.8ex / 3 */ +#administration { position: absolute; top: 59.3ex; right: 0; } #window-debugging { position: absolute; bottom: 0; right: 0; } code { font-family: Ubuntu Mono, monospace; } diff --git a/tools/build.ahk b/tools/build.ahk index d21e92e..07fb1f5 100644 --- a/tools/build.ahk +++ b/tools/build.ahk @@ -30,10 +30,13 @@ SetWorkingDir %A_ScriptDir% ;; Ensures a consistent starting directory. Progress, 10 compile(A_ScriptDir . "\..\src\Main.ahk", A_ScriptDir . "\..\bugn.exe", A_ScriptDir . "\..\src\logo.ico") + Progress, 70 + + createCheatSheet(A_ScriptDir . "\..\doc\Default_hotkeys.md", A_ScriptDir . "\..\doc\Cheat_sheet") Progress, 100 _log.message("Building " . M_NAME . " finished", 0) - Sleep, 1000 + Sleep, 500 Progress, OFF Return ;; end of the auto-execute section @@ -79,16 +82,44 @@ compile(source, destination, customIcon, compiler := "C:\Program Files\AutoHotke Global _log useMpress := FileExist(compressor) - _log.message("**Compile**: Variable set, source -> ``" . source . "``, the file does " . (FileExist(source) ? "" : "**not** ") . "exist.", 5) - _log.message("**Compile**: Variable set, destination -> ``" . destination . "``, the file does " . (FileExist(destination) ? "" : "**not** ") . "exist.", 5) - _log.message("**Compile**: Variable set, customIcon -> ``" . customIcon . "``, the file does " . (FileExist(customIcon) ? "" : "**not** ") . "exist.", 5) - _log.message("**Compile**: Variable set, compiler -> ``" . compiler . "``, the file does " . (FileExist(compiler) ? "" : "**not** ") . "exist.", 5) - _log.message("**Compile**: Variable set, useMpress -> ``" . useMpress . "``", 5) + _log.message("**compile**: Variable set, source -> ``" . source . "``, the file does " . (FileExist(source) ? "" : "**not** ") . "exist.", 5) + _log.message("**compile**: Variable set, destination -> ``" . destination . "``, the file does " . (FileExist(destination) ? "" : "**not** ") . "exist.", 5) + _log.message("**compile**: Variable set, customIcon -> ``" . customIcon . "``, the file does " . (FileExist(customIcon) ? "" : "**not** ") . "exist.", 5) + _log.message("**compile**: Variable set, compiler -> ``" . compiler . "``, the file does " . (FileExist(compiler) ? "" : "**not** ") . "exist.", 5) + _log.message("**compile**: Variable set, useMpress -> ``" . useMpress . "``", 5) If (FileExist(source) && FileExist(compiler)) RunWait, %compiler% /in %source% /icon %customIcon% /mpress %useMpress% /out %destination% _log.message("Compiling the script to an executable finished.", 4) } +createCheatSheet(source, destDir, filename := "cheat_sheet", converter := "C:\Users\joten\AppData\Local\Pandoc\pandoc.exe") { + Global _log + + _log.message("**createCheatSheet**: Variable set, source -> ``" . source . "``, the file does " . (FileExist(source) ? "" : "**not** ") . "exist.", 5) + _log.message("**createCheatSheet**: Variable set, destDir -> ``" . destDir . "``, the file does " . (FileExist(destDir) ? "" : "**not** ") . "exist.", 5) + _log.message("**createCheatSheet**: Variable set, converter -> ``" . converter . "``, the file does " . (FileExist(converter) ? "" : "**not** ") . "exist.", 5) + If (FileExist(source) && FileExist(destDir) && FileExist(converter)) { + FileRead, md, %source% + If (ErrorLevel = 0) { + md := RegExReplace(md, "s)^## Default hotkeys\R\R.+\R\### Window management", "## bug.n default hotkeys`r`n`r`n### Window management") + md := StrReplace(md, "`r`n-------------------------------------------------------------------------------`r`n", "`r`n") + md := RegExReplace(md, "s)\R>.+?\R\R", "`r`n") + md := RegExReplace(md, "s)\R>.+?\R\R", "`r`n") + md := StrReplace(md, "``Config_hotkey=", "#### ") + md := RegExReplace(md, "::.+\R", "") + md := StrReplace(md, "#", "Win") + md := StrReplace(md, "!", "Alt") + md := StrReplace(md, "^", "Ctrl") + md := StrReplace(md, "+", "Shift") + md := StrReplace(md, "", "<n>") + FileDelete, %destDir%\%filename%.md + FileAppend, %md%, %destDir%\%filename%.md + } + RunWait, % converter . " -o " . destDir . "\" . filename . ".html -S --section-divs -c reset.css -c cheat_sheet.css " . destDir . "\" . filename . ".md" + } + _log.message("Creating the cheat sheet finished.", 4) +} + IntMin(int_1, int_2) { Return, int_1 < int_2 ? int_1 : int_2 }