[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 02/38: [mdoc]: Trivially refactor.
From: |
G. Branden Robinson |
Subject: |
[groff] 02/38: [mdoc]: Trivially refactor. |
Date: |
Fri, 2 Sep 2022 19:56:29 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit d88e98649a05c9efdf59a0cc0faa01a94a504f98
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Aug 25 08:25:02 2022 -0500
[mdoc]: Trivially refactor.
* tmac/mdoc/doc-common:
* tmac/mdoc/doc-ditroff:
* tmac/mdoc/doc-nroff: Stop using "Null" as an empty string indicator
when comparing a string interpolation to an empty parameter will serve
just as well; it is also more idiomatic. The string in question,
`doc-section`, is never formatted if it is empty anyway; the very
tests at issue, which populate `doc-header-string`, ensure this.
---
ChangeLog | 13 +++++++++++++
tmac/mdoc/doc-common | 4 ++--
tmac/mdoc/doc-ditroff | 2 +-
tmac/mdoc/doc-nroff | 2 +-
4 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b28215690..633a905f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2022-08-25 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ [mdoc]: Trivially refactor.
+
+ * tmac/mdoc/doc-common:
+ * tmac/mdoc/doc-ditroff:
+ * tmac/mdoc/doc-nroff: Stop using "Null" as an empty string
+ indicator when comparing a string interpolation to an empty
+ parameter will serve just as well; it is also more idiomatic.
+ The string in question, `doc-section`, is never formatted if it
+ is empty anyway; the very tests at issue, which populate
+ `doc-header-string`, ensure this.
+
2022-08-23 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/env.cpp (environment::set_family): Throw error
diff --git a/tmac/mdoc/doc-common b/tmac/mdoc/doc-common
index e289826e5..9a019e7e0 100644
--- a/tmac/mdoc/doc-common
+++ b/tmac/mdoc/doc-common
@@ -209,7 +209,7 @@
.\" NS doc-section global string
.\" NS the manual section
.
-.ds doc-section Null
+.ds doc-section \" empty
.
.
.\" NS Dt user macro (not parsed, not callable)
@@ -344,7 +344,7 @@
. \" reset default arguments
. ds doc-document-title UNTITLED
. ds doc-volume LOCAL
-. ds doc-section Null
+. ds doc-section \" empty
. ds doc-command-name
.
. if !"\$1"" \
diff --git a/tmac/mdoc/doc-ditroff b/tmac/mdoc/doc-ditroff
index 41cb61e9d..c51ba030f 100644
--- a/tmac/mdoc/doc-ditroff
+++ b/tmac/mdoc/doc-ditroff
@@ -194,7 +194,7 @@
.eo
.de doc-setup-header
. ds doc-header-string "\*[doc-document-title]
-. if !"\*[doc-section]"Null" \
+. if !"\*[doc-section]"" \
. as doc-header-string \|(\*[doc-section])
.
. br
diff --git a/tmac/mdoc/doc-nroff b/tmac/mdoc/doc-nroff
index dcfcb1abb..0136d67df 100644
--- a/tmac/mdoc/doc-nroff
+++ b/tmac/mdoc/doc-nroff
@@ -198,7 +198,7 @@
.eo
.de doc-setup-header
. ds doc-header-string "\*[doc-document-title]
-. if !"\*[doc-section]"Null" \
+. if !"\*[doc-section]"" \
. as doc-header-string (\*[doc-section])
.
. br
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 02/38: [mdoc]: Trivially refactor.,
G. Branden Robinson <=