From de2e6bb351aff2968e9657472a633b53c9fec04a Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 14 Jan 2023 20:03:53 -0600 Subject: whitespace --- plugins/el.sh | 379 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 189 insertions(+), 190 deletions(-) (limited to 'plugins') diff --git a/plugins/el.sh b/plugins/el.sh index 87eca03..8bc1e84 100644 --- a/plugins/el.sh +++ b/plugins/el.sh @@ -6,54 +6,55 @@ EL_ESCAPE=true el() { # el NAME ARGS... - ## Create an HTML element named NAME using ARGS. - # Any ARGS that contain an equals sign will be made into attributes of the - # element, until the special argument '--' which will stop attribute - # processing. While some nesting is possible with 'el', the way bash - # expansion works it's not great. - # - # No validation is done on any arguments in this function. It could create - # something that looks vaguely like an HTML element but isn't valid. - _name="$1"; shift || return 1 # Require at least an element name - _element="$_name" - _content="" - _process_args=true + ## Create an HTML element named NAME using ARGS. + # Any ARGS that contain an equals sign will be made into attributes of the + # element, until the special argument '--' which will stop attribute + # processing. While some nesting is possible with 'el', the way bash + # expansion works it's not great. + # + # No validation is done on any arguments in this function. It could create + # something that looks vaguely like an HTML element but isn't valid. + _name="$1" + shift || return 1 # Require at least an element name + _element="$_name" + _content="" + _process_args=true - while test -n "$1"; do - case "$1" in - --) - if "$_process_args"; then - _process_args=false - else - _content="$_content${_content:+ }$1" - fi - ;; - '\<'*) - _process_args=false - _content="$_content${_content:+ }$1" - ;; - *=*) - if "$_process_args"; then - _element="$_element ${1%%=*}=\"${1#*=}\"" - else - _content="$_content${_content:+ }$1" - fi - ;; - *) - if "$_process_args"; then - _process_args=false - fi - _content="$_content${_content:+ }$1" - ;; - esac - shift - done - if $EL_ESCAPE; then - fmt='\<%s\>%s\\n' - else - fmt='<%s>%s\n' - fi - printf "$fmt" "$_element" "$_content" "$_name" + while test -n "$1"; do + case "$1" in + --) + if "$_process_args"; then + _process_args=false + else + _content="$_content${_content:+ }$1" + fi + ;; + '\<'*) + _process_args=false + _content="$_content${_content:+ }$1" + ;; + *=*) + if "$_process_args"; then + _element="$_element ${1%%=*}=\"${1#*=}\"" + else + _content="$_content${_content:+ }$1" + fi + ;; + *) + if "$_process_args"; then + _process_args=false + fi + _content="$_content${_content:+ }$1" + ;; + esac + shift + done + if $EL_ESCAPE; then + fmt='\<%s\>%s\\n' + else + fmt='<%s>%s\n' + fi + printf "$fmt" "$_element" "$_content" "$_name" } ### HTML5 element aliases @@ -66,149 +67,147 @@ el() { # el NAME ARGS... : "${EL_PREFIX:=_}" for e in \ - html \ - base \ - head \ - link \ - meta \ - style \ - title \ - body \ - address \ - article \ - aside \ - footer \ - header \ - h1 \ - h2 \ - h3 \ - h4 \ - h5 \ - h6 \ - main \ - nav \ - section \ - blockquote \ - dd \ - div \ - dl \ - dt \ - figcaption \ - figure \ - hr \ - li \ - menu \ - ol \ - p \ - pre \ - ul \ - a \ - abbr \ - b \ - bdi \ - bdo \ - br \ - cite \ - code \ - data \ - dfn \ - em \ - i \ - kbd \ - mark \ - q \ - rp \ - rt \ - ruby \ - s \ - samp \ - small \ - span \ - strong \ - sub \ - sup \ - time \ - u \ - var \ - wbr \ - area \ - audio \ - img \ - map \ - track \ - video \ - embed \ - iframe \ - object \ - picture \ - portal \ - source \ - svg \ - math \ - canvas \ - noscript \ - script \ - del \ - ins \ - caption \ - col \ - colgroup \ - table \ - tbody \ - td \ - tfoot \ - th \ - thead \ - tr \ - button \ - datalist \ - fieldset \ - form \ - input \ - label \ - legend \ - meter \ - optgroup \ - option \ - output \ - progress \ - select \ - textarea \ - details \ - dialog \ - summary \ - slot \ - template \ - acronym \ - applet \ - bgsound \ - big \ - blink \ - center \ - content \ - dir \ - font \ - frame \ - frameset \ - image \ - keygen \ - marquee \ - menuitem \ - nobr \ - noembed \ - noframes \ - param \ - plaintext \ - rb \ - rtc \ - shadow \ - spacer \ - strike \ - tt \ - xmp \ - ; do - eval "alias $EL_PREFIX$e='el $e'" + html \ + base \ + head \ + link \ + meta \ + style \ + title \ + body \ + address \ + article \ + aside \ + footer \ + header \ + h1 \ + h2 \ + h3 \ + h4 \ + h5 \ + h6 \ + main \ + nav \ + section \ + blockquote \ + dd \ + div \ + dl \ + dt \ + figcaption \ + figure \ + hr \ + li \ + menu \ + ol \ + p \ + pre \ + ul \ + a \ + abbr \ + b \ + bdi \ + bdo \ + br \ + cite \ + code \ + data \ + dfn \ + em \ + i \ + kbd \ + mark \ + q \ + rp \ + rt \ + ruby \ + s \ + samp \ + small \ + span \ + strong \ + sub \ + sup \ + time \ + u \ + var \ + wbr \ + area \ + audio \ + img \ + map \ + track \ + video \ + embed \ + iframe \ + object \ + picture \ + portal \ + source \ + svg \ + math \ + canvas \ + noscript \ + script \ + del \ + ins \ + caption \ + col \ + colgroup \ + table \ + tbody \ + td \ + tfoot \ + th \ + thead \ + tr \ + button \ + datalist \ + fieldset \ + form \ + input \ + label \ + legend \ + meter \ + optgroup \ + option \ + output \ + progress \ + select \ + textarea \ + details \ + dialog \ + summary \ + slot \ + template \ + acronym \ + applet \ + bgsound \ + big \ + blink \ + center \ + content \ + dir \ + font \ + frame \ + frameset \ + image \ + keygen \ + marquee \ + menuitem \ + nobr \ + noembed \ + noframes \ + param \ + plaintext \ + rb \ + rtc \ + shadow \ + spacer \ + strike \ + tt \ + xmp; do + eval "alias $EL_PREFIX$e='el $e'" done - # el.sh ends here -- cgit 1.4.1-21-gabe81