#!/bin/bash

section() {
    local LANG=C
    if [ "$1" = "help" ]; then
        echo "Usage: ${0##*/} [options]"
        echo '    start="start"        section start'
        echo '    end="end"            section end'
        echo '    text="text"          text to the section'
        echo '    fontSize="number"    value: 1~6'
        echo ''
    fi

#It is only necessary to declare the variables that need changes in the content, the file that calls this script already creates the variable that will be used in the script



# start
if [ -n "$start" ];then
read -d $'' ShowText <<EOF
<section class="box mt-4 mb-4  mx-5">
EOF
echo "$ShowText"
fi

#fontSize
if [ -n "$fontSize" ];then
    local fontSize="${fontSize:+h$fontSize}"
else
    local fontSize=h1
fi

# text
if [ -n "$text" ];then
read -d $'' ShowText <<EOF
<$fontSize class="mb-2 mt-3">$text</$fontSize>
EOF
echo "$ShowText"
fi

# end
if [ -n "$end" ];then
echo "</section>"
fi
}
