changeset 16:070793dd21b2

imgupd: add new imgupd-themes(5) manual page
author David Demelier <markand@malikania.fr>
date Mon, 21 Dec 2020 23:38:09 +0100
parents f2ab199ac19b
children eabbceba24f2
files .hgignore CHANGES.md Makefile imgupd-themes.5.in imgupd.8.in
diffstat 5 files changed, 224 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Mon Dec 21 20:57:51 2020 +0100
+++ b/.hgignore	Mon Dec 21 23:38:09 2020 +0100
@@ -14,6 +14,7 @@
 \.o$
 
 # Executables.
+^imgupd-themes\.5$
 ^imgupd(\.8)?$
 ^imgupd-clean(\.8)?$
 ^imgup(\.1)?$
--- a/CHANGES.md	Mon Dec 21 20:57:51 2020 +0100
+++ b/CHANGES.md	Mon Dec 21 23:38:09 2020 +0100
@@ -5,7 +5,8 @@
 ----------------------
 
 - Rename the project from imgpaster to imgup,
-- Import a new theme based on mini.css.
+- Import a new theme based on mini.css,
+- Add imgupd-themes(5) manual page.
 
 imgup 0.1.0 2020-11-26
 ----------------------
--- a/Makefile	Mon Dec 21 20:57:51 2020 +0100
+++ b/Makefile	Mon Dec 21 23:38:09 2020 +0100
@@ -112,7 +112,7 @@
 
 imgupd-clean.o: imgupd-clean.8 ${CORE_LIB} ${SQLITE_LIB}
 
-imgupd.o: imgupd.8 ${CORE_LIB} ${SQLITE_LIB}
+imgupd.o: imgupd-themes.5 imgupd.8 ${CORE_LIB} ${SQLITE_LIB}
 
 imgup: imgup.sh imgup.1
 	cp imgup.sh imgup
@@ -121,7 +121,7 @@
 clean:
 	rm -f ${SQLITE_LIB} extern/sqlite3.o
 	rm -f ${CORE_LIB} ${CORE_OBJS} ${CORE_DEPS}
-	rm -f imgupd imgupd.d imgupd.o imgupd.8
+	rm -f imgupd imgupd.d imgupd.o imgupd-themes.5 imgupd.8
 	rm -f imgupd-clean imgupd-clean.d imgupd-clean.o imgupd-clean.8
 	rm -f imgup imgup.1
 	rm -f test.db ${TESTS_OBJS}
@@ -134,17 +134,19 @@
 
 install-imgupd:
 	mkdir -p ${DESTDIR}${BINDIR}
+	mkdir -p ${DESTDIR}${MANDIR}/man5
 	mkdir -p ${DESTDIR}${MANDIR}/man8
 	cp imgupd ${DESTDIR}${BINDIR}
 	cp imgupd-clean ${DESTDIR}${BINDIR}
 	mkdir -p ${DESTDIR}${SHAREDIR}/imgup
 	cp -R themes ${DESTDIR}${SHAREDIR}/imgup
+	cp imgupd-themes.5 ${DESTDIR}${MANDIR}/man5
 	cp imgupd.8 ${DESTDIR}${MANDIR}/man8
 	cp imgupd-clean.8 ${DESTDIR}${MANDIR}/man8
 
 install: install-imgupd install-imgup
 
-dist: clean
+dist:
 	mkdir -p imgup-${VERSION}
 	cp -R extern imgup-${VERSION}
 	cp -R themes imgup-${VERSION}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imgupd-themes.5.in	Mon Dec 21 23:38:09 2020 +0100
