From d44e7f620f4970ab72bd7979cd8751857f683915 Mon Sep 17 00:00:00 2001 From: Louie S Date: Fri, 15 Sep 2023 10:11:41 -0400 Subject: Improve design, fix guide names for info-reader target --- src/index-page.sh | 12 ++++-------- src/info-reader/get_title | 8 ++++++++ src/texinfo/get_title | 8 ++++++++ 3 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 src/info-reader/get_title create mode 100644 src/texinfo/get_title (limited to 'src') diff --git a/src/index-page.sh b/src/index-page.sh index ef398af..becfd48 100755 --- a/src/index-page.sh +++ b/src/index-page.sh @@ -5,17 +5,13 @@ # shellcheck source=./lib/insert . "$(dirname "$0")"/lib/insert -DB_PATH="$1" +CALLER="$1" shift -get_title() { - FILE="$1" +. "$(dirname "$0")"/"$CALLER"/get_title - pup -p -f "$FILE" 'title text{}' | \ - tr -d \\n | \ - sed 's/ (GNU[^)]*)$//' | \ - sed 's/\"/\"\"/g' -} +DB_PATH="$1" +shift insert_pages() { # Get title and insert into table for each html file diff --git a/src/info-reader/get_title b/src/info-reader/get_title new file mode 100644 index 0000000..b09c385 --- /dev/null +++ b/src/info-reader/get_title @@ -0,0 +1,8 @@ +get_title() { + FILE="$1" + + pup -p -f "$FILE" 'title text{}' | \ + tr -d \\n | \ + sed 's/ ([^)]*GNU[^)]*)$//' | \ + sed 's/\"/\"\"/g' +} diff --git a/src/texinfo/get_title b/src/texinfo/get_title new file mode 100644 index 0000000..b501501 --- /dev/null +++ b/src/texinfo/get_title @@ -0,0 +1,8 @@ +get_title() { + FILE="$1" + + pup -p -f "$FILE" 'title text{}' | \ + tr -d \\n | \ + sed 's/ (GNU[^)]*)$//' | \ + sed 's/\"/\"\"/g' +} -- cgit