diff --git a/config.toml b/config.toml index d5140694df..4cd636d278 100644 --- a/config.toml +++ b/config.toml @@ -39,6 +39,18 @@ disableLanguages = ["hi", "no"] noClasses = true style = "emacs" tabWidth = 4 + [markup.tableOfContents] + endLevel = 2 + ordered = false + startLevel = 2 + [markup.goldmark.parser] + attribute = true + autoHeadingID = true + autoHeadingIDType = "blackfriday" + [markup.goldmark.extensions] + definitionList = true + table = true + typographer = false [frontmatter] date = ["date", ":filename", "publishDate", "lastmod"] diff --git a/i18n/en.toml b/i18n/en.toml index 0c4403604e..493d0debc2 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -180,12 +180,21 @@ other = "Note:" [objectives_heading] other = "Objectives" +[options_heading] +other = "Options" + [prerequisites_heading] other = "Before you begin" +[seealso_heading] +other = "See Also" + [subscribe_button] other = "Subscribe" +[synopsis_heading] +other = "Synopsis" + [ui_search_placeholder] other = "Search" diff --git a/layouts/shortcodes/heading.html b/layouts/shortcodes/heading.html new file mode 100644 index 0000000000..791ff6ffa0 --- /dev/null +++ b/layouts/shortcodes/heading.html @@ -0,0 +1,4 @@ + +{{- $heading := .Get 0 -}} +{{- $heading := printf "%s_heading" $heading -}} +{{- T $heading | safeHTML -}} diff --git a/scripts/replace-capture.sh b/scripts/replace-capture.sh new file mode 100755 index 0000000000..6cdde69ec3 --- /dev/null +++ b/scripts/replace-capture.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +# set K8S_WEBSITE in your env to your docs website root +# Note: website/content//docs +CONTENT_DIR=${K8S_WEBSITE}/content + +# 16 langs +# de en es fr hi id it ja ko no pl pt ru uk vi zh + +declare -a DIRS=("concepts" "contribute" "home" "reference" "setup" "tasks" "tutorials") +declare -a EMPTY_STMTS=("body" "discussion" "lessoncontent" "overview" "steps") +declare -a REPLACE_STMTS=("cleanup" "objectives" "options" "prerequisites" "seealso" "synopsis" "whatsnext") +declare -a CONTENT_TYPES=("concept" "task" "tutorial" "tool_reference") +END_CAPTURE="{{% \/capture %}}" +CONTENT_TEMPLATE="content_template:" + +# replace or remove capture statements +function replace_capture_stmts { + echo "i:""$i" + if [ -d "$1" ] ; then + for i in `ls $1`; do + replace_capture_stmts "${1}/${i}" + done + else + if [ -f "$1" ] ; then + ls -f $1 | while read -r file; do + for stmt in "${EMPTY_STMTS[@]}" ; do + CAPTURE_STMT="{{% capture ""$stmt"" %}}" + COMMENT_REPLACE="" + sed -i -e "s/${CAPTURE_STMT}/${COMMENT_REPLACE}/g" $1 + done + + for stmt in "${REPLACE_STMTS[@]}" ; do + CAPTURE_STMT="{{% capture ""$stmt"" %}}" + HEADING_STMT="## {{% heading \"""$stmt""\" %}}\n" + echo "HEADING STMT TO ADD:""$HEADING_STMT" + sed -i -e "s/${CAPTURE_STMT}/${HEADING_STMT}/g" $1 + done + + sed -i -e "s/${END_CAPTURE}//g" $1 + + # replace content_template: templates/ with + # content_template: + #sed -i -e "s/^${CONTENT_TEMPLATE}/# ${CONTENT_TEMPLATE}/g" $1 + for t in "${CONTENT_TYPES[@]}" ; do + sed -i -e "s/content_template:[[:space:]]*templates\/$t/content_type: $t/g" $1 + done + done + else + exit 1 + fi + fi +} + +# change to docs content dir +cd $CONTENT_DIR + +for langdir in `ls $CONTENT_DIR`; do + # Testing with a couple of langs to start + if [ $langdir = "en" ] ; then + LANGDIR="$CONTENT_DIR""/""$langdir""/docs" + + for d in "${DIRS[@]}"; do + ROOTDIR="${LANGDIR}""/""$d" + cd ${ROOTDIR} + for i in `ls ${ROOTDIR}`; do + replace_capture_stmts "${ROOTDIR}""/""$i" + done + done + fi +done