This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 3ed43dc99f70a421a47d037ee7d6ddfba69a23fd
Author: Shad Storhaug <[email protected]>
AuthorDate: Sat Oct 30 17:12:55 2021 +0700

    src/docs/LuceneDocsPlugins/LuceneNoteTokenRendererPart.cs: Changed 
internal/experimental messages to match Lucene
---
 .../LuceneNoteTokenRendererPart.cs                 | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/docs/LuceneDocsPlugins/LuceneNoteTokenRendererPart.cs 
b/src/docs/LuceneDocsPlugins/LuceneNoteTokenRendererPart.cs
index f956ba0..8314577 100644
--- a/src/docs/LuceneDocsPlugins/LuceneNoteTokenRendererPart.cs
+++ b/src/docs/LuceneDocsPlugins/LuceneNoteTokenRendererPart.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * 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
@@ -19,6 +19,7 @@
 
 using Microsoft.DocAsCode.Dfm;
 using Microsoft.DocAsCode.MarkdownLite;
+using System.Text;
 
 namespace LuceneDocsPlugins
 {
@@ -27,14 +28,27 @@ namespace LuceneDocsPlugins
     /// </summary>
     public sealed class LuceneNoteTokenRendererPart : 
DfmCustomizedRendererPartBase<IMarkdownRenderer, LuceneNoteBlockToken, 
MarkdownBlockContext>
     {
-        private const string Message = "This is a Lucene.NET {0} API, use at 
your own risk";
+        private const string ExperimentalMessage = "This API is experimental 
and might change in incompatible ways in the next release.";
+        private const string InternalMessage = "This API is for internal 
purposes only and might change in incompatible ways in the next release.";
+
+        private readonly StringBuilder builder = new StringBuilder();
 
         public override string Name => "LuceneTokenRendererPart";
 
         public override bool Match(IMarkdownRenderer renderer, 
LuceneNoteBlockToken token, MarkdownBlockContext context) 
             => true;
 
-        public override StringBuffer Render(IMarkdownRenderer renderer, 
LuceneNoteBlockToken token, MarkdownBlockContext context) 
-            => "<div class=\"lucene-block lucene-" + token.Label.ToLower() + 
"\">" + string.Format(Message, token.Label.ToUpper()) + "</div>";
+        public override StringBuffer Render(IMarkdownRenderer renderer, 
LuceneNoteBlockToken token, MarkdownBlockContext context)
+        {
+            string message = token.Label.ToUpperInvariant() == "INTERNAL" ? 
InternalMessage : ExperimentalMessage;
+
+            builder.Clear(); // Reuse string builder
+            builder.AppendLine("<div class=\"NOTE\">");
+            builder.AppendLine("<h5>Note</h5>");
+            builder.Append("<p>").Append(message).AppendLine("</p>");
+            builder.AppendLine("</div>");
+            return builder.ToString();
+            //return "<div class=\"lucene-block lucene-" + 
token.Label.ToLower() + "\">" + string.Format(Message, token.Label.ToUpper()) + 
"</div>";
+        }
     }
 }
\ No newline at end of file

Reply via email to