Support for sub-pages, and metadata powered markdown files.
This commit is contained in:
parent
eff7646d6b
commit
c15e6400df
83
build.sh
83
build.sh
|
@ -26,7 +26,15 @@ pagedump()
|
||||||
# always check for markdown first
|
# always check for markdown first
|
||||||
if [ -f "$1.md" ]
|
if [ -f "$1.md" ]
|
||||||
then
|
then
|
||||||
pandoc -t html -f markdown "$1.md"
|
|
||||||
|
# always check for markdown first
|
||||||
|
if [ -f "$1.yaml" ]
|
||||||
|
then
|
||||||
|
pandoc -t markdown --metadata-file "$1.yaml" --template "$1.md" | pandoc -t html
|
||||||
|
else
|
||||||
|
pandoc -t html -f markdown "$1.md"
|
||||||
|
fi
|
||||||
|
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -166,7 +174,7 @@ make_news_header()
|
||||||
echo "</table>" >> "$2"
|
echo "</table>" >> "$2"
|
||||||
}
|
}
|
||||||
|
|
||||||
# arguments: site, page side, page, title
|
# arguments: site, page side, page, title, sub-page
|
||||||
site_button()
|
site_button()
|
||||||
{
|
{
|
||||||
if [ "$2" = "news" ]
|
if [ "$2" = "news" ]
|
||||||
|
@ -179,7 +187,13 @@ site_button()
|
||||||
BTN_NAME="$3"
|
BTN_NAME="$3"
|
||||||
BTN_PAGE="$3"
|
BTN_PAGE="$3"
|
||||||
fi
|
fi
|
||||||
BTN_OUT="_pb_$BTN_NAME"
|
|
||||||
|
if [ "$5" = "" ]
|
||||||
|
then
|
||||||
|
BTN_OUT="_pb_$BTN_NAME"
|
||||||
|
else
|
||||||
|
BTN_OUT="_pb_$5_$BTN_NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -f "$BTN_SEARCHPATH/$BTN_NAME.gif" ]
|
if [ -f "$BTN_SEARCHPATH/$BTN_NAME.gif" ]
|
||||||
then
|
then
|
||||||
|
@ -202,7 +216,12 @@ site_button()
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "<a href=\"$BTN_PAGE.html\">• $4</a><br>"
|
if [ "$5" = "" ]
|
||||||
|
then
|
||||||
|
echo "<a href=\"$BTN_PAGE.html\"> $4</a><br>"
|
||||||
|
else
|
||||||
|
echo "<a href=\"$5_$BTN_PAGE.html\">• $4</a><br>"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# arguments: site-name (folder inside ./sites)
|
# arguments: site-name (folder inside ./sites)
|
||||||
|
@ -235,7 +254,7 @@ site_process()
|
||||||
# enumerate and list the right-aligned pages
|
# enumerate and list the right-aligned pages
|
||||||
if [ -d "./sites/$1/pages_right" ]
|
if [ -d "./sites/$1/pages_right" ]
|
||||||
then
|
then
|
||||||
find ./sites/$1/pages_right -name title | sort | while read LINE
|
find ./sites/$1/pages_right -maxdepth 2 -name title | sort | while read LINE
|
||||||
do
|
do
|
||||||
DIR=$(dirname "$LINE")
|
DIR=$(dirname "$LINE")
|
||||||
ID_NAME=$(basename "$DIR")
|
ID_NAME=$(basename "$DIR")
|
||||||
|
@ -247,14 +266,22 @@ site_process()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
site_button "$1" "pages_right" "$ID_NAME" "$TITLE" >> "$TMP_PAGES_R"
|
site_button "$1" "pages_right" "$ID_NAME" "$TITLE" >> "$TMP_PAGES_R"
|
||||||
#echo "<a href=\"$ID_NAME.html\">• $TITLE</a><br>" >> "$TMP_PAGES_R"
|
|
||||||
|
# a page may have sub-pages
|
||||||
|
find "./sites/$1/pages_right/$ID_NAME/" -mindepth 2 -maxdepth 2 -name title | sort | while read SUBLINE
|
||||||
|
do
|
||||||
|
SUBDIR=$(dirname "$SUBLINE")
|
||||||
|
SUBID_NAME=$(basename "$SUBDIR")
|
||||||
|
SUBTITLE=$(cat "$SUBDIR/title")
|
||||||
|
site_button "$1" "pages_right/$ID_NAME" "$SUBID_NAME" "$SUBTITLE" "$ID_NAME" >> "$TMP_PAGES_L"
|
||||||
|
done
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# enumerate and list the left-aligned pages
|
# enumerate and list the left-aligned pages
|
||||||
if [ -d "./sites/$1/pages_left" ]
|
if [ -d "./sites/$1/pages_left" ]
|
||||||
then
|
then
|
||||||
find ./sites/$1/pages_left -name title | sort | while read LINE
|
find ./sites/$1/pages_left -maxdepth 2 -name title | sort | while read LINE
|
||||||
do
|
do
|
||||||
DIR=$(dirname "$LINE")
|
DIR=$(dirname "$LINE")
|
||||||
ID_NAME=$(basename "$DIR")
|
ID_NAME=$(basename "$DIR")
|
||||||
|
@ -266,7 +293,15 @@ site_process()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
site_button "$1" "pages_left" "$ID_NAME" "$TITLE" >> "$TMP_PAGES_L"
|
site_button "$1" "pages_left" "$ID_NAME" "$TITLE" >> "$TMP_PAGES_L"
|
||||||
#echo "<a href=\"$ID_NAME.html\">• $TITLE</a><br>" >> "$TMP_PAGES_L"
|
|
||||||
|
# a page may have sub-pages
|
||||||
|
find "./sites/$1/pages_left/$ID_NAME/" -mindepth 2 -maxdepth 2 -name title | sort | while read SUBLINE
|
||||||
|
do
|
||||||
|
SUBDIR=$(dirname "$SUBLINE")
|
||||||
|
SUBID_NAME=$(basename "$SUBDIR")
|
||||||
|
SUBTITLE=$(cat "$SUBDIR/title")
|
||||||
|
site_button "$1" "pages_left/$ID_NAME" "$SUBID_NAME" "$SUBTITLE" "$ID_NAME" >> "$TMP_PAGES_L"
|
||||||
|
done
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -292,7 +327,7 @@ site_process()
|
||||||
# build right-aligned pages
|
# build right-aligned pages
|
||||||
if [ -d "./sites/$1/pages_right" ]
|
if [ -d "./sites/$1/pages_right" ]
|
||||||
then
|
then
|
||||||
find ./sites/$1/pages_right -name title | sort | while read LINE
|
find ./sites/$1/pages_right -maxdepth 2 -name title | sort | while read LINE
|
||||||
do
|
do
|
||||||
DIR=$(dirname "$LINE")
|
DIR=$(dirname "$LINE")
|
||||||
ID_NAME=$(basename "$DIR")
|
ID_NAME=$(basename "$DIR")
|
||||||
|
@ -303,13 +338,27 @@ site_process()
|
||||||
html_start "$OUTFILE" "$TITLE" "$1"
|
html_start "$OUTFILE" "$TITLE" "$1"
|
||||||
pagedump "$DIR/content" >> "$OUTFILE"
|
pagedump "$DIR/content" >> "$OUTFILE"
|
||||||
html_end "$OUTFILE" "$1"
|
html_end "$OUTFILE" "$1"
|
||||||
|
|
||||||
|
# handle sub-pages
|
||||||
|
find "./sites/$1/pages_right/$ID_NAME/" -mindepth 2 -maxdepth 2 -name title | sort | while read SUBLINE
|
||||||
|
do
|
||||||
|
SUBDIR=$(dirname "$SUBLINE")
|
||||||
|
SUBID_NAME=$(basename "$SUBDIR")
|
||||||
|
SUBTITLE=$(cat "$SUBDIR/title")
|
||||||
|
SUBOUTFILE="./out/$1/${ID_NAME}_${SUBID_NAME}.html"
|
||||||
|
|
||||||
|
# generate the individual news page
|
||||||
|
html_start "$SUBOUTFILE" "$TITLE - $SUBTITLE" "$1"
|
||||||
|
pagedump "$SUBDIR/content" >> "$SUBOUTFILE"
|
||||||
|
html_end "$SUBOUTFILE" "$1"
|
||||||
|
done
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build left-aligned pages
|
# Build left-aligned pages
|
||||||
if [ -d "./sites/$1/pages_left" ]
|
if [ -d "./sites/$1/pages_left" ]
|
||||||
then
|
then
|
||||||
find ./sites/$1/pages_left -name title | sort | while read LINE
|
find ./sites/$1/pages_left -maxdepth 2 -name title | sort | while read LINE
|
||||||
do
|
do
|
||||||
DIR=$(dirname "$LINE")
|
DIR=$(dirname "$LINE")
|
||||||
ID_NAME=$(basename "$DIR")
|
ID_NAME=$(basename "$DIR")
|
||||||
|
@ -320,6 +369,20 @@ site_process()
|
||||||
html_start "$OUTFILE" "$TITLE" "$1"
|
html_start "$OUTFILE" "$TITLE" "$1"
|
||||||
pagedump "$DIR/content" >> "$OUTFILE"
|
pagedump "$DIR/content" >> "$OUTFILE"
|
||||||
html_end "$OUTFILE" "$1"
|
html_end "$OUTFILE" "$1"
|
||||||
|
|
||||||
|
# handle sub-pages
|
||||||
|
find "./sites/$1/pages_left/$ID_NAME/" -mindepth 2 -maxdepth 2 -name title | sort | while read SUBLINE
|
||||||
|
do
|
||||||
|
SUBDIR=$(dirname "$SUBLINE")
|
||||||
|
SUBID_NAME=$(basename "$SUBDIR")
|
||||||
|
SUBTITLE=$(cat "$SUBDIR/title")
|
||||||
|
SUBOUTFILE="./out/$1/${ID_NAME}_${SUBID_NAME}.html"
|
||||||
|
|
||||||
|
# generate the individual news page
|
||||||
|
html_start "$SUBOUTFILE" "$TITLE - $SUBTITLE" "$1"
|
||||||
|
pagedump "$SUBDIR/content" >> "$SUBOUTFILE"
|
||||||
|
html_end "$SUBOUTFILE" "$1"
|
||||||
|
done
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
14
readme.txt
14
readme.txt
|
@ -51,6 +51,20 @@ file inside your page directory. Name it the same thing as your page.
|
||||||
Same can be done for the 'News' button, just name it 'news' and place it
|
Same can be done for the 'News' button, just name it 'news' and place it
|
||||||
inside the `./sites/???/news/` directory with the file format of your choosing.
|
inside the `./sites/???/news/` directory with the file format of your choosing.
|
||||||
|
|
||||||
|
# Sub-pages
|
||||||
|
|
||||||
|
Pages can have sub-pages. Simply have another page-styled directory within
|
||||||
|
a page directory. For example, `./sites/???/pages_left/games/files/` containing both
|
||||||
|
a `title` and a `content.md` file.
|
||||||
|
|
||||||
|
# Metadata within pages
|
||||||
|
|
||||||
|
You can use metadata within Markdown pages. If your `content.md` has a `content.yaml` file
|
||||||
|
alongside it, it will be used within the page accordingly. Please see this page for detailed
|
||||||
|
information:
|
||||||
|
|
||||||
|
https://pandoc.org/MANUAL.html#extension-yaml_metadata_block
|
||||||
|
|
||||||
# LICENSE
|
# LICENSE
|
||||||
|
|
||||||
Licensed under the ISC license. Everything in here was written by
|
Licensed under the ISC license. Everything in here was written by
|
||||||
|
|
Loading…
Reference in New Issue