mkdio.c (discount-2.2.3a.tar.bz2) | : | mkdio.c (discount-2.2.4.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 74 | skipping to change at line 74 | |||
p->flags |= PIPECHAR; | p->flags |= PIPECHAR; | |||
EXPAND(p->text) = c; | EXPAND(p->text) = c; | |||
++xp; | ++xp; | |||
} | } | |||
} | } | |||
EXPAND(p->text) = 0; | EXPAND(p->text) = 0; | |||
S(p->text)--; | S(p->text)--; | |||
p->dle = mkd_firstnonblank(p); | p->dle = mkd_firstnonblank(p); | |||
} | } | |||
/* trim leading blanks from a header line | /* trim leading characters from a line, then adjust the dle. | |||
*/ | */ | |||
void | void | |||
__mkd_header_dle(Line *p) | __mkd_trim_line(Line *p, int clip) | |||
{ | { | |||
CLIP(p->text, 0, 1); | if ( clip >= S(p->text) ) | |||
p->dle = mkd_firstnonblank(p); | S(p->text) = p->dle = 0; | |||
else if ( clip > 0 ) { | ||||
CLIP(p->text, 0, clip); | ||||
p->dle = mkd_firstnonblank(p); | ||||
} | ||||
} | } | |||
/* build a Document from any old input. | /* build a Document from any old input. | |||
*/ | */ | |||
typedef int (*getc_func)(void*); | typedef int (*getc_func)(void*); | |||
Document * | Document * | |||
populate(getc_func getc, void* ctx, int flags) | populate(getc_func getc, void* ctx, int flags) | |||
{ | { | |||
Cstring line; | Cstring line; | |||
skipping to change at line 128 | skipping to change at line 132 | |||
DELETE(line); | DELETE(line); | |||
if ( (pandoc == 3) && !(flags & (MKD_NOHEADER|MKD_STRICT)) ) { | if ( (pandoc == 3) && !(flags & (MKD_NOHEADER|MKD_STRICT)) ) { | |||
/* the first three lines started with %, so we have a header. | /* the first three lines started with %, so we have a header. | |||
* clip the first three lines out of content and hang them | * clip the first three lines out of content and hang them | |||
* off header. | * off header. | |||
*/ | */ | |||
Line *headers = T(a->content); | Line *headers = T(a->content); | |||
a->title = headers; __mkd_header_dle(a->title); | a->title = headers; __mkd_trim_line(a->title, 1); | |||
a->author= headers->next; __mkd_header_dle(a->author); | a->author= headers->next; __mkd_trim_line(a->author, 1); | |||
a->date = headers->next->next; __mkd_header_dle(a->date); | a->date = headers->next->next; __mkd_trim_line(a->date, 1); | |||
T(a->content) = headers->next->next->next; | T(a->content) = headers->next->next->next; | |||
} | } | |||
return a; | return a; | |||
} | } | |||
/* convert a file into a linked list | /* convert a file into a linked list | |||
*/ | */ | |||
Document * | Document * | |||
End of changes. 4 change blocks. | ||||
7 lines changed or deleted | 11 lines changed or added |