Skip to contentSkip to conversation

Fix multi-paragraph list items in OPTIONS section

PATCH New Jonas Fonseca 1 participant 1 message Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix multi-paragraph list items in OPTIONS section

Asciidoc cannot handle multi-paragraph description list items without the need for adding special control characters and reindenting all paragraphs but the first. Workaround it in make-cg-asciidoc so that the documentation in the script headers can use the more intuitive and readable formatting.

Affected files are cg-patch and cg-commit.

---

 Documentation/make-cg-asciidoc |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)
Documentation/make-cg-asciidoc +24 -1
index 126d4eb..c454062 100755
@@ -112,8 +112,31 @@ $DESCRIPTION
 
 OPTIONS
 -------
-$OPTIONS
+
+--
+__END__
+
+# Only indent the first paragraph of multi-paragraph list items.
+multipara=
+echo "$OPTIONS" | while read line; do
+	case "$line" in
+	*::)
+		multipara=
+		;;
+	"")
+		multipara=t
+		;;
+	*)
+		[ "$multipara" ] || line="	$line"
+	esac
+
+	echo "$line"
+done
+
+cat <<__END__
+
 $HELP_OPTIONS
+--
 
 $MISC
 
Signature · 1 line
Jonas Fonseca