Esempio n. 1
0
        public void Transform(Match match, MarkdownReplacementArgs args)
        {
            var reference = new ReferenceSection();

            foreach (var refMatch in match.Find(reference.Name))
            {
                reference.AddReference(refMatch, args);
            }

            var count = match.Matches.Count;

            for (int i = 0; i < count; i++)
            {
                var section     = match.Matches[i];
                var replacement = replacements.GetReplacement(section.Name);
                replacement.Transform(section, args);
            }
        }
Esempio n. 2
0
        public void ReplaceEncoding(int index, int end, Scanner scanner, MatchCollection matches, MarkdownReplacementArgs args)
        {
            int last  = index;
            var count = matches.Count;

            for (int i = 0; i < count; i++)
            {
                var replacementMatch = matches[i];
                var replacement      = replacements.GetReplacement(replacementMatch.Name);

                if (replacementMatch.Index > last)
                {
                    args.Output.Append(scanner.Substring(last, replacementMatch.Index - last));
                }
                last = replacementMatch.Index + replacementMatch.Length;

                replacement.Transform(replacementMatch, args);
            }
            if (last < end)
            {
                args.Output.Append(scanner.Substring(last, end - last));
            }
        }