Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print function fix #363

Merged
merged 1 commit into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions helpers/helpers_emba_html_generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,8 @@ generate_report_file()

sed -i -E -e "s:[=]{65}:$HR_DOUBLE:g ; s:^[-]{65}$:$HR_MONO:g" "$TMP_FILE" || true
sed -i -e "s:^:$P_START: ; s:$:$P_END:" "$TMP_FILE" || true
# this fixes the </pre> lines instead of <pre></pre> - something weird with \r\n
sed -i -E "s:\r$P_END:$P_END:" "$TMP_FILE" || true

# add html tags for style
add_color_tags "$TMP_FILE"
Expand Down Expand Up @@ -608,9 +610,9 @@ scan_report()
{
# at the end of an EMBA run, we have to disable all non-valid links to modules
local LINK_ARR
readarray -t LINK_ARR < <(grep -a -R -E "class\=\"refmodul\" href=\"(.*)" "$ABS_HTML_PATH" | cut -d"\"" -f 4 | cut -d"#" -f 1 | sort -u)
readarray -t LINK_ARR < <(grep -a -R -E "class\=\"refmodul\" href=\"(.*)" "$ABS_HTML_PATH" | cut -d"\"" -f 4 | cut -d"#" -f 1 | sort -u || true)
local LINK_FILE_ARR
readarray -t LINK_FILE_ARR < <(grep -a -R -E -l "class\=\"refmodul\" href=\"(.*)" "$ABS_HTML_PATH")
readarray -t LINK_FILE_ARR < <(grep -a -R -E -l "class\=\"refmodul\" href=\"(.*)" "$ABS_HTML_PATH" || true)
for LINK in "${LINK_ARR[@]}" ; do
for FILE in "${LINK_FILE_ARR[@]}" ; do
if ! [[ -f "$ABS_HTML_PATH""/""$LINK" ]] ; then
Expand Down
14 changes: 7 additions & 7 deletions helpers/helpers_emba_print.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ print_output()
# add a link as third argument to add a link marker for web report
local REF_LINK="${3:-}"
local TYPE_CHECK
TYPE_CHECK="$( safe_echo "$OUTPUT" | cut -c1-3 )"
TYPE_CHECK="$( echo "$OUTPUT" | cut -c1-3 )"
if [[ "$TYPE_CHECK" == "[-]" || "$TYPE_CHECK" == "[*]" || "$TYPE_CHECK" == "[!]" || "$TYPE_CHECK" == "[+]" ]] ; then
local COLOR_OUTPUT_STRING=""
COLOR_OUTPUT_STRING="$(color_output "$OUTPUT")"
Expand All @@ -119,9 +119,9 @@ print_output()
safe_echo "$(format_log "$COLOR_OUTPUT_STRING")" "$LOG_FILE_MOD"
fi
else
safe_echo "$(format_log "$COLOR_OUTPUT_STRING")""\\n""$(format_log "[REF] ""$REF_LINK" 1)" "$LOG_FILE"
safe_echo "$(format_log "$COLOR_OUTPUT_STRING")""\\r\\n""$(format_log "[REF] ""$REF_LINK" 1)" "$LOG_FILE"
if [[ -n "${LOG_FILE_MOD:-}" ]]; then
safe_echo "$(format_log "$COLOR_OUTPUT_STRING")""\\n""$(format_log "[REF] ""$REF_LINK" 1)" "$LOG_FILE_MOD"
safe_echo "$(format_log "$COLOR_OUTPUT_STRING")""\\r\\n""$(format_log "[REF] ""$REF_LINK" 1)" "$LOG_FILE_MOD"
fi
fi
fi
Expand All @@ -136,9 +136,9 @@ print_output()
safe_echo "$(format_log "$OUTPUT")" "$LOG_FILE_MOD"
fi
else
safe_echo "$(format_log "$OUTPUT")""\\n""$(format_log "[REF] ""$REF_LINK" 1)" "$LOG_FILE"
safe_echo "$(format_log "$OUTPUT")""\\r\\n""$(format_log "[REF] ""$REF_LINK" 1)" "$LOG_FILE"
if [[ -n "${LOG_FILE_MOD:-}" ]]; then
safe_echo "$(format_log "$OUTPUT")""\\n""$(format_log "[REF] ""$REF_LINK" 1)" "$LOG_FILE_MOD"
safe_echo "$(format_log "$OUTPUT")""\\r\\n""$(format_log "[REF] ""$REF_LINK" 1)" "$LOG_FILE_MOD"
fi
fi
fi
Expand All @@ -155,9 +155,9 @@ safe_echo() {
# %b ARGUMENT as a string with '\' escapes interpreted, except that octal escapes are of the form \0 or
if [[ -v 2 ]]; then
local LOG_TO_FILE="${2:-}"
printf -- "%b" "$STRING_TO_ECHO\n" | tee -a "$LOG_TO_FILE" >/dev/null || true
printf -- "%b" "$STRING_TO_ECHO\r\n" | tee -a "$LOG_TO_FILE" >/dev/null || true
else
printf -- "%b" "$STRING_TO_ECHO\n" || true
printf -- "%b" "$STRING_TO_ECHO\r\n" || true
fi
}

Expand Down