+# text2...
+# dt_or_dd1...
+# dt_or_dd2...
+
+sub reorder_dt_and_dl ( $$$ )
+{ my ($he, $startflag) = (check_args(3, @_))[0,1]; # ignore depth argument
+ if (!$startflag)
+ { return; }
+
+ if ($he->tag() eq "p")
+ { my $ref_pcontent = $he->content();
+ if (defined $ref_pcontent)
+ { my @pcontent = @{$ref_pcontent};
+ # print "reorder_dt_and_dl found a \n"; $he->dump();
+ if ((scalar(@pcontent) >= 1)
+ && (ref $pcontent[0]) && ($pcontent[0]->tag() eq "dl")
+ && $pcontent[0]->implicit())
+ { my $ref_dlcontent = $pcontent[0]->content();
+ # print "reorder_dt_and_dl found a
and implicit
\n";
+ if (defined $ref_dlcontent)
+ { my @dlcontent = @{$ref_dlcontent};
+ if ((scalar(@dlcontent) >= 1)
+ && (ref $dlcontent[0]) && ($dlcontent[0]->tag() eq "dt"))
+ { my $ref_dtcontent = $dlcontent[0]->content();
+ # print "reorder_dt_and_dl found a , implicit
, and - \n";
+ if (defined $ref_dtcontent)
+ { my @dtcontent = @{$ref_dtcontent};
+ if ((scalar(@dtcontent) > 0)
+ && (ref $dtcontent[$#dtcontent])
+ && ($dtcontent[$#dtcontent]->tag() eq "dl"))
+ { my $ref_dl2content = $dtcontent[$#dtcontent]->content();
+ # print "reorder_dt_and_dl found a
, implicit
, - , and
\n";
+ if (defined $ref_dl2content)
+ { my @dl2content = @{$ref_dl2content};
+ if ((scalar(@dl2content) > 0)
+ && (ref ($dl2content[0]))
+ && ($dl2content[0]->tag() eq "dd"))
+ {
+ # print "reorder_dt_and_dl found a , implicit
, - ,
, and - \n";
+ # print STDERR "CHANGING\n"; $he->dump();
+ html_replace_by_ignore($dtcontent[$#dtcontent]);
+ splice(@{$ref_dlcontent}, 1, 0, @dl2content);
+ # print STDERR "CHANGED TO:\n"; $he->dump();
+ return 0; # don't traverse children
+ } } } } } } } } }
+ return 1;
+}
+
+
# If we find a paragraph that looks like
#
#
@@ -1668,3 +1746,5 @@ if (scalar(@ARGV) != 1)
{ die "Pass one argument, the main/contents page"; }
process_contents_file($ARGV[0]);
+
+# end of html2texi.pl