Commits

Anonymous committed 13034b5

Add support for the xhtml-1_1 mode.

Comments (0)

Files changed (4)

modules/App-XML-DocBook-Docmake/Changes

+0.0300
+        - Add support for the xhtml-1_1 mode.
+
 0.0201  Tue Jun 30 15:43:00 IDT 2009
         - Fixed --make with xhtml - previously it didn't build the
         xhtml at all.

modules/App-XML-DocBook-Docmake/META.yml

 ---
-name: App-XML-DocBook-Builder
-version: 0.0201
+abstract: 'Build DocBook/XML files.'
 author:
   - 'Shlomi Fish <shlomif@cpan.org>'
-abstract: Build DocBook/XML files.
-license: mit
-resources:
-  homepage: http://www.shlomifish.org/open-source/projects/docmake/
-  license: http://www.opensource.org/licenses/mit-license.php
-  repository: http://svn.berlios.de/svnroot/repos/web-cpan/App-XML-DocBook-Docmake/
-requires:
-  Class::Accessor: 0
-  File::Path: 0
-  File::Spec: 0
-  Getopt::Long: 2.37
-  Pod::Usage: 0
-  strict: 0
-  warnings: 0
 build_requires:
   Test::More: 0
   Test::Trap: 0
-provides:
-  App::XML::DocBook::Builder:
-    file: lib/App/XML/DocBook/Builder.pm
-    version: 0.0201
-  App::XML::DocBook::Docmake:
-    file: lib/App/XML/DocBook/Docmake.pm
-    version: 0.0201
-  App::XML::DocBook::Docmake::CmdComponent:
-    file: lib/App/XML/DocBook/Docmake.pm
-generated_by: Module::Build version 0.33
-meta-spec:
-  url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
+configure_requires:
+  Module::Build: 0.36
+generated_by: 'Module::Build version 0.3617'
 keywords:
   - automation
   - convert
   - xml
   - xsl-fo
   - xslt
+license: mit
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4
+name: App-XML-DocBook-Builder
+provides:
+  App::XML::DocBook::Builder:
+    file: lib/App/XML/DocBook/Builder.pm
+    version: 0.0201
+  App::XML::DocBook::Docmake:
+    file: lib/App/XML/DocBook/Docmake.pm
+    version: 0.0201
+  App::XML::DocBook::Docmake::CmdComponent:
+    file: lib/App/XML/DocBook/Docmake.pm
+requires:
+  Class::Accessor: 0
+  File::Path: 0
+  File::Spec: 0
+  Getopt::Long: 2.37
+  Pod::Usage: 0
+  strict: 0
+  warnings: 0
+resources:
+  homepage: http://www.shlomifish.org/open-source/projects/docmake/
+  license: http://www.opensource.org/licenses/mit-license.php
+  repository: http://svn.berlios.de/svnroot/repos/web-cpan/App-XML-DocBook-Docmake/
+version: 0.0201

modules/App-XML-DocBook-Docmake/lib/App/XML/DocBook/Docmake.pm

     _output_path
     _stylesheet
     _verbose
+    _real_mode
     _xslt_mode
     _xslt_stringparams
 ));
     'xhtml' =>
     {
     },
+    'xhtml-1_1' =>
+    {
+        real_mode => "xhtml",
+    },
     'rtf' =>
     {
         xslt_mode => "fo",
     if ($mode_struct)
     {
         $self->_mode($mode);
+
+        if ($mode_struct->{real_mode})
+        {
+            $self->_real_mode($mode_struct->{real_mode});
+        }
+        else
+        {
+            $self->_real_mode($mode);
+        }
+
         if ($mode_struct->{xslt_mode})
         {
             $self->_xslt_mode($mode_struct->{xslt_mode});
 {
     my $self = shift;
 
-    my $mode = $self->_mode();
+    my $real_mode = $self->_real_mode();
 
-    my $mode_func = "_run_mode_$mode";
+    my $mode_func = '_run_mode_' . $self->_real_mode;
 
     return $self->$mode_func(@_);
 }
     rtf - convert to RTF (MS Word).
     pdf - convert to PDF (Adobe Acrobat).
     xhtml - convert to XHTML.
+    xhtml-1_1 - convert to XHTML-1.1.
 EOF
 }
 
         ;
 }
 
+sub _is_xhtml
+{
+    my $self = shift;
+
+    return (($self->_mode() eq "xhtml") || ($self->_mode() eq "xhtml-1_1"));
+}
+
 sub _calc_output_param_for_xslt
 {
     my $self = shift;
 
     # If it's XHTML, then it's a directory and xsltproc requires that
     # it will have a trailing slash.
-    if ($self->_mode() eq "xhtml")
+    if ($self->_is_xhtml)
     {
         if ($output_path !~ m{/\z})
         {
 
     # If it's XHTML, then we need to compare against the index.html
     # because the directory is freshly made.
-    if ($self->_mode() eq "xhtml")
+    if ($self->_is_xhtml)
     {
         $output_path .= "index.html";
     }

modules/App-XML-DocBook-Docmake/t/01-use.t

 use strict;
 use warnings;
 
-use Test::More tests => 14;
+use Test::More tests => 16;
 use Test::Trap qw( trap $trap :flow:stderr(systemsafe):stdout(systemsafe):warn );
 
 use App::XML::DocBook::Docmake;
         "an empty stringparam is accepted and propagated to the xsltproc command",
     );
 }
+
+{
+    my $docmake = MyTest::DocmakeAppDebug->new({argv => [
+            "-v",
+            "--stringparam",
+            "empty.param=",
+            "-o", "my-output-dir",
+            "xhtml-1_1",
+            "input.xml",
+            ]});
+
+    # TEST
+    ok ($docmake, "xhtml-1_1 docmake was constructed successfully");
+
+    $docmake->run();
+
+    # TEST
+    is_deeply(MyTest::DocmakeAppDebug->debug_commands(),
+        [
+            [
+                "xsltproc",
+                "-o", "my-output-dir/",
+                "--stringparam", "empty.param", "",
+                "http://docbook.sourceforge.net/release/xsl/current/xhtml-1_1/docbook.xsl",
+                "input.xml",
+            ]
+        ],
+        "Testing xhtml-1_1",
+    );
+}