public static void CreateControls(Action<HtmlWriter> rendering, ControlCollection controlCollection) { string html = HtmlWriter.Generate(rendering); if (string.IsNullOrEmpty(html)) return; var regex = new Regex(@"<\?UMBRACO_MACRO(?<property>\s*(?<name>[a-zA-Z_]+)=""(?<value>[^""]*)"")+\s*/>", RegexOptions.Singleline | RegexOptions.IgnoreCase); foreach (var extraction in regex.Extract(html)) { if (extraction.Type == RegexExtractionType.Text) controlCollection.Add(new LiteralControl(((RegexTextExtraction)extraction).Value)); else controlCollection.Add(LoadMacro(((RegexMatchExtraction)extraction).Value)); } }
public static void CreateModuleContent(Action<HtmlWriter> rendering, ControlCollection controlCollection, int? columnSpan) { string html = HtmlWriter.Generate(rendering); if (string.IsNullOrEmpty(html)) return; var regex = new Regex(@"<module ref=""(?<ref>\d+)""[^/]*/[^>]*>", RegexOptions.Singleline); foreach (var extraction in regex.Extract(html)) { if (extraction.Type == RegexExtractionType.Text) controlCollection.Add(new LiteralControl(((RegexTextExtraction)extraction).Value)); else controlCollection.Add(LoadModule(((RegexMatchExtraction)extraction).Value, columnSpan)); } }