version 1.18, 2017/05/04 17:48:29 |
version 1.22, 2017/05/30 16:31:29 |
|
|
#include <assert.h> |
#include <assert.h> |
#include <ctype.h> |
#include <ctype.h> |
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
|
#include <string.h> |
#include <string.h> |
|
|
#include "mandoc_aux.h" |
#include "mandoc_aux.h" |
Line 223 static const struct md_act __md_acts[MDOC_MAX - MDOC_D |
|
Line 222 static const struct md_act __md_acts[MDOC_MAX - MDOC_D |
|
{ md_cond_body, md_pre_En, md_post_En, NULL, NULL }, /* En */ |
{ md_cond_body, md_pre_En, md_post_En, NULL, NULL }, /* En */ |
{ NULL, NULL, NULL, NULL, NULL }, /* Dx */ |
{ NULL, NULL, NULL, NULL, NULL }, /* Dx */ |
{ NULL, NULL, md_post_pc, NULL, NULL }, /* %Q */ |
{ NULL, NULL, md_post_pc, NULL, NULL }, /* %Q */ |
{ NULL, md_pre_Pp, NULL, NULL, NULL }, /* sp */ |
|
{ NULL, md_pre_Lk, md_post_pc, NULL, NULL }, /* %U */ |
{ NULL, md_pre_Lk, md_post_pc, NULL, NULL }, /* %U */ |
{ NULL, NULL, NULL, NULL, NULL }, /* Ta */ |
{ NULL, NULL, NULL, NULL, NULL }, /* Ta */ |
{ NULL, NULL, NULL, NULL, NULL }, /* ll */ |
|
}; |
}; |
static const struct md_act *const md_acts = __md_acts - MDOC_Dd; |
static const struct md_act *const md_acts = __md_acts - MDOC_Dd; |
|
|
Line 323 md_node(struct roff_node *n) |
|
Line 320 md_node(struct roff_node *n) |
|
} else if (n->tok < ROFF_MAX) { |
} else if (n->tok < ROFF_MAX) { |
switch (n->tok) { |
switch (n->tok) { |
case ROFF_br: |
case ROFF_br: |
md_pre_br(n); |
process_children = md_pre_br(n); |
break; |
break; |
|
case ROFF_sp: |
|
process_children = md_pre_Pp(n); |
|
break; |
default: |
default: |
abort(); |
process_children = 0; |
|
break; |
} |
} |
} else { |
} else { |
assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX); |
assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX); |
Line 1305 md_uri(const char *s) |
|
Line 1306 md_uri(const char *s) |
|
static int |
static int |
md_pre_Lk(struct roff_node *n) |
md_pre_Lk(struct roff_node *n) |
{ |
{ |
const struct roff_node *link, *descr; |
const struct roff_node *link, *descr, *punct; |
|
|
if ((link = n->child) == NULL) |
if ((link = n->child) == NULL) |
return 0; |
return 0; |
|
|
|
/* Find beginning of trailing punctuation. */ |
|
punct = n->last; |
|
while (punct != link && punct->flags & NODE_DELIMC) |
|
punct = punct->prev; |
|
punct = punct->next; |
|
|
/* Link text. */ |
/* Link text. */ |
descr = link->next; |
descr = link->next; |
if (descr == NULL || descr->flags & NODE_DELIMC) |
if (descr == punct) |
descr = link; /* no text */ |
descr = link; /* no text */ |
md_rawword("["); |
md_rawword("["); |
outflags &= ~MD_spc; |
outflags &= ~MD_spc; |
do { |
do { |
md_word(descr->string); |
md_word(descr->string); |
descr = descr->next; |
descr = descr->next; |
} while (descr != NULL && !(descr->flags & NODE_DELIMC)); |
} while (descr != punct); |
outflags &= ~MD_spc; |
outflags &= ~MD_spc; |
|
|
/* Link target. */ |
/* Link target. */ |
Line 1329 md_pre_Lk(struct roff_node *n) |
|
Line 1336 md_pre_Lk(struct roff_node *n) |
|
md_rawword(")"); |
md_rawword(")"); |
|
|
/* Trailing punctuation. */ |
/* Trailing punctuation. */ |
while (descr != NULL) { |
while (punct != NULL) { |
md_word(descr->string); |
md_word(punct->string); |
descr = descr->next; |
punct = punct->next; |
} |
} |
return 0; |
return 0; |
} |
} |