This is an automated email from the ASF dual-hosted git repository. kwin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-fluido-skin.git
The following commit(s) were added to refs/heads/master by this push: new c80e842 [MSKINS-258] Disable code highlighting and line numbers for "<pre><code class="nohighlight nocode">" c80e842 is described below commit c80e8425d28a1f3b913dc66884b2d5c76b411db9 Author: Konrad Windszus <konrad.winds...@netcentric.biz> AuthorDate: Sun Nov 24 10:52:18 2024 +0100 [MSKINS-258] Disable code highlighting and line numbers for "<pre><code class="nohighlight nocode">" That HTML is emitted by the MarkdownParser (Flexmark) for fenced code blocks without info string (https://spec.commonmark.org/0.31.2/#info-string) --- src/it/verbatim/pom.xml | 75 ++++++++++++++++++++++++ src/it/verbatim/src/site/apt/verbatim-apt.apt | 31 ++++++++++ src/it/verbatim/src/site/markdown/verbatim-md.md | 29 +++++++++ src/it/verbatim/src/site/site.xml | 51 ++++++++++++++++ src/it/verbatim/verify.groovy | 29 +++++++++ src/main/resources/META-INF/maven/site.vm | 2 +- 6 files changed, 216 insertions(+), 1 deletion(-) diff --git a/src/it/verbatim/pom.xml b/src/it/verbatim/pom.xml new file mode 100644 index 0000000..01e7cc4 --- /dev/null +++ b/src/it/verbatim/pom.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.maven.skins</groupId> + <artifactId>maven-skins</artifactId> + <version>@project.parent.version@</version> + </parent> + + <groupId>org.apache.maven.skins.its</groupId> + <artifactId>@project.artifactId@-verbatim</artifactId> + <version>@project.version@</version> + <packaging>jar</packaging> + + <name>@project.name@ IT, verbatim</name> + <url>https://maven.apache.org/skins/@project.artifactId@/verbatim/</url> + + <properties> + <skinName>@project.name@</skinName> + <skinDescription>@project.description@</skinDescription> + <skinGroupId>@project.groupId@</skinGroupId> + <skinArtifactId>@project.artifactId@</skinArtifactId> + <skinVersion>@project.version@</skinVersion> + </properties> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.2</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <version>@sitePluginVersion@</version> + </plugin> + </plugins> + </build> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-project-info-reports-plugin</artifactId> + <version>@projectInfoReportsPluginVersion@</version> + <configuration> + <dependencyDetailsEnabled>false</dependencyDetailsEnabled> + </configuration> + </plugin> + </plugins> + </reporting> + +</project> diff --git a/src/it/verbatim/src/site/apt/verbatim-apt.apt b/src/it/verbatim/src/site/apt/verbatim-apt.apt new file mode 100644 index 0000000..0e4a985 --- /dev/null +++ b/src/it/verbatim/src/site/apt/verbatim-apt.apt @@ -0,0 +1,31 @@ +~~ Licensed to the Apache Software Foundation (ASF) under one +~~ or more contributor license agreements. See the NOTICE file +~~ distributed with this work for additional information +~~ regarding copyright ownership. The ASF licenses this file +~~ to you under the Apache License, Version 2.0 (the +~~ "License"); you may not use this file except in compliance +~~ with the License. You may obtain a copy of the License at +~~ +~~ http://www.apache.org/licenses/LICENSE-2.0 +~~ +~~ Unless required by applicable law or agreed to in writing, +~~ software distributed under the License is distributed on an +~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +~~ KIND, either express or implied. See the License for the +~~ specific language governing permissions and limitations +~~ under the License. + +~~ NOTE: For help with the syntax of this file, see: +~~ http://maven.apache.org/doxia/references/apt-format.html + +--- +Simple +Verbose +block +--- + ++-- +int main() +{ +} ++-- \ No newline at end of file diff --git a/src/it/verbatim/src/site/markdown/verbatim-md.md b/src/it/verbatim/src/site/markdown/verbatim-md.md new file mode 100644 index 0000000..42de40b --- /dev/null +++ b/src/it/verbatim/src/site/markdown/verbatim-md.md @@ -0,0 +1,29 @@ +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +``` +Simple +Verbose +block +``` + +```java +int main() +{ +} +``` \ No newline at end of file diff --git a/src/it/verbatim/src/site/site.xml b/src/it/verbatim/src/site/site.xml new file mode 100644 index 0000000..50c33a1 --- /dev/null +++ b/src/it/verbatim/src/site/site.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + --> + +<site xmlns="http://maven.apache.org/SITE/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SITE/2.0.0 https://maven.apache.org/xsd/site-2.0.0.xsd" + name="${skinName}"> + + <skin> + <groupId>${skinGroupId}</groupId> + <artifactId>${skinArtifactId}</artifactId> + <version>${skinVersion}</version> + </skin> + + <publishDate format="yyyy-MM-dd" position="right" /> + <version position="right" /> + + <body> + <breadcrumbs> + <item name="Apache Maven Fluido Skin" href="https://maven.apache.org/skins/maven-fluido-skin/index.html" /> + <item name="Maven Fluido Skin ITs" href="https://maven.apache.org/skins/maven-fluido-skin/ITs.html" /> + </breadcrumbs> + + <menu name="Overview"> + <item name="Introduction" href="index.html"/> + </menu> + + <menu ref="reports"/> + + </body> + +</site> diff --git a/src/it/verbatim/verify.groovy b/src/it/verbatim/verify.groovy new file mode 100644 index 0000000..feca105 --- /dev/null +++ b/src/it/verbatim/verify.groovy @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +private void assertVerbatimHtml(File file) { + assert file.exists() + String html = file.text + // only one snippet with code and linenumbers + assert (html.count( 'class="prettyprint linenums"' ) == 1) + // the other snippet is just verbatim (no code!) +} + +assertVerbatimHtml(new File(basedir, "target/site/verbatim-apt.html")) +assertVerbatimHtml(new File(basedir, "target/site/verbatim-md.html")) diff --git a/src/main/resources/META-INF/maven/site.vm b/src/main/resources/META-INF/maven/site.vm index 03c96d4..9c4845c 100644 --- a/src/main/resources/META-INF/maven/site.vm +++ b/src/main/resources/META-INF/maven/site.vm @@ -239,7 +239,7 @@ #* *##set( $sourceStyle = "prettyprint" ) #* *##end ## -#* *##if ( $bodyContent )$bodyContent.replaceAll( '<pre>(<code[ >])', '<pre class="' + $sourceStyle + '">' + $esc.d + '1' ).replace( 'class="bodyTable"', 'class="table table-striped"' ).replace( 'class="bodyTable bodyTableBorder"', 'class="table table-bordered table-striped"' )#end +#* *##if ( $bodyContent )$bodyContent.replaceAll( '<pre>(<code[ >](?!.*class=\"nohighlight nocode\"))', '<pre class="' + $sourceStyle + '">' + $esc.d + '1' ).replace( 'class="bodyTable"', 'class="table table-striped"' ).replace( 'class="bodyTable bodyTableBorder"', 'class="table table-bordered table-striped"' )#end </main> #* *##if( $sideBarEnabled ) </div>