You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "kwin (via GitHub)" <gi...@apache.org> on 2023/01/20 21:43:14 UTC

[GitHub] [maven-doxia-converter] kwin opened a new pull request, #38: DOXIATOOLS-75 improved directory input support

kwin opened a new pull request, #38:
URL: https://github.com/apache/maven-doxia-converter/pull/38

   Replace extensions instead of appending it
   Keep subdirectory structure from "in" in "out"
   Define extensions per format


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-doxia-converter] michael-o commented on a diff in pull request #38: DOXIATOOLS-75 improved directory input support

Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on code in PR #38:
URL: https://github.com/apache/maven-doxia-converter/pull/38#discussion_r1090033914


##########
src/main/java/org/apache/maven/doxia/cli/CLIManager.java:
##########
@@ -159,8 +164,12 @@ private static String getSupportedFormatAndEncoding()
 
     private static String getSupportedFormat()
     {
-        return "\nSupported Formats:\n from: " + join( DefaultConverter.SUPPORTED_FROM_FORMAT, ", " )
-            + " or autodetect" + "\n to:   " + join( DefaultConverter.SUPPORTED_TO_FORMAT, ", " )
+        String fromFormats = EnumSet.allOf( DefaultConverter.ParserFormat.class ).stream()
+                .map( f -> f.toString().toLowerCase() ).collect( Collectors.joining( ", " ) );
+        String toFormats = EnumSet.allOf( DefaultConverter.SinkFormat.class ).stream()
+                .map( f -> f.toString().toLowerCase() ).collect( Collectors.joining( ", " ) );

Review Comment:
   Locale sensitive lower-case



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-doxia-converter] kwin commented on a diff in pull request #38: DOXIATOOLS-75 improved directory input support

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #38:
URL: https://github.com/apache/maven-doxia-converter/pull/38#discussion_r1090037742


##########
src/main/java/org/apache/maven/doxia/cli/CLIManager.java:
##########
@@ -159,8 +164,12 @@ private static String getSupportedFormatAndEncoding()
 
     private static String getSupportedFormat()
     {
-        return "\nSupported Formats:\n from: " + join( DefaultConverter.SUPPORTED_FROM_FORMAT, ", " )
-            + " or autodetect" + "\n to:   " + join( DefaultConverter.SUPPORTED_TO_FORMAT, ", " )
+        String fromFormats = EnumSet.allOf( DefaultConverter.ParserFormat.class ).stream()
+                .map( f -> f.toString().toLowerCase() ).collect( Collectors.joining( ", " ) );
+        String toFormats = EnumSet.allOf( DefaultConverter.SinkFormat.class ).stream()
+                .map( f -> f.toString().toLowerCase() ).collect( Collectors.joining( ", " ) );

Review Comment:
   Doesn't make any difference (in any locale for ASCII characters used in the enum it is the same)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-doxia-converter] michael-o commented on a diff in pull request #38: DOXIATOOLS-75 improved directory input support

Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on code in PR #38:
URL: https://github.com/apache/maven-doxia-converter/pull/38#discussion_r1097654781


##########
src/main/java/org/apache/maven/doxia/DefaultConverter.java:
##########
@@ -357,23 +458,19 @@ private void parse( File inputFile, String inputEncoding, String inputFormat, Ou
         }
 
         File outputFile;
-        if ( output.getFile().isDirectory() )
+        if ( outputDirectoryOrFile.isDirectory() 
+             || !SelectorUtils.match( "**.*", output.getFile().getName() ) 

Review Comment:
   Agreed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-doxia-converter] kwin merged pull request #38: DOXIATOOLS-75 improved directory input support

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin merged PR #38:
URL: https://github.com/apache/maven-doxia-converter/pull/38


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-doxia-converter] kwin commented on a diff in pull request #38: DOXIATOOLS-75 improved directory input support

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #38:
URL: https://github.com/apache/maven-doxia-converter/pull/38#discussion_r1097669348


##########
src/main/java/org/apache/maven/doxia/DefaultConverter.java:
##########
@@ -78,57 +77,160 @@
 public class DefaultConverter
     implements Converter
 {
-    private static final String APT_PARSER = "apt";
-
-    private static final String CONFLUENCE_PARSER = "confluence";
-
-    private static final String DOCBOOK_PARSER = "docbook";
-
-    private static final String FML_PARSER = "fml";
-
-    private static final String TWIKI_PARSER = "twiki";
-
-    private static final String XDOC_PARSER = "xdoc";
-
-    private static final String XHTML_PARSER = "xhtml";
-
-    private static final String XHTML5_PARSER = "xhtml5";
-
-    private static final String MARKDOWN_PARSER = "markdown";
-
-    /** Supported input format, i.e. supported Doxia parser */
-    public static final String[] SUPPORTED_FROM_FORMAT =
-        { APT_PARSER, CONFLUENCE_PARSER, DOCBOOK_PARSER, FML_PARSER, MARKDOWN_PARSER, TWIKI_PARSER,
-            XDOC_PARSER, XHTML_PARSER, XHTML5_PARSER };
+    /**
+     * All supported Doxia formats (either only parser, only sink or both)
+     */
+    public enum DoxiaFormat
+    {
+        APT( "apt", "apt", true, true ),
+        CONFLUENCE( "confluence", "confluence", true, true ),
+        DOCBOOK( "docbook", "xml", "article", true, true ),
+        FML( "fml", "fml", "faqs", true, false ),
+        FO( "fo", "fo", false, true ),
+        ITEXT( "itext", "itext", false, true ),
+        LATEX( "latex", "tex", false, true ),
+        TWIKI( "twiki", "twiki", true, true ),
+        RTF( "rtf", "rtf", false, true ),
+        XDOC( "xdoc", "xml", "document", true, true ),
+        XHTML( "xhtml", "html", "html", true, true ),
+        XHTML5( "xhtml5", "html", true, true ), // no autodetect support
+        MARKDOWN( "markdown", "md", false, true );
 
-    private static final String APT_SINK = "apt";
+        /** Plexus role hint for Doxia sink/parser */
+        private final String roleHint;
+        private final String extension;
+        /** The name of the first element in case this is an XML format, otherwise {@code null} */
+        private final String firstElement;
+        private final boolean hasParser;
+        private final boolean hasSink;
 
-    private static final String CONFLUENCE_SINK = "confluence";
+        DoxiaFormat( String roleHint, String extension, boolean hasParser, boolean hasSink )
+        {
+            this( roleHint, extension, null, hasParser, hasSink );
+        }
 
-    private static final String DOCBOOK_SINK = "docbook";
+        DoxiaFormat( String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink )
+        {
+            this.roleHint = roleHint;
+            this.extension = extension;
+            this.firstElement = firstElement;
+            this.hasParser = hasParser;
+            this.hasSink = hasSink;
+        }
 
-    private static final String FO_SINK = "fo";
+        /**
+         * 
+         * @return the primary extension used with this format
+         */
+        public String getExtension()
+        {
+            return extension;
+        }
 
-    private static final String ITEXT_SINK = "itext";
+        public boolean hasParser()
+        {
+            return hasParser;
+        }
 
-    private static final String LATEX_SINK = "latex";
+        public boolean hasSink()
+        {
+            return hasSink;
+        }
 
-    private static final String RTF_SINK = "rtf";
+        /**
+         * 
+         * @return {@code true} in case this format is XML based
+         */
+        public boolean isXml()
+        {
+            return firstElement != null;
+        }
 
-    private static final String TWIKI_SINK = "twiki";
+        /**
+         * @param plexus not null
+         * @return an instance of <code>Parser</code> depending on the format.
+         * @throws ComponentLookupException if could not find the Parser for the given format.
+         * @throws IllegalArgumentException if any parameter is null
+         */
+        public Parser getParser( PlexusContainer plexus )
+            throws ComponentLookupException
+        {
+            if ( !hasParser )
+            {
+                throw new IllegalStateException( "The format " + this.toString() + " is not supported as parser!" );
+            }
+            Objects.requireNonNull( plexus, "plexus is required" );
 
-    private static final String XDOC_SINK = "xdoc";
+            return (Parser) plexus.lookup( Parser.ROLE, roleHint );
+        }
 
-    private static final String XHTML_SINK = "xhtml";
+        /**
+         * @param plexus not null
+         * @return an instance of <code>SinkFactory</code> depending on the given format.
+         * @throws ComponentLookupException if could not find the SinkFactory for the given format.
+         * @throws IllegalArgumentException if any parameter is null
+         */
+        public SinkFactory getSinkFactory( PlexusContainer plexus )
+            throws ComponentLookupException
+        {
+            if ( !hasSink )
+            {
+                throw new IllegalStateException( "The format " + this.toString() + " is not supported as sink!" );

Review Comment:
   Fixed in https://github.com/apache/maven-doxia-converter/pull/38/commits/4fa08336ee9db0ae4d4eb4c22b68f8ebb22f6d7d.



##########
src/main/java/org/apache/maven/doxia/DefaultConverter.java:
##########
@@ -78,57 +77,160 @@
 public class DefaultConverter
     implements Converter
 {
-    private static final String APT_PARSER = "apt";
-
-    private static final String CONFLUENCE_PARSER = "confluence";
-
-    private static final String DOCBOOK_PARSER = "docbook";
-
-    private static final String FML_PARSER = "fml";
-
-    private static final String TWIKI_PARSER = "twiki";
-
-    private static final String XDOC_PARSER = "xdoc";
-
-    private static final String XHTML_PARSER = "xhtml";
-
-    private static final String XHTML5_PARSER = "xhtml5";
-
-    private static final String MARKDOWN_PARSER = "markdown";
-
-    /** Supported input format, i.e. supported Doxia parser */
-    public static final String[] SUPPORTED_FROM_FORMAT =
-        { APT_PARSER, CONFLUENCE_PARSER, DOCBOOK_PARSER, FML_PARSER, MARKDOWN_PARSER, TWIKI_PARSER,
-            XDOC_PARSER, XHTML_PARSER, XHTML5_PARSER };
+    /**
+     * All supported Doxia formats (either only parser, only sink or both)
+     */
+    public enum DoxiaFormat
+    {
+        APT( "apt", "apt", true, true ),
+        CONFLUENCE( "confluence", "confluence", true, true ),
+        DOCBOOK( "docbook", "xml", "article", true, true ),
+        FML( "fml", "fml", "faqs", true, false ),
+        FO( "fo", "fo", false, true ),
+        ITEXT( "itext", "itext", false, true ),
+        LATEX( "latex", "tex", false, true ),
+        TWIKI( "twiki", "twiki", true, true ),
+        RTF( "rtf", "rtf", false, true ),
+        XDOC( "xdoc", "xml", "document", true, true ),
+        XHTML( "xhtml", "html", "html", true, true ),
+        XHTML5( "xhtml5", "html", true, true ), // no autodetect support
+        MARKDOWN( "markdown", "md", false, true );
 
-    private static final String APT_SINK = "apt";
+        /** Plexus role hint for Doxia sink/parser */
+        private final String roleHint;
+        private final String extension;
+        /** The name of the first element in case this is an XML format, otherwise {@code null} */
+        private final String firstElement;
+        private final boolean hasParser;
+        private final boolean hasSink;
 
-    private static final String CONFLUENCE_SINK = "confluence";
+        DoxiaFormat( String roleHint, String extension, boolean hasParser, boolean hasSink )
+        {
+            this( roleHint, extension, null, hasParser, hasSink );
+        }
 
-    private static final String DOCBOOK_SINK = "docbook";
+        DoxiaFormat( String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink )
+        {
+            this.roleHint = roleHint;
+            this.extension = extension;
+            this.firstElement = firstElement;
+            this.hasParser = hasParser;
+            this.hasSink = hasSink;
+        }
 
-    private static final String FO_SINK = "fo";
+        /**
+         * 
+         * @return the primary extension used with this format
+         */
+        public String getExtension()
+        {
+            return extension;
+        }
 
-    private static final String ITEXT_SINK = "itext";
+        public boolean hasParser()
+        {
+            return hasParser;
+        }
 
-    private static final String LATEX_SINK = "latex";
+        public boolean hasSink()
+        {
+            return hasSink;
+        }
 
-    private static final String RTF_SINK = "rtf";
+        /**
+         * 
+         * @return {@code true} in case this format is XML based
+         */
+        public boolean isXml()
+        {
+            return firstElement != null;
+        }
 
-    private static final String TWIKI_SINK = "twiki";
+        /**
+         * @param plexus not null
+         * @return an instance of <code>Parser</code> depending on the format.
+         * @throws ComponentLookupException if could not find the Parser for the given format.
+         * @throws IllegalArgumentException if any parameter is null
+         */
+        public Parser getParser( PlexusContainer plexus )
+            throws ComponentLookupException
+        {
+            if ( !hasParser )
+            {
+                throw new IllegalStateException( "The format " + this.toString() + " is not supported as parser!" );

Review Comment:
   Fixed in https://github.com/apache/maven-doxia-converter/pull/38/commits/4fa08336ee9db0ae4d4eb4c22b68f8ebb22f6d7d.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-doxia-converter] kwin commented on a diff in pull request #38: DOXIATOOLS-75 improved directory input support

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #38:
URL: https://github.com/apache/maven-doxia-converter/pull/38#discussion_r1096569820


##########
src/main/java/org/apache/maven/doxia/DefaultConverter.java:
##########
@@ -125,10 +120,172 @@
 
     private static final String MARKDOWN_SINK = "markdown";
 
-    /** Supported output format, i.e. supported Doxia Sink */
-    public static final String[] SUPPORTED_TO_FORMAT =
-        { APT_SINK, CONFLUENCE_SINK, DOCBOOK_SINK, FO_SINK, ITEXT_SINK, LATEX_SINK, MARKDOWN_SINK, RTF_SINK, TWIKI_SINK,
-            XDOC_SINK, XHTML_SINK, XHTML5_SINK };
+    /**
+     * All supported source formats
+     */
+    public enum ParserFormat
+    {
+        APT( APT_PARSER, "apt" ),
+        CONFLUENCE( CONFLUENCE_PARSER, "confluence" ),
+        DOCBOOK( DOCBOOK_PARSER, "xml", "article" ),
+        FML( FML_PARSER, "fml", "faqs" ),
+        TWIKI( TWIKI_PARSER, "twiki" ),
+        XDOC( XDOC_PARSER, "xml", "document" ),
+        XHTML( XHTML_PARSER, "html", "html" ),
+        XHTML5( XHTML5_PARSER, "html" ), // no autodetect support
+        MARKDOWN( MARKDOWN_PARSER, "md" );

Review Comment:
   We can easily do it in a subsequent PR. It is just enum constructors to remove...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-doxia-converter] michael-o commented on a diff in pull request #38: DOXIATOOLS-75 improved directory input support

Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on code in PR #38:
URL: https://github.com/apache/maven-doxia-converter/pull/38#discussion_r1096807707


##########
src/main/java/org/apache/maven/doxia/DefaultConverter.java:
##########
@@ -78,57 +77,160 @@
 public class DefaultConverter
     implements Converter
 {
-    private static final String APT_PARSER = "apt";
-
-    private static final String CONFLUENCE_PARSER = "confluence";
-
-    private static final String DOCBOOK_PARSER = "docbook";
-
-    private static final String FML_PARSER = "fml";
-
-    private static final String TWIKI_PARSER = "twiki";
-
-    private static final String XDOC_PARSER = "xdoc";
-
-    private static final String XHTML_PARSER = "xhtml";
-
-    private static final String XHTML5_PARSER = "xhtml5";
-
-    private static final String MARKDOWN_PARSER = "markdown";
-
-    /** Supported input format, i.e. supported Doxia parser */
-    public static final String[] SUPPORTED_FROM_FORMAT =
-        { APT_PARSER, CONFLUENCE_PARSER, DOCBOOK_PARSER, FML_PARSER, MARKDOWN_PARSER, TWIKI_PARSER,
-            XDOC_PARSER, XHTML_PARSER, XHTML5_PARSER };
+    /**
+     * All supported Doxia formats (either only parser, only sink or both)
+     */
+    public enum DoxiaFormat
+    {
+        APT( "apt", "apt", true, true ),
+        CONFLUENCE( "confluence", "confluence", true, true ),
+        DOCBOOK( "docbook", "xml", "article", true, true ),
+        FML( "fml", "fml", "faqs", true, false ),
+        FO( "fo", "fo", false, true ),
+        ITEXT( "itext", "itext", false, true ),
+        LATEX( "latex", "tex", false, true ),
+        TWIKI( "twiki", "twiki", true, true ),
+        RTF( "rtf", "rtf", false, true ),
+        XDOC( "xdoc", "xml", "document", true, true ),
+        XHTML( "xhtml", "html", "html", true, true ),
+        XHTML5( "xhtml5", "html", true, true ), // no autodetect support
+        MARKDOWN( "markdown", "md", false, true );
 
-    private static final String APT_SINK = "apt";
+        /** Plexus role hint for Doxia sink/parser */
+        private final String roleHint;
+        private final String extension;
+        /** The name of the first element in case this is an XML format, otherwise {@code null} */
+        private final String firstElement;
+        private final boolean hasParser;
+        private final boolean hasSink;
 
-    private static final String CONFLUENCE_SINK = "confluence";
+        DoxiaFormat( String roleHint, String extension, boolean hasParser, boolean hasSink )
+        {
+            this( roleHint, extension, null, hasParser, hasSink );
+        }
 
-    private static final String DOCBOOK_SINK = "docbook";
+        DoxiaFormat( String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink )
+        {
+            this.roleHint = roleHint;
+            this.extension = extension;
+            this.firstElement = firstElement;
+            this.hasParser = hasParser;
+            this.hasSink = hasSink;
+        }
 
-    private static final String FO_SINK = "fo";
+        /**
+         * 
+         * @return the primary extension used with this format
+         */
+        public String getExtension()
+        {
+            return extension;
+        }
 
-    private static final String ITEXT_SINK = "itext";
+        public boolean hasParser()
+        {
+            return hasParser;
+        }
 
-    private static final String LATEX_SINK = "latex";
+        public boolean hasSink()
+        {
+            return hasSink;
+        }
 
-    private static final String RTF_SINK = "rtf";
+        /**
+         * 
+         * @return {@code true} in case this format is XML based
+         */
+        public boolean isXml()
+        {
+            return firstElement != null;
+        }
 
-    private static final String TWIKI_SINK = "twiki";
+        /**
+         * @param plexus not null
+         * @return an instance of <code>Parser</code> depending on the format.
+         * @throws ComponentLookupException if could not find the Parser for the given format.
+         * @throws IllegalArgumentException if any parameter is null
+         */
+        public Parser getParser( PlexusContainer plexus )
+            throws ComponentLookupException
+        {
+            if ( !hasParser )
+            {
+                throw new IllegalStateException( "The format " + this.toString() + " is not supported as parser!" );

Review Comment:
   toString() is redundant.



##########
src/main/java/org/apache/maven/doxia/DefaultConverter.java:
##########
@@ -78,57 +77,160 @@
 public class DefaultConverter
     implements Converter
 {
-    private static final String APT_PARSER = "apt";
-
-    private static final String CONFLUENCE_PARSER = "confluence";
-
-    private static final String DOCBOOK_PARSER = "docbook";
-
-    private static final String FML_PARSER = "fml";
-
-    private static final String TWIKI_PARSER = "twiki";
-
-    private static final String XDOC_PARSER = "xdoc";
-
-    private static final String XHTML_PARSER = "xhtml";
-
-    private static final String XHTML5_PARSER = "xhtml5";
-
-    private static final String MARKDOWN_PARSER = "markdown";
-
-    /** Supported input format, i.e. supported Doxia parser */
-    public static final String[] SUPPORTED_FROM_FORMAT =
-        { APT_PARSER, CONFLUENCE_PARSER, DOCBOOK_PARSER, FML_PARSER, MARKDOWN_PARSER, TWIKI_PARSER,
-            XDOC_PARSER, XHTML_PARSER, XHTML5_PARSER };
+    /**
+     * All supported Doxia formats (either only parser, only sink or both)
+     */
+    public enum DoxiaFormat
+    {
+        APT( "apt", "apt", true, true ),
+        CONFLUENCE( "confluence", "confluence", true, true ),
+        DOCBOOK( "docbook", "xml", "article", true, true ),
+        FML( "fml", "fml", "faqs", true, false ),
+        FO( "fo", "fo", false, true ),
+        ITEXT( "itext", "itext", false, true ),
+        LATEX( "latex", "tex", false, true ),
+        TWIKI( "twiki", "twiki", true, true ),
+        RTF( "rtf", "rtf", false, true ),
+        XDOC( "xdoc", "xml", "document", true, true ),
+        XHTML( "xhtml", "html", "html", true, true ),
+        XHTML5( "xhtml5", "html", true, true ), // no autodetect support
+        MARKDOWN( "markdown", "md", false, true );
 
-    private static final String APT_SINK = "apt";
+        /** Plexus role hint for Doxia sink/parser */
+        private final String roleHint;
+        private final String extension;
+        /** The name of the first element in case this is an XML format, otherwise {@code null} */
+        private final String firstElement;
+        private final boolean hasParser;
+        private final boolean hasSink;
 
-    private static final String CONFLUENCE_SINK = "confluence";
+        DoxiaFormat( String roleHint, String extension, boolean hasParser, boolean hasSink )
+        {
+            this( roleHint, extension, null, hasParser, hasSink );
+        }
 
-    private static final String DOCBOOK_SINK = "docbook";
+        DoxiaFormat( String roleHint, String extension, String firstElement, boolean hasParser, boolean hasSink )
+        {
+            this.roleHint = roleHint;
+            this.extension = extension;
+            this.firstElement = firstElement;
+            this.hasParser = hasParser;
+            this.hasSink = hasSink;
+        }
 
-    private static final String FO_SINK = "fo";
+        /**
+         * 
+         * @return the primary extension used with this format
+         */
+        public String getExtension()
+        {
+            return extension;
+        }
 
-    private static final String ITEXT_SINK = "itext";
+        public boolean hasParser()
+        {
+            return hasParser;
+        }
 
-    private static final String LATEX_SINK = "latex";
+        public boolean hasSink()
+        {
+            return hasSink;
+        }
 
-    private static final String RTF_SINK = "rtf";
+        /**
+         * 
+         * @return {@code true} in case this format is XML based
+         */
+        public boolean isXml()
+        {
+            return firstElement != null;
+        }
 
-    private static final String TWIKI_SINK = "twiki";
+        /**
+         * @param plexus not null
+         * @return an instance of <code>Parser</code> depending on the format.
+         * @throws ComponentLookupException if could not find the Parser for the given format.
+         * @throws IllegalArgumentException if any parameter is null
+         */
+        public Parser getParser( PlexusContainer plexus )
+            throws ComponentLookupException
+        {
+            if ( !hasParser )
+            {
+                throw new IllegalStateException( "The format " + this.toString() + " is not supported as parser!" );
+            }
+            Objects.requireNonNull( plexus, "plexus is required" );
 
-    private static final String XDOC_SINK = "xdoc";
+            return (Parser) plexus.lookup( Parser.ROLE, roleHint );
+        }
 
-    private static final String XHTML_SINK = "xhtml";
+        /**
+         * @param plexus not null
+         * @return an instance of <code>SinkFactory</code> depending on the given format.
+         * @throws ComponentLookupException if could not find the SinkFactory for the given format.
+         * @throws IllegalArgumentException if any parameter is null
+         */
+        public SinkFactory getSinkFactory( PlexusContainer plexus )
+            throws ComponentLookupException
+        {
+            if ( !hasSink )
+            {
+                throw new IllegalStateException( "The format " + this.toString() + " is not supported as sink!" );

Review Comment:
   same here



##########
src/main/java/org/apache/maven/doxia/DefaultConverter.java:
##########
@@ -357,23 +458,19 @@ private void parse( File inputFile, String inputEncoding, String inputFormat, Ou
         }
 
         File outputFile;
-        if ( output.getFile().isDirectory() )
+        if ( outputDirectoryOrFile.isDirectory() 
+             || !SelectorUtils.match( "**.*", output.getFile().getName() ) 

Review Comment:
   This pattern looks wrong. Shouldn't it be: `**/*`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-doxia-converter] michael-o commented on a diff in pull request #38: DOXIATOOLS-75 improved directory input support

Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on code in PR #38:
URL: https://github.com/apache/maven-doxia-converter/pull/38#discussion_r1094401251


##########
src/main/java/org/apache/maven/doxia/cli/CLIManager.java:
##########
@@ -159,8 +164,12 @@ private static String getSupportedFormatAndEncoding()
 
     private static String getSupportedFormat()
     {
-        return "\nSupported Formats:\n from: " + join( DefaultConverter.SUPPORTED_FROM_FORMAT, ", " )
-            + " or autodetect" + "\n to:   " + join( DefaultConverter.SUPPORTED_TO_FORMAT, ", " )
+        String fromFormats = EnumSet.allOf( DefaultConverter.ParserFormat.class ).stream()
+                .map( f -> f.toString().toLowerCase() ).collect( Collectors.joining( ", " ) );
+        String toFormats = EnumSet.allOf( DefaultConverter.SinkFormat.class ).stream()
+                .map( f -> f.toString().toLowerCase() ).collect( Collectors.joining( ", " ) );
+        return "\nSupported Formats:\n from: " + fromFormats
+            + " or " + AUTO_FORMAT + "\n to:   " + toFormats
             + "\n";

Review Comment:
   use system LS



##########
src/main/java/org/apache/maven/doxia/DefaultConverter.java:
##########
@@ -125,10 +120,172 @@
 
     private static final String MARKDOWN_SINK = "markdown";
 
-    /** Supported output format, i.e. supported Doxia Sink */
-    public static final String[] SUPPORTED_TO_FORMAT =
-        { APT_SINK, CONFLUENCE_SINK, DOCBOOK_SINK, FO_SINK, ITEXT_SINK, LATEX_SINK, MARKDOWN_SINK, RTF_SINK, TWIKI_SINK,
-            XDOC_SINK, XHTML_SINK, XHTML5_SINK };
+    /**
+     * All supported source formats
+     */
+    public enum ParserFormat
+    {
+        APT( APT_PARSER, "apt" ),
+        CONFLUENCE( CONFLUENCE_PARSER, "confluence" ),
+        DOCBOOK( DOCBOOK_PARSER, "xml", "article" ),
+        FML( FML_PARSER, "fml", "faqs" ),
+        TWIKI( TWIKI_PARSER, "twiki" ),
+        XDOC( XDOC_PARSER, "xml", "document" ),
+        XHTML( XHTML_PARSER, "html", "html" ),
+        XHTML5( XHTML5_PARSER, "html" ), // no autodetect support
+        MARKDOWN( MARKDOWN_PARSER, "md" );

Review Comment:
   Wouldn't it make sense to move Doxia 2.0 first before handling removed format?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-doxia-converter] kwin commented on a diff in pull request #38: DOXIATOOLS-75 improved directory input support

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #38:
URL: https://github.com/apache/maven-doxia-converter/pull/38#discussion_r1096569785


##########
src/main/java/org/apache/maven/doxia/cli/CLIManager.java:
##########
@@ -159,8 +164,12 @@ private static String getSupportedFormatAndEncoding()
 
     private static String getSupportedFormat()
     {
-        return "\nSupported Formats:\n from: " + join( DefaultConverter.SUPPORTED_FROM_FORMAT, ", " )
-            + " or autodetect" + "\n to:   " + join( DefaultConverter.SUPPORTED_TO_FORMAT, ", " )
+        String fromFormats = EnumSet.allOf( DefaultConverter.ParserFormat.class ).stream()
+                .map( f -> f.toString().toLowerCase() ).collect( Collectors.joining( ", " ) );
+        String toFormats = EnumSet.allOf( DefaultConverter.SinkFormat.class ).stream()
+                .map( f -> f.toString().toLowerCase() ).collect( Collectors.joining( ", " ) );
+        return "\nSupported Formats:\n from: " + fromFormats
+            + " or " + AUTO_FORMAT + "\n to:   " + toFormats
             + "\n";

Review Comment:
   Done in https://github.com/apache/maven-doxia-converter/pull/38/commits/2b480deb54709437a7062846324d74bf3e415c37 (although not really related to this PR as `\n` was used everywhere else before)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-doxia-converter] kwin commented on a diff in pull request #38: DOXIATOOLS-75 improved directory input support

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #38:
URL: https://github.com/apache/maven-doxia-converter/pull/38#discussion_r1097497739


##########
src/main/java/org/apache/maven/doxia/DefaultConverter.java:
##########
@@ -357,23 +458,19 @@ private void parse( File inputFile, String inputEncoding, String inputFormat, Ou
         }
 
         File outputFile;
-        if ( output.getFile().isDirectory() )
+        if ( outputDirectoryOrFile.isDirectory() 
+             || !SelectorUtils.match( "**.*", output.getFile().getName() ) 

Review Comment:
   Rather `*.*` because it only matches on the file name (not the full path), however I haven't modified the globbing either. Let us not put too much into this PR.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org