From 3346ee504d87b690135176bebeecf513a150d2a5 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 30 Jan 2011 16:05:30 +0000 Subject: Implement the \N'number' (numbered character) roff escape sequence. Don't use it in new manuals, it is inherently non-portable, but we need it for backward-compatibility with existing manuals, for example in Xenocara driver pages. ok kristaps@ matthieu@ jmc@ --- usr.bin/mandoc/term.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'usr.bin/mandoc/term.c') diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c index e2d136a1cca..3544fd4d603 100644 --- a/usr.bin/mandoc/term.c +++ b/usr.bin/mandoc/term.c @@ -1,7 +1,7 @@ -/* $Id: term.c,v 1.55 2011/01/04 22:28:17 schwarze Exp $ */ +/* $Id: term.c,v 1.56 2011/01/30 16:05:29 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons - * Copyright (c) 2010 Ingo Schwarze + * Copyright (c) 2010, 2011 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -348,6 +348,17 @@ term_vspace(struct termp *p) } +static void +numbered(struct termp *p, const char *word, size_t len) +{ + const char *rhs; + + rhs = chars_num2char(word, len); + if (rhs) + encode(p, rhs, 1); +} + + static void spec(struct termp *p, enum roffdeco d, const char *word, size_t len) { @@ -507,6 +518,9 @@ term_word(struct termp *p, const char *word) word += a2roffdeco(&deco, &seq, &ssz); switch (deco) { + case (DECO_NUMBERED): + numbered(p, seq, ssz); + break; case (DECO_RESERVED): res(p, seq, ssz); break; -- cgit v1.2.3