mirror of
https://github.com/HandBrake/HandBrake-docs.git
synced 2025-12-15 14:05:26 -06:00
build: Fix sed params on linux.
This commit is contained in:
parent
cedcf6f493
commit
b13b886daa
48
build-docs
48
build-docs
@ -80,7 +80,7 @@ function build_source {
|
|||||||
# preprocess markdown to add implicit figures
|
# preprocess markdown to add implicit figures
|
||||||
sed -E \
|
sed -E \
|
||||||
-e 's|^!\[(.+)]\([ ]*(.+)[ ]*"(.+)"[ ]*\)$|<figure><a href="\2"><img src="\2" alt="\1" /></a><figcaption>\3</figcaption></figure>|' \
|
-e 's|^!\[(.+)]\([ ]*(.+)[ ]*"(.+)"[ ]*\)$|<figure><a href="\2"><img src="\2" alt="\1" /></a><figcaption>\3</figcaption></figure>|' \
|
||||||
-i .sedbak "${SOURCE}"
|
-i.sedbak "${SOURCE}"
|
||||||
# convert preprocessed markdown document to html
|
# convert preprocessed markdown document to html
|
||||||
"${MARKDOWN}" -fdlextra -ffencedcode -ffootnote -fgithubtags "${SOURCE}" > "${DOCUMENT_Content}"
|
"${MARKDOWN}" -fdlextra -ffencedcode -ffootnote -fgithubtags "${SOURCE}" > "${DOCUMENT_Content}"
|
||||||
# copy main template
|
# copy main template
|
||||||
@ -92,38 +92,38 @@ function build_source {
|
|||||||
# omit header and footer templates from license documents
|
# omit header and footer templates from license documents
|
||||||
if [[ "${DEST_NAME}" == "license" ]] || [[ "${DEST_NAME}" == "license-summary" ]]; then
|
if [[ "${DEST_NAME}" == "license" ]] || [[ "${DEST_NAME}" == "license-summary" ]]; then
|
||||||
sed -E \
|
sed -E \
|
||||||
-e 's|{{[ ]*template\.header[ ]*}}||g' \
|
-e 's|\{\{[ ]*template\.header[ ]*\}\}||g' \
|
||||||
-e 's|{{[ ]*template\.footer[ ]*}}||g' \
|
-e 's|\{\{[ ]*template\.footer[ ]*\}\}||g' \
|
||||||
-i .sedbak "${DEST}.html"
|
-i.sedbak "${DEST}.html"
|
||||||
fi
|
fi
|
||||||
# inject header, content, footer
|
# inject header, content, footer
|
||||||
sed -E \
|
sed -E \
|
||||||
-e '/{{[ ]*template\.header[ ]*}}/r '"${TEMPLATE_Header}"'' -e '/{{[ ]*template\.header[ ]*}}/d' \
|
-e '/\{\{[ ]*template\.header[ ]*\}\}/{r '"${TEMPLATE_Header}" -e 'd;}' \
|
||||||
-e '/{{[ ]*document\.content[ ]*}}/r '"${DOCUMENT_Content}"'' -e '/{{[ ]*document\.content[ ]*}}/d' \
|
-e '/\{\{[ ]*document\.content[ ]*\}\}/{r '"${DOCUMENT_Content}" -e 'd;}' \
|
||||||
-e '/{{[ ]*template\.footer[ ]*}}/r '"${TEMPLATE_Footer}"'' -e '/{{[ ]*template\.footer[ ]*}}/d' \
|
-e '/\{\{[ ]*template\.footer[ ]*\}\}/{r '"${TEMPLATE_Footer}" -e 'd;}' \
|
||||||
-i .sedbak "${DEST}.html"
|
-i.sedbak "${DEST}.html"
|
||||||
# process custom tags
|
# process custom tags
|
||||||
sed -E \
|
sed -E \
|
||||||
-e 's|{{[ ]*document\.title[ ]*}}|'"${DOCUMENT_Title:-}"'|g' \
|
-e 's|\{\{[ ]*document\.title[ ]*\}\}|'"${DOCUMENT_Title:-}"'|g' \
|
||||||
-e 's|{{[ ]*document\.project[ ]*}}|'"${DOCUMENT_Project:-}"'|g' \
|
-e 's|\{\{[ ]*document\.project[ ]*\}\}|'"${DOCUMENT_Project:-}"'|g' \
|
||||||
-e 's|{{[ ]*document\.project-url[ ]*}}|'"${DOCUMENT_Project_URL:-}"'|g' \
|
-e 's|\{\{[ ]*document\.project-url[ ]*\}\}|'"${DOCUMENT_Project_URL:-}"'|g' \
|
||||||
-e 's|{{[ ]*document\.project-version[ ]*}}|'"${DOCUMENT_Project_Version:-}"'|g' \
|
-e 's|\{\{[ ]*document\.project-version[ ]*\}\}|'"${DOCUMENT_Project_Version:-}"'|g' \
|
||||||
-e 's|{{[ ]*document\.language[ ]*}}|'"${DOCUMENT_Language:-}"'|g' \
|
-e 's|\{\{[ ]*document\.language[ ]*\}\}|'"${DOCUMENT_Language:-}"'|g' \
|
||||||
-e 's|{{[ ]*document\.language-code[ ]*}}|'"${DOCUMENT_Language_Code:-}"'|g' \
|
-e 's|\{\{[ ]*document\.language-code[ ]*\}\}|'"${DOCUMENT_Language_Code:-}"'|g' \
|
||||||
-e 's|{{[ ]*document\.text-encoding[ ]*}}|'"${DOCUMENT_Text_Encoding:-}"'|g' \
|
-e 's|\{\{[ ]*document\.text-encoding[ ]*\}\}|'"${DOCUMENT_Text_Encoding:-}"'|g' \
|
||||||
-e 's|{{[ ]*document\.authors[ ]*}}|'"${DOCUMENT_Authors:-}"'|g' \
|
-e 's|\{\{[ ]*document\.authors[ ]*\}\}|'"${DOCUMENT_Authors:-}"'|g' \
|
||||||
-e 's|{{[ ]*document\.copyright[ ]*}}|'"${DOCUMENT_Copyright:-}"'|g' \
|
-e 's|\{\{[ ]*document\.copyright[ ]*\}\}|'"${DOCUMENT_Copyright:-}"'|g' \
|
||||||
-e 's|{{[ ]*document\.license[ ]*}}|'"${DOCUMENT_License:-}"'|g' \
|
-e 's|\{\{[ ]*document\.license[ ]*\}\}|'"${DOCUMENT_License:-}"'|g' \
|
||||||
-e 's|{{[ ]*document\.license-abbr[ ]*}}|'"${DOCUMENT_License_Abbr:-}"'|g' \
|
-e 's|\{\{[ ]*document\.license-abbr[ ]*\}\}|'"${DOCUMENT_License_Abbr:-}"'|g' \
|
||||||
-e 's|{{[ ]*document\.license-url[ ]*}}|'"${DOCUMENT_License_URL:-}"'|g' \
|
-e 's|\{\{[ ]*document\.license-url[ ]*\}\}|'"${DOCUMENT_License_URL:-}"'|g' \
|
||||||
-e 's|{{[ ]*document\.redirect-url[ ]*}}|'"${DOCUMENT_Redirect_URL:-}"'|g' \
|
-e 's|\{\{[ ]*document\.redirect-url[ ]*\}\}|'"${DOCUMENT_Redirect_URL:-}"'|g' \
|
||||||
-e 's|{{[ ]*base\.relpath[ ]*}}|'"${BASE_RELPATH:-}"'|g' \
|
-e 's|\{\{[ ]*base\.relpath[ ]*\}\}|'"${BASE_RELPATH:-}"'|g' \
|
||||||
-i .sedbak "${DEST}.html"
|
-i.sedbak "${DEST}.html"
|
||||||
# postprocess
|
# postprocess
|
||||||
sed -E \
|
sed -E \
|
||||||
-e 's|<p><figure>|<figure>|' \
|
-e 's|<p><figure>|<figure>|' \
|
||||||
-e 's|</figure></p>|</figure>|' \
|
-e 's|</figure></p>|</figure>|' \
|
||||||
-i .sedbak "${DEST}.html"
|
-i.sedbak "${DEST}.html"
|
||||||
|
|
||||||
# clean up
|
# clean up
|
||||||
rm -f "${DEST}.yaml"
|
rm -f "${DEST}.yaml"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user