aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2022-02-19 20:07:32 -0300
committerEuAndreh <eu@euandre.org>2022-02-19 20:07:32 -0300
commit9f91c6ac59299519ad3abbae0e2511590511088d (patch)
tree2fd26a6d61f5a9d85a396ef0d76e85d015fb5234
parentMakefile: Include append $(NAME) to the definition of $(LIBEXECDIR) (diff)
downloadtd-9f91c6ac59299519ad3abbae0e2511590511088d.tar.gz
td-9f91c6ac59299519ad3abbae0e2511590511088d.tar.xz
src/td.in: Add -S option to dump suggested CSS
-rw-r--r--Makefile11
-rw-r--r--src/locale/HELP1.en.txt1
-rw-r--r--src/locale/USAGE.en.txt2
-rw-r--r--src/style.css76
-rwxr-xr-xsrc/td.in13
5 files changed, 97 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 8d57c45..336c6be 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,7 @@ LIBEXECDIR = $(PREFIX)/libexec/$(NAME)
SHAREDIR = $(PREFIX)/share
LOCALEDIR = $(SHAREDIR)/locale
MANDIR = $(SHAREDIR)/man
+DATADIR = $(SHAREDIR)/$(NAME)
.SUFFIXES:
@@ -23,6 +24,7 @@ MANDIR = $(SHAREDIR)/man
-e 's:@NAME@:$(NAME):g' \
-e 's:@LIBEXECDIR@:$(LIBEXECDIR):g' \
-e 's:@LOCALEDIR@:$(LOCALEDIR):g' \
+ -e 's:@DATADIR@:$(DATADIR):g' \
< $< > $@
if [ -x $< ]; then chmod +x $@; fi
@@ -91,7 +93,8 @@ install: all
mkdir -p \
$(DESTDIR)$(BINDIR) \
$(DESTDIR)$(LIBEXECDIR) \
- $(DESTDIR)$(LOCALEDIR)
+ $(DESTDIR)$(LOCALEDIR) \
+ $(DESTDIR)$(DATADIR)
cp src/$(NAME) $(DESTDIR)$(BINDIR)
cp src/locale/load-messages.sh $(DESTDIR)$(LIBEXECDIR)
for l in $(TRANSLATIONS) en $(CONTRIBLANGS); do \
@@ -100,12 +103,14 @@ install: all
src/locale/$$l.sh src/locale/*.$$l.txt \
$(DESTDIR)$(LOCALEDIR)/$$l/LC_MESSAGES/$(NAME); \
done
+ cp src/style.css $(DESTDIR)$(DATADIR)
sh doc/manpages.sh -ip $(DESTDIR)$(MANDIR) $(manpages)
uninstall:
rm -f \
- $(DESTDIR)$(BINDIR)/$(NAME) \
- $(DESTDIR)$(LIBEXECDIR)/load-messages.sh
+ $(DESTDIR)$(BINDIR)/$(NAME) \
+ $(DESTDIR)$(LIBEXECDIR)/load-messages.sh \
+ $(DESTDIR)$(DATADIR)/style.css
for l in $(TRANSLATIONS) en $(CONTRIBLANGS); do \
rm -f $(DESTDIR)$(LOCALEDIR)/$$l/LC_MESSAGES/$(NAME)/*; \
done
diff --git a/src/locale/HELP1.en.txt b/src/locale/HELP1.en.txt
index 6de6a0b..62173dd 100644
--- a/src/locale/HELP1.en.txt
+++ b/src/locale/HELP1.en.txt
@@ -9,6 +9,7 @@ Options:
-l list the supported values for $TD_USE_BUILTIN_HOOKS
-L lint the issues file
-H pre-process issues file before generating HTML
+ -S dump suggested CSS
-h, --help show this help message
-V, --version print the version number
diff --git a/src/locale/USAGE.en.txt b/src/locale/USAGE.en.txt
index f2e9a03..377741a 100644
--- a/src/locale/USAGE.en.txt
+++ b/src/locale/USAGE.en.txt
@@ -1,4 +1,4 @@
Usage:
td [-c] [-m MESSAGE] [-t TYPE] [-s STATE] [-F RC_FILE]
- td [-HlL]
+ td [-HSlL]
td [-hV]
diff --git a/src/style.css b/src/style.css
new file mode 100644
index 0000000..031aec8
--- /dev/null
+++ b/src/style.css
@@ -0,0 +1,76 @@
+body {
+ max-width: 800px;
+ margin: 0 auto 0 auto;
+}
+
+hr {
+ background-color: #ccc;
+}
+
+.header-anchor {
+ opacity: 0.5;
+ display: inline-block;
+}
+
+.tag {
+ font-family: monospace;
+ font-size: 70%;
+ background-color: lightgray;
+ color: black;
+ padding: 3px;
+ border-radius: 5px;
+}
+
+.TODO {
+ color: brown;
+}
+
+.DOING {
+ color: yellowgreen;
+}
+
+.WAITING, .MEETING {
+ color: orange;
+}
+
+.INACTIVE {
+ color: gray;
+}
+
+.NEXT {
+ color: red;
+}
+
+.CANCELLED, .DONE, .WONTFIX {
+ color: green;
+}
+
+pre, code {
+ background-color: #ddd;
+ border-radius: 5px;
+ padding: 5px;
+}
+
+pre > code {
+ overflow: auto;
+ white-space: pre;
+}
+
+@media(prefers-color-scheme: dark) {
+ :root {
+ color: white;
+ background-color: black;
+ }
+
+ a {
+ color: hsl(211, 100%, 60%);
+ }
+
+ a:visited {
+ color: hsl(242, 100%, 80%);
+ }
+
+ pre, code {
+ background-color: #222;
+ }
+}
diff --git a/src/td.in b/src/td.in
index c6a7e9f..c1ce0ff 100755
--- a/src/td.in
+++ b/src/td.in
@@ -10,7 +10,7 @@ add_msg() {
MSG_USAGE="$(cat <<-'EOF'
Usage:
@NAME@ [-c] [-m MESSAGE] [-t TYPE] [-s STATE] [-F RC_FILE]
- @NAME@ [-HlL]
+ @NAME@ [-HSlL]
@NAME@ [-hV]
EOF
)"
@@ -28,6 +28,7 @@ MSG_HELP1="$(cat <<-'EOF'
-l list the supported values for $TD_USE_BUILTIN_HOOKS
-L lint the issues file
-H pre-process issues file before generating HTML
+ -S dump suggested CSS
-h, --help show this help message
-V, --version print the version number
@@ -360,6 +361,10 @@ html_pre_process() {
html_process_ids
}
+dump_suggested_css() {
+ cat '@DATADIR@/style.css'
+}
+
#
@@ -482,7 +487,7 @@ for flag in "$@"; do
esac
done
-OPTIONS='cm:t:s:F:lLHhV'
+OPTIONS='cm:t:s:F:lLHShV'
RC_FILE="$PWD/.tdrc"
while getopts ":$OPTIONS" flag; do
@@ -548,6 +553,10 @@ while getopts "$OPTIONS" flag; do
html_pre_process < "$TD_FILE"
exit
;;
+ S)
+ dump_suggested_css
+ exit
+ ;;
h)
usage
help