You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2022/02/24 07:07:59 UTC

[lucenenet] branch master updated (e0c394b -> e75b86e)

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

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


    from e0c394b  docs: Lucene_Net_Codecs.md: Updated version in example to 4.8.0-beta00016
     new 72e5544  docs: Updated docs.ps1 and plugins to update the Changes link on the docs home page to point to the correct tag in the GitHub repository (fixes #621).
     new 11c10bd  Docs: Updated View Source link to use current version tag rather than master branch
     new e75b86e  BUG: Lucene.Net.Search.package.md: Corrected link to TooManyClausesException

The 3 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:
 src/Lucene.Net/Search/package.md                   |  2 +-
 .../EnvironmentVariableDfmTextInlineRule.cs        | 49 +++++++++++
 .../EnvironmentVariableInCodeBlockRule.cs          | 47 +++++++++++
 .../EnvironmentVariableInLinkInlineRule.cs         | 98 ++++++++++++++++++++++
 .../EnvironmentVariableInlineRule.cs               | 51 ++++++-----
 .../EnvironmentVariableRendererPart.cs             | 73 ++++++++--------
 .../LuceneDocsPlugins/EnvironmentVariableUtil.cs   | 67 +++++++++++++++
 .../LuceneDocsPlugins/LuceneDfmEngineCustomizer.cs | 65 +++++++++-----
 src/docs/LuceneDocsPlugins/LuceneNoteBlockRule.cs  | 37 ++++----
 src/docs/LuceneDocsPlugins/LuceneNoteBlockToken.cs | 38 ++++-----
 .../LuceneNoteTokenRendererPart.cs                 | 38 ++++-----
 src/docs/LuceneDocsPlugins/RendererPartProvider.cs | 43 +++++-----
 .../LuceneTemplate/ManagedReference.extension.js   |  6 +-
 .../common.js                                      | 14 +++-
 websites/apidocs/docfx.global.json                 |  9 +-
 websites/apidocs/docfx.global.subsite.json         |  5 +-
 websites/apidocs/docs.ps1                          |  5 ++
 websites/apidocs/index.md                          |  2 +-
 websites/apidocs/toc.yml                           |  6 +-
 websites/apidocs/toc/toc.yml                       |  6 +-
 20 files changed, 476 insertions(+), 185 deletions(-)
 create mode 100644 src/docs/LuceneDocsPlugins/EnvironmentVariableDfmTextInlineRule.cs
 create mode 100644 src/docs/LuceneDocsPlugins/EnvironmentVariableInCodeBlockRule.cs
 create mode 100644 src/docs/LuceneDocsPlugins/EnvironmentVariableInLinkInlineRule.cs
 create mode 100644 src/docs/LuceneDocsPlugins/EnvironmentVariableUtil.cs
 copy websites/apidocs/Templates/{DefaultTemplateNoAssets => LuceneTemplate}/common.js (92%)

[lucenenet] 01/03: docs: Updated docs.ps1 and plugins to update the Changes link on the docs home page to point to the correct tag in the GitHub repository (fixes #621).

Posted by ni...@apache.org.
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 72e55442fa2f5b9a4b84d93f885b21c04cf944ed
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Thu Feb 24 11:05:18 2022 +0700

    docs: Updated docs.ps1 and plugins to update the Changes link on the docs home page to point to the correct tag in the GitHub repository (fixes #621).
---
 .../EnvironmentVariableDfmTextInlineRule.cs        | 49 +++++++++++
 .../EnvironmentVariableInCodeBlockRule.cs          | 47 +++++++++++
 .../EnvironmentVariableInLinkInlineRule.cs         | 98 ++++++++++++++++++++++
 .../EnvironmentVariableInlineRule.cs               | 51 ++++++-----
 .../EnvironmentVariableRendererPart.cs             | 73 ++++++++--------
 .../LuceneDocsPlugins/EnvironmentVariableUtil.cs   | 67 +++++++++++++++
 .../LuceneDocsPlugins/LuceneDfmEngineCustomizer.cs | 65 +++++++++-----
 src/docs/LuceneDocsPlugins/LuceneNoteBlockRule.cs  | 37 ++++----
 src/docs/LuceneDocsPlugins/LuceneNoteBlockToken.cs | 38 ++++-----
 .../LuceneNoteTokenRendererPart.cs                 | 38 ++++-----
 src/docs/LuceneDocsPlugins/RendererPartProvider.cs | 43 +++++-----
 websites/apidocs/docs.ps1                          |  4 +
 websites/apidocs/index.md                          |  2 +-
 13 files changed, 445 insertions(+), 167 deletions(-)

diff --git a/src/docs/LuceneDocsPlugins/EnvironmentVariableDfmTextInlineRule.cs b/src/docs/LuceneDocsPlugins/EnvironmentVariableDfmTextInlineRule.cs
new file mode 100644
index 0000000..e68145c
--- /dev/null
+++ b/src/docs/LuceneDocsPlugins/EnvironmentVariableDfmTextInlineRule.cs
@@ -0,0 +1,49 @@
+//using Microsoft.DocAsCode.Dfm;
+//using Microsoft.DocAsCode.MarkdownLite;
+//using System;
+//using System.Text;
+//using System.Text.RegularExpressions;
+
+//namespace LuceneDocsPlugins
+//{
+//    // LUCENENET TODO: This is not functional yet
+
+//    /*
+//     * 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.
+//     */
+
+//    public class EnvironmentVariableDfmTextInlineRule : DfmTextInlineRule
+//    {
+//        public static readonly Regex EnvVar = EnvironmentVariableUtil.EnvVarRegexInline;
+
+//        public override IMarkdownToken TryMatch(IMarkdownParser parser, IMarkdownParsingContext context)
+//        {
+//            var match = Text.Match(context.CurrentMarkdown);
+//            if (match.Length == 0)
+//            {
+//                return null;
+//            }
+//            var sourceInfo = context.Consume(match.Length);
+
+//            //Console.WriteLine("Hey!!!!");
+
+//            var environmentVariableMatch = EnvVar.Match(match.Groups[0].Value);
+//            //Console.WriteLine(environmentVariableMatch.Success);
+//            string replacement = environmentVariableMatch.Success ? EnvironmentVariableUtil.ReplaceEnvironmentVariables(match.Groups[0].Value, match, new StringBuilder(match.Groups[0].Value.Length)) : match.Groups[0].Value;
+//            return new MarkdownTextToken(this, parser.Context, StringHelper.Escape(Smartypants(parser.Options, replacement)), sourceInfo);
+//        }
+//    }
+//}
diff --git a/src/docs/LuceneDocsPlugins/EnvironmentVariableInCodeBlockRule.cs b/src/docs/LuceneDocsPlugins/EnvironmentVariableInCodeBlockRule.cs
new file mode 100644
index 0000000..9d64892
--- /dev/null
+++ b/src/docs/LuceneDocsPlugins/EnvironmentVariableInCodeBlockRule.cs
@@ -0,0 +1,47 @@
+//using Microsoft.DocAsCode.MarkdownLite;
+//using System.Text.RegularExpressions;
+
+//namespace LuceneDocsPlugins
+//{
+//    // LUCENENET TODO: This is not functional yet
+
+//    /*
+//     * 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.
+//     */
+
+//    public class EnvironmentVariableInCodeBlockRule : MarkdownCodeBlockRule
+//    {
+//        public static readonly Regex EnvVarRegex = EnvironmentVariableUtil.EnvVarRegexInline;
+
+//        public override IMarkdownToken TryMatch(IMarkdownParser parser, IMarkdownParsingContext context)
+//        {
+//            //Console.WriteLine("Hello World!");
+
+//            var token = base.TryMatch(parser, context) as MarkdownCodeBlockToken;
+//            if (token is null) return null;
+
+//            //Console.WriteLine("Alert: Code.");
+//            //Console.WriteLine(token.Code);
+
+//            var environmentVariableMatch = EnvVarRegex.Match(token.Code);
+//            if (!environmentVariableMatch.Success) return token;
+
+//            var code = EnvironmentVariableUtil.ReplaceEnvironmentVariables(token.Code, environmentVariableMatch);
+
+//            return new MarkdownCodeBlockToken(token.Rule, token.Context, code, token.Lang, token.SourceInfo);
+//        }
+//    }
+//}
diff --git a/src/docs/LuceneDocsPlugins/EnvironmentVariableInLinkInlineRule.cs b/src/docs/LuceneDocsPlugins/EnvironmentVariableInLinkInlineRule.cs
new file mode 100644
index 0000000..73f3ca8
--- /dev/null
+++ b/src/docs/LuceneDocsPlugins/EnvironmentVariableInLinkInlineRule.cs
@@ -0,0 +1,98 @@
+using Microsoft.DocAsCode.MarkdownLite;
+using System;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace LuceneDocsPlugins
+{
+    /*
+     * 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.
+     */
+
+    /// <summary>
+    /// Replaces an environment variables that are nested within the text, href, or title of a Markdown link.
+    /// </summary>
+    public class EnvironmentVariableInLinkInlineRule : MarkdownLinkInlineRule
+    {
+        public override string Name => "EnvVar.Link";
+
+        public static readonly Regex EnvVarRegex = EnvironmentVariableUtil.EnvVarRegexInline;
+
+        public override IMarkdownToken TryMatch(IMarkdownParser parser, IMarkdownParsingContext context)
+        {
+            // NOTE: This copies the logic from MarkdownLinkInlineRule, but does not match if there are no links to replace.
+            // This isn't perfect, but at least it ensures we only match the one [Changes]() link it is intended to match
+            // and replaces multiple environment variables if they exist.
+
+            // The when the Consume() method below is called, there doesn't appear to be any way to make the cursor backtrack,
+            // and the scan is only performed once. This is why we have to resort to this. Not sure if there is a better way to make
+            // nested tokens than this, but it doesn't seem like there is.
+
+            var match = Link.Match(context.CurrentMarkdown);
+            if (match.Length == 0)
+            {
+                return null;
+            }
+            if (MarkdownInlineContext.GetIsInLink(parser.Context) && match.Value[0] != '!')
+            {
+                return null;
+            }
+            if (IsEscape(match.Groups[1].Value) || IsEscape(match.Groups[2].Value))
+            {
+                return null;
+            }
+
+            var text = match.Groups[1].Value;
+            var title = match.Groups[4].Value;
+            var href = match.Groups[2].Value;
+
+            var textMatch = EnvVarRegex.Match(text);
+            var titleMatch = EnvVarRegex.Match(title);
+            var hrefMatch = EnvVarRegex.Match(href);
+
+            // Don't match unless we have a match for our EnvVar pattern in any part of the link
+            if (!textMatch.Success && !titleMatch.Success && !hrefMatch.Success)
+                return null;
+
+            StringBuilder scratch = null;
+
+            if (textMatch.Success || titleMatch.Success || hrefMatch.Success)
+                scratch = new StringBuilder();
+
+            if (textMatch.Success)
+                text = EnvironmentVariableUtil.ReplaceEnvironmentVariables(text, textMatch, scratch);
+            if (titleMatch.Success)
+                title = EnvironmentVariableUtil.ReplaceEnvironmentVariables(title, titleMatch, scratch);
+            if (hrefMatch.Success)
+                href = EnvironmentVariableUtil.ReplaceEnvironmentVariables(href, hrefMatch, scratch);
+
+            var sourceInfo = context.Consume(match.Length);
+            return GenerateToken(parser, href, title, text, match.Value[0] == '!', sourceInfo, MarkdownLinkType.NormalLink, null);
+        }
+
+        private bool IsEscape(string text)
+        {
+            for (int i = text.Length - 1; i >= 0; i--)
+            {
+                if (text[i] != '\\')
+                {
+                    return (text.Length - i) % 2 == 0;
+                }
+            }
+            return text.Length % 2 == 1;
+        }
+    }
+}
diff --git a/src/docs/LuceneDocsPlugins/EnvironmentVariableInlineRule.cs b/src/docs/LuceneDocsPlugins/EnvironmentVariableInlineRule.cs
index 7fc8b34..545b83b 100644
--- a/src/docs/LuceneDocsPlugins/EnvironmentVariableInlineRule.cs
+++ b/src/docs/LuceneDocsPlugins/EnvironmentVariableInlineRule.cs
@@ -1,37 +1,30 @@
-/*
- * 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.
- */
-
+using Microsoft.DocAsCode.MarkdownLite;
 using System;
-using System.Collections.Immutable;
-using System.Text.RegularExpressions;
-using Microsoft.DocAsCode.MarkdownLite;
 
 namespace LuceneDocsPlugins
 {
+    /*
+     * 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.
+     */
+
     public class EnvironmentVariableInlineRule : IMarkdownRule
     {
         // give it a name
         public string Name => "EnvVarToken";
 
-        // define my regex to match
-        private static readonly Regex _envVarRegex = new Regex(@"^\<EnvVar:(\w+?)\>", RegexOptions.Compiled);
-
         // process the match
         public IMarkdownToken TryMatch(IMarkdownParser parser, IMarkdownParsingContext context)
         {
@@ -41,8 +34,12 @@ namespace LuceneDocsPlugins
             // dotnet tool install lucene-cli -g --version [EnvVar: LuceneNetVersion]
             // ```
 
-            var match = _envVarRegex.Match(context.CurrentMarkdown);
-            if (match.Length == 0) return null;
+            //Console.Write(context.CurrentMarkdown);
+            //Console.WriteLine("------------------------------------------------------------------------------");
+
+            var match = EnvironmentVariableUtil.EnvVarRegex.Match(context.CurrentMarkdown);
+
+            if (!match.Success) return null;
 
             var envVar = match.Groups[1].Value;
             var text = Environment.GetEnvironmentVariable(envVar);
diff --git a/src/docs/LuceneDocsPlugins/EnvironmentVariableRendererPart.cs b/src/docs/LuceneDocsPlugins/EnvironmentVariableRendererPart.cs
index f6d5cfa..9fa48b6 100644
--- a/src/docs/LuceneDocsPlugins/EnvironmentVariableRendererPart.cs
+++ b/src/docs/LuceneDocsPlugins/EnvironmentVariableRendererPart.cs
@@ -1,43 +1,40 @@
-/*
- * 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.
- */
+//using Microsoft.DocAsCode.Dfm;
+//using Microsoft.DocAsCode.MarkdownLite;
 
-using Microsoft.DocAsCode.Dfm;
-using Microsoft.DocAsCode.MarkdownLite;
-using System.Linq;
+//namespace LuceneDocsPlugins
+//{
+//    /*
+//     * 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.
+//     */
 
-namespace LuceneDocsPlugins
-{
-    // TODO: this is actually not needed since we are inserting our own inline rule, although the docs
-    // claim we need it https://dotnet.github.io/docfx/tutorial/howto_customize_docfx_flavored_markdown.html
-    // maybe that is only the case for block level items? I cannot quite figure it out looking at the docfx code
+//    // TODO: this is actually not needed since we are inserting our own inline rule, although the docs
+//    // claim we need it https://dotnet.github.io/docfx/tutorial/howto_customize_docfx_flavored_markdown.html
+//    // maybe that is only the case for block level items? I cannot quite figure it out looking at the docfx code
 
-    ///// <summary>
-    ///// Used to replace environment variables tokens with their values
-    ///// </summary>
-    //public sealed class EnvironmentVariableRendererPart : DfmCustomizedRendererPartBase<IMarkdownRenderer, MarkdownTextToken, MarkdownInlineContext>
-    //{
-    //    public override string Name => "EnvironmentVariableRendererPart";
+//    /// <summary>
+//    /// Used to replace environment variables tokens with their values
+//    /// </summary>
+//    public sealed class EnvironmentVariableRendererPart : DfmCustomizedRendererPartBase<IMarkdownRenderer, MarkdownTextToken, MarkdownInlineContext>
+//    {
+//        public override string Name => "EnvironmentVariableRendererPart";
 
-    //    public override bool Match(IMarkdownRenderer renderer, MarkdownTextToken token, MarkdownInlineContext context) 
-    //        => true;
+//        public override bool Match(IMarkdownRenderer renderer, MarkdownTextToken token, MarkdownInlineContext context)
+//            => true;
 
-    //    public override StringBuffer Render(IMarkdownRenderer renderer, MarkdownTextToken token, MarkdownInlineContext context)
-    //        => token.Content;
-    //}
-}
\ No newline at end of file
+//        public override StringBuffer Render(IMarkdownRenderer renderer, MarkdownTextToken token, MarkdownInlineContext context)
+//            => token.Content;
+//    }
+//}
\ No newline at end of file
diff --git a/src/docs/LuceneDocsPlugins/EnvironmentVariableUtil.cs b/src/docs/LuceneDocsPlugins/EnvironmentVariableUtil.cs
new file mode 100644
index 0000000..9bdd241
--- /dev/null
+++ b/src/docs/LuceneDocsPlugins/EnvironmentVariableUtil.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace LuceneDocsPlugins
+{
+    /*
+     * 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.
+     */
+
+    public class EnvironmentVariableUtil
+    {
+        public const string EnvVarRegexString = @"[\<\[]EnvVar\:(\w+?)[\>\]]";
+        public static readonly Regex EnvVarRegex = new Regex("^" + EnvVarRegexString, RegexOptions.Compiled);
+        public static readonly Regex EnvVarRegexInline = new Regex(EnvVarRegexString, RegexOptions.Compiled | RegexOptions.Multiline);
+
+
+        public static string ReplaceEnvironmentVariables(string sourceText, Match match)
+            => ReplaceEnvironmentVariables(sourceText, match, reuse: null);
+
+        public static string ReplaceEnvironmentVariables(string sourceText, Match match, StringBuilder reuse)
+        {
+            if (match.Success)
+            {
+                if (reuse is null)
+                    reuse = new StringBuilder();
+                else
+                    reuse.Clear();
+
+                int lastMatchEnd = 0;
+
+                do
+                {
+                    var envVar = match.Groups[1].Value;
+
+                    // Append the prefix that didn't match the regex (or text since last match)
+                    reuse.Append(sourceText.Substring(lastMatchEnd, match.Index - lastMatchEnd));
+
+                    // Do the replacement of the regex match
+                    reuse.Append(Environment.GetEnvironmentVariable(envVar));
+
+                    lastMatchEnd = match.Index + match.Length;
+
+                } while ((match = match.NextMatch()).Success);
+
+                // Append the suffix that didn't match the regex
+                reuse.Append(sourceText.Substring(lastMatchEnd));
+
+                return reuse.ToString();
+            }
+            return sourceText;
+        }
+    }
+}
diff --git a/src/docs/LuceneDocsPlugins/LuceneDfmEngineCustomizer.cs b/src/docs/LuceneDocsPlugins/LuceneDfmEngineCustomizer.cs
index 6bfd711..08865b5 100644
--- a/src/docs/LuceneDocsPlugins/LuceneDfmEngineCustomizer.cs
+++ b/src/docs/LuceneDocsPlugins/LuceneDfmEngineCustomizer.cs
@@ -1,29 +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.
- */
-
+using System;
 using System.Collections.Generic;
+using System.Collections.Immutable;
 using System.Composition;
 using Microsoft.DocAsCode.Dfm;
 using Microsoft.DocAsCode.MarkdownLite;
 
 namespace LuceneDocsPlugins
 {
+    /*
+     * 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.
+     */
+
     /// <summary>
     /// Exports our custom markdown parser via MEF to DocFx
     /// </summary>
@@ -31,14 +31,39 @@ namespace LuceneDocsPlugins
     public class LuceneDfmEngineCustomizer : IDfmEngineCustomizer
     {
         public void Customize(DfmEngineBuilder builder, IReadOnlyDictionary<string, object> parameters)
-         {
+        {
             // insert inline rule at the top
+            builder.InlineRules = builder.InlineRules.Insert(0, new EnvironmentVariableInLinkInlineRule());
             builder.InlineRules = builder.InlineRules.Insert(0, new EnvironmentVariableInlineRule());
+            // LUCENENET TODO: The inline text replacement still isn't working. Not sure why.
+            //builder.InlineRules = builder.InlineRules.Insert(0, new EnvironmentVariableDfmTextInlineRule());
+
+            //// Find the MarkdownLinkInlineRule position, and insert rules to replace text within the link before it
+            //var markdownLinkInlineRuleIndex = builder.InlineRules.FindIndex(r => r is MarkdownLinkInlineRule);
+            //builder.InlineRules.Insert(markdownLinkInlineRuleIndex, new EnvironmentVariableInLinkInlineRule());
+
+            //builder.InlineRules = Replace<DfmTextInlineRule, EnvironmentVariableDfmTextInlineRule>(builder.InlineRules);
 
             // insert block rule above header rule. Why? I dunno, that's what the docs say: 
             // https://dotnet.github.io/docfx/tutorial/intro_markdown_lite.html#select-token-kind
             var blockIndex = builder.BlockRules.FindIndex(r => r is MarkdownHeadingBlockRule);
             builder.BlockRules = builder.BlockRules.Insert(blockIndex, new LuceneNoteBlockRule());
+
+            // LUCENENET TODO: The code replacement still isn't working (or even matching). Not sure why.
+            //builder.BlockRules = Replace<MarkdownCodeBlockRule, EnvironmentVariableInCodeBlockRule>(builder.BlockRules);
+        }
+
+        private static ImmutableList<IMarkdownRule> Replace<TSource, TReplacement>(ImmutableList<IMarkdownRule> blockRules)
+            where TSource : IMarkdownRule
+            where TReplacement : IMarkdownRule, new()
+        {
+            var index = blockRules.FindIndex(item => item is TSource);
+            if (index < 0)
+            {
+                throw new ArgumentException($"{typeof(TSource).Name} should exist!");
+            }
+            blockRules = blockRules.Insert(index, new TReplacement());
+            return blockRules.RemoveAt(index + 1);
         }
     }
 }
diff --git a/src/docs/LuceneDocsPlugins/LuceneNoteBlockRule.cs b/src/docs/LuceneDocsPlugins/LuceneNoteBlockRule.cs
index af3ce3c..938ef3f 100644
--- a/src/docs/LuceneDocsPlugins/LuceneNoteBlockRule.cs
+++ b/src/docs/LuceneDocsPlugins/LuceneNoteBlockRule.cs
@@ -1,27 +1,24 @@
-/*
- * 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.
- */
-
-using System.Text.RegularExpressions;
+using System.Text.RegularExpressions;
 using Microsoft.DocAsCode.MarkdownLite;
 
 namespace LuceneDocsPlugins
 {
+    /*
+     * 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.
+     */
 
     /// <summary>
     /// The regex rule to parse out the custom Lucene tokens
diff --git a/src/docs/LuceneDocsPlugins/LuceneNoteBlockToken.cs b/src/docs/LuceneDocsPlugins/LuceneNoteBlockToken.cs
index f98041e..d8dd4f6 100644
--- a/src/docs/LuceneDocsPlugins/LuceneNoteBlockToken.cs
+++ b/src/docs/LuceneDocsPlugins/LuceneNoteBlockToken.cs
@@ -1,26 +1,24 @@
-/*
- * 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.
- */
-
-using Microsoft.DocAsCode.MarkdownLite;
+using Microsoft.DocAsCode.MarkdownLite;
 
 namespace LuceneDocsPlugins
 {
+    /*
+     * 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.
+     */
+
     /// <summary>
     /// A custom token class representing our custom Lucene tokens
     /// </summary>
diff --git a/src/docs/LuceneDocsPlugins/LuceneNoteTokenRendererPart.cs b/src/docs/LuceneDocsPlugins/LuceneNoteTokenRendererPart.cs
index 8314577..8782ae1 100644
--- a/src/docs/LuceneDocsPlugins/LuceneNoteTokenRendererPart.cs
+++ b/src/docs/LuceneDocsPlugins/LuceneNoteTokenRendererPart.cs
@@ -1,28 +1,26 @@
-/*
- * 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.
- */
-
-using Microsoft.DocAsCode.Dfm;
+using Microsoft.DocAsCode.Dfm;
 using Microsoft.DocAsCode.MarkdownLite;
 using System.Text;
 
 namespace LuceneDocsPlugins
 {
+    /*
+     * 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.
+     */
+
     /// <summary>
     /// Used to replace custom Lucene tokens with custom HTML markup
     /// </summary>
diff --git a/src/docs/LuceneDocsPlugins/RendererPartProvider.cs b/src/docs/LuceneDocsPlugins/RendererPartProvider.cs
index 20c17a3..58ddda3 100644
--- a/src/docs/LuceneDocsPlugins/RendererPartProvider.cs
+++ b/src/docs/LuceneDocsPlugins/RendererPartProvider.cs
@@ -1,38 +1,39 @@
-/*
- * 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.
- */
-
-using System.Collections.Generic;
+using System.Collections.Generic;
 using System.Composition;
 using Microsoft.DocAsCode.Dfm;
 
 namespace LuceneDocsPlugins
 {
+    /*
+     * 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.
+     */
+
     /// <summary>
     /// Exports our custom renderer via MEF to DocFx
     /// </summary>
     [Export(typeof(IDfmCustomizedRendererPartProvider))]
     public class RendererPartProvider : IDfmCustomizedRendererPartProvider
     {
+        private readonly LuceneNoteTokenRendererPart luceneNoteTokenRendererPart = new LuceneNoteTokenRendererPart();
+
         public IEnumerable<IDfmCustomizedRendererPart> CreateParts(IReadOnlyDictionary<string, object> parameters)
         {
-            yield return new LuceneNoteTokenRendererPart();
+            yield return luceneNoteTokenRendererPart;
             //yield return new EnvironmentVariableRendererPart();
+            //yield return new EnvironmentVariableBlockRendererPart();
         }
     }
 
diff --git a/websites/apidocs/docs.ps1 b/websites/apidocs/docs.ps1
index b344281..09044fa 100644
--- a/websites/apidocs/docs.ps1
+++ b/websites/apidocs/docs.ps1
@@ -45,8 +45,12 @@ if ($BaseUrl -eq 'https://lucenenet.apache.org/docs/') {
 $BaseUrl = $BaseUrl.TrimEnd('/') # Remove any trailing slash
 Write-Host "Base URL for xref map set to $BaseUrl"
 
+# Generate the Git tag for the current version
+$VCSLabel = 'Lucene.Net_' + $LuceneNetVersion.Replace('.', '_').Replace('-', '_')
+
 # set env vars that will be replaced in Markdown
 $env:LuceneNetVersion = $LuceneNetVersion
+$env:LuceneNetReleaseTag = $VCSLabel
 
 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
 
diff --git a/websites/apidocs/index.md b/websites/apidocs/index.md
index 1a198e5..d0ebe9e 100644
--- a/websites/apidocs/index.md
+++ b/websites/apidocs/index.md
@@ -29,7 +29,7 @@ on some of the conceptual or inner details of Lucene:
 
 ## Reference Documents
 
-- [Changes](https://github.com/apache/lucenenet/releases/tag/<EnvVar:LuceneNetReleaseTag>): List of changes in this release.
+- [Changes](https://github.com/apache/lucenenet/releases/tag/[EnvVar:LuceneNetReleaseTag]): List of changes in this release.
 <!-- - System Requirements: Minimum and supported .NET versions. LUCENENT TODO: Add link -->
 - [Migration Guide](xref:Lucene.Net.Migration.Guide): What changed in Lucene 4; how to migrate code from Lucene 3.x.
 - [Source Stepping](xref:source-stepping): How to use the Visual Studio debugger to step into Lucene.NET source code.

[lucenenet] 02/03: Docs: Updated View Source link to use current version tag rather than master branch

Posted by ni...@apache.org.
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 11c10bd2338fe33b3ae2ae31d3838f4f077c2e3c
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Thu Feb 24 13:46:08 2022 +0700

    Docs: Updated View Source link to use current version tag rather than master branch
---
 .../LuceneTemplate/ManagedReference.extension.js   |   6 +-
 .../apidocs/Templates/LuceneTemplate/common.js     | 245 +++++++++++++++++++++
 websites/apidocs/docfx.global.json                 |   9 +-
 websites/apidocs/docfx.global.subsite.json         |   5 +-
 websites/apidocs/docs.ps1                          |   1 +
 websites/apidocs/toc.yml                           |   6 +-
 websites/apidocs/toc/toc.yml                       |   6 +-
 7 files changed, 263 insertions(+), 15 deletions(-)

diff --git a/websites/apidocs/Templates/LuceneTemplate/ManagedReference.extension.js b/websites/apidocs/Templates/LuceneTemplate/ManagedReference.extension.js
index 03bb818..af52187 100644
--- a/websites/apidocs/Templates/LuceneTemplate/ManagedReference.extension.js
+++ b/websites/apidocs/Templates/LuceneTemplate/ManagedReference.extension.js
@@ -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
@@ -29,6 +29,10 @@ exports.preTransform = function (model) {
   if (model && model._gitSource && model.source && model.source.remote && model.source.remote.repo) {
     model.source.remote.repo = model._gitSource;
   }
+  
+  if (model && model._gitContribute && model._gitContribute.tag && model.source && model.source.remote) {
+    model.source.remote.tag = model._gitContribute.tag;
+  }
 
   return model;
 }
diff --git a/websites/apidocs/Templates/LuceneTemplate/common.js b/websites/apidocs/Templates/LuceneTemplate/common.js
new file mode 100644
index 0000000..d56c74f
--- /dev/null
+++ b/websites/apidocs/Templates/LuceneTemplate/common.js
@@ -0,0 +1,245 @@
+/*
+ * 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.
+ */
+
+// Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.
+exports.path = {};
+exports.path.getFileNameWithoutExtension = getFileNameWithoutExtension;
+exports.path.getDirectoryName = getDirectoryName;
+
+exports.getHtmlId = getHtmlId;
+
+exports.getViewSourceHref = getViewSourceHref;
+exports.getImproveTheDocHref = getImproveTheDocHref;
+exports.processSeeAlso = processSeeAlso;
+
+exports.isAbsolutePath = isAbsolutePath;
+exports.isRelativePath = isRelativePath;
+
+function getFileNameWithoutExtension(path) {
+    if (!path || path[path.length - 1] === '/' || path[path.length - 1] === '\\') return '';
+    var fileName = path.split('\\').pop().split('/').pop();
+    return fileName.slice(0, fileName.lastIndexOf('.'));
+}
+
+function getDirectoryName(path) {
+    if (!path) return '';
+    var index = path.lastIndexOf('/');
+    return path.slice(0, index + 1);
+}
+
+function getHtmlId(input) {
+    if (!input) return '';
+    return input.replace(/\W/g, '_');
+}
+
+// Note: the parameter `gitContribute` won't be used in this function
+function getViewSourceHref(item, gitContribute, gitUrlPattern) {
+    if (!item || !item.source || !item.source.remote) return '';
+    return getRemoteUrl(item.source.remote, item.source.startLine - '0' + 1, null, gitUrlPattern);
+}
+
+function getImproveTheDocHref(item, gitContribute, gitUrlPattern) {
+    if (!item) return '';
+    if (!item.documentation || !item.documentation.remote) {
+        // LUCENENET TODO: Set up Improve This Doc to edit the .cs file (the xml doc comments) rather than creating a new .md file
+        //if (item || item.source || item.source.remote) {
+        //    return getRemoteUrl(item.source.remote, item.source.startLine - '0' + 1, gitContribute, gitUrlPattern);
+        //} else {
+            return getNewFileUrl(item, gitContribute, gitUrlPattern);
+        //}
+    } else {
+        return getRemoteUrl(item.documentation.remote, item.documentation.startLine + 1, gitContribute, gitUrlPattern);
+    }
+}
+
+function processSeeAlso(item) {
+    if (item.seealso) {
+        for (var key in item.seealso) {
+            addIsCref(item.seealso[key]);
+        }
+    }
+    item.seealso = item.seealso || null;
+}
+
+function isAbsolutePath(path) {
+    return /^(\w+:)?\/\//g.test(path);
+}
+
+function isRelativePath(path) {
+    if (!path) return false;
+    return !exports.isAbsolutePath(path);
+}
+
+var gitUrlPatternItems = {
+    'github': {
+        // HTTPS form: https://github.com/{org}/{repo}.git
+        // SSH form: git@github.com:{org}/{repo}.git
+        // generate URL: https://github.com/{org}/{repo}/blob/{branch}/{path}
+        'testRegex': /^(https?:\/\/)?(\S+\@)?(\S+\.)?github\.com(\/|:).*/i,
+        'generateUrl': function (gitInfo) {
+            var url = normalizeGitUrlToHttps(gitInfo.repo);
+            url = getRepoWithoutGitExtension(url);
+            url += '/blob' + '/' + gitInfo.branch + '/' + gitInfo.path;
+            if (gitInfo.startLine && gitInfo.startLine > 0) {
+                url += '/#L' + gitInfo.startLine;
+            }
+            return url;
+        },
+        'generateNewFileUrl': function (gitInfo, uid) {
+            var url = normalizeGitUrlToHttps(gitInfo.repo);
+            url = getRepoWithoutGitExtension(url);
+            url += '/new';
+            url += '/' + gitInfo.branch;
+            url += '/' + getOverrideFolder(gitInfo.apiSpecFolder);
+            url += '/new?filename=' + getHtmlId(uid) + '.md';
+            url += '&value=' + encodeURIComponent(getOverrideTemplate(uid));
+            return url;
+        }
+    },
+    'vso': {
+        // HTTPS form: https://{user}.visualstudio.com/{org}/_git/{repo}
+        // SSH form: ssh://{user}@{user}.visualstudio.com:22/{org}/_git/{repo}
+        // generated URL under branch: https://{user}.visualstudio.com/{org}/_git/{repo}?path={path}&version=GB{branch}
+        // generated URL under detached HEAD: https://{user}.visualstudio.com/{org}/_git/{repo}?path={path}&version=GC{commit}
+        'testRegex': /^(https?:\/\/)?(ssh:\/\/\S+\@)?(\S+\.)?visualstudio\.com(\/|:).*/i,
+        'generateUrl': function (gitInfo) {
+            var url = normalizeGitUrlToHttps(gitInfo.repo);
+            var branchPrefix = /[0-9a-fA-F]{40}/.test(gitInfo.branch) ? 'GC' : 'GB';
+            url += '?path=' + gitInfo.path + '&version=' + branchPrefix + gitInfo.branch;
+            if (gitInfo.startLine && gitInfo.startLine > 0) {
+                url += '&line=' + gitInfo.startLine;
+            }
+            return url;
+        },
+        'generateNewFileUrl': function (gitInfo, uid) {
+            return '';
+        }
+    }
+}
+
+function getRepoWithoutGitExtension(repo) {
+    if (repo.substr(-4) === '.git') {
+        repo = repo.substr(0, repo.length - 4);
+    }
+    return repo;
+}
+
+function normalizeGitUrlToHttps(repo) {
+    var pos = repo.indexOf('@');
+    if (pos == -1) return repo;
+    return 'https://' + repo.substr(pos + 1).replace(/:[0-9]+/g, '').replace(/:/g, '/');
+}
+
+function getNewFileUrl(item, gitContribute, gitUrlPattern) {
+    // do not support VSO for now
+    if (!item.source) {
+        return '';
+    }
+
+    var gitInfo = getGitInfo(gitContribute, item.source.remote);
+    if (!gitInfo.repo || !gitInfo.branch || !gitInfo.path) {
+        return '';
+    }
+
+    var patternName = getPatternName(gitInfo.repo, gitUrlPattern);
+    if (!patternName) return patternName;
+    return gitUrlPatternItems[patternName].generateNewFileUrl(gitInfo, item.uid);
+}
+
+function getRemoteUrl(remote, startLine, gitContribute, gitUrlPattern) {
+    var gitInfo = getGitInfo(gitContribute, remote);
+    if (!gitInfo.repo || !gitInfo.branch || !gitInfo.path) {
+        return '';
+    }
+
+    var patternName = getPatternName(gitInfo.repo, gitUrlPattern);
+    if (!patternName) return '';
+
+    gitInfo.startLine = startLine;
+    // LUCENENET specific - change view source link to show latest tag, not the docs branch
+    if (!gitContribute && gitInfo.tag) {
+        gitInfo.branch = gitInfo.tag;
+    }
+    return gitUrlPatternItems[patternName].generateUrl(gitInfo);
+}
+
+function getGitInfo(gitContribute, gitRemote) {
+    // apiSpecFolder defines the folder contains overwrite files for MRef, the default value is apiSpec
+    var defaultApiSpecFolder = 'apiSpec';
+
+    var result = {};
+    if (gitContribute && gitContribute.apiSpecFolder) {
+        result.apiSpecFolder = gitContribute.apiSpecFolder;
+    } else {
+        result.apiSpecFolder = defaultApiSpecFolder;
+    }
+    mergeKey(gitContribute, gitRemote, result, 'repo');
+    mergeKey(gitContribute, gitRemote, result, 'branch');
+    mergeKey(gitContribute, gitRemote, result, 'path');
+    mergeKey(gitContribute, gitRemote, result, 'tag'); // LUCENENET specific
+
+    return result;
+
+    function mergeKey(source, sourceFallback, dest, key) {
+        if (source && source.hasOwnProperty(key)) {
+            dest[key] = source[key];
+        } else if (sourceFallback && sourceFallback.hasOwnProperty(key)) {
+            dest[key] = sourceFallback[key];
+        }
+    }
+}
+
+function getPatternName(repo, gitUrlPattern) {
+    if (gitUrlPattern && gitUrlPattern.toLowerCase() in gitUrlPatternItems) {
+        return gitUrlPattern.toLowerCase();
+    } else {
+        for (var p in gitUrlPatternItems) {
+            if (gitUrlPatternItems[p].testRegex.test(repo)) {
+                return p;
+            }
+        }
+    }
+    return '';
+}
+
+function getOverrideFolder(path) {
+    if (!path) return "";
+    path = path.replace('\\', '/');
+    if (path.charAt(path.length - 1) == '/') path = path.substring(0, path.length - 1);
+    return path;
+}
+
+function getOverrideTemplate(uid) {
+    if (!uid) return "";
+    var content = "";
+    content += "---\n";
+    content += "uid: " + uid + "\n";
+    content += "summary: '*You can override summary for the API here using *MARKDOWN* syntax'\n";
+    content += "---\n";
+    content += "\n";
+    content += "*Please type below more information about this API:*\n";
+    content += "\n";
+    return content;
+}
+
+function addIsCref(seealso) {
+    if (!seealso.linkType || seealso.linkType.toLowerCase() == "cref") {
+        seealso.isCref = true;
+    }
+}
diff --git a/websites/apidocs/docfx.global.json b/websites/apidocs/docfx.global.json
index 8e0f4fc..b46149e 100644
--- a/websites/apidocs/docfx.global.json
+++ b/websites/apidocs/docfx.global.json
@@ -1,14 +1,15 @@
 {
-    "_appTitle":  "Apache Lucene.NET 4.8.0-beta00015 Documentation",
+    "_appTitle":  "Apache Lucene.NET 4.8.0-beta00016 Documentation",
     "_disableContribution":  false,
     "_appFaviconPath":  "logo/favicon.ico",
     "_enableSearch":  true,
     "_appLogoPath":  "logo/lucene-net-color.png",
-    "_appFooter":  "Copyright \u0026copy; 2021 The Apache Software Foundation, Licensed under the \u003ca href=\u0027http://www.apache.org/licenses/LICENSE-2.0\u0027 target=\u0027_blank\u0027\u003eApache License, Version 2.0\u003c/a\u003e\u003cbr/\u003e \u003csmall\u003eApache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation. \u003cbr/\u003eAll other marks mentioned may be trademarks or regist [...]
+    "_appFooter":  "Copyright \u0026copy; 2022 The Apache Software Foundation, Licensed under the \u003ca href=\u0027http://www.apache.org/licenses/LICENSE-2.0\u0027 target=\u0027_blank\u0027\u003eApache License, Version 2.0\u003c/a\u003e\u003cbr/\u003e \u003csmall\u003eApache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation. \u003cbr/\u003eAll other marks mentioned may be trademarks or regist [...]
     "_gitContribute":  {
                            "repo":  "https://github.com/apache/lucenenet",
-                           "branch":  "docs/4.8.0-beta00015",
-                           "apiSpecFolder":  "websites/apidocs/apiSpec"
+                           "branch":  "docs/4.8.0-beta00016",
+                           "apiSpecFolder":  "websites/apidocs/apiSpec",
+                           "tag":  "Lucene.Net_4_8_0_beta00016"
                        },
     "_gitSource":  "https://github.com/apache/lucenenet.git"
 }
diff --git a/websites/apidocs/docfx.global.subsite.json b/websites/apidocs/docfx.global.subsite.json
index b5a4166..6cf6b98 100644
--- a/websites/apidocs/docfx.global.subsite.json
+++ b/websites/apidocs/docfx.global.subsite.json
@@ -1,5 +1,4 @@
-{
+{
   "_rel": "https://lucenenet.apache.org/docs/4.8.0-beta00009/",
-  "_api": "https://lucenenet.apache.org/docs/4.8.0-beta00015/"
+  "_api": "https://lucenenet.apache.org/docs/4.8.0-beta00016/"
 }
-
diff --git a/websites/apidocs/docs.ps1 b/websites/apidocs/docs.ps1
index 09044fa..38728b5 100644
--- a/websites/apidocs/docs.ps1
+++ b/websites/apidocs/docs.ps1
@@ -125,6 +125,7 @@ $DocFxJsonContent = Get-Content $DocFxGlobalJson | ConvertFrom-Json
 $DocFxJsonContent._appFooter = "Copyright &copy; $((Get-Date).Year) The Apache Software Foundation, Licensed under the <a href='http://www.apache.org/licenses/LICENSE-2.0' target='_blank'>Apache License, Version 2.0</a><br/> <small>Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation. <br/>All other marks mentioned may be trademarks or registered trademarks of their respective owners.</small>"
 $DocFxJsonContent._appTitle = "Apache Lucene.NET $LuceneNetVersion Documentation"
 $DocFxJsonContent._gitContribute.branch = "docs/$LuceneNetVersion"
+$DocFxJsonContent._gitContribute.tag = "$VCSLabel"
 $DocFxJsonContent | ConvertTo-Json -depth 100 | Set-Content $DocFxGlobalJson
 
 # NOTE: The order of these depends on if one of the projects requries the xref map of another, normally all require the core xref map
diff --git a/websites/apidocs/toc.yml b/websites/apidocs/toc.yml
index 72dbfa1..446bef5 100644
--- a/websites/apidocs/toc.yml
+++ b/websites/apidocs/toc.yml
@@ -1,9 +1,7 @@
-- name: Lucene.Net API
-  topicHref: https://lucenenet.apache.org/docs/4.8.0-beta00015/
+- name: Lucene.Net API
+  topicHref: https://lucenenet.apache.org/docs/4.8.0-beta00016/
 - name: Lucene.Net CLI
   href: ../../src/dotnet/tools/lucene-cli/docs/
   topicHref: ../../src/dotnet/tools/lucene-cli/docs/index.md
 - name: Lucene.Net Website
   href: https://lucenenet.apache.org/
-
-
diff --git a/websites/apidocs/toc/toc.yml b/websites/apidocs/toc/toc.yml
index eab677c..f4c7b8d 100644
--- a/websites/apidocs/toc/toc.yml
+++ b/websites/apidocs/toc/toc.yml
@@ -1,6 +1,6 @@
-- name: Lucene.Net API
-  topicHref: https://lucenenet.apache.org/docs/4.8.0-beta00015
+- name: Lucene.Net API
+  topicHref: https://lucenenet.apache.org/docs/4.8.0-beta00016
 - name: Lucene.Net CLI
-  topicHref: https://lucenenet.apache.org/docs/4.8.0-beta00015/cli/index.html
+  topicHref: https://lucenenet.apache.org/docs/4.8.0-beta00016/cli/index.html
 - name: Lucene.Net Website
   topicHref: https://lucenenet.apache.org/

[lucenenet] 03/03: BUG: Lucene.Net.Search.package.md: Corrected link to TooManyClausesException

Posted by ni...@apache.org.
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 e75b86ecc5ed8219100ec7a0b472e7a4454ec013
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Thu Feb 24 13:47:08 2022 +0700

    BUG: Lucene.Net.Search.package.md: Corrected link to TooManyClausesException
---
 src/Lucene.Net/Search/package.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Lucene.Net/Search/package.md b/src/Lucene.Net/Search/package.md
index c5f3b9d..e7de812 100644
--- a/src/Lucene.Net/Search/package.md
+++ b/src/Lucene.Net/Search/package.md
@@ -59,7 +59,7 @@ Things start to get interesting when one combines multiple [TermQuery](xref:Luce
 2. <p>[Occur.MUST](xref:Lucene.Net.Search.Occur#Lucene_Net_Search_Occur_MUST) — Use this operator when a clause is required to occur in the result set. Every document in the result set will match all such clauses.</p>
 3. <p>[Occur.MUST_NOT](xref:Lucene.Net.Search.Occur#Lucene_Net_Search_Occur_MUST_NOT) — Use this operator when a clause must not occur in the result set. No document in the result set will match any such clauses.</p>
 
-Boolean queries are constructed by adding two or more [BooleanClause](xref:Lucene.Net.Search.BooleanClause) instances. If too many clauses are added, a [TooManyClauses](xref:Lucene.Net.Search.BooleanQuery.TooManyClauses) exception will be thrown during searching. This most often occurs when a [Query](xref:Lucene.Net.Search.Query) is rewritten into a [BooleanQuery](xref:Lucene.Net.Search.BooleanQuery) with many [TermQuery](xref:Lucene.Net.Search.TermQuery) clauses, for example by [Wildcar [...]
+Boolean queries are constructed by adding two or more [BooleanClause](xref:Lucene.Net.Search.BooleanClause) instances. If too many clauses are added, a [TooManyClausesException](xref:Lucene.Net.Search.BooleanQuery.TooManyClausesException) will be thrown during searching. This most often occurs when a [Query](xref:Lucene.Net.Search.Query) is rewritten into a [BooleanQuery](xref:Lucene.Net.Search.BooleanQuery) with many [TermQuery](xref:Lucene.Net.Search.TermQuery) clauses, for example by  [...]
 
 #### Phrases