From 71b652bd920b03a97f4263bb49ff591fefd0fee8 Mon Sep 17 00:00:00 2001 From: Matthieu Dumont Date: Wed, 27 Jan 2016 14:55:10 +0100 Subject: [PATCH] docs(documentation.md): Fix not working links Closes #65 --- README.md | 7 +++++-- scripts/build-docs | 15 ++++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7c7c7615..7144c7f2 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Check out our [website][1] to add an outstanding search to your documentation. - + ## Introduction @@ -194,7 +194,7 @@ docsearch({ You will find all Algolia API options in its [own documentation][23] - + ## Development workflow @@ -248,6 +248,7 @@ configure the build path of eventmachine with bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl)/include ``` + [1]: https://community.algolia.com/docsearch/ [2]: https://img.shields.io/npm/v/docsearch.js.svg?style=flat-square @@ -276,3 +277,5 @@ bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl)/incl [25]: https://jekyllrb.com/ [26]: https://www.ruby-lang.org/en/ [27]: http://bundler.io/ + + diff --git a/scripts/build-docs b/scripts/build-docs index acf85f2e..ba361006 100755 --- a/scripts/build-docs +++ b/scripts/build-docs @@ -5,15 +5,19 @@ set -o errexit readonly SOURCE=README.md readonly OUTPUT=docs/documentation.md -readonly START_TAG="" -readonly END_TAG="" + +readonly START_DOC_TAG="" +readonly END_DOC_TAG="" + +readonly START_LINKS_TAG="" +readonly END_LINKS_TAG="" function escape_regex { - echo "$@" | sed -e 's/[]\/\!$*.^|[]/\\&/g' + echo "$1" | sed -e 's/[]\/\!$*.^|[]/\\&/g' } function extract { - sed -n "/^\s*$(escape_regex $START_TAG)\s*$/,/^\s*$(escape_regex $END_TAG)\s*$/p" \ + sed -n "/^\s*$(escape_regex "$1")\s*$/,/^\s*$(escape_regex "$2")\s*$/p" \ | sed '$d' \ | sed -n '2,$p' } @@ -27,7 +31,8 @@ function main { echo "permalink: /documentation/" >> $OUTPUT echo "---" >> $OUTPUT - cat $SOURCE | extract >> $OUTPUT + cat $SOURCE | extract "$START_DOC_TAG" "$END_DOC_TAG" >> $OUTPUT + cat $SOURCE | extract "$START_LINKS_TAG" "$END_LINKS_TAG" >> $OUTPUT } main