forked from decal/werdlists
-
Notifications
You must be signed in to change notification settings - Fork 2
/
append-spaces-endofline
executable file
·55 lines (39 loc) · 1.1 KB
/
append-spaces-endofline
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
#
# Append two spaces to the end of each markdown line such that the generated
# HTML contains a line break where intended..
#
[ ! -d scripts ] && echo
[ -f scripts/shared/colors ] && source scripts/shared/colors
[ -f scripts/shared/env ] && source scripts/shared/env
if [ ! "$1" ]
then echo -e "${reset}"
echo -ne "${purplef}"
dos2unix --version 2>&1
echo -e "${reset}"
echo -ne "${whitef}"
mv --version 2>&1
echo -e "${reset}"
echo -ne "${redf}"
cp --version 2>&1
echo -e "${reset}"
echo -e "${yellowf}usage${boldon}:${reset} ${bluef}${ulon}$0${reset} ${greenb}MDFILE${reset}"
echo -e " ${greenb}MDFILE${reset} ${italicson}markdown file to normalize with line terminating spaces${reset}"
echo
exit 1
fi
echo -ne "${redf}"
cp -v -- "$1" /tmp 2>&1
echo -e "${reset}"
declare achar="$(echo '$1' | sed -r 's!([A-Z]{1}).*$!\1!g')"
declare afile="${achar}.md"
(while read line
do echo "${line} "
done) < "$1" > "$afile"
echo -ne "${whitef}"
mv -v -- "$afile" "$1" 2>&1
echo -e "${reset}"
echo -ne "${purplef}"
dos2unix -- "$1" 2>&1
echo -e "${reset}"
exit 0