Exemplo n.º 1
0
        public override void WriteOutput(OutputContext context)
        {
            using (var scope = context.BeginUndoableScope()) {
                context.Append("@media ");
                for (var index = 0; index < mediaQueries.Count; index++)
                {
                    if (index > 0)
                    {
                        context.Append(", ");
                    }

                    var mediaQuery = mediaQueries[index];
                    context.Append(mediaQuery);
                }

                context.AppendLine(" {");

                using (context.EnterExtenderScope(Extenders))
                {
                    if (context.Append(Block))
                    {
                        scope.KeepChanges();
                    }
                }

                context.AppendLine("}");
            }
        }
Exemplo n.º 2
0
        public override void WriteOutput(OutputContext context)
        {
            if (Block.RuleCount == 0)
            {
                return;
            }


            if (context.IsReference)
            {
                var extenderSelectorList = new SelectorList(Selectors.Selectors.SelectMany(s => context.Extensions.GetExtensions(s, includeReferences: false)));
                if (extenderSelectorList.IsEmpty())
                {
                    return;
                }

                context.Append(extenderSelectorList);
            }
            else
            {
                context.Append(Selectors);
            }

            context.AppendOptional(' ');
            context.AppendLine("{");
            context.Append(Block);
            context.Indent();
            context.AppendLine("}");
        }
Exemplo n.º 3
0
        public override void WriteOutput(OutputContext context)
        {
            if (block.Statements.Count == 0)
            {
                return;
            }

            context.IncreaseIndentLevel();

            context.Indent();

            for (var index = 0; index < keyframePositions.Count; index++)
            {
                var keyframePosition = keyframePositions[index];

                context.Append(keyframePosition);

                if (index < keyframePositions.Count - 1)
                {
                    context.Append(", ");
                }
            }

            context.AppendOptional(' ');
            context.AppendLine("{");

            context.Append(block);

            context.Indent();
            context.AppendLine("}");

            context.DecreaseIndentLevel();
        }
Exemplo n.º 4
0
        public override void WriteOutput(OutputContext context)
        {
            context.Append("@supports");
            context.Append(' ');
            context.Append(condition);
            context.AppendOptional(' ');

            context.AppendLine("{");
            context.Append(block);
            context.AppendLine("}");
        }
Exemplo n.º 5
0
 public override void WriteOutput(OutputContext context)
 {
     context.Indent();
     context.Append('@');
     context.Append(ruleIdentifier);
     context.Append(' ');
     context.Append(identifier);
     context.AppendOptional(' ');
     context.AppendLine("{");
     foreach (var keyframe in keyframes)
     {
         context.Append(keyframe);
     }
     context.Indent();
     context.AppendLine("}");
 }
Exemplo n.º 6
0
        public override void WriteOutput(OutputContext context)
        {
            context.Indent();
            context.Append("@page");
            if (additionalSelector != null)
            {
                context.Append(' ');
                context.Append(additionalSelector);
            }

            context.AppendOptional(' ');
            context.AppendLine("{");
            context.Append(block);

            context.Indent();
            context.AppendLine("}");
        }
Exemplo n.º 7
0
        public override void WriteOutput(OutputContext context)
        {
            context.Indent();
            context.Append("@");
            context.Append(identifier);
            if (value != null)
            {
                context.Append(' ');
                context.Append(value);
            }

            context.AppendOptional(' ');
            context.AppendLine("{");
            context.Append(block);

            context.Indent();
            context.AppendLine("}");
        }
Exemplo n.º 8
0
        public override void WriteOutput(OutputContext context)
        {
            var lines = content.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var line in lines)
            {
                context.Indent();
                context.AppendLine(line);
            }
        }
Exemplo n.º 9
0
        public override void WriteOutput(OutputContext context)
        {
            context.Indent();
            context.Append("@import");
            context.Append(' ');
            context.Append(Url);
            if (mediaQueries.Any())
            {
                context.Append(' ');

                WriteQueries(context);
            }
            context.AppendLine(";");
        }
Exemplo n.º 10
0
        public override void WriteOutput(OutputContext context)
        {
            var outputSelectors = Selectors
                                  .Concat(Selectors.SelectMany(s => context.Extensions.GetExtensions(s, includeReferences: true)))
                                  .Distinct()
                                  .ToList();

            for (var index = 0; index < outputSelectors.Count; index++)
            {
                context.Indent();
                var selector = outputSelectors[index];
                context.Append(selector);
                if (index < outputSelectors.Count - 1)
                {
                    context.AppendLine(",");
                }
            }
        }
Exemplo n.º 11
0
        public override void WriteOutput(OutputContext context)
        {
            using (var scope = context.BeginUndoableScope()) {
                context.IncreaseIndentLevel();

                bool hasOutput = false;

                for (var index = 0; index < Statements.Count; index++)
                {
                    var statement = Statements[index];
                    if (statement is Rule r)
                    {
                        // Rules may exist within media queries, but are only indented and semicolon-terminated within rule blocks
                        context.Indent();

                        hasOutput |= context.Append(r);

                        bool isLast = index == Statements.Count - 1;
                        if (isLast)
                        {
                            context.AppendOptional(';');
                        }
                        else
                        {
                            context.Append(';');
                        }
                        context.AppendLine();
                    }
                    else
                    {
                        hasOutput |= context.Append(statement);
                    }
                }

                if (hasOutput)
                {
                    scope.KeepChanges();
                }

                context.DecreaseIndentLevel();
            }
        }
Exemplo n.º 12
0
 public override void WriteOutput(OutputContext context)
 {
     context.Append("@charset ");
     context.Append(charset);
     context.AppendLine(";");
 }