mirror of
https://github.com/tests-always-included/mo.git
synced 2024-12-18 16:27:52 +00:00
Minor bugfixes found while writing more tests
This commit is contained in:
parent
9ad785ff32
commit
bc5c313828
13
mo
13
mo
@ -58,7 +58,9 @@ mustache-find-end-tag() {
|
|||||||
# Found our end tag
|
# Found our end tag
|
||||||
if [[ -z "$4" ]] && mustache-is-standalone STANDALONE_BYTES "$SCANNED" "${CONTENT[2]}" true; then
|
if [[ -z "$4" ]] && mustache-is-standalone STANDALONE_BYTES "$SCANNED" "${CONTENT[2]}" true; then
|
||||||
# This is also a standalone tag - clean up whitespace
|
# This is also a standalone tag - clean up whitespace
|
||||||
|
# and move those whitespace bytes to the "tag" element
|
||||||
STANDALONE_BYTES=( $STANDALONE_BYTES )
|
STANDALONE_BYTES=( $STANDALONE_BYTES )
|
||||||
|
CONTENT[1]="${SCANNED:${STANDALONE_BYTES[0]}}${CONTENT[1]}${CONTENT[2]:0:${STANDALONE_BYTES[1]}}"
|
||||||
SCANNED="${SCANNED:0:${STANDALONE_BYTES[0]}}"
|
SCANNED="${SCANNED:0:${STANDALONE_BYTES[0]}}"
|
||||||
CONTENT[2]="${CONTENT[2]:${STANDALONE_BYTES[1]}}"
|
CONTENT[2]="${CONTENT[2]:${STANDALONE_BYTES[1]}}"
|
||||||
fi
|
fi
|
||||||
@ -82,6 +84,7 @@ mustache-find-end-tag() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Did not find our closing tag
|
# Did not find our closing tag
|
||||||
|
SCANNED="$SCANNED${CONTENT[0]}"
|
||||||
local "$1" && mustache-indirect-array "$1" "${SCANNED}" "" ""
|
local "$1" && mustache-indirect-array "$1" "${SCANNED}" "" ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +175,7 @@ mustache-indent-lines() {
|
|||||||
CONTENT=${CONTENT:$POS_R + 1}
|
CONTENT=${CONTENT:$POS_R + 1}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mustache-trim-chars TRIMMED "$FRAGMENT" false true " " "$'\t'" "$'\n'" "$'\r'"
|
mustache-trim-chars TRIMMED "$FRAGMENT" false true " " $'\t' $'\n' $'\r'
|
||||||
|
|
||||||
if [ ! -z "$TRIMMED" ]; then
|
if [ ! -z "$TRIMMED" ]; then
|
||||||
FRAGMENT="$2$FRAGMENT"
|
FRAGMENT="$2$FRAGMENT"
|
||||||
@ -183,7 +186,7 @@ mustache-indent-lines() {
|
|||||||
mustache-find-string POS_R "$CONTENT" $'\r'
|
mustache-find-string POS_R "$CONTENT" $'\r'
|
||||||
done
|
done
|
||||||
|
|
||||||
mustache-trim-chars TRIMMED "$CONTENT" false true " " "$'\t'"
|
mustache-trim-chars TRIMMED "$CONTENT" false true " " $'\t'
|
||||||
|
|
||||||
if [ ! -z "$TRIMMED" ]; then
|
if [ ! -z "$TRIMMED" ]; then
|
||||||
CONTENT="$2$CONTENT"
|
CONTENT="$2$CONTENT"
|
||||||
@ -278,8 +281,8 @@ mustache-is-function() {
|
|||||||
mustache-is-standalone() {
|
mustache-is-standalone() {
|
||||||
local AFTER_TRIMMED BEFORE_TRIMMED CHAR
|
local AFTER_TRIMMED BEFORE_TRIMMED CHAR
|
||||||
|
|
||||||
mustache-trim-chars BEFORE_TRIMMED "$2" false true " " "$'\t'"
|
mustache-trim-chars BEFORE_TRIMMED "$2" false true " " $'\t'
|
||||||
mustache-trim-chars AFTER_TRIMMED "$3" true false " " "$'\t'"
|
mustache-trim-chars AFTER_TRIMMED "$3" true false " " $'\t'
|
||||||
CHAR=${BEFORE_TRIMMED: -1}
|
CHAR=${BEFORE_TRIMMED: -1}
|
||||||
|
|
||||||
if [[ "$CHAR" != $'\n' ]] && [[ "$CHAR" != $'\r' ]]; then
|
if [[ "$CHAR" != $'\n' ]] && [[ "$CHAR" != $'\r' ]]; then
|
||||||
@ -688,7 +691,7 @@ mustache-trim-chars() {
|
|||||||
mustache-trim-whitespace() {
|
mustache-trim-whitespace() {
|
||||||
local RESULT
|
local RESULT
|
||||||
|
|
||||||
mustache-trim-chars RESULT "$2" true true "$'\r'" "$'\n'" "$'\t'" " "
|
mustache-trim-chars RESULT "$2" true true $'\r' $'\n' $'\t' " "
|
||||||
local "$1" && mustache-indirect "$1" "$RESULT"
|
local "$1" && mustache-indirect "$1" "$RESULT"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user