stagit

Personal Stagit Fork
commit 012e5fc960c924aca8d52c8b3a0e56ae618a2676
parent af747fbf9d6a7833144e70a3089c69f934dfd0c7
Author: maydayv7 <maydayv7@gmail.com>
Date:   Fri,  2 Jan 2026 22:11:14 +0530

feat: Use root `style.css`

Diffstat:
MMakefile | 17+++--------------
MREADME.md | 3+++
Mflake.nix | 2+-
Mstagit-index.1 | 2+-
Mstagit-index.c | 6++----
Mstagit.1 | 4++--
Mstagit.c | 6++----
Dstyle.css | 154-------------------------------------------------------------------------------
8 files changed, 14 insertions(+), 180 deletions(-)

diff --git a/Makefile b/Makefile @@ -30,9 +30,6 @@ COMPATSRC = \ BIN = \ stagit\ stagit-index -MAN1 = \ - stagit.1\ - stagit-index.1 DOC = \ LICENSE\ README @@ -56,8 +53,8 @@ all: ${BIN} dist: rm -rf ${NAME}-${VERSION} mkdir -p ${NAME}-${VERSION} - cp -f ${MAN1} ${HDR} ${SRC} ${COMPATSRC} ${DOC} \ - Makefile favicon.png style.css \ + cp -f ${HDR} ${SRC} ${COMPATSRC} ${DOC} \ + Makefile favicon.png \ example_create.sh example_post-receive.sh \ ${NAME}-${VERSION} # make tarball @@ -83,29 +80,21 @@ install: all for f in ${BIN}; do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done # installing example files. mkdir -p ${DESTDIR}${DOCPREFIX} - cp -f style.css\ - favicon.png\ + cp -f favicon.png\ example_create.sh\ example_post-receive.sh\ README\ ${DESTDIR}${DOCPREFIX} - # installing manual pages. - mkdir -p ${DESTDIR}${MANPREFIX}/man1 - cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1 - for m in ${MAN1}; do chmod 644 ${DESTDIR}${MANPREFIX}/man1/$$m; done uninstall: # removing executable files. for f in ${BIN}; do rm -f ${DESTDIR}${PREFIX}/bin/$$f; done # removing example files. rm -f \ - ${DESTDIR}${DOCPREFIX}/style.css\ ${DESTDIR}${DOCPREFIX}/favicon.png\ ${DESTDIR}${DOCPREFIX}/example_create.sh\ ${DESTDIR}${DOCPREFIX}/example_post-receive.sh\ ${DESTDIR}${DOCPREFIX}/README -rmdir ${DESTDIR}${DOCPREFIX} - # removing manual pages. - for m in ${MAN1}; do rm -f ${DESTDIR}${MANPREFIX}/man1/$$m; done .PHONY: all clean dist install uninstall diff --git a/README.md b/README.md @@ -8,6 +8,9 @@ It generates static HTML pages for a git repository. This is my personal fork of `stagit` +- Modified header +- Added `-n` flag to set `sitename` for header button +- Pages are now styled by the `style.css` present at root - Added [md4c](https://github.com/mity/md4c) to parse Markdown files - Added [Chroma](https://github.com/alecthomas/chroma) for code syntax highlighting diff --git a/flake.nix b/flake.nix @@ -35,7 +35,7 @@ mkdir -p $out/share/doc/stagit cp stagit $out/bin/ cp stagit-index $out/bin/ - cp style.css favicon.png $out/share/doc/stagit/ + cp favicon.png $out/share/doc/stagit/ wrapProgram $out/bin/stagit --prefix PATH : ${lib.makeBinPath [ chroma ]} ''; }; diff --git a/stagit-index.1 b/stagit-index.1 @@ -35,7 +35,7 @@ For changing the style of the page you can use the following files: .It favicon.png favicon image. .It style.css -CSS stylesheet. +Global CSS stylesheet (must be present at root). .El .Sh EXAMPLES .Bd -literal diff --git a/stagit-index.c b/stagit-index.c @@ -108,10 +108,8 @@ void writeheader(FILE *fp) { "</title>\n<link rel=\"icon\" type=\"image/png\" " "href=\"%sfavicon.png\" />\n", relpath); - fprintf( - fp, - "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\" />\n", - relpath); + fputs("<link rel=\"stylesheet\" type=\"text/css\" href=\"/style.css\" />\n", + fp); fputs("</head>\n<body>\n", fp); fputs("<header class=\"header\">\n", fp); diff --git a/stagit.1 b/stagit.1 @@ -106,8 +106,8 @@ For changing the style of the page you can use the following files: .Bl -tag -width Ds .It favicon.png favicon image. -.It style.css -CSS stylesheet. +.It /style.css +Global CSS stylesheet (must be present at root). .El .Sh EXIT STATUS .Ex -std diff --git a/stagit.c b/stagit.c @@ -519,10 +519,8 @@ void writeheader(FILE *fp, const char *title) { fputs("<link rel=\"alternate\" type=\"application/atom+xml\" title=\"", fp); xmlencode(fp, name, strlen(name)); fprintf(fp, " Atom Feed (tags)\" href=\"%stags.xml\" />\n", relpath); - fprintf( - fp, - "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\" />\n", - relpath); + fputs("<link rel=\"stylesheet\" type=\"text/css\" href=\"/style.css\" />\n", + fp); fputs("</head>\n<body>\n", fp); fputs("<header class=\"header\">\n", fp); diff --git a/style.css b/style.css @@ -1,154 +0,0 @@ -body { - color: #000; - background-color: #fff; - font-family: monospace; -} - -h1, h2, h3, h4, h5, h6 { - font-size: 1em; - margin: 0; -} - -img, h1, h2 { - vertical-align: middle; -} - -img { - border: 0; -} - -a:target { - background-color: #ccc; -} - -a.d, -a.h, -a.i, -a.line { - text-decoration: none; -} - -#blob a { - color: #555; -} - -#blob a:hover { - color: blue; - text-decoration: none; -} - -table thead td { - font-weight: bold; -} - -table td { - padding: 0 0.4em; -} - -#content table td { - vertical-align: top; - white-space: nowrap; -} - -#branches tr:hover td, -#tags tr:hover td, -#index tr:hover td, -#log tr:hover td, -#files tr:hover td { - background-color: #eee; -} - -#index tr td:nth-child(2), -#tags tr td:nth-child(3), -#branches tr td:nth-child(3), -#log tr td:nth-child(2) { - white-space: normal; -} - -td.num { - text-align: right; -} - -.desc { - color: #555; -} - -hr { - border: 0; - border-top: 1px solid #555; - height: 1px; -} - -pre { - font-family: monospace; -} - -pre a.h { - color: #00a; -} - -.A, -span.i, -pre a.i { - color: #070; -} - -.D, -span.d, -pre a.d { - color: #e00; -} - -pre a.h:hover, -pre a.i:hover, -pre a.d:hover { - text-decoration: none; -} - -@media (prefers-color-scheme: dark) { - body { - background-color: #000; - color: #bdbdbd; - } - hr { - border-color: #222; - } - a { - color: #56c8ff; - } - a:target { - background-color: #222; - } - .desc { - color: #aaa; - } - #blob a { - color: #555; - } - #blob a:target { - color: #eee; - } - #blob a:hover { - color: #56c8ff; - } - pre a.h { - color: #00cdcd; - } - .A, - span.i, - pre a.i { - color: #00cd00; - } - .D, - span.d, - pre a.d { - color: #cd0000; - } - #branches tr:hover td, - #tags tr:hover td, - #index tr:hover td, - #log tr:hover td, - #files tr:hover td { - background-color: #111; - } -}