Description: Fix output of <screen> with <userinput>/<computeroutput>
 <screen> implies a verbatim environment but this was not respected
 if you use sub-elements like <userinput>/<computeroutput>.
 . 
 This patch improves Publican::XmlClean->my_as_XML() to look for
 the verbatim environmement in all ancestors instead of only the direct
 parent.
 .
 Furthermore within a <screen> it's expected that <userinput> is
 in bold while <computeroutput> is normal. This was overriden by
 Publican's xsl/pdf.xsl for some reason. To minimize disruption, I
 add a second override that restores the original behaviour when
 <computeroutput> is part of <screen>.
 .
 Upstream currently considers this to not be a bug. So this patch
 might stay as Debian specific for a while.
Author: Raphaël Hertzog <hertzog@debian.org>
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=752851

--- a/datadir/xsl/pdf.xsl
+++ b/datadir/xsl/pdf.xsl
@@ -1541,6 +1541,10 @@ Version:1.72
   <xsl:call-template name="inline.boldmonoseq"/>
 </xsl:template>
 
+<xsl:template match="screen/computeroutput">
+  <xsl:call-template name="inline.monoseq"/>
+</xsl:template>
+
 <xsl:template match="replaceable">
   <xsl:call-template name="inline.italicmonoseq"/>
 </xsl:template>
--- a/lib/Publican/XmlClean.pm
+++ b/lib/Publican/XmlClean.pm
@@ -822,10 +822,15 @@ sub my_as_XML {
             }
             else {    # it's just text
                 my $parent = $_[3];
+                my $is_verbatim = 0;
+                my $ancestor = $parent;
+                while ($ancestor && !$is_verbatim) {
+                    $is_verbatim = $MAP_OUT{ $ancestor->{'_tag'} }->{'verbatim'};
+                    $ancestor = $ancestor->parent();
+                }
 
                 # Remove extra space from non-verbatim tags
-                if ( $parent
-                    && !( $MAP_OUT{ $parent->{'_tag'} }->{verbatim} ) )
+                if (!$is_verbatim)
                 {
 
                   # Don't out put empty tags
