From 84edc9dc89c69ad351d186153f8b488a6de77567 Mon Sep 17 00:00:00 2001 From: Arthur Maciel Date: Sat, 9 Jul 2022 17:52:10 -0300 Subject: [PATCH] Generates sexp API index --- scripts/generate-doc-index.sh | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/scripts/generate-doc-index.sh b/scripts/generate-doc-index.sh index a24fd673..efb1a23d 100755 --- a/scripts/generate-doc-index.sh +++ b/scripts/generate-doc-index.sh @@ -2,7 +2,7 @@ # Cyclone Scheme # https://github.com/justinethier/cyclone # -# Copyright (c) 2014-2016, Justin Ethier +# Copyright (c) 2014-2022, Justin Ethier # All rights reserved. # # Generate a sorted list of functions/variables from the API documentation. @@ -18,3 +18,30 @@ grep -r "^- \[" docs/api/srfi/* | ./scripts/convert-doc-index >> $TMP grep -r "^\[" docs/api/srfi/* | ./scripts/convert-doc-index >> $TMP grep -r "^\[" docs/api/cyclone/* | ./scripts/convert-doc-index >> $TMP sort $TMP | ./scripts/alphabetize > $API + +# -------------------------------------------------------------------------------- +# Index with SEXP format (needed by Winds) +# The sed command bellow transforms... + +# ; newline +#- - - ; hyphens used as sections divs +#[`abs`](api/scheme/base.md#abs) ; Markdown link +#[`acos`](api/scheme/inexact.md#acos) ; Markdown link + +# ...into... + +#((abs (scheme base)) ; ((definition1 library-that-contains-it) +# (acos (scheme inexact))) ; (definition2 library-that-contains-it)) + +API_SEXP=api-index.scm +sed -e '/^-\|^$/d' \ + -e 's/\[`/(/' \ + -e 's/`\](api\// (/' \ + -e 's/.md.*$/))/' \ + -e 's/\// /g' \ + -e 's/[[:space:]]\+/ /g' $API > $API_SEXP + +# Add extra opening and closing parentheses +sed -e '1s/^/(/' \ + -e '$s/$/)/' \ + -i $API_SEXP