jira-importer opened a new issue, #323:
URL: https://github.com/apache/maven-fluido-skin/issues/323

   **[Matthias 
Bünger](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=JIRAUSER302100)**
 opened 
**[DOXIASITETOOLS-358](https://issues.apache.org/jira/browse/DOXIASITETOOLS-358?redirect=false)**
 and commented
   
   In my MavenSite's PR to fix rendering warnings the question if html headers 
can be added when writing Markdown files. [Konrad 
Windszus](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=kwin)] 
answered that it it's possible in general, but unclear how doxia-sitetolls 
handles them:
   
   > In general every valid HTML is also valid in MD 
(https://daringfireball.net/projects/markdown/syntax#html). This is more a 
question on how the resulting HTML is being partitioned by the doxia-sitetools 
(to inject things like navigation).
   
   Because there's interest to transform the xml-docs into Markdown I made some 
tests about this.
   
   ## First test
   
   ```java
   <head>
     <meta charset="UTF-8">
     <meta name="description" content="Free Web tutorials">
     <meta name="keywords" content="HTML, CSS, JavaScript">
     <meta name="author" content="John Doe">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
   </head>
   ```
   
   This failes in exceptions
   
   ```java
   URI: /developers/mdwithhtmltest2.html
   STATUS:      500
   MESSAGE:     javax.servlet.ServletException: 
org.apache.maven.doxia.siterenderer.RendererException: Error parsing 
'D:\Github\Maven\maven-site\content\markdown\developers\mdwithhtmltest2.md', 
line 28
   SERVLET:     default
   CAUSED BY:   javax.servlet.ServletException: 
org.apache.maven.doxia.siterenderer.RendererException: Error parsing 
'D:\Github\Maven\maven-site\content\markdown\developers\mdwithhtmltest2.md', 
line 28
   CAUSED BY:   org.apache.maven.doxia.siterenderer.RendererException: Error 
parsing 
'D:\Github\Maven\maven-site\content\markdown\developers\mdwithhtmltest2.md', 
line 28
   CAUSED BY:   org.apache.maven.doxia.parser.ParseException: Error parsing the 
model
   CAUSED BY:   org.codehaus.plexus.util.xml.pull.XmlPullParserException: end 
tag name </head> must be the same as start tag <meta> from line 20 (position: 
TEXT seen ...<title>Download Apache Maven</title>\n</head>... @28:8) 
   ```
   
   We learn
   * void elements (like meta tags) are not (fully) supported by DOXIA
   
   ## Second test
   
   ```java
   <head>
     <meta charset="UTF-8" />
     <meta name="description" content="Free Web tutorials" />
     <meta name="keywords" content="HTML, CSS, JavaScript" />
     <meta name="author" content="John Doe" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   </head>
   ```
   
   This gets transformed to
   
   ```java
   <html xmlns="http://www.w3.org/1999/xhtml"; lang="en">
     <head>
       <meta charset="UTF-8" />
       <meta name="viewport" content="width=device-width, initial-scale=1" />
       <meta name="generator" content="Apache Maven Doxia Site Renderer 2.0.0" 
/>
       <meta name="author" content="John Doe" />
       <title>Maven</title>
       <link rel="stylesheet" href="../css/apache-maven-fluido-2.0.1.min.css" />
       <link rel="stylesheet" href="../css/site.css" />
       <link rel="stylesheet" href="../css/print.css" media="print" />
       <script src="../js/apache-maven-fluido-2.0.1.min.js"></script>
   <meta charset="UTF-8" /><meta name="description" content="Free Web 
tutorials" /><meta name="keywords" content="HTML, CSS, JavaScript" /><meta 
name="viewport" content="width=device-width, initial-scale=1.0" />    <!-- 
Matomo -->
       <script>
           ///
       </script>
       <!-- End Matomo Code -->
     </head>
     <body>
   ```
   
   We see
   * "Maven" as a title gets added somehow (for me, but I assume it's some 
Doxia or fluido skin configuration)
   * The manually added HTML meta tags **{**}all excepts author{**}** got put 
behind the path definition for the fluido Javascript
   * This leads duplicated meta, in this test the "viewport" one.
   * Void elements are renedered with a trailing slash resulting in validator 
infos / warning
   
   > Info: Trailing slash on void elements has no effect and interacts badly 
with unquoted attribute values.
   > 
   > From line 19, column 5; to line 19, column 67
   > 
   > s" />↩ \<link rel="stylesheet" href="../css/print.css" media="print" />↩ <
   
   ## Third test
   
   As we have xml-files with multiple authors and a title definition I tested 
this too.
   
   ```java
   <head>
     <meta charset="UTF-8" />
     <meta name="description" content="Free Web tutorials" />
     <meta name="keywords" content="HTML, CSS, JavaScript" />
     <meta name="author" content="John Doe" />
    <meta name="author" content="Maven 1" />
    <meta name="author" content="Maven 2" />
    <meta name="generator" content="Not Doxia">
   <title>Download Apache Maven</title>
   </head>
   ```
   
   This gets transformed to
   
   ```java
   <html xmlns="http://www.w3.org/1999/xhtml"; lang="en">
     <head>
       <meta charset="UTF-8" />
       <meta name="viewport" content="width=device-width, initial-scale=1" />
       <meta name="generator" content="Apache Maven Doxia Site Renderer 2.0.0" 
/>
       <meta name="author" content="John Doe" />
       <meta name="author" content="Maven 1" />
       <meta name="author" content="Maven 2" />
       <title>Download Apache Maven – Maven</title>
       <link rel="stylesheet" href="../css/apache-maven-fluido-2.0.1.min.css" />
       <link rel="stylesheet" href="../css/site.css" />
       <link rel="stylesheet" href="../css/print.css" media="print" />
       <script src="../js/apache-maven-fluido-2.0.1.min.js"></script>
   <meta charset="UTF-8" /><meta name="description" content="Free Web 
tutorials" /><meta name="keywords" content="HTML, CSS, JavaScript" /><meta 
name="generator" content="Not Doxia" />    <!-- Matomo -->
       <script>
           ///
       </script>
       <!-- End Matomo Code -->
     </head>
   ```
   
   Additional to what we saw in the first test:
   * multiple authors are picked up and rendered correctly
   * the "title" attribute" is picked up and used
   
   ## Fourth test
   
   Last test was about the html elements which are not headers.
   
   ```java
   <nav>
     <a href="/html/">HTML</a> |
     <a href="/css/">CSS</a> |
     <a href="/js/">JavaScript</a> |
     <a href="/python/">Python</a>
   </nav>
   
   1. Mojo API Specification
   
   Let's test this
   ```
   
   ```java
         <main id="bodyColumn" class="span10">
   
   <nav>
     <a href="/html/">HTML</a> |
     <a href="/css/">CSS</a> |
     <a href="/js/">JavaScript</a> |
     <a href="/python/">Python</a>
   </nav>
   <section><a id="Mojo_API_Specification"></a>
   <h1>Mojo API Specification</h1>
   <p>Let's test this</p></section>        </main>
   ```
   
   As expected they just got put into the main area of the page (here resulting 
in duplicate nav, but that's user's fault)
   
   ## Result
   
   As a result we can see that it's possible to add meta tags, but this might 
create invalid HTML, e.g. duplicate charset, but also infos/warnings, due the 
trailing slash on void elements
   
   
   ---
   
   **Affects:** 2.0.0-M19
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to