Fix dashes in preamable

Fixes https://todo.sr.ht/~sircmpwn/scdoc/9
master
Drew DeVault 7 years ago
parent 9744a539ab
commit a3a853c548
  1. 2
      src/main.c
  2. 8
      test/preamble

@ -47,7 +47,7 @@ static void parse_preamble(struct parser *p) {
struct tm *now_tm = localtime(&now);
strftime(date, sizeof(date), "%F", now_tm);
while ((ch = parser_getch(p)) != UTF8_INVALID) {
if (ch < 0x80 && isalnum(ch)) {
if ((ch < 0x80 && isalnum(ch)) || ch == '_' || ch == '-') {
assert(str_append_ch(name, ch) != -1);
} else if (ch == '(') {
section = parse_section(p);

@ -15,7 +15,7 @@ end 1
begin "Expects name to alphanumeric"
scdoc <<EOF >/dev/null
____(8)
!!!!(8)
EOF
end 1
@ -42,3 +42,9 @@ scdoc <<EOF | grep '^\.TH "test" "8" "'"$(date +'%F')"'"' >/dev/null
test(8)
EOF
end 0
begin "Preserves dashes"
scdoc <<EOF | grep '^\.TH "test-manual" "8" "'"$(date +'%F')"'"' >/dev/null
test-manual(8)
EOF
end 0

Loading…
Cancel
Save