@@ -0,0 +1,214 @@
+.\"
+.\" Copyright (c) 2020 David Demelier <markand@malikania.fr>
+.\"
+.\" Permission to use, copy, modify, and/or distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd 25 November, 2020
+.Dt IMGUPD-THEMES 5
+.Os
+.\" NAME
+.Sh NAME
+.Nm imgupd-themes
+.Nd themes for imgupd
+.\" DESCRIPTION
+.Sh DESCRIPTION
+This manual page describe the file hierarchy and syntax required to create a new
+theme for
+.Nm imgupd .
+.Pp
+A theme consists of fragments and pages. A fragment is a piece of HTML code that
+may be repeated while a page is usually the HTML code that is inside the
+.Dq <body></body>
+HTML tag.
+.\" THEME STRUCTURE
+.Sh THEME STRUCTURE
+The easiest way to create a new theme is to copy the predefined
+.Pa minimal
+and adapt the files to the desired style. See it in
+@SHAREDIR@/imgup/themes/minimal.
+.Pp
+The following files must be provided into a directory:
+.Bd -literal -offset indent
+theme/fragments/duration.html
+theme/fragments/footer.html
+theme/fragments/header.html
+theme/fragments/image.html
+theme/pages/400.html
+theme/pages/404.html
+theme/pages/500.html
+theme/pages/image.html
+theme/pages/index.html
+theme/pages/new.html
+theme/pages/search.html
+.Ed
+.Pp
+See below for a description per file.
+.\" KEYWORDS
+.Sh KEYWORDS
+Templates files may contain keywords that are replaced during processing using
+the syntax
+.Dq @@variable@@ .
+.Pp
+The following keywords are supported:
+.Bl -tag -width 10n
+.It Va author
+The image author.
+.It Va date
+Date as a string.
+.It Va duration
+Duration expressed as a string. May be
+.Dq hour ,
+.Dq day ,
+.Dq week ,
+.Dq month .
+.It Va durations
+Fragment repeated for every duration supported using
+.Pa fragments/duration.html
+template.
+.It Va expiration
+The time left for the image expressed as minutes, hours or days depending on the
+time left.
+.It Va filename
+Original filename including its extension.
+.It Va id
+Unique image indentifier.
+.It Va images
+Fragment repeated for every image using
+.Pa fragments/image.html
+template.
+.It Va pastes
+Fragment repeated for every paste using
+.Pa fragments/paste.html
+template.
+.It Va public
+String set to
+.Dq Yes
+if public or
+.Dq "No"
+otherwise.
+.It Va title
+Image title.
+.El
+.\" PAGES AND FRAGMENTS
+.Sh PAGES AND FRAGMENTS
+.\" fragments/duration.html
+.Ss fragments/duration.html
+A fragment that should generate a
+.Dq <select>
+option for the given duration.
+.Pp
+Supported keywords:
+.Bl -bullet -compact
+.It
+.Va duration
+.El
+.\" fragments/footer.html
+.Ss fragments/footer.html
+Fragment applied at the end of a page.
+.\" fragments/header.html
+.Ss fragments/header.html
+Fragment applied at the beginning of a page.
+.\" fragments/image.html
+.Ss fragments/image.html
+Repeated fragment in the
+.Pa pages/index.html
+page.
+.Pp
+Supported keywords:
+.Bl -bullet -compact
+.It
+.Va id
+.It
+.Va title
+.It
+.Va author
+.It
+.Va date
+.It
+.Va expiration
+.El
+.Ss pages/400.html
+.Ss pages/404.html
+.Ss pages/500.html
+Those pages are used to indicate an error that are generated from
+.Nm imgupd .
+.Pp
+There are no keywords.
+.\" pages/index.html
+.Ss pages/index.html
+This page is the landing of the
+.Nm imgupd
+program. It should provide a list of last recents pastes.
+.Pp
+Supported keywords:
+.Bl -bullet -compact
+.It
+.Va pastes
+.El
+.\" pages/image.html
+.Ss pages/image.html
+Details of a image.
+.Pp
+Supported keywords:
+.Bl -bullet -compact
+.It
+.Va id
+.It
+.Va title
+.It
+.Va author
+.It
+.Va filename
+.It
+.Va date
+.It
+.Va visible
+.It
+.Va expiration
+.El
+.\" pages/new.html
+.Ss pages/new.html
+Create a form for uploading a new image. The form should submit a POST request
+to the same page with the following field data:
+.Pp
+.Bl -tag -width 10n
+.It Va title
+Image title.
+.It Va author
+Image author.
+.It Va duration
+Image duration (should use
+.Dq durations
+keyword).
+.It Va filename
+Path to the file to upload.
+.El
+.Pp
+Supported keywords:
+.Bl -bullet -compact
+.It
+.Va durations
+.El
+.\" pages/search.html
+.Ss pages/search.html
+Create a form for searching images. The form should submit a POST request to the
+same page with the following field data:
+.Bl -tag
+.It Va title
+Title to search
+.It Va author
+Author of image.
+.El
+.\" SEE ALSO
+.Sh SEE ALSO
+.Xr imgupd 8
--- a/imgupd.8.in	Mon Dec 21 20:57:51 2020 +0100
+++ b/imgupd.8.in	Mon Dec 21 23:38:09 2020 +0100
@@ -35,7 +35,7 @@
 one from a web form.
 .Pp
 It supports:
-.Bl -bullet -compat
+.Bl -bullet -compact
 .It
 Listing of recent images,
 .It
@@ -204,4 +204,5 @@
 .\" SEE ALSO
 .Sh SEE ALSO
 .Xr imgup 1 ,
+.Xr imgupd-themes 5 ,
 .Xr kfcgi 8