Merge pull request #488 from arthurmaciel/master

Generates sexp API index
This commit is contained in:
Justin Ethier 2022-07-17 08:14:55 -07:00 committed by GitHub
commit cbd3d63172
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,7 @@
# Cyclone Scheme # Cyclone Scheme
# https://github.com/justinethier/cyclone # https://github.com/justinethier/cyclone
# #
# Copyright (c) 2014-2016, Justin Ethier # Copyright (c) 2014-2022, Justin Ethier
# All rights reserved. # All rights reserved.
# #
# Generate a sorted list of functions/variables from the API documentation. # 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/srfi/* | ./scripts/convert-doc-index >> $TMP
grep -r "^\[" docs/api/cyclone/* | ./scripts/convert-doc-index >> $TMP grep -r "^\[" docs/api/cyclone/* | ./scripts/convert-doc-index >> $TMP
sort $TMP | ./scripts/alphabetize > $API 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