Added creating a cheat sheet to the build process

This commit is contained in:
joten 2018-01-13 22:19:16 +01:00
parent b3226c8539
commit 6e6b889381
2 changed files with 46 additions and 15 deletions

View file

@ -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; }

View file

@ -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=", "#### <kbd>")
md := RegExReplace(md, "::.+\R", "</kbd>")
md := StrReplace(md, "<kbd>#", "<kbd>Win</kbd><kbd>")
md := StrReplace(md, "<kbd>!", "<kbd>Alt</kbd><kbd>")
md := StrReplace(md, "<kbd>^", "<kbd>Ctrl</kbd><kbd>")
md := StrReplace(md, "<kbd>+", "<kbd>Shift</kbd><kbd>")
md := StrReplace(md, "<n>", "&lt;n&gt;")
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
}