]> git.armaanb.net Git - stagit.git/commitdiff
Use /usr/local/share
authorArmaan Bhojwani <me@armaanb.net>
Mon, 8 Mar 2021 14:11:20 +0000 (09:11 -0500)
committerArmaan Bhojwani <me@armaanb.net>
Mon, 8 Mar 2021 14:11:51 +0000 (09:11 -0500)
Makefile
highlight.py
requirements.txt
stagit.c

index 905d3bd3e5fd397e7c5b3bb7f9b29aa06354982a..c0acb10b336b514285236603f3f6e618b1fc68fe 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,7 @@ VERSION = 0.9.3
 PREFIX = /usr/local
 MANPREFIX = ${PREFIX}/man
 DOCPREFIX = ${PREFIX}/share/doc/${NAME}
 PREFIX = /usr/local
 MANPREFIX = ${PREFIX}/man
 DOCPREFIX = ${PREFIX}/share/doc/${NAME}
+SHAREPREFIX = ${PREFIX}/share/${NAME}
 
 LIBGIT_INC = -I/usr/local/include
 LIBGIT_LIB = -L/usr/local/lib -lgit2
 
 LIBGIT_INC = -I/usr/local/include
 LIBGIT_LIB = -L/usr/local/lib -lgit2
@@ -80,15 +81,17 @@ install: all
        for f in ${BIN}; do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done
        # installing example files.
        mkdir -p ${DESTDIR}${DOCPREFIX}
        for f in ${BIN}; do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done
        # installing example files.
        mkdir -p ${DESTDIR}${DOCPREFIX}
-       cp -f style.min.css\
-               syntax.css\
-               favicon.png\
+       cp -f favicon.png\
                logo.png\
                example_create.sh\
                example_post-receive.sh\
                README\
                logo.png\
                example_create.sh\
                example_post-receive.sh\
                README\
-               highlight.py\
                ${DESTDIR}${DOCPREFIX}
                ${DESTDIR}${DOCPREFIX}
+       mkdir -p ${DESTDIR}${SHAREPREFIX}
+       cp -f style.min.css\
+               syntax.css\
+               highlight.py\
+               ${DESTDIR}${SHAREPREFIX}
        # installing manual pages.
        mkdir -p ${DESTDIR}${MANPREFIX}/man1
        cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1
        # installing manual pages.
        mkdir -p ${DESTDIR}${MANPREFIX}/man1
        cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1
@@ -99,9 +102,9 @@ uninstall:
        for f in ${BIN}; do rm -f ${DESTDIR}${PREFIX}/bin/$$f; done
        # removing example files.
        rm -f \
        for f in ${BIN}; do rm -f ${DESTDIR}${PREFIX}/bin/$$f; done
        # removing example files.
        rm -f \
-               ${DESTDIR}${DOCPREFIX}/style.min.css\
-               ${DESTDIR}${DOCPREFIX}/syntax.css\
-               ${DESTDIR}${DOCPREFIX}/highlight.py\
+               ${DESTDIR}${SHAREPREFIX}/style.min.css\
+               ${DESTDIR}${SHAREPREFIX}/syntax.css\
+               ${DESTDIR}${SHAREPREFIX}/highlight.py\
                ${DESTDIR}${DOCPREFIX}/favicon.png\
                ${DESTDIR}${DOCPREFIX}/logo.png\
                ${DESTDIR}${DOCPREFIX}/example_create.sh\
                ${DESTDIR}${DOCPREFIX}/favicon.png\
                ${DESTDIR}${DOCPREFIX}/logo.png\
                ${DESTDIR}${DOCPREFIX}/example_create.sh\
index eb146e7849033bd475f2eff7bd46fbbd0b8dbfb1..2b81d8cee6538cdbec506abee73f9220d590fca3 100755 (executable)
@@ -46,14 +46,15 @@ formatter = HtmlFormatter(
     anchorlinenos=True,
 )
 
     anchorlinenos=True,
 )
 
+outp = ""
 if rendered:
 if rendered:
-    print('<article class="markup markdown">')
-    print(rendered)
-    print("</article>")
-print('<div id="blob">')
-print(highlight(contents, lexer, formatter))
-print("</div>")
-print('<link rel="stylesheet" href="/syntax.css"')
+    outp += '<article class="markup markdown">'
+    outp += rendered
+    outp += "</article>"
+outp += f'<div id="blob">{highlight(contents, lexer, formatter)}</div>"'
+outp += '<link rel="stylesheet" href="/syntax.css"'
+
+print(outp)
 
 print(f"Filename: {filename}; Lexer: {lexer}.", file=stderr)
 
 
 print(f"Filename: {filename}; Lexer: {lexer}.", file=stderr)
 
index 9fda546a7b1c926c7e98d59a799aba2793184d48..3d78ab3c0fc862b731d9bf480c1360757c118db0 100644 (file)
@@ -1,4 +1,3 @@
 Pygments
 markdown
 pymdown-extensions
 Pygments
 markdown
 pymdown-extensions
-
index daa81fc67d36c1f54909aefea1024c0aa710c3b8..264604eb4fffd984ff7ef47993e7ff0d4b44de84 100644 (file)
--- a/stagit.c
+++ b/stagit.c
@@ -418,7 +418,7 @@ writefooter(FILE *fp)
 }
 
 int
 }
 
 int
-syntax_highlight(const char *filename, FILE *fp, const char *s, size_t len)
+call_py(const char *filename, FILE *fp, const char *s, size_t len)
 {
        // Flush HTML-file
        fflush(fp);
 {
        // Flush HTML-file
        fflush(fp);
@@ -428,7 +428,7 @@ syntax_highlight(const char *filename, FILE *fp, const char *s, size_t len)
        dup2(fileno(fp), 1);
 
        // Python Pygments script for syntax highlighting.
        dup2(fileno(fp), 1);
 
        // Python Pygments script for syntax highlighting.
-       FILE *child = popen("/usr/local/share/doc/stagit/highlight.py", "w");
+       FILE *child = popen("/usr/local/share/stagit/highlight.py", "w");
        if (child == NULL) {
                printf("child is null: %s", strerror(errno));
                exit(1);
        if (child == NULL) {
                printf("child is null: %s", strerror(errno));
                exit(1);
@@ -458,7 +458,7 @@ writeblobhtml(const char *filename, FILE *fp, const git_blob *blob)
        git_off_t len = git_blob_rawsize(blob);
 
        if (len > 0) {
        git_off_t len = git_blob_rawsize(blob);
 
        if (len > 0) {
-               lc = syntax_highlight(filename, fp, s, len);
+               lc = call_py(filename, fp, s, len);
        }
 
        return lc;
        }
 
        return lc;
@@ -1171,9 +1171,9 @@ main(int argc, char *argv[])
        /* copy css */
        char cwd[PATH_MAX];
        strcpy(cwd, getcwd(cwd, sizeof(cwd)));
        /* copy css */
        char cwd[PATH_MAX];
        strcpy(cwd, getcwd(cwd, sizeof(cwd)));
-       cp("/usr/local/share/doc/stagit/syntax.css", strcat(cwd, "/syntax.css"));
+       cp("/usr/local/share/stagit/syntax.css", strcat(cwd, "/syntax.css"));
        strcpy(cwd, getcwd(cwd, sizeof(cwd)));
        strcpy(cwd, getcwd(cwd, sizeof(cwd)));
-       cp("/usr/local/share/doc/stagit/style.min.css", strcat(cwd, "/style.min.css"));
+       cp("/usr/local/share/stagit/style.min.css", strcat(cwd, "/style.min.css"));
 
        /* strip .git suffix */
        if (!(strippedname = strdup(name)))
 
        /* strip .git suffix */
        if (!(strippedname = strdup(name)))