aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/eqn.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-06-21 18:38:26 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-06-21 18:38:26 +0000
commit7b4f4788463c868435c4b85cc729ff1e9ea56aae (patch)
tree61e9398f74041b29ac188acf3c735c716dfeb3f3 /eqn.c
parent6b9c3a191a96339a81695c0d1270020363b60c58 (diff)
downloadmandoc-7b4f4788463c868435c4b85cc729ff1e9ea56aae.tar.gz
mandoc-7b4f4788463c868435c4b85cc729ff1e9ea56aae.tar.zst
mandoc-7b4f4788463c868435c4b85cc729ff1e9ea56aae.zip
quoted words are not parsed for defined keys
Diffstat (limited to 'eqn.c')
-rw-r--r--eqn.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/eqn.c b/eqn.c
index 142922b0..8616c3ed 100644
--- a/eqn.c
+++ b/eqn.c
@@ -1,4 +1,4 @@
-/* $Id: eqn.c,v 1.64 2017/06/21 18:04:34 schwarze Exp $ */
+/* $Id: eqn.c,v 1.65 2017/06/21 18:38:26 schwarze Exp $ */
/*
* Copyright (c) 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -523,6 +523,14 @@ eqn_tok_parse(struct eqn_node *ep, char **p)
if (STRNEQ(start, sz, eqn_toks[i], strlen(eqn_toks[i])))
return i;
+ for (i = 0; i < EQNSYM__MAX; i++) {
+ if (STRNEQ(start, sz,
+ eqnsyms[i].str, strlen(eqnsyms[i].str))) {
+ mandoc_asprintf(p, "\\[%s]", eqnsyms[i].sym);
+ return EQN_TOK__MAX;
+ }
+ }
+
if (p != NULL)
*p = mandoc_strndup(start, sz);
@@ -713,7 +721,7 @@ eqn_parse(struct eqn_node *ep, struct eqn_box *parent)
struct eqn_box *cur;
const char *start;
char *p;
- size_t i, sz;
+ size_t sz;
enum eqn_tok tok, subtok;
enum eqn_post pos;
int size;
@@ -1097,17 +1105,8 @@ this_tok:
}
cur = eqn_box_alloc(ep, parent);
cur->type = EQN_TEXT;
- for (i = 0; i < EQNSYM__MAX; i++)
- if (0 == strcmp(eqnsyms[i].str, p)) {
- (void)snprintf(sym, sizeof(sym),
- "\\[%s]", eqnsyms[i].sym);
- cur->text = mandoc_strdup(sym);
- free(p);
- break;
- }
+ cur->text = p;
- if (i == EQNSYM__MAX)
- cur->text = p;
/*
* Post-process list status.
*/