From 7d6ea069526ea719872eb410ab17b503d56501f3 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 14 May 2018 18:42:32 -0400 Subject: [PATCH] Emit .RS 4 instead of .RS 4, remove extra RE Fixes https://todo.sr.ht/~sircmpwn/scdoc/8 --- src/main.c | 7 +++---- test/indent | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) create mode 100755 test/indent diff --git a/src/main.c b/src/main.c index 3431ecf..524a858 100644 --- a/src/main.c +++ b/src/main.c @@ -169,7 +169,7 @@ static int parse_indent(struct parser *p, int *indent, bool write) { roff_macro(p, "RE", NULL); } } else if (i == *indent + 1) { - roff_macro(p, "RS", "4", NULL); + fprintf(p->output, ".RS 4\n"); } else if (i != *indent && ch == '\t') { parser_fatal(p, "Indented by an amount greater than 1"); } @@ -179,7 +179,7 @@ static int parse_indent(struct parser *p, int *indent, bool write) { } static void list_header(struct parser *p, int *num) { - roff_macro(p, "RS", "4", NULL); + fprintf(p->output, ".RS 4\n"); fprintf(p->output, ".ie n \\{\\\n"); if (*num == -1) { fprintf(p->output, "\\h'-0%d'%s\\h'+03'\\c\n", @@ -252,7 +252,7 @@ static void parse_literal(struct parser *p, int *indent) { } int stops = 0; roff_macro(p, "nf", NULL); - roff_macro(p, "RS", "4", NULL); + fprintf(p->output, ".RS 4\n"); do { int _indent = *indent; parse_indent(p, &_indent, false); @@ -479,7 +479,6 @@ commit_table: roff_macro(p, "TE", NULL); fprintf(p->output, ".sp 1\n"); - roff_macro(p, "RE", NULL); } static void parse_document(struct parser *p) { diff --git a/test/indent b/test/indent new file mode 100755 index 0000000..087e30c --- /dev/null +++ b/test/indent @@ -0,0 +1,21 @@ +#!/bin/sh +. test/lib.sh + +begin "Indents indented text" +scdoc </dev/null +test(8) + +Not indented + Indented one level +EOF +end 0 + +begin "Deindents following indented text" +scdoc </dev/null +test(8) + +Not indented + Indented one level +Not indented +EOF +end 0