X-Git-Url: https://git.cameronkatri.com/mandoc.git/blobdiff_plain/b810f6f611ea50a9e8b84277e8a2fab4a820d64c..be16c6b2869526a6cf4cb39790990d8632c7b2de:/mandoc.c diff --git a/mandoc.c b/mandoc.c index cd26ff29..0619420c 100644 --- a/mandoc.c +++ b/mandoc.c @@ -1,7 +1,7 @@ -/* $Id: mandoc.c,v 1.89 2014/12/15 17:30:30 schwarze Exp $ */ +/* $Id: mandoc.c,v 1.92 2015/02/20 23:55:10 schwarze Exp $ */ /* - * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons - * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze + * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons + * Copyright (c) 2011-2015 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 @@ -156,16 +156,18 @@ mandoc_escape(const char **end, const char **start, int *sz) /* FALLTHROUGH */ case 'D': /* FALLTHROUGH */ - case 'o': - /* FALLTHROUGH */ case 'R': /* FALLTHROUGH */ case 'X': /* FALLTHROUGH */ case 'Z': - if ('\0' == **start) - return(ESCAPE_ERROR); gly = ESCAPE_IGNORE; + /* FALLTHROUGH */ + case 'o': + if (**start == '\0') + return(ESCAPE_ERROR); + if (gly == ESCAPE_ERROR) + gly = ESCAPE_OVERSTRIKE; term = **start; *start = ++*end; break; @@ -225,7 +227,7 @@ mandoc_escape(const char **end, const char **start, int *sz) /* See +/- counts as a sign. */ if ('+' == **end || '-' == **end || ASCII_HYPH == **end) - (*end)++; + *start = ++*end; switch (**end) { case '(': @@ -240,6 +242,14 @@ mandoc_escape(const char **end, const char **start, int *sz) *start = ++*end; term = '\''; break; + case '3': + /* FALLTHROUGH */ + case '2': + /* FALLTHROUGH */ + case '1': + *sz = (*end)[-1] == 's' && + isdigit((unsigned char)(*end)[1]) ? 2 : 1; + break; default: *sz = 1; break;