summaryrefslogtreecommitdiffstats
path: root/mandoc.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-06-02 19:21:23 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-06-02 19:21:23 +0000
commitbfb452504d8b3a8d83033a92009dcdba6370788c (patch)
tree8f12de603ba3eae6da0c83f0cac8c59ede05373a /mandoc.c
parent341cc10aaf00ff009f89041f23ec4e6e6519285e (diff)
downloadmandoc-bfb452504d8b3a8d83033a92009dcdba6370788c.tar.gz
Partial implementation of \h (horizontal line drawing function).
A full implementation would require access to output device properties and state variables (both only available after the main parser has finalized the parse tree) before numerical expansions in the roff preprocessor (i.e., before the main parser is even started). Not trying to pull that stunt right now because the static-width implementation committed here is sufficient for tcl-style manual pages and already more complicated than i would have suspected.
Diffstat (limited to 'mandoc.c')
-rw-r--r--mandoc.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/mandoc.c b/mandoc.c
index 03c25e0d..5f57801d 100644
--- a/mandoc.c
+++ b/mandoc.c
@@ -1,7 +1,7 @@
/* $Id$ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2011-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -175,7 +175,17 @@ mandoc_escape(const char **end, const char **start, int *sz)
++*end;
return ESCAPE_ERROR;
}
- gly = (*start)[-1] == 'h' ? ESCAPE_HORIZ : ESCAPE_IGNORE;
+ switch ((*start)[-1]) {
+ case 'h':
+ gly = ESCAPE_HORIZ;
+ break;
+ case 'l':
+ gly = ESCAPE_HLINE;
+ break;
+ default:
+ gly = ESCAPE_IGNORE;
+ break;
+ }
term = **start;
*start = ++*end;
break;