chiark / gitweb /
Split template docs out to disorder_templates(5)
[disorder] / scripts / macro-docs
index 30ad91fa76e656a862f0df0784d29beaf32aba0d..84f1f42e33f890ea43f18a8ee799be1146e60d5a 100755 (executable)
@@ -27,6 +27,7 @@ while(defined($_ = <>)) {
 }
 
 # Generate docs in name order
+my $indented = 0;
 for my $m (sort keys %macros) {
   my @docs = @{$macros{$m}};
   my $heading = shift @docs;
@@ -40,17 +41,38 @@ for my $m (sort keys %macros) {
   print ".TP\n";
   print ".B $heading\n";
   for my $d (@docs) {
+    if($d =~ /^-\s*([^:]+):\s+(.*)/) {
+      if(!$indented) {
+       print ".RS\n";
+       $indented = 1;
+      }
+      print ".TP 8\n";
+      print ".B $1\n";
+      $d = $2;
+    }
     if($d =~ /^- /) {
       $d = $';
+      if(!$indented) {
+       print ".RS\n";
+       $indented = 1;
+      }
       print ".TP\n";
       print ".B .\n";
     }
     if($d eq '') {
-      print ".PP\n";
+      if($indented) {
+       print ".RE\n";
+       $indented = 0;
+      }
+      print ".IP\n";
     } else {
       # Keep sentence-ending full stops at end of line
       $d =~ s/\.  /\.\n/g;
       print "$d\n";
     }
   }
+  if($indented) {
+    print ".RE\n";
+    $indented = 0;
+  }
 }