From f0364f75826289663a743f8b5096478137b7b14e Mon Sep 17 00:00:00 2001 From: Dhaval Soneji Date: Sun, 10 Jan 2021 22:53:18 +0000 Subject: [PATCH 1/3] Update readme --- .github/workflows/toc.yml | 17 ++++++++ README.md | 84 ++++++++++++++++++++++++++++++++++----- 2 files changed, 90 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/toc.yml diff --git a/.github/workflows/toc.yml b/.github/workflows/toc.yml new file mode 100644 index 0000000..b6db19c --- /dev/null +++ b/.github/workflows/toc.yml @@ -0,0 +1,17 @@ +on: + push: + paths: ["README.md"] + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v2 + - run: | + curl https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc -o gh-md-toc + chmod a+x gh-md-toc + ./gh-md-toc --insert --no-backup README.md + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Auto update markdown TOC diff --git a/README.md b/README.md index 765828d..593a39a 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,50 @@ +# Introduction to the README Template + +Hare Krishna! Welcome to the PS README template. Please fill out this template on how your project is/was developed and deployed to create documentation. The storage of information in one place is very useful and also ensures all the information is present for the future. + +Please keep this template structure and do not remove any sections. Feel free to add subsections under the existing headings. If any sections do not apply, please leave them intact, for future use. Do not hesitate to contact the current maintainer () if you have any questions or queries. Please also feel free to submit a Pull Request to improve this template. + +This template should be used to create the `README.md` file in your project repository. The file properly starts below! ⬇️ + KCSOC Studio Logo -## Introduction -Welcome to the official repository for KCSOC Studio. +# KCSoc Studio + +Live site at: studio.kcsoc.com + +# Table of Contents 📚 + + + + + +# Description and Purpose 📝 This revolutionary tool will help you make professional, high-quality posters and trailers for your local KCSOC without you needing to have any photo/video editing skills whatsover! New features are planned to be added soon. Feel free to report any bugs/issues or create pull requests. +## Screenshots + +| Landing | Image Search | Final Creation. | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| ![](https://imgur.com/QZkXRLQ.png) | ![](https://imgur.com/3JjZhy3.png) | ![](https://imgur.com/G76OeSp.png) | + +# Intended Audience 🎭 + +Please describe who your intended audience is here + +# People of Contact 👤 + +Please fill in this table and add any other important people who may need to be contacted in the future. + +| Title | Name | Email | Phone | +| --------------------- | -------------------------- | ----------------- | ----------- | +| Project Owner/Creator | Hersh Kataria (@hersh-kat) | - | - | +| Server setup/hosting | Dhaval (@soneji) | dhaval@soneji.xyz | 07737312647 | +| Managed/maintained by | Josh Guha (@joshguha) | - | - | +| Emergency Contact | Firstname Lastname | email@example.com | 0123456789 | + +# Technologies, Dependencies, and Notable Libraries 👾 + This project was built using **ReactJS** & **Material-UI**, and uses the following API's: - **Dropbox API** to get design files when creating posters using a tempalte @@ -12,16 +52,9 @@ This project was built using **ReactJS** & **Material-UI**, and uses the followi - **Pixabay API** to search for images when creating posters - **Shotstack API** to edit and render videos -## Website Link -Check out the live version of KCSOC Studio at: + -https://kcsocstudio.hershkat.com - -## Screenshots - -| Landing | Image Search | Final Creation. | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | -| ![](https://imgur.com/QZkXRLQ.png) | ![](https://imgur.com/3JjZhy3.png) | ![](https://imgur.com/G76OeSp.png) | +# How to Run Project 🏃 ## Building from source @@ -39,3 +72,32 @@ You will also see any lint errors in the console. Builds the app for production to the `build` folder.
It correctly bundles React in production mode and optimizes the build for the best performance. + +# Admin Credentials 🕴 + +Please provide any admin credentials for the project here, including credentials for external providers (e.g. google cloud or mongodb) + +Main App Login: + +``` +Username: admin +Password: admin +``` + +# Email for Project 📧 + +N/A + +# Deployment & Costs 💰 + +Please provide any costs for APIs, services, etc. here. + +| Technology | Cost | +| --------------------- | ---- | +| PS Server for hosting | \_ | +| Emails | \_ | +| Any cloud Solutions | \_ | + +# Backups 🧯 + +Please provide information on how any data the project stores is being backed up, or add details requesting certain parts of the project to be backed up From f49d0b26758f16644fd59ad4aea7d933b57f6746 Mon Sep 17 00:00:00 2001 From: soneji Date: Sun, 10 Jan 2021 22:53:40 +0000 Subject: [PATCH 2/3] Auto update markdown TOC --- README.md | 18 +++ gh-md-toc | 350 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 368 insertions(+) create mode 100755 gh-md-toc diff --git a/README.md b/README.md index 593a39a..06a7486 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,24 @@ Live site at: studio.kcsoc.com # Table of Contents 📚 + * [Introduction to the README Template](#introduction-to-the-readme-template) + * [KCSoc Studio](#kcsoc-studio) + * [Table of Contents 📚](#table-of-contents-) + * [Description and Purpose 📝](#description-and-purpose-) + * [Screenshots](#screenshots) + * [Intended Audience 🎭](#intended-audience-) + * [People of Contact 👤](#people-of-contact-) + * [Technologies, Dependencies, and Notable Libraries 👾](#technologies-dependencies-and-notable-libraries-) + * [How to Run Project 🏃](#how-to-run-project-) + * [Building from source](#building-from-source) + * [npm start](#npm-start) + * [npm run build](#npm-run-build) + * [Admin Credentials 🕴](#admin-credentials-) + * [Email for Project 📧](#email-for-project-) + * [Deployment & Costs 💰](#deployment--costs-) + * [Backups 🧯](#backups-) + + diff --git a/gh-md-toc b/gh-md-toc new file mode 100755 index 0000000..2be2e5f --- /dev/null +++ b/gh-md-toc @@ -0,0 +1,350 @@ +#!/usr/bin/env bash + +# +# Steps: +# +# 1. Download corresponding html file for some README.md: +# curl -s $1 +# +# 2. Discard rows where no substring 'user-content-' (github's markup): +# awk '/user-content-/ { ... +# +# 3.1 Get last number in each row like ' ... sitemap.js.*<\/h/)+2, RLENGTH-5) +# +# 5. Find anchor and insert it inside "(...)": +# substr($0, match($0, "href=\"[^\"]+?\" ")+6, RLENGTH-8) +# + +gh_toc_version="0.7.0" + +gh_user_agent="gh-md-toc v$gh_toc_version" + +# +# Download rendered into html README.md by its url. +# +# +gh_toc_load() { + local gh_url=$1 + + if type curl &>/dev/null; then + curl --user-agent "$gh_user_agent" -s "$gh_url" + elif type wget &>/dev/null; then + wget --user-agent="$gh_user_agent" -qO- "$gh_url" + else + echo "Please, install 'curl' or 'wget' and try again." + exit 1 + fi +} + +# +# Converts local md file into html by GitHub +# +# -> curl -X POST --data '{"text": "Hello world github/linguist#1 **cool**, and #1!"}' https://api.github.com/markdown +#

Hello world github/linguist#1 cool, and #1!

'" +gh_toc_md2html() { + local gh_file_md=$1 + URL=https://api.github.com/markdown/raw + + if [ ! -z "$GH_TOC_TOKEN" ]; then + TOKEN=$GH_TOC_TOKEN + else + TOKEN_FILE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/token.txt" + if [ -f "$TOKEN_FILE" ]; then + TOKEN="$(cat $TOKEN_FILE)" + fi + fi + if [ ! -z "${TOKEN}" ]; then + AUTHORIZATION="Authorization: token ${TOKEN}" + fi + + # echo $URL 1>&2 + OUTPUT=$(curl -s \ + --user-agent "$gh_user_agent" \ + --data-binary @"$gh_file_md" \ + -H "Content-Type:text/plain" \ + -H "$AUTHORIZATION" \ + "$URL") + + if [ "$?" != "0" ]; then + echo "XXNetworkErrorXX" + fi + if [ "$(echo "${OUTPUT}" | awk '/API rate limit exceeded/')" != "" ]; then + echo "XXRateLimitXX" + else + echo "${OUTPUT}" + fi +} + + +# +# Is passed string url +# +gh_is_url() { + case $1 in + https* | http*) + echo "yes";; + *) + echo "no";; + esac +} + +# +# TOC generator +# +gh_toc(){ + local gh_src=$1 + local gh_src_copy=$1 + local gh_ttl_docs=$2 + local need_replace=$3 + local no_backup=$4 + + if [ "$gh_src" = "" ]; then + echo "Please, enter URL or local path for a README.md" + exit 1 + fi + + + # Show "TOC" string only if working with one document + if [ "$gh_ttl_docs" = "1" ]; then + + echo "Table of Contents" + echo "=================" + echo "" + gh_src_copy="" + + fi + + if [ "$(gh_is_url "$gh_src")" == "yes" ]; then + gh_toc_load "$gh_src" | gh_toc_grab "$gh_src_copy" + if [ "${PIPESTATUS[0]}" != "0" ]; then + echo "Could not load remote document." + echo "Please check your url or network connectivity" + exit 1 + fi + if [ "$need_replace" = "yes" ]; then + echo + echo "!! '$gh_src' is not a local file" + echo "!! Can't insert the TOC into it." + echo + fi + else + local rawhtml=$(gh_toc_md2html "$gh_src") + if [ "$rawhtml" == "XXNetworkErrorXX" ]; then + echo "Parsing local markdown file requires access to github API" + echo "Please make sure curl is installed and check your network connectivity" + exit 1 + fi + if [ "$rawhtml" == "XXRateLimitXX" ]; then + echo "Parsing local markdown file requires access to github API" + echo "Error: You exceeded the hourly limit. See: https://developer.github.com/v3/#rate-limiting" + TOKEN_FILE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/token.txt" + echo "or place GitHub auth token here: ${TOKEN_FILE}" + exit 1 + fi + local toc=`echo "$rawhtml" | gh_toc_grab "$gh_src_copy"` + echo "$toc" + if [ "$need_replace" = "yes" ]; then + if grep -Fxq "" $gh_src && grep -Fxq "" $gh_src; then + echo "Found markers" + else + echo "You don't have or in your file...exiting" + exit 1 + fi + local ts="<\!--ts-->" + local te="<\!--te-->" + local dt=`date +'%F_%H%M%S'` + local ext=".orig.${dt}" + local toc_path="${gh_src}.toc.${dt}" + local toc_footer="" + # http://fahdshariff.blogspot.ru/2012/12/sed-mutli-line-replacement-between-two.html + # clear old TOC + sed -i${ext} "/${ts}/,/${te}/{//!d;}" "$gh_src" + # create toc file + echo "${toc}" > "${toc_path}" + echo -e "\n${toc_footer}\n" >> "$toc_path" + # insert toc file + if [[ "`uname`" == "Darwin" ]]; then + sed -i "" "/${ts}/r ${toc_path}" "$gh_src" + else + sed -i "/${ts}/r ${toc_path}" "$gh_src" + fi + echo + if [ $no_backup = "yes" ]; then + rm ${toc_path} ${gh_src}${ext} + fi + echo "!! TOC was added into: '$gh_src'" + if [ -z $no_backup ]; then + echo "!! Origin version of the file: '${gh_src}${ext}'" + echo "!! TOC added into a separate file: '${toc_path}'" + fi + echo + fi + fi +} + +# +# Grabber of the TOC from rendered html +# +# $1 - a source url of document. +# It's need if TOC is generated for multiple documents. +# +gh_toc_grab() { + common_awk_script=' + modified_href = "" + split(href, chars, "") + for (i=1;i <= length(href); i++) { + c = chars[i] + res = "" + if (c == "+") { + res = " " + } else { + if (c == "%") { + res = "\\\\x" + } else { + res = c "" + } + } + modified_href = modified_href res + } + print sprintf("%*s", level*3, " ") "* [" text "](" gh_url modified_href ")" + ' + if [ `uname -s` == "OS/390" ]; then + grepcmd="pcregrep -o" + echoargs="" + awkscript='{ + level = substr($0, length($0), 1) + text = substr($0, match($0, /a>.*<\/h/)+2, RLENGTH-5) + href = substr($0, match($0, "href=\"([^\"]+)?\"")+6, RLENGTH-7) + '"$common_awk_script"' + }' + else + grepcmd="grep -Eo" + echoargs="-e" + awkscript='{ + level = substr($0, length($0), 1) + text = substr($0, match($0, /a>.*<\/h/)+2, RLENGTH-5) + href = substr($0, match($0, "href=\"[^\"]+?\"")+6, RLENGTH-7) + '"$common_awk_script"' + }' + fi + href_regex='href=\"[^\"]+?\"' + + # if closed is on the new line, then move it on the prev line + # for example: + # was: The command foo1 + # + # became: The command foo1 + sed -e ':a' -e 'N' -e '$!ba' -e 's/\n<\/h/<\/h/g' | + + # find strings that corresponds to template + $grepcmd '//g' | sed 's/<\/code>//g' | + + # remove g-emoji + sed 's/]*[^<]*<\/g-emoji> //g' | + + # now all rows are like: + # ... / placeholders" + echo " $app_name - Create TOC for markdown from STDIN" + echo " $app_name --help Show help" + echo " $app_name --version Show version" + return + fi + + if [ "$1" = '--version' ]; then + echo "$gh_toc_version" + echo + echo "os: `lsb_release -d | cut -f 2`" + echo "kernel: `cat /proc/version`" + echo "shell: `$SHELL --version`" + echo + for tool in curl wget grep awk sed; do + printf "%-5s: " $tool + echo `$tool --version | head -n 1` + done + return + fi + + if [ "$1" = "-" ]; then + if [ -z "$TMPDIR" ]; then + TMPDIR="/tmp" + elif [ -n "$TMPDIR" -a ! -d "$TMPDIR" ]; then + mkdir -p "$TMPDIR" + fi + local gh_tmp_md + if [ `uname -s` == "OS/390" ]; then + local timestamp=$(date +%m%d%Y%H%M%S) + gh_tmp_md="$TMPDIR/tmp.$timestamp" + else + gh_tmp_md=$(mktemp $TMPDIR/tmp.XXXXXX) + fi + while read input; do + echo "$input" >> "$gh_tmp_md" + done + gh_toc_md2html "$gh_tmp_md" | gh_toc_grab "" + return + fi + + if [ "$1" = '--insert' ]; then + need_replace="yes" + shift + fi + + if [ "$1" = '--no-backup' ]; then + need_replace="yes" + no_backup="yes" + shift + fi + for md in "$@" + do + echo "" + gh_toc "$md" "$#" "$need_replace" "$no_backup" + done + + echo "" + echo "Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)" +} + +# +# Entry point +# +gh_toc_app "$@" + From b76bf6f9e4f43390124684826e27bec3de4a2425 Mon Sep 17 00:00:00 2001 From: Dhaval Soneji Date: Sun, 10 Jan 2021 22:58:57 +0000 Subject: [PATCH 3/3] Remove gh-md-toc file --- .gitignore | 4 +- gh-md-toc | 350 ----------------------------------------------------- 2 files changed, 3 insertions(+), 351 deletions(-) delete mode 100755 gh-md-toc diff --git a/.gitignore b/.gitignore index 50c46ad..0c999c5 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,6 @@ npm-debug.log* yarn-debug.log* yarn-error.log* .eslintrc.json -.prettierrc \ No newline at end of file +.prettierrc + +gh-md-toc diff --git a/gh-md-toc b/gh-md-toc deleted file mode 100755 index 2be2e5f..0000000 --- a/gh-md-toc +++ /dev/null @@ -1,350 +0,0 @@ -#!/usr/bin/env bash - -# -# Steps: -# -# 1. Download corresponding html file for some README.md: -# curl -s $1 -# -# 2. Discard rows where no substring 'user-content-' (github's markup): -# awk '/user-content-/ { ... -# -# 3.1 Get last number in each row like ' ... sitemap.js.*<\/h/)+2, RLENGTH-5) -# -# 5. Find anchor and insert it inside "(...)": -# substr($0, match($0, "href=\"[^\"]+?\" ")+6, RLENGTH-8) -# - -gh_toc_version="0.7.0" - -gh_user_agent="gh-md-toc v$gh_toc_version" - -# -# Download rendered into html README.md by its url. -# -# -gh_toc_load() { - local gh_url=$1 - - if type curl &>/dev/null; then - curl --user-agent "$gh_user_agent" -s "$gh_url" - elif type wget &>/dev/null; then - wget --user-agent="$gh_user_agent" -qO- "$gh_url" - else - echo "Please, install 'curl' or 'wget' and try again." - exit 1 - fi -} - -# -# Converts local md file into html by GitHub -# -# -> curl -X POST --data '{"text": "Hello world github/linguist#1 **cool**, and #1!"}' https://api.github.com/markdown -#

Hello world github/linguist#1 cool, and #1!

'" -gh_toc_md2html() { - local gh_file_md=$1 - URL=https://api.github.com/markdown/raw - - if [ ! -z "$GH_TOC_TOKEN" ]; then - TOKEN=$GH_TOC_TOKEN - else - TOKEN_FILE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/token.txt" - if [ -f "$TOKEN_FILE" ]; then - TOKEN="$(cat $TOKEN_FILE)" - fi - fi - if [ ! -z "${TOKEN}" ]; then - AUTHORIZATION="Authorization: token ${TOKEN}" - fi - - # echo $URL 1>&2 - OUTPUT=$(curl -s \ - --user-agent "$gh_user_agent" \ - --data-binary @"$gh_file_md" \ - -H "Content-Type:text/plain" \ - -H "$AUTHORIZATION" \ - "$URL") - - if [ "$?" != "0" ]; then - echo "XXNetworkErrorXX" - fi - if [ "$(echo "${OUTPUT}" | awk '/API rate limit exceeded/')" != "" ]; then - echo "XXRateLimitXX" - else - echo "${OUTPUT}" - fi -} - - -# -# Is passed string url -# -gh_is_url() { - case $1 in - https* | http*) - echo "yes";; - *) - echo "no";; - esac -} - -# -# TOC generator -# -gh_toc(){ - local gh_src=$1 - local gh_src_copy=$1 - local gh_ttl_docs=$2 - local need_replace=$3 - local no_backup=$4 - - if [ "$gh_src" = "" ]; then - echo "Please, enter URL or local path for a README.md" - exit 1 - fi - - - # Show "TOC" string only if working with one document - if [ "$gh_ttl_docs" = "1" ]; then - - echo "Table of Contents" - echo "=================" - echo "" - gh_src_copy="" - - fi - - if [ "$(gh_is_url "$gh_src")" == "yes" ]; then - gh_toc_load "$gh_src" | gh_toc_grab "$gh_src_copy" - if [ "${PIPESTATUS[0]}" != "0" ]; then - echo "Could not load remote document." - echo "Please check your url or network connectivity" - exit 1 - fi - if [ "$need_replace" = "yes" ]; then - echo - echo "!! '$gh_src' is not a local file" - echo "!! Can't insert the TOC into it." - echo - fi - else - local rawhtml=$(gh_toc_md2html "$gh_src") - if [ "$rawhtml" == "XXNetworkErrorXX" ]; then - echo "Parsing local markdown file requires access to github API" - echo "Please make sure curl is installed and check your network connectivity" - exit 1 - fi - if [ "$rawhtml" == "XXRateLimitXX" ]; then - echo "Parsing local markdown file requires access to github API" - echo "Error: You exceeded the hourly limit. See: https://developer.github.com/v3/#rate-limiting" - TOKEN_FILE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/token.txt" - echo "or place GitHub auth token here: ${TOKEN_FILE}" - exit 1 - fi - local toc=`echo "$rawhtml" | gh_toc_grab "$gh_src_copy"` - echo "$toc" - if [ "$need_replace" = "yes" ]; then - if grep -Fxq "" $gh_src && grep -Fxq "" $gh_src; then - echo "Found markers" - else - echo "You don't have or in your file...exiting" - exit 1 - fi - local ts="<\!--ts-->" - local te="<\!--te-->" - local dt=`date +'%F_%H%M%S'` - local ext=".orig.${dt}" - local toc_path="${gh_src}.toc.${dt}" - local toc_footer="" - # http://fahdshariff.blogspot.ru/2012/12/sed-mutli-line-replacement-between-two.html - # clear old TOC - sed -i${ext} "/${ts}/,/${te}/{//!d;}" "$gh_src" - # create toc file - echo "${toc}" > "${toc_path}" - echo -e "\n${toc_footer}\n" >> "$toc_path" - # insert toc file - if [[ "`uname`" == "Darwin" ]]; then - sed -i "" "/${ts}/r ${toc_path}" "$gh_src" - else - sed -i "/${ts}/r ${toc_path}" "$gh_src" - fi - echo - if [ $no_backup = "yes" ]; then - rm ${toc_path} ${gh_src}${ext} - fi - echo "!! TOC was added into: '$gh_src'" - if [ -z $no_backup ]; then - echo "!! Origin version of the file: '${gh_src}${ext}'" - echo "!! TOC added into a separate file: '${toc_path}'" - fi - echo - fi - fi -} - -# -# Grabber of the TOC from rendered html -# -# $1 - a source url of document. -# It's need if TOC is generated for multiple documents. -# -gh_toc_grab() { - common_awk_script=' - modified_href = "" - split(href, chars, "") - for (i=1;i <= length(href); i++) { - c = chars[i] - res = "" - if (c == "+") { - res = " " - } else { - if (c == "%") { - res = "\\\\x" - } else { - res = c "" - } - } - modified_href = modified_href res - } - print sprintf("%*s", level*3, " ") "* [" text "](" gh_url modified_href ")" - ' - if [ `uname -s` == "OS/390" ]; then - grepcmd="pcregrep -o" - echoargs="" - awkscript='{ - level = substr($0, length($0), 1) - text = substr($0, match($0, /a>.*<\/h/)+2, RLENGTH-5) - href = substr($0, match($0, "href=\"([^\"]+)?\"")+6, RLENGTH-7) - '"$common_awk_script"' - }' - else - grepcmd="grep -Eo" - echoargs="-e" - awkscript='{ - level = substr($0, length($0), 1) - text = substr($0, match($0, /a>.*<\/h/)+2, RLENGTH-5) - href = substr($0, match($0, "href=\"[^\"]+?\"")+6, RLENGTH-7) - '"$common_awk_script"' - }' - fi - href_regex='href=\"[^\"]+?\"' - - # if closed is on the new line, then move it on the prev line - # for example: - # was: The command foo1 - # - # became: The command foo1 - sed -e ':a' -e 'N' -e '$!ba' -e 's/\n<\/h/<\/h/g' | - - # find strings that corresponds to template - $grepcmd '//g' | sed 's/<\/code>//g' | - - # remove g-emoji - sed 's/]*[^<]*<\/g-emoji> //g' | - - # now all rows are like: - # ... / placeholders" - echo " $app_name - Create TOC for markdown from STDIN" - echo " $app_name --help Show help" - echo " $app_name --version Show version" - return - fi - - if [ "$1" = '--version' ]; then - echo "$gh_toc_version" - echo - echo "os: `lsb_release -d | cut -f 2`" - echo "kernel: `cat /proc/version`" - echo "shell: `$SHELL --version`" - echo - for tool in curl wget grep awk sed; do - printf "%-5s: " $tool - echo `$tool --version | head -n 1` - done - return - fi - - if [ "$1" = "-" ]; then - if [ -z "$TMPDIR" ]; then - TMPDIR="/tmp" - elif [ -n "$TMPDIR" -a ! -d "$TMPDIR" ]; then - mkdir -p "$TMPDIR" - fi - local gh_tmp_md - if [ `uname -s` == "OS/390" ]; then - local timestamp=$(date +%m%d%Y%H%M%S) - gh_tmp_md="$TMPDIR/tmp.$timestamp" - else - gh_tmp_md=$(mktemp $TMPDIR/tmp.XXXXXX) - fi - while read input; do - echo "$input" >> "$gh_tmp_md" - done - gh_toc_md2html "$gh_tmp_md" | gh_toc_grab "" - return - fi - - if [ "$1" = '--insert' ]; then - need_replace="yes" - shift - fi - - if [ "$1" = '--no-backup' ]; then - need_replace="yes" - no_backup="yes" - shift - fi - for md in "$@" - do - echo "" - gh_toc "$md" "$#" "$need_replace" "$no_backup" - done - - echo "" - echo "Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)" -} - -# -# Entry point -# -gh_toc_app "$@" -