build: Improve author identification and formatting.

Allow email address appended to name in order to create a more unique identifier. The email portion is stripped during conversion from Markdown to HTML. Authors may now use the following format in replace of a simple name, if desired: Jane Doe <jane@example.com>

The list of authors is now automatically pretty printed: Jane Doe, John Doe, and Other Doe
This commit is contained in:
Bradley Sepos 2016-04-11 12:05:43 -04:00
parent 0968cc09e1
commit 2c9e88dae1

View File

@ -80,6 +80,13 @@ function build_source {
eval $(parse_yaml "${DEST}.yaml" "DOCUMENT_")
fi
# process authors
DOCUMENT_Authors=$(echo "${DOCUMENT_Authors}" | sed -e 's/,[^ ]/, /g' -e 's/[ ]*<[^,]*>//g' -e 's/\(.*\), /\1, and /')
DELIM_NUM=$(grep -o ',' <<< "${DOCUMENT_Authors}" | wc -l)
if [[ "${DELIM_NUM}" -eq 1 ]]; then
DOCUMENT_Authors=$(echo "${DOCUMENT_Authors}" | sed -e 's/,//')
fi
# preprocess markdown to add implicit figures
sed -E \
-e 's|^!\[(.+)]\([ ]*(.+)[ ]*"(.+)"[ ]*\)$|<figure><a href="\2"><img src="\2" alt="\1" /></a><figcaption>\3</figcaption></figure>|' \