diff --git a/Scripts/Bash/Functions/Html/html.sh b/Scripts/Bash/Functions/Html/html.sh index b084b79..52af4fb 100755 --- a/Scripts/Bash/Functions/Html/html.sh +++ b/Scripts/Bash/Functions/Html/html.sh @@ -26,17 +26,10 @@ function html { + # Define variables. local FILES='' - # Define list of html files to process using option value as - # reference. - if [[ -d $OPTIONVAL ]];then - FILES=$(find $OPTIONVAL -regextype posix-egrep -type f -regex '.*/*.(html|htm)$') - elif [[ -f $OPTIONVAL ]];then - FILES=$OPTIONVAL - fi - - # Define command line interface for html-based actions. + # Define command-line interface. html_getActions } diff --git a/Scripts/Bash/Functions/Html/html_getActions.sh b/Scripts/Bash/Functions/Html/html_getActions.sh index 2f1b4f8..ca1e27f 100755 --- a/Scripts/Bash/Functions/Html/html_getActions.sh +++ b/Scripts/Bash/Functions/Html/html_getActions.sh @@ -29,7 +29,7 @@ function html_getActions { # Evaluate option name and define which actions does centos-art.sh # script supports. - case $OPTIONNAM in + case $ACTIONNAM in '--update-headings' ) # Update html headings to create table of content. diff --git a/Scripts/Bash/Functions/Html/html_updateHeadings.sh b/Scripts/Bash/Functions/Html/html_updateHeadings.sh index 5232b9a..8392aea 100644 --- a/Scripts/Bash/Functions/Html/html_updateHeadings.sh +++ b/Scripts/Bash/Functions/Html/html_updateHeadings.sh @@ -57,6 +57,39 @@ function html_updateHeadings { # to save html option name, option value, and heading title. PATTERN="(]>)(.*[^<])" + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="filter:" + + # Parse arguments using getopt(1) command parser. + cli_doParseArguments + + # Reset positional parameters using output from (getopt) argument + # parser. + eval set -- "$ARGUMENTS" + + # Define action to take for each option passed. + while true; do + case "$1" in + --filter ) + REGEX="$2" + shift 2 + ;; + * ) + break + esac + done + + # Re-define regular expression in order to force matching to html + # files only. + REGEX=$(echo "${REGEX}\.(html|htm)") + + # Define list of files to process. + cli_getFilesList + + # Process list of files. for FILE in $FILES;do # Verify list of html files. Are files really html files? If