public override void Handler()
 {
     if (HasAttribute("name") && HasAttribute("href"))
     {
         HtmlSkeleton.AddFont(GetAttribute("name"), GetAttribute("href"));
     }
 }
        public override void Handler()
        {
            string css = GetContent();

            if (string.IsNullOrWhiteSpace(css))
            {
                return;
            }

            HtmlSkeleton.AddStyle(css, HasAttribute("inline"));
        }
Exemple #3
0
        public string GetColumnClass()
        {
            var parsedWidth      = GetParsedWidth();
            var formattedClassNb = parsedWidth.Value.ToString().Replace('.', '-');

            // LR: Default to pixels
            string className = $"mj-column-px-{formattedClassNb}";

            // LR: Override for percetages
            if (parsedWidth.Unit.Equals("%", StringComparison.InvariantCultureIgnoreCase))
            {
                className = $"mj-column-per-{formattedClassNb}";
            }

            HtmlSkeleton.AddMediaQuery(className, parsedWidth);

            return(className);
        }
Exemple #4
0
        public BodyComponent(IElement element, BaseComponent parent) : base(element, parent)
        {
            string tagName = GetTagName();

            // If inside the head of the document then ignore component setup which is used for rendering.
            if (IsBodyComponentInDocumentHead())
            {
                return;
            }

            // LR: Setup Box Model
            CssBoxModel = GetBoxModel();

            // LR: Register component styles
            HtmlSkeleton.AddHeadStyle(tagName, HeadStyle());
            HtmlSkeleton.AddComponentHeadStyle(tagName, ComponentsHeadStyle());

            // LR: Setup last
            SetupStyles();
        }
Exemple #5
0
        public async Task <string> CompileAsync()
        {
            // LR: Wrap the dynamically generated content in a the skeleton template
            string html = HtmlSkeleton.Build(VirtualDocument);

            // LR: Pass to the content post-processor
            string processed = ContentPostProcess(html);

            // LR: Respect parser options
            if (_parserOptions.Minify)
            {
                return(await MinifyHtmlAsync(processed));
            }
            else if (_parserOptions.Prettify)
            {
                return(await PrettifyHtmlAsync(processed));
            }

            // Faster
            return(processed);
        }