Skip to content

Commit

Permalink
Improve organization of _show() default pipeline.
Browse files Browse the repository at this point in the history
  • Loading branch information
xwmx committed Sep 22, 2023
1 parent 245a78f commit 9043a84
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions nb
Original file line number Diff line number Diff line change
Expand Up @@ -18824,16 +18824,22 @@ Can't show archives. Export archive and expand to edit.\\n"
_target_extension="${_target_filename##*.}"
fi

cat "${_target_path}" \
| LC_ALL=C sed -E \
-e "s/^([[:space:]]*-) /\1${_ME}-ph-${_ME}/g" \
-e "s/^([[:space:]]*\*) /\1${_ME}-ph-${_ME}/g" \
| LC_ALL=C fold -s -w "${_COLUMNS}" \
| LC_ALL=C sed -E \
-e "s/^([[:space:]]*-)${_ME}-ph-${_ME}/\1 /g" \
-e "s/^([[:space:]]*\*)${_ME}-ph-${_ME}/\1 /g" \
| _highlight_syntax_if_available "${_target_extension:-}" \
| _pager
{
cat "${_target_path}"
} | {
# fold to current width
LC_ALL=C sed -E \
-e "s/^([[:space:]]*-) /\1${_ME}-ph-${_ME}/g" \
-e "s/^([[:space:]]*\*) /\1${_ME}-ph-${_ME}/g" \
| LC_ALL=C fold -s -w "${_COLUMNS}" \
| LC_ALL=C sed -E \
-e "s/^([[:space:]]*-)${_ME}-ph-${_ME}/\1 /g" \
-e "s/^([[:space:]]*\*)${_ME}-ph-${_ME}/\1 /g"
} | {
_highlight_syntax_if_available "${_target_extension:-}"
} | {
_pager
}
fi
fi
fi
Expand Down

0 comments on commit 9043a84

Please sign in to comment.