Make filename generation routine play nice with Russian and Unix
This commit is contained in:
parent
b861d25a3a
commit
52f974c606
1 changed files with 4 additions and 0 deletions
4
bb.sh
4
bb.sh
|
@ -499,7 +499,11 @@ parse_file() {
|
|||
title=$(echo "$line" | sed 's/<\/*p>//g')
|
||||
filename="$(echo $title | tr [:upper:] [:lower:])"
|
||||
filename="$(echo $filename | sed 's/\ /-/g')"
|
||||
filename="$(echo $filename | sed 'y/йцукенгшщзхъфывапролджэячсмитьбю/jcukengsszh-fyvaproldzeahsmit-by/')"
|
||||
filename="$(echo $filename | sed 'y/ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ/jcukengsszh-fyvaproldzeahsmit-by/')"
|
||||
filename="$(echo $filename | tr -dc '[:alnum:]-')" # html likes alphanumeric
|
||||
filename="$(echo $filename | sed 's/^-*//')" # unix utilities are unhappy if filename starts with -
|
||||
[ "$filename" ] || filename=$RANDOM # if filename gets empty, put something in it
|
||||
filename="$filename.html"
|
||||
content="$filename.tmp"
|
||||
|
||||
|
|
Loading…
Reference in a new issue