You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2023/01/28 22:22:44 UTC
[maven-reporting-impl] branch MSHARED-1185 updated (2f46537 -> c4b1ad4)
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a change to branch MSHARED-1185
in repository https://gitbox.apache.org/repos/asf/maven-reporting-impl.git
discard 2f46537 [MSHARED-1185] Introduce AbstractMavenReportRenderer#verbatimSource()
new c4b1ad4 [MSHARED-1185] Introduce AbstractMavenReportRenderer#verbatimSource()
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (2f46537)
\
N -- N -- N refs/heads/MSHARED-1185 (c4b1ad4)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../java/org/apache/maven/reporting/AbstractMavenReportRenderer.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[maven-reporting-impl] 01/01: [MSHARED-1185] Introduce AbstractMavenReportRenderer#verbatimSource()
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch MSHARED-1185
in repository https://gitbox.apache.org/repos/asf/maven-reporting-impl.git
commit c4b1ad4b987f622e8c9e231d15ff6f14257facb6
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sat Jan 28 23:10:47 2023 +0100
[MSHARED-1185] Introduce AbstractMavenReportRenderer#verbatimSource()
---
.../reporting/its/custom/CustomReportRenderer.java | 4 ++++
src/it/use-as-direct-mojo/verify.groovy | 11 +++++++++--
src/it/use-as-site-report/verify.groovy | 12 ++++++++++--
.../reporting/AbstractMavenReportRenderer.java | 21 +++++++++++++++++++--
4 files changed, 42 insertions(+), 6 deletions(-)
diff --git a/src/it/setup-reporting-plugin/src/main/java/org/apache/maven/reporting/its/custom/CustomReportRenderer.java b/src/it/setup-reporting-plugin/src/main/java/org/apache/maven/reporting/its/custom/CustomReportRenderer.java
index 53536a8..ea75516 100644
--- a/src/it/setup-reporting-plugin/src/main/java/org/apache/maven/reporting/its/custom/CustomReportRenderer.java
+++ b/src/it/setup-reporting-plugin/src/main/java/org/apache/maven/reporting/its/custom/CustomReportRenderer.java
@@ -44,6 +44,10 @@ public class CustomReportRenderer
text( "Custom Maven Report with Renderer content." );
+ verbatimText( "Custom verbatim text." );
+
+ verbatimSource( "var custom_code = true;" );
+
endSection();
}
}
diff --git a/src/it/use-as-direct-mojo/verify.groovy b/src/it/use-as-direct-mojo/verify.groovy
index d1b9ee4..59438cd 100644
--- a/src/it/use-as-direct-mojo/verify.groovy
+++ b/src/it/use-as-direct-mojo/verify.groovy
@@ -25,10 +25,17 @@ assert f.text.contains( 'Custom Maven Report content.' );
f = new File( site, 'custom-report-with-renderer.html' );
assert f.exists();
-assert f.text.contains( 'Custom Maven Report with Renderer content.' );
+text = f.text.normalize();
+assert text.contains( 'Custom Maven Report with Renderer content.' );
+assert text.contains( '''\
+<div class="verbatim">
+<pre>Custom verbatim text.</pre></div>'''.normalize() );
+assert text.contains( '''\
+<div class="verbatim source">
+<pre>var custom_code = true;</pre></div>'''.normalize() );
f = new File( site, 'external/report.html' );
assert f.exists();
assert f.text.contains( '<h1>External Report</h1>' );
-return true;
\ No newline at end of file
+return true;
diff --git a/src/it/use-as-site-report/verify.groovy b/src/it/use-as-site-report/verify.groovy
index d1b9ee4..105ed52 100644
--- a/src/it/use-as-site-report/verify.groovy
+++ b/src/it/use-as-site-report/verify.groovy
@@ -25,10 +25,18 @@ assert f.text.contains( 'Custom Maven Report content.' );
f = new File( site, 'custom-report-with-renderer.html' );
assert f.exists();
-assert f.text.contains( 'Custom Maven Report with Renderer content.' );
+text = f.text.normalize();
+assert text.contains( 'Custom Maven Report with Renderer content.' );
+// TODO align with use-as-direct-mojo as soon as Maven Site Plugin uses Doxia 2.0.0-M5
+assert text.contains( '''\
+<div>
+<pre>Custom verbatim text.</pre></div>'''.normalize() );
+assert text.contains( '''\
+<div>
+<pre>var custom_code = true;</pre></div>'''.normalize() );
f = new File( site, 'external/report.html' );
assert f.exists();
assert f.text.contains( '<h1>External Report</h1>' );
-return true;
\ No newline at end of file
+return true;
diff --git a/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java b/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java
index cd339d8..2daf830 100644
--- a/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java
+++ b/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java
@@ -21,7 +21,7 @@ package org.apache.maven.reporting;
import org.apache.maven.doxia.markup.Markup;
import org.apache.maven.doxia.sink.Sink;
-
+import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
import org.apache.maven.shared.utils.StringUtils;
import java.util.ArrayList;
@@ -129,7 +129,7 @@ public abstract class AbstractMavenReportRenderer
/**
* Convenience method to wrap section ending in the current sink.
*
- * @see Sink#section_()
+ * @see Sink#section_(int)
* @throws IllegalStateException if too many closing sections.
*/
protected void endSection()
@@ -407,6 +407,23 @@ public abstract class AbstractMavenReportRenderer
}
}
+ /**
+ * Convenience method to wrap source code as verbatim style in the current sink .
+ *
+ * @param source a source code, could be null.
+ * @see #text(String)
+ * @see Sink#verbatim(org.apache.maven.doxia.sink.SinkEventAttributes)
+ * @see Sink#verbatim_()
+ */
+ protected void verbatimSource( String source )
+ {
+ sink.verbatim( SinkEventAttributeSet.SOURCE );
+
+ text( source );
+
+ sink.verbatim_();
+ }
+
/**
* Convenience method to add a Javascript code in the current sink.
*