From 0c44f4afd0c3ee568b7ddbc44fa92f5e89f79ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= Date: Mon, 27 Sep 2021 21:18:46 +0200 Subject: func: Add title generation and possibility to skip --- bin/func | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'bin') diff --git a/bin/func b/bin/func index eb3b489..793c722 100644 --- a/bin/func +++ b/bin/func @@ -171,11 +171,32 @@ __generate_index() { echo "" } +__generate_metadata() { + # 1: filename + # Generate metadata with title + local _title + local _show_title + + _show_title=$(__get_value "${1}" show_title || true) + + if [ "${_show_title}" = "" ]; then + _title=$(__get_value_title "${1}") + + cat <<-EOF +

+ ${_title} +

+ EOF + fi +} + __handle_md() { # 1: filename # Handle markdown files. __lowdown "${1}" > "${tmp_file}.body" + __generate_metadata "${1}" > "${tmp_file}.metadata" + if [ ! "$(__get_value ${1} index)" = "" ]; then __generate_index "${1}" > "${tmp_file}.index" else -- cgit v1.2.3