From 3f8c4e04c5795563e41ea5fffd250101af71f3d1 Mon Sep 17 00:00:00 2001 From: Peter Brightwell Date: Thu, 14 Jul 2022 10:16:44 +0100 Subject: [PATCH] Relocate webidl (#56) * Move webidl to APIs/idl * Change webidl title * Change webidl location * Use top level idl dir --- extract-docs.sh | 23 +++++++++-------------- make-indexes.sh | 22 +++++++++++++++++++++- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/extract-docs.sh b/extract-docs.sh index 896ca3b..bd7e746 100755 --- a/extract-docs.sh +++ b/extract-docs.sh @@ -106,11 +106,6 @@ function render_docs { echo "Copying images" cp -r "$docs_dir/images" "../$target_dir/$docs_dir" fi - - if [ -d "$docs_dir/idl" ] ; then - echo "Copying idl" - cp -r "$docs_dir/idl" "../$target_dir/$docs_dir" - fi } # Render RAML in the specified relative path @@ -220,21 +215,21 @@ function render_examples { } -# Render WebIDL in the specified relative path +# Render Web IDL in the specified relative path function render_webidl { - webidl_dir=$1 + idl_dir=$1 - for i in "$webidl_dir"/*.webidl; do + for i in "$idl_dir"/*.webidl; do HTML_EXAMPLE=${i%%.webidl}.html render-webidl.sh -n "$i" "Framework definitions ${i##*/}" >> "$HTML_EXAMPLE" done echo "Moving webidl" - mkdir -p "../$target_dir/$webidl_dir" - for i in "$webidl_dir"/*.html; do - mv "$i" "../$target_dir/$webidl_dir" + mkdir -p "../$target_dir/$idl_dir" + for i in "$idl_dir"/*.html; do + mv "$i" "../$target_dir/$idl_dir" done - cp -r ../.scripts/codemirror "../$target_dir/$webidl_dir" + cp -r ../.scripts/codemirror "../$target_dir/$idl_dir" } @@ -307,8 +302,8 @@ function extract_and_render { render_examples testingfacade/examples fi - if [ -d APIs/idl ]; then - render_webidl APIs/idl + if [ -d idl ]; then + render_webidl idl fi fi # AMWA_ID ) diff --git a/make-indexes.sh b/make-indexes.sh index 31805e5..4ad8072 100755 --- a/make-indexes.sh +++ b/make-indexes.sh @@ -169,6 +169,23 @@ function do_examples_index } +function do_idl_index +{ + set -x + idl_dir="$1" + + INDEX_IDL="$idl_dir/$INDEX" + echo -e "\n### [Web IDL]($idl_dir) $tree_text\n" >> "$INDEX" + echo -e "## Web IDL $tree_text\n" > "$INDEX_IDL" + for webidl in "$idl_dir"/*.html; do + no_ext="${webidl%%.html}" + linktext="${no_ext##*/}" + echo "- [$linktext]($webidl)" >> "$INDEX" + echo "- [$linktext](${webidl##*/})" >> "$INDEX_IDL" + done + set +x +} + function do_tree { tree=$1 label=$2 # because of spelling of plurals @@ -186,7 +203,7 @@ function do_tree { if [[ "$AMWA_ID" == "NMOS-PARAMETER-REGISTERS" ]]; then echo "{% include register_table.html %}" >> "$INDEX" - # Other repos may have (possibly numbered) docs/, APIs/, APIs/schemas/, schemas/, examples/ + # Other repos may have (possibly numbered) docs/, APIs/, APIs/schemas/, schemas/, examples/, idl/ else if [[ "$label" == "branch" && "$dirname" == "main" ]]; then # avoid "...for branch main" in repos where that might cause confusion @@ -218,6 +235,9 @@ function do_tree { do_examples_index testingfacade/examples fi + if [ -d idl ]; then + do_idl_index idl + fi fi ) done