test suite and more secapes
This commit is contained in:
parent
27467189ab
commit
c7aa7a83dd
2 changed files with 25 additions and 2 deletions
|
@ -179,9 +179,10 @@ escapeLexer = do
|
||||||
|
|
||||||
escChar :: PandocMonad m => ManLexer m EscapeThing
|
escChar :: PandocMonad m => ManLexer m EscapeThing
|
||||||
escChar =
|
escChar =
|
||||||
let skipSeqs = ["%", "{", "}", "&"]
|
let skipSeqs = ["%", "{", "}", "&", "\n", ":", "\"", "0", "c"]
|
||||||
subsSeqs = [ ("-", '-'), (" ", ' '), ("\\", '\\'), ("[lq]", '“'), ("[rq]", '”')
|
subsSeqs = [ ("-", '-'), (" ", ' '), ("\\", '\\'), ("[lq]", '“'), ("[rq]", '”')
|
||||||
, ("[em]", '—'), ("[en]", '–') ]
|
, ("[em]", '—'), ("[en]", '–'), ("*(lq", '«'), ("*(rq", '»')
|
||||||
|
, ("t", '\t'), ("e", '\\') ]
|
||||||
substitute :: PandocMonad m => (String,Char) -> ManLexer m EscapeThing
|
substitute :: PandocMonad m => (String,Char) -> ManLexer m EscapeThing
|
||||||
substitute (from,to) = try $ string from >> return (EChar to)
|
substitute (from,to) = try $ string from >> return (EChar to)
|
||||||
skip :: PandocMonad m => String -> ManLexer m EscapeThing
|
skip :: PandocMonad m => String -> ManLexer m EscapeThing
|
||||||
|
|
22
test/grofftest.sh
Normal file
22
test/grofftest.sh
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# iterates over specified directory, containing "\w+\.\d"-like files,
|
||||||
|
# executes pandoc voer them and prints stderr on nonzero return code
|
||||||
|
|
||||||
|
if [ $# -ne 2 ]; then
|
||||||
|
echo "Not enough arguments"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
PANDOC=$1
|
||||||
|
DIR=$2
|
||||||
|
|
||||||
|
$PANDOC --version > /dev/null || { echo "pandoc executable error" >&2 ; exit 1 ; }
|
||||||
|
|
||||||
|
ls $2 | egrep "^.+\.[0-9]$" | while read f ; do
|
||||||
|
FILE="$DIR/$f"
|
||||||
|
$PANDOC -f man -t native < $FILE > /dev/null
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Failed to convert $FILE"
|
||||||
|
fi
|
||||||
|
done
|
Loading…
Add table
Reference in a new issue