groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 01/01: groffer: add device/mode xhtml


From: Bernd Warken
Subject: [groff] 01/01: groffer: add device/mode xhtml
Date: Thu, 27 Aug 2015 13:36:30 +0000

bwarken pushed a commit to branch master
in repository groff.

commit 13db0b14d564d7824e68eb751d6e084304f7387f
Author: Bernd Warken <address@hidden>
Date:   Thu Aug 27 15:36:02 2015 +0200

    groffer: add device/mode xhtml
---
 contrib/groffer/ChangeLog     |    6 ++++++
 contrib/groffer/groffer.1.man |   36 ++++++++++++++++++++++++++++++++----
 contrib/groffer/groffer.pl    |   10 ++++++++--
 contrib/groffer/main_subs.pl  |   32 ++++++++++++++++++++++++++------
 contrib/groffer/subs.pl       |    9 ++++++---
 5 files changed, 78 insertions(+), 15 deletions(-)

diff --git a/contrib/groffer/ChangeLog b/contrib/groffer/ChangeLog
index 3fa62bd..8e8e603 100644
--- a/contrib/groffer/ChangeLog
+++ b/contrib/groffer/ChangeLog
@@ -1,5 +1,11 @@
 2015-08-27  Bernd Warken  <address@hidden>
 
+       * *.pl: Add device (mode) `xhtml'.
+
+       * groffer.1.man: Add documentation for device `xhtml'.
+
+2015-08-27  Bernd Warken  <address@hidden>
+
        * groffer.1.man: Correct the documentation for `--viewer'.
 
 2015-08-05  Bernd Warken  <address@hidden>
diff --git a/contrib/groffer/groffer.1.man b/contrib/groffer/groffer.1.man
index b873f58..5505ced 100644
--- a/contrib/groffer/groffer.1.man
+++ b/contrib/groffer/groffer.1.man
@@ -22,8 +22,6 @@ groffer \- display groff files and man\~pages on X and tty
 Copyright \(co 2001-2015
    Free Software Foundation, Inc.
 
-Author: Bernd Warken <address@hidden>
-
 Last update: 27 Aug 2015
 
 This file is part of groffer, which is part of groff, a free software
@@ -163,6 +161,8 @@ or
 .I \%dvi
 display program, a web browser by generating
 .I \%html
+or
+.I \%xhtml
 in
 .IR \%www\~mode ,
 or several
@@ -240,6 +240,7 @@ Long options can be abbreviated in several ways.
 .OP \-\-utf8
 .OP \-\-viewer prog
 .OP \-\-www
+.OP \-\-xhtml
 .OP \-\-x\~\fR|\fB\~\-\-X
 .YS
 .RE
@@ -524,6 +525,7 @@ The default modes are
 .IR "mode pdf" ,
 .IR "mode ps" ,
 .IR "mode html" ,
+.IR "mode xhtml" ,
 .IR "mode x" ,
 and
 .I "mode dvi"
@@ -694,6 +696,14 @@ and
 The text html viewer is
 .BR \%lynx (1).
 .
+By default, the existence of a sequence of standard web browsers is
+tested, starting with
+.BR \%konqueror (1)
+and
+.BR \%mozilla (1).
+The text html viewer is
+.BR \%lynx (1).
+.
 .
 .TP
 .B pdf
@@ -822,6 +832,19 @@ Equivalent to
 .BR \-\-mode=x .
 .
 .
+.TP
+.B xhtml
+Translate the input into
+.I xhtml
+format, which is an
+.I XML
+version of
+.IR html .
+.
+Then display the result in a web browser program, mostly the known
+.IR "html viewers" .
+.
+.
 .P
 The following modes do not use the
 .I \%groffer
@@ -1066,6 +1089,7 @@ arguments are mapped to the corresponding
 option:
 .BR \%dvi ,
 .BR \%html ,
+.BR \%xhtml ,
 and
 .BR \%ps .
 All
@@ -2055,7 +2079,8 @@ in a PDF viewer
 .IP \*(BU 2m
 in a web browser
 .nh
-.RI ( html
+.RI ( html ,
+.RI ( xhtml
 or
 .IR \%www\~mode )
 .hy
@@ -3477,6 +3502,8 @@ for the
 .B ls
 program, decompress it, format it to
 .I \%html
+or
+.I \%xhtml
 format
 .nh
 .RI ( \%www\~mode )
@@ -3829,7 +3856,8 @@ Viewers for
 .BR \%lynx (1)
 Web-browsers for
 .BR \%groffer 's
-.I \%html
+.IR \%html ,
+.IR \%xhtml
 or
 .IR \%www\~mode .
 .
diff --git a/contrib/groffer/groffer.pl b/contrib/groffer/groffer.pl
index 4e2e575..63ccc96 100755
--- a/contrib/groffer/groffer.pl
+++ b/contrib/groffer/groffer.pl
@@ -5,11 +5,13 @@
 # Source file position: <groff-source>/contrib/groffer/groffer.pl
 # Installed position: <prefix>/bin/groffer
 
-# Copyright (C) 2006-2014
+# Copyright (C) 2006-2015
 #   Free Software Foundation, Inc.
 
 # Written by Bernd Warken <address@hidden>.
 
+# Last update: 27 Aug 2015
+
 # This file is part of `groffer', which is part of `groff'.
 
 # `groff' is free software; you can redistribute it and/or modify it
@@ -163,7 +165,8 @@ our @Conf_Files = 
(File::Spec->catfile(File::Spec->rootdir(),
                                      'groffer.conf')
                 );
 
-our @Default_Modes = ('pdf', 'pdf2', 'html', 'ps', 'x', 'dvi', 'tty');
+our @Default_Modes = ('pdf', 'pdf2', 'html', 'xhtml', 'ps', 'x', 'dvi',
+                     'tty');
 our $Default_Resolution = 100;
 our $Default_tty_Device = 'utf8';
 
@@ -181,6 +184,9 @@ our %Viewer_X = ('DVI' => ['kdvi', 'xdvi', 'dvilx'],
                'HTML' => ['konqueror', 'epiphany'. 'mozilla-firefox',
                           'firefox', 'mozilla', 'netscape', 'galeon',
                           'opera', 'amaya','arena', 'mosaic'],
+               'XHTML' => ['konqueror', 'epiphany'. 'mozilla-firefox',
+                          'firefox', 'mozilla', 'netscape', 'galeon',
+                          'opera', 'amaya','arena', 'mosaic'],
                'PDF' => ['okular', 'kpdf', 'acroread', 'evince',
                          'xpdf -z 150', 'gpdf', 'xpdf', 'zathura'.
                          'epdfview', 'qpdfview', 'apvlv', 'qpdfview',
diff --git a/contrib/groffer/main_subs.pl b/contrib/groffer/main_subs.pl
index 90627cc..67d2cc8 100644
--- a/contrib/groffer/main_subs.pl
+++ b/contrib/groffer/main_subs.pl
@@ -5,9 +5,11 @@
 # Source file position: <groff-source>/contrib/groffer/subs.pl
 # Installed position: <prefix>/lib/groff/groffer/subs.pl
 
-# Copyright (C) 2006-2014  Free Software Foundation, Inc.
+# Copyright (C) 2006-2015  Free Software Foundation, Inc.
 # Written by Bernd Warken <address@hidden>.
 
+# LAst update: 27 Aug 2015
+
 # This file is part of `groffer', which is part of `groff'.
 
 # `groff' is free software; you can redistribute it and/or modify it
@@ -66,7 +68,7 @@ sub main_set_options {
   'groff', 'help', 'intermediate-output', 'html', 'latin1', 'man',
   'no-location', 'no-man', 'no-special', 'pdf', 'pdf2', 'ps', 'rv',
   'source', 'text', 'to-stdout', 'text-device', 'tty', 'tty-device',
-  'utf8', 'version', 'whatis', 'where', 'www', 'x', 'X');
+  'utf8', 'version', 'whatis', 'where', 'www', 'x', 'X', 'xhtml');
 
 ### main_set_options()
   my @opts_groffer_long_arg =
@@ -75,10 +77,10 @@ sub main_set_options {
      # tty viewers are ignored
      'dvi-viewer-tty', 'html-viewer-tty', 'pdf-viewer-tty',
      'ps-viewer-tty', 'tty-viewer-tty', 'www-viewer-tty',
-     'X-viewer-tty', 'x-viewer-tty',
+     'X-viewer-tty', 'x-viewer-tty', 'xhtml-viewer-tty',,
      # viewers for modes are ignored
      'dvi-viewer', 'html-viewer', 'pdf-viewer', 'ps-viewer', 'tty-viewer',
-     'www-viewer', 'X-viewer', 'x-viewer',
+     'www-viewer', 'X-viewer', 'x-viewer', 'xhtml-viewer',
     );
 
   ##### groffer options inhereted from groff
@@ -190,9 +192,11 @@ sub main_set_options {
                          '--where' => '--location',
                          '--www' => '--html',
                          '--X' => '--x',
+                         '--xhtml' => '--html',
                          # '--dvi-viewer' => '--viewer',
                          '--dvi-viewer-tty' => '--viewer',
                          '--html-viewer-tty' => '--viewer',
+                         '--xhtml-viewer-tty' => '--pager',
                          '--pdf-viewer-tty' => '--viewer',
                          '--ps-viewer-tty' => '--viewer',
                          '--tty-viewer' => '--pager',
@@ -657,6 +661,7 @@ sub main_parse_params {
                        'cp1047' => 'tty',
                        'dvi'=> 'dvi',
                        'html' => 'html',
+                       'xhtml' => 'html',
                        'latin1' => 'tty',
                        'lbp' => 'groff',
                        'lj4' => 'groff',
@@ -1016,7 +1021,7 @@ sub main_set_mode {
       $Display{'MODE'} = $Opt{'MODE'};
       return 1;
     }
-    $Display{'MODE'} = $Opt{'MODE'} if $Opt{'MODE'} =~ /^html$/;
+    $Display{'MODE'} = $Opt{'MODE'} if $Opt{'MODE'} =~ /^x?html$/;
     @modes = ($Opt{'MODE'});
   } else {                     # empty mode
     if ($Opt{'DEVICE'}) {
@@ -1876,6 +1881,21 @@ sub main_display {
       next SWITCH;
     };
 
+    /^xhtml$/ and do {
+      if ($Opt{'DEVICE'} && $Opt{'DEVICE'} ne 'xhtml') {
+       warn "main_display(): " .
+         "wrong device for $Display{'MODE'} mode: $Opt{'DEVICE'};"
+      }
+      $modefile .= '.xhtml';
+      $groggy = `cat $tmp_cat | grog -Txhtml`;
+      die "main_display(): grog error;" if $?;
+      chomp $groggy;
+      print STDERR "grog output: $groggy\n" if $Debug{'GROG'};
+      &_do_display();
+      next SWITCH;
+    };
+
+
     /^pdf$/ and do {
       $modefile .= '.pdf';
       $groggy = `cat $tmp_cat | grog -Tpdf --ligatures`;
@@ -1946,7 +1966,7 @@ sub main_display {
        die "main_display(): grog error;" if $?;
        chomp $groggy;
        print STDERR "grog output: $groggy\n" if $Debug{'GROG'};
-      } elsif ($Opt{'DEVICE'} =~ /^(X.*|dvi|html|lbp|lj4|ps)$/) {
+      } elsif ($Opt{'DEVICE'} =~ /^(X.*|dvi|html|xhtml|lbp|lj4|ps)$/) {
        # these devices work with
        $groggy = `cat $tmp_cat | grog -T$Opt{'DEVICE'} -X`;
        die "main_display(): grog error;" if $?;
diff --git a/contrib/groffer/subs.pl b/contrib/groffer/subs.pl
index 7f5a1dc..a9ab753 100644
--- a/contrib/groffer/subs.pl
+++ b/contrib/groffer/subs.pl
@@ -5,9 +5,11 @@
 # Source file position: <groff-source>/contrib/groffer/subs.pl
 # Installed position: <prefix>/lib/groff/groffer/subs.pl
 
-# Copyright (C) 2006-2014  Free Software Foundation, Inc.
+# Copyright (C) 2006-2015  Free Software Foundation, Inc.
 # Written by Bernd Warken <address@hidden>.
 
+# Last update: 27 Aug 2015
+
 # This file is part of `groffer', which is part of `groff'.
 
 # `groff' is free software; you can redistribute it and/or modify it
@@ -556,7 +558,7 @@ The most important groffer long options are
 --help         display this helping output.
 --html         display in a web browser.
 --man          check file parameters first whether they are man pages.
---mode=auto|dvi|groff|html|pdf|ps|source|text|tty|utf8|www|x|X
+--mode=auto|dvi|groff|html|pdf|ps|source|text|tty|utf8|www|x|X|xhtml
                choose display mode.
 --no-man       disable man-page facility.
 --no-special   disable --all, --apropos*, and --whatis
@@ -572,6 +574,7 @@ The most important groffer long options are
 --whatis       display the file name and description of man pages
 --www          same as --html.
 --x --X                display with "gxditview" using an X* device.
+--xhtml                display html in XML mode using a web browser.
 
 The usual X Windows toolkit options transformed into GNU long options:
 --background=color, --bd=size, --bg=color, --bordercolor=color,
@@ -594,7 +597,7 @@ EOF
 # option.  The old options are only ignored:
 # --dvi-viewer=prog choose the viewer program for dvi mode.
 # --html-viewer=program
-#                  choose the web browser for html mode.
+#                  choose the web browser for html or xhtml mode.
 # --pdf-viewer=prog choose the viewer program for pdf mode.
 # --ps-viewer=prog  choose the viewer program for ps mode.
 # --tty-viewer=prog select a pager for tty mode; same as --pager.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]