=================================================================== RCS file: /cvs/docbook2mdoc/parse.c,v retrieving revision 1.6 retrieving revision 1.8 diff -u -p -r1.6 -r1.8 --- docbook2mdoc/parse.c 2019/03/28 15:05:40 1.6 +++ docbook2mdoc/parse.c 2019/04/02 13:11:09 1.8 @@ -1,4 +1,4 @@ -/* $Id: parse.c,v 1.6 2019/03/28 15:05:40 schwarze Exp $ */ +/* $Id: parse.c,v 1.8 2019/04/02 13:11:09 schwarze Exp $ */ /* * Copyright (c) 2014 Kristaps Dzonsons * Copyright (c) 2019 Ingo Schwarze @@ -73,6 +73,7 @@ static const struct element elements[] = { { "colspec", NODE_COLSPEC }, { "command", NODE_COMMAND }, { "constant", NODE_CONSTANT }, + { "contrib", NODE_CONTRIB }, { "copyright", NODE_COPYRIGHT }, { "date", NODE_DATE }, { "editor", NODE_EDITOR }, @@ -82,7 +83,7 @@ static const struct element elements[] = { { "envar", NODE_ENVAR }, { "fieldsynopsis", NODE_FIELDSYNOPSIS }, { "filename", NODE_FILENAME }, - { "firstname", NODE_IGNORE }, + { "firstname", NODE_PERSONNAME }, { "firstterm", NODE_FIRSTTERM }, { "footnote", NODE_FOOTNOTE }, { "funcdef", NODE_FUNCDEF }, @@ -122,7 +123,7 @@ static const struct element elements[] = { { "option", NODE_OPTION }, { "orderedlist", NODE_ORDEREDLIST }, { "orgname", NODE_ORGNAME }, - { "othername", NODE_IGNORE }, + { "othername", NODE_PERSONNAME }, { "para", NODE_PARA }, { "paramdef", NODE_PARAMDEF }, { "parameter", NODE_PARAMETER }, @@ -164,7 +165,7 @@ static const struct element elements[] = { { "spanspec", NODE_SPANSPEC }, { "structname", NODE_STRUCTNAME }, { "subtitle", NODE_SUBTITLE }, - { "surname", NODE_IGNORE }, + { "surname", NODE_PERSONNAME }, { "synopsis", NODE_SYNOPSIS }, { "table", NODE_TABLE }, { "tbody", NODE_TBODY }, @@ -521,6 +522,7 @@ struct ptree * parse_file(struct parse *p, int fd, const char *fname) { char b[4096]; + char *cp; ssize_t rsz; /* Return value from read(2). */ size_t rlen; /* Number of bytes in b[]. */ size_t poff; /* Parse offset in b[]. */ @@ -646,6 +648,29 @@ parse_file(struct parse *p, int fd, const char *fname) if (advance(p, b, rlen, &pend, " >") && rsz > 0) break; + if (pend > poff + 3 && + strncmp(b + poff, ""); + if (cp == NULL) { + if (rsz > 0) { + pend = rlen; + break; + } + cp = b + rlen; + } else + cp += 3; + while (b + pend < cp) { + if (b[++pend] == '\n') { + p->nline++; + p->ncol = 1; + } else + p->ncol++; + } + continue; + } elem_end = 0; if (b[pend] != '>') in_tag = 1;