version 1.30, 2011/12/09 01:21:10 |
version 1.31, 2011/12/09 11:16:34 |
Line 1288 pformatted(DB *hash, struct buf *buf, struct buf *dbuf |
|
Line 1288 pformatted(DB *hash, struct buf *buf, struct buf *dbuf |
|
buf_append(buf, of->title); |
buf_append(buf, of->title); |
hash_put(hash, buf, TYPE_Nm); |
hash_put(hash, buf, TYPE_Nm); |
|
|
/* Skip to first blank line. */ |
/* Skip to first blank line. */ |
|
|
while (NULL != (line = fgetln(stream, &len))) |
while (NULL != (line = fgetln(stream, &len))) |
if (len && '\n' == *line) |
if ('\n' == *line) |
break; |
break; |
|
|
/* |
/* |
* Skip to first section header. |
* Assume the first line that is not indented |
* This happens when text is flush-left. |
* is the first section header. Skip to it. |
*/ |
*/ |
|
|
while (NULL != (line = fgetln(stream, &len))) |
while (NULL != (line = fgetln(stream, &len))) |
if (len && '\n' != *line && ' ' != *line) |
if ('\n' != *line && ' ' != *line) |
break; |
break; |
|
|
/* |
/* |
* If no page content can be found or the input line is |
* If no page content can be found, or the input line |
* malformed (zer-length or has no trailing newline), reuse the |
* is already the next section header, or there is no |
* page title as the page description. |
* trailing newline, reuse the page title as the page |
|
* description. |
*/ |
*/ |
|
|
line = fgetln(stream, &len); |
line = fgetln(stream, &len); |
if (NULL == line || len == 0 || '\n' != line[(int)len - 1]) { |
if (NULL == line || ' ' != *line || '\n' != line[(int)len - 1]) { |
buf_appendb(dbuf, buf->cp, buf->size); |
buf_appendb(dbuf, buf->cp, buf->size); |
hash_put(hash, buf, TYPE_Nd); |
hash_put(hash, buf, TYPE_Nd); |
fclose(stream); |
fclose(stream); |
Line 1319 pformatted(DB *hash, struct buf *buf, struct buf *dbuf |
|
Line 1320 pformatted(DB *hash, struct buf *buf, struct buf *dbuf |
|
|
|
line[(int)--len] = '\0'; |
line[(int)--len] = '\0'; |
|
|
/* |
/* |
* Skip to the last dash. |
* Skip to the first dash. |
* Use the remaining line as the description (no more than 70 |
* Use the remaining line as the description (no more than 70 |
* bytes). |
* bytes). |
*/ |
*/ |