WikiFunctions.Parse.Parsers.RefsBeforePunctuation C# (CSharp) Method

RefsBeforePunctuation() private static method

private static RefsBeforePunctuation ( string articleText ) : string
articleText string
return string
        private static string RefsBeforePunctuation(string articleText)
        {
            bool skip = false;
            // 'quick' regexes are used for runtime performance saving
            if (RefsBeforePunctuationQuick.IsMatch(articleText))
            {
                while(!skip && RefsBeforePunctuationR.IsMatch(articleText))
                {
                    articleText = RefsBeforePunctuationR.Replace(articleText, m =>
                        {
                            // do not move punctuation if colon after ref on line starting with semi colon
                            if(m.Groups[2].Value.Equals(":") && LineStartsSemiColon.Matches(articleText).Cast<Match>().Any(l => l.Value.Contains(m.Value)))
                            {
                                skip = true;
                                return m.Value;
                            }

                            return m.Groups[2].Value + m.Groups[1].Value + m.Groups[3].Value;
                        });
                    articleText = RefsAfterDupePunctuation.Replace(articleText, "$1$2$3");
                }
            }
            return articleText;
        }
Parsers