чување 788b45f7ff6d74dbbe2fe137838dacbef8bae703
родитељ a929ede87178108513dede0267f453b482d2d1b2
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Mon, 25 Jan 2021 12:46:17 +0100
process_git_log: Warning instead of error when git not present; process_formula: Use katex -d switch, output dollar signs with formula if katex not present
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 3, додавања: 13(+), брисања: 9(-)
diff --git a/README b/README
@@ -9,10 +9,11 @@ transforms custom Markdown-like syntax into HTML.
Prerequisites
-------------
-Aside from the obvious (GCC), slweb requires realpath(1) to determine paths in
-local links and groff(1) and gzip(1) to create and compress documentation.
-git(1) is, aside from cloning the repository, required to use the directive
-{git-log}.
+Aside from the obvious (a C compiler, by default GNU C), slweb requires
+realpath(1) to determine paths in local links and groff(1) and gzip(1) to create
+and compress documentation. git(1) is, aside from cloning the repository,
+required to use the directive {git-log}. KaTeX (https://katex.org) is optionally
+used for math mode.
Install
diff --git a/index.html b/index.html
@@ -136,7 +136,7 @@ this program. If not, see <<a href="https://www.gnu.org/licenses">https://www
<div id="git-log">
Previous commit:
-index.slw 90fe7e2 2021-01-25 06:59:09 +0100 (Страхиња Радић) (HEAD -> master, origin/master, origin/HEAD)
+index.slw a929ede 2021-01-25 07:01:26 +0100 (Страхиња Радић) (HEAD -> master, origin/master, origin/HEAD)
</div><!--git-log-->
diff --git a/slweb.c b/slweb.c
@@ -368,7 +368,7 @@ process_git_log(FILE* output)
if (print_command(command, output, FALSE))
{
print_output(output, "</div><!--git-log-->\n");
- return error(1, (uint8_t*)"git-log: Cannot run git");
+ return warning(1, (uint8_t*)"git-log: Cannot run git");
}
print_output(output, "</div><!--git-log-->\n");
@@ -1468,13 +1468,16 @@ process_formula(FILE* output, uint8_t* token, BOOL display_formula)
int result = 0;
CALLOC(command, uint8_t, BUFSIZE)
- u8_snprintf(command, BUFSIZE-1, "katex <<<'%s%s'",
- display_formula ? "\\displaystyle " : "",
+ u8_snprintf(command, BUFSIZE-1, "katex %s<<<'%s'",
+ display_formula ? "-d " : "",
token);
result = print_command(command, output, TRUE);
if (result)
- print_output(output, "%s", token);
+ print_output(output, "%s$%s$%s",
+ display_formula ? "$" : "",
+ token,
+ display_formula ? "$" : "");
free(command);
return result;