public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: Petr Machata <pmachata@redhat.com>
Cc: Andrew Cagney <cagney@redhat.com>, frysk <frysk@sourceware.org>
Subject: Re: Put refpurposes one line for easy manpage generation.
Date: Fri, 04 Apr 2008 09:16:00 -0000	[thread overview]
Message-ID: <1207297907.3417.3.camel@cc1341701-a.deven1.ov.home.nl> (raw)
In-Reply-To: <20080403222914.GA25866@hridell.englab.brq.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1431 bytes --]

Hi Petr,

On Fri, 2008-04-04 at 00:29 +0200, Petr Machata wrote:
> While I agree xslt is the proper way, I also immediately know the sed
> syntax.

Nice! That works like a charm. I even changed a couple of files to have
the tag embedded in other tags on the same line and split over several
lines to test it out. All looks fine:
http://sourceware.org/frysk/manpages.

Committed as follows:

    frysk-common/ChangeLog
    2008-04-04  Mark Wielaard  <mwielaard@redhat.com>
            Petr Machata <pmachata@redhat.com>
    
        * frysk.xml: Split refpurpose tag over multiple lines.
        * manpages.sh (refpurposegrep): New.
        (suffix): Use refpurposegrep.
    
    frysk-core/frysk/bindir/ChangeLog
    2008-04-04  Mark Wielaard  <mwielaard@redhat.com>
    
        * fdebuginfo.xml: Put refpurpose tag on multiple lines.
        * fexe.xml: Likewise.
        * fmaps.xml: Likewise.
    
    frysk-core/frysk/pkglibdir/ChangeLog
    2008-04-04  Mark Wielaard  <mwielaard@redhat.com>
    
        * funit-exit.xml: Put refpurpose tag on multiple lines.
        * fparser.xml: Likewise.
    
    frysk-sys/frysk/pkglibdir/ChangeLog
    2008-04-04  Mark Wielaard  <mwielaard@redhat.com>
    
        * funit-procmask.xml: Put refpurpose tag on multiple lines.
    
    frysk-top/ChangeLog
    2008-04-04  Mark Wielaard  <mwielaard@redhat.com>
    
        * Makefile.am (manpages): Clarify error message.

Cheers,

Mark

[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 5147 bytes --]

diff --git a/frysk-common/frysk.xml b/frysk-common/frysk.xml
index 404b014..8991af9 100644
--- a/frysk-common/frysk.xml
+++ b/frysk-common/frysk.xml
@@ -62,7 +62,8 @@
 
   <refnamediv>
     <refname>frysk</refname>
-    <refpurpose>The Frysk Debugging, Tracing, and Monitoring Tool Suite</refpurpose>
+    <refpurpose>The Frysk Debugging, Tracing, and Monitoring
+                Tool Suite</refpurpose>
   </refnamediv>
   
   <refsect1>
diff --git a/frysk-common/manpages.sh b/frysk-common/manpages.sh
index ac0c0b6..c41513a 100755
--- a/frysk-common/manpages.sh
+++ b/frysk-common/manpages.sh
@@ -57,6 +57,24 @@ sed -n < ${template} \
 
 # Generate the body for the man pages.
 
+refpurposegrep=$(cat << EOF
+/<refpurpose>/{
+ :loop
+   /<\/refpurpose>/b break
+   N
+   b loop
+
+ :break
+   s,^.*<refpurpose>,,
+   s,</refpurpose>.*$,,
+   s,\(^[[:space:]]*\|[[:space:]]*$\),,g
+   s,[[:space:]]\+, ,g
+   p
+   q
+}
+EOF
+)
+
 suffix=
 for xmlfile in "$@" ; do
     if expr x"${xmlfile}" : "x-" > /dev/null ; then
@@ -84,7 +102,7 @@ EOF
 <li><tt><a href="${name}.${n}.html">${name}.${n}</a></tt>
 EOF
 	# Catch empty (aka not on one line) refpurpose tags.
-	desc=$(sed -n 's/<refpurpose>\(.*\)<\/refpurpose>/\1/ p' $xmlfile)
+	desc=$(sed -n "$refpurposegrep" $xmlfile)
 	if test -z "$desc"; then exit 1; fi
 	echo "$desc"
 	echo "</li>"
diff --git a/frysk-core/frysk/bindir/fdebuginfo.xml b/frysk-core/frysk/bindir/fdebuginfo.xml
index 3798c06..8f88f0b 100644
--- a/frysk-core/frysk/bindir/fdebuginfo.xml
+++ b/frysk-core/frysk/bindir/fdebuginfo.xml
@@ -70,7 +70,8 @@
 
   <refnamediv>
     <refname>fdebuginfo</refname>
-    <refpurpose>display the debug-info paths for a process and its shared modules</refpurpose>
+    <refpurpose>display the debug-info paths for a process
+                and its shared modules</refpurpose>
   </refnamediv>
   
   <refsynopsisdiv>
diff --git a/frysk-core/frysk/bindir/ferror.xml b/frysk-core/frysk/bindir/ferror.xml
index 6d4bc90..b8742b6 100644
--- a/frysk-core/frysk/bindir/ferror.xml
+++ b/frysk-core/frysk/bindir/ferror.xml
@@ -70,7 +70,8 @@
 
   <refnamediv>
     <refname>ferror</refname>
-    <refpurpose>print a stack trace when the given message is printed by the traced program</refpurpose>
+    <refpurpose>print a stack trace when the given message is printed
+                by the traced program</refpurpose>
   </refnamediv>
   
   <refsynopsisdiv>
diff --git a/frysk-core/frysk/bindir/fmaps.xml b/frysk-core/frysk/bindir/fmaps.xml
index 692967e..de7a3dd 100644
--- a/frysk-core/frysk/bindir/fmaps.xml
+++ b/frysk-core/frysk/bindir/fmaps.xml
@@ -69,9 +69,8 @@
   </refmeta>
 
   <refnamediv>
-    <refname>fmaps</refname>
-    <refpurpose>print the process or a corefile's address maps.</refpurpose>
-  </refnamediv>
+    <refname>fmaps</refname><refpurpose>print the process or a corefile's
+                                        address maps</refpurpose></refnamediv>
   
   <refsynopsisdiv>
     <cmdsynopsis>
diff --git a/frysk-core/frysk/pkglibdir/fparser.xml b/frysk-core/frysk/pkglibdir/fparser.xml
index 3635e45..352e330 100644
--- a/frysk-core/frysk/pkglibdir/fparser.xml
+++ b/frysk-core/frysk/pkglibdir/fparser.xml
@@ -62,7 +62,8 @@
 
   <refnamediv>
     <refname>fparser</refname>
-    <refpurpose>Runs the frysk standalone source code parser utility.</refpurpose>
+    <refpurpose>runs the frysk standalone source code parser
+                utility</refpurpose>
   </refnamediv>
   
   <refsynopsisdiv>
diff --git a/frysk-core/frysk/pkglibdir/funit-exit.xml b/frysk-core/frysk/pkglibdir/funit-exit.xml
index d420b15..513ab11 100644
--- a/frysk-core/frysk/pkglibdir/funit-exit.xml
+++ b/frysk-core/frysk/pkglibdir/funit-exit.xml
@@ -62,7 +62,8 @@
 
   <refnamediv>
     <refname>funit-exit</refname>
-    <refpurpose>exits with specified status, or terminates with the specified signal</refpurpose>
+    <refpurpose>exits with specified status,
+                or terminates with the specified signal</refpurpose>
   </refnamediv>
   
   <refsynopsisdiv>
diff --git a/frysk-sys/frysk/pkglibdir/funit-procmask.xml b/frysk-sys/frysk/pkglibdir/funit-procmask.xml
index add4d7b..9e82450 100644
--- a/frysk-sys/frysk/pkglibdir/funit-procmask.xml
+++ b/frysk-sys/frysk/pkglibdir/funit-procmask.xml
@@ -62,7 +62,8 @@
 
   <refnamediv>
     <refname>funit-procmask</refname>
-    <refpurpose>Test the processes signal mask for the presence (or absence) of a list if signals</refpurpose>
+    <refpurpose>test the processes signal mask for the presence
+                (or absence) of a list if signals</refpurpose>
   </refnamediv>
   
   <refsynopsisdiv>
diff --git a/frysk-top/Makefile.am b/frysk-top/Makefile.am
index 9f6a8c8..5a95c67 100644
--- a/frysk-top/Makefile.am
+++ b/frysk-top/Makefile.am
@@ -89,7 +89,7 @@ manpages manpages/index.html:
 		$(srcdir)/frysk-gui/frysk/bindir/*.xml \
 		-"Test framework" \
 		$(srcdir)/*/frysk/pkglibdir/*.xml \
-	    || (echo "Bad [not on one line] refpurpose tag found."; exit 1)
+	    || (echo "Bad xml file or no refpurpose tag found."; exit 1)
 	mv manpages/index.new manpages/index.html
 \f
 # Generate JAVADOC documentation.

      reply	other threads:[~2008-04-04  8:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-03 14:10 Mark Wielaard
2008-04-03 14:25 ` Andrew Cagney
2008-04-03 14:40   ` Mark Wielaard
2008-04-03 21:03     ` Andrew Cagney
2008-04-03 21:11       ` Mark Wielaard
2008-04-04  8:32         ` Petr Machata
2008-04-04  9:16           ` Mark Wielaard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1207297907.3417.3.camel@cc1341701-a.deven1.ov.home.nl \
    --to=mark@klomp.org \
    --cc=cagney@redhat.com \
    --cc=frysk@sourceware.org \
    --cc=pmachata@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).