aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libmdoc.h
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-03-22 14:05:45 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-03-22 14:05:45 +0000
commitb6591e91b037a5c71a68512372ea2da15154fe2f (patch)
treec96674dbcfbe48c6ed6f289d9f580bab9dab811f /libmdoc.h
parentbce51df74cd9c0cb090845736c5e6f8313d4fd6c (diff)
downloadmandoc-b6591e91b037a5c71a68512372ea2da15154fe2f.tar.gz
mandoc-b6591e91b037a5c71a68512372ea2da15154fe2f.tar.zst
mandoc-b6591e91b037a5c71a68512372ea2da15154fe2f.zip
Move mandoc_isdelim() back into libmdoc.h. This fixes an unreported
error where (1) -man pages were punctuating delimiters (e.g., `.B a ;') and where (2) standalone punctuation in -mdoc or -man (e.g., ";" on its own line) would also be punctuated. This introduces a small amount of complexity of mdoc_{html,term}.c must manage their own spacing with running print_word() or print_text(). The check for delimiting now happens in mdoc_macro.c's dword().
Diffstat (limited to 'libmdoc.h')
-rw-r--r--libmdoc.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/libmdoc.h b/libmdoc.h
index 9e3a3f55..1877212d 100644
--- a/libmdoc.h
+++ b/libmdoc.h
@@ -1,4 +1,4 @@
-/* $Id: libmdoc.h,v 1.69 2011/03/20 16:02:05 kristaps Exp $ */
+/* $Id: libmdoc.h,v 1.70 2011/03/22 14:05:45 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -80,6 +80,23 @@ enum margverr {
ARGV_WORD
};
+/*
+ * A punctuation delimiter is opening, closing, or "middle mark"
+ * punctuation. These govern spacing.
+ * Opening punctuation (e.g., the opening parenthesis) suppresses the
+ * following space; closing punctuation (e.g., the closing parenthesis)
+ * suppresses the leading space; middle punctuation (e.g., the vertical
+ * bar) can do either. The middle punctuation delimiter bends the rules
+ * depending on usage.
+ */
+enum mdelim {
+ DELIM_NONE = 0,
+ DELIM_OPEN,
+ DELIM_MIDDLE,
+ DELIM_CLOSE,
+ DELIM_MAX
+};
+
extern const struct mdoc_macro *const mdoc_macros;
__BEGIN_DECLS
@@ -126,6 +143,9 @@ enum margserr mdoc_zargs(struct mdoc *, int,
int mdoc_macroend(struct mdoc *);
+#define DELIMSZ 6 /* hint: max possible size of a delimiter */
+enum mdelim mdoc_isdelim(const char *);
+
__END_DECLS
#endif /*!LIBMDOC_H*/