Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

refactored display_file()

  • Loading branch information...
commit 78868249e6133e05e84e0281b602e25e84371631 1 parent ad65e9f
@tj authored
Showing with 10 additions and 11 deletions.
  1. +10 −11 bin/mad
View
21 bin/mad
@@ -79,17 +79,16 @@ display_file() {
local strong=$(get strong)
local em=$(get em)
- cat $1 \
- | perl -pe "
- s|^#+ *(.+)|\e[$heading\1\e[0m|g; \
- s|\`(.+?)\`|\e[$code\1\e[0m|g; \
- s|\*\*(.+?)\*\*|\e[$strong\1\e[0m|g; \
- s|__(.+?)__|\e[$strong\1\e[0m|g; \
- s|\*(.+?)\*|\e[$em\1\e[0m|g; \
- s|_(.+?)_|\e[$em\1\e[0m|g; \
- s| (.+)| \e[$code\1\e[0m|g; \
- s|<(.+?)>||g; \
- s|^| |;" \
+ < "$1" perl -pe "
+ s|^#+ *(.+)|\e[$heading\1\e[0m|g; \
+ s|\`(.+?)\`|\e[$code\1\e[0m|g; \
+ s|\*\*(.+?)\*\*|\e[$strong\1\e[0m|g; \
+ s|__(.+?)__|\e[$strong\1\e[0m|g; \
+ s|\*(.+?)\*|\e[$em\1\e[0m|g; \
+ s|_(.+?)_|\e[$em\1\e[0m|g; \
+ s| (.+)| \e[$code\1\e[0m|g; \
+ s|<(.+?)>||g; \
+ s|^| |;" \
| less -R
exit
}
Please sign in to comment.
Something went wrong with that request. Please try again.