From 10f3a00d861cfb57a65a3ac5333f33534d1f332e Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 21 May 2004 13:25:07 +0000 Subject: [PATCH] Continuation lines --- recctrl/danbibr.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/recctrl/danbibr.c b/recctrl/danbibr.c index 1b160af..ab0df34 100644 --- a/recctrl/danbibr.c +++ b/recctrl/danbibr.c @@ -1,4 +1,4 @@ -/* $Id: danbibr.c,v 1.1 2004-05-21 11:58:56 adam Exp $ +/* $Id: danbibr.c,v 1.2 2004-05-21 13:25:07 adam Exp $ Copyright (C) 2004 Index Data Aps @@ -86,6 +86,8 @@ static data1_node *mk_tree(struct grs_read_info *p, const char *rec_buf) data1_node *root = data1_mk_root(p->dh, p->mem, "danbib"); const char *cp = rec_buf; + root = data1_mk_tag(p->dh, p->mem, "danbib", 0, root); + if (1) /* all */ { data1_node *text_node = data1_mk_tag(p->dh, p->mem, "text", 0, root); @@ -100,7 +102,7 @@ static data1_node *mk_tree(struct grs_read_info *p, const char *rec_buf) cp++; continue; } - if (*cp == ' ') /* continuation */ + else if (*cp == ' ') /* bad continuation */ { while (*cp && *cp != '\n') cp++; @@ -151,8 +153,23 @@ static data1_node *mk_tree(struct grs_read_info *p, const char *rec_buf) data1_mk_tag_n(p->dh, p->mem, cp, 1, 0, tag_node); cp++; start_text = cp; - while (*cp && *cp != '\n'&& *cp != '*') - cp++; + while (*cp) + { + if (*cp == '\n' && cp[1] == ' ') + { + cp++; + if (start_text != cp) + data1_mk_text_n(p->dh, p->mem, start_text, + cp-start_text, sub_tag_node); + while (*cp == ' ') + cp++; + start_text = cp; + } + else if (*cp == '\n') + break; + else + cp++; + } if (start_text != cp) data1_mk_text_n(p->dh, p->mem, start_text, cp-start_text, sub_tag_node); -- 1.7.10.4