From 1be9861064bb6392dca44712e96c14fb63fb6f22 Mon Sep 17 00:00:00 2001 From: David Parsons Date: Thu, 21 Oct 2010 21:10:24 -0700 Subject: [PATCH] Redo the superscript and relaxed emphasis flags into NOSUPERSCRIPT and NORELAXED, so the default is to have them turned on and you need to turn them off (or do STRICT) explicitly. --- generate.c | 12 ++++++------ main.c | 2 ++ markdown.h | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/generate.c b/generate.c index 61d3e31..870e946 100644 --- a/generate.c +++ b/generate.c @@ -1137,9 +1137,9 @@ text(MMIOT *f) Qchar(c, f); break; /* A^B -> AB */ - case '^': if ( !(f->flags & MKD_SUPERSCRIPT) || - (f->flags & (STRICT|INSIDE_TAG)) || isthisspace(f,-1) - || isthisspace(f,1) ) + case '^': if ( (f->flags & (MKD_NOSUPERSCRIPT|STRICT|INSIDE_TAG)) + || isthisspace(f,-1) + || isthisspace(f,1) ) Qchar(c,f); else { char *sup = cursor(f); @@ -1155,9 +1155,9 @@ text(MMIOT *f) break; case '_': /* Underscores don't count if they're in the middle of a word */ - if ( (f->flags & MKD_RELAXED) && !(f->flags & STRICT) - && isthisalnum(f,-1) - && isthisalnum(f,1) ) { + if ( (f->flags & (MKD_NORELAXED|STRICT)) + && isthisalnum(f,-1) + && isthisalnum(f,1) ) { Qchar(c, f); break; } diff --git a/main.c b/main.c index fcde68a..6dfd5e4 100644 --- a/main.c +++ b/main.c @@ -58,6 +58,8 @@ static struct { { "safelink",0, MKD_SAFELINK }, { "del", 1, MKD_NOSTRIKETHROUGH }, { "strikethrough", 1, MKD_NOSTRIKETHROUGH }, + { "superscript", 1, MKD_NOSUPERSCRIPT }, + { "emphasis", 0, MKD_NORELAXED }, { "1.0", 0, MKD_1_COMPAT }, } ; diff --git a/markdown.h b/markdown.h index be553c6..025dc6c 100644 --- a/markdown.h +++ b/markdown.h @@ -85,8 +85,8 @@ typedef struct mmiot { #define INSIDE_TAG 0x00000020 #define NO_PSEUDO_PROTO 0x00000040 #define CDATA_OUTPUT 0x00000080 -#define MKD_SUPERSCRIPT 0x00000100 -#define MKD_RELAXED 0x00000200 +#define MKD_NOSUPERSCRIPT 0x00000100 +#define MKD_NORELAXED 0x00000200 #define NOTABLES 0x00000400 #define NOSTRIKETHROUGH 0x00000800 #define TOC 0x00001000