Data-Edit-Xml-To-Dita

 view release on metacpan or  search on metacpan

lib/Data/Edit/Xml/To/DitaVb.pm  view on Meta::CPAN

sub lint             {1}                                                        # Lint output xml
sub mimajen          {0}                                                        # 1- Copy files to web, 0 - suppress
sub notify           {!&develop and &upload ? &upload : 0}                      # 1 - Broadcast results of conversion if at 100% lint, 2 - broadcast regardless of error count.
sub numberOfFiles    {undef}                                                    # Expected number of output files
sub printTopicTrees  {1}                                                        # 1 - print the parse tree before cutting out the topics
sub publish          {0}                                                        # 1 - convert Dita to Html and publish via DITA-OT if at 100% lint,  2 - publish regardless
sub restructure      {0}                                                        # 1 - Restructure results of conversion if at 100% lint, 2 - restructure regardless of error count.
sub restructurePhases{1}                                                        # Number of restructuring phases to run
sub testMode         {&develop ? 1 : 0}                                         # 1 - run development tests, 2- run standalone tests, 0 run production documents
sub titleOnly        {0}                                                        # Use only the title of topics to create GB Standard file names otherwise use the following text as well if the title is too short
sub unicode          {download}                                                 # Convert to utf8 if true.
sub upload           {&develop ? 0 : 1}                                         # Upload to S3 Bucket if true and the conversion is at 100%, 2 - upload to S3 Bucket regardless, 0 - no upload to S3 Bucket.
sub version          {q()}                                                      # Description of this run as printed in notification message and title
sub xref             {1}                                                        # Xref output xml.
sub xrefAddNavTitles {1}                                                        # Add navtitles to bookmap entries if true
sub xrefAllowUniquePartialMatches{1}                                            # Allow partial matching - i.e ignore the stuff to the right of the # in a reference if doing so produces a unique result
sub xrefMatchTopics  {0}                                                        # Either 0 for no topic matching or the percentage confidence level for topic matching
#ub relinkDitaRefs   {0}                                                        # Relink dita references that are valid in the input corpus so that they are valid in the output corpus as well.
#ub singleTopicBM    {fixDitaRefs}                                              # 1 - allow single topic book maps when cutting out topics which is required if using L<fixDitaRefs>, 0 - multiple topics required for a bookmap

sub catalog          {q(/home/phil/r/dita/dita-ot-3.1/catalog-dita.xml)}        # Dita catalog to be used for linting.

lib/Data/Edit/Xml/To/DitaVb.pm  view on Meta::CPAN

    my $text = $Text =~ s(encoding="[^"]+") (encoding="UTF-8")r;                # Write encoding if necessary
    $text    = spelling $text, $target;                                         # Check/fix spelling
    owf($target, $text) unless $text eq $Text;
    return undef
   }

  $source;
 }

sub convertToUTF8                                                               #P Convert the encoding of documents in L<downloads|/downloads> to utf8 equivalents in folder L<in|/in>.
 {if (unicode)
   {clearFolder(in, clearCount);

    my @d = searchDirectoryTreesForMatchingFiles(downloads, inputExt);          # Files downloaded
    my $n = @d;
    confess "No documents to convert" unless $n;                                # Stop right here if there is nothing to convert

    lll "Unicode conversion $n ",
        "xml documents to convert from folder: ", downloads;

    my @results = runInSquareRootParallel(maximumNumberOfProcesses,             # Convert in square parallel because we have a lot of small fast conversions
       sub{convertOneFileToUTF8(@_)},
       sub{@_},
       @d);

    if (my @failed = grep {$_} @results)                                        # Consolidate results -  list of conversions that failed
     {my $t = formatTableBasic([[qw(File)], map {[$_]} @failed]);
      eee "The following source files failed to convert:\n", $t;
     }
    else
     {lll "Unicode conversion - converted all $n documents";
      Flip::Flop::unicode();
     }
   }
  else
   {ddd "Unicode conversion not requested";
   }
 }

sub convertToUTF822                                                             #P Convert the encoding of documents in L<downloads|/downloads> to utf8 equivalents in folder L<in|/in>.
 {if (unicode)
   {clearFolder(in, clearCount);

    my @d = searchDirectoryTreesForMatchingFiles(downloads, inputExt);          # Files downloaded
    my $n = @d;
    confess "No documents to convert" unless $n;                                # Stop right here if there is nothing to convert

    lll "Unicode conversion $n ",
        "xml documents to convert from folder: ", downloads;

    my $ps = newProcessStarter(maximumNumberOfProcesses);                       # Process starter

lib/Data/Edit/Xml/To/DitaVb.pm  view on Meta::CPAN

        if ($source)                                                            # A failing file
         {push @failed, $source;                                                # Report failures
         }
       }
      if (@failed)                                                              # Confess to projects that failed to covert
       {my $t = formatTableBasic([[qw(File)], map {[$_]} @failed]);
        eee "The following source files failed to convert:\n", $t;
       }
      else
       {lll "Unicode conversion - converted all $n documents";
        Flip::Flop::unicode();
       }
     }
   }
  else
   {ddd "Unicode conversion not requested";
   }
 }

sub projectCount()                                                              #P Number of projects.
 {scalar keys %$projects

lib/Data/Edit/Xml/To/DitaVb.pm  view on Meta::CPAN

testExchangeOut
testExpected
testFails
testFails2
testMode
testResults
testStandAlone
tests
titleOnly
topicTrees
unicode
upload
user
version
www
xref
xrefAllowUniquePartialMatches
xrefMatchTopics
)
 }

lib/Data/Edit/Xml/To/DitaVb.pm  view on Meta::CPAN



The following is a list of all the attributes in this package.  A method coded
with the same name in your package will over ride the method of the same name
in this package and thus provide your value for the attribute in place of the
default value supplied for this attribute by this package.

=head2 Replaceable Attribute List


catalog clearCount client conversion convert debug deguidize develop ditaBin ditaXrefs docSet download downloads endTime errorLogFile exchange exchangeHome exchangeItems extendedNames fails fixBadRefs fixDitaRefs fixFailingFiles fixXrefsByTitle gathe...


=head2 catalog

Dita catalog to be used for linting.


=head2 clearCount

Limit on number of files to clear from each output folder.

lib/Data/Edit/Xml/To/DitaVb.pm  view on Meta::CPAN

=head2 titleOnly

Use only the title of topics to create GB Standard file names otherwise use the following text as well if the title is too short


=head2 topicTrees

Folder to contain printed topic trees if requested by printTopicTrees


=head2 unicode

Convert to utf8 if true.


=head2 upload

Upload to S3 Bucket if true and the conversion is at 100%, 2 - upload to S3 Bucket regardless, 0 - no upload to S3 Bucket.


=head2 user



( run in 0.610 second using v1.01-cache-2.11-cpan-88abd93f124 )