本文整理汇总了C#中Element.Group方法的典型用法代码示例。如果您正苦于以下问题:C# Element.Group方法的具体用法?C# Element.Group怎么用?C# Element.Group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Element
的用法示例。
在下文中一共展示了Element.Group方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
internal Engine Parse(bool showTree, Element env)
{
var matches = _parser.Parse();
if(!matches) throw new ParsingException("FAILURE: Parser did not match input file");
var pegEl = _parser.GetRoot();
var treeWalker = new TreeBuilder(pegEl, less);
Root = treeWalker.Build();
css = Root.Group().ToCss();
if (showTree)
{
var tprint = new TreePrint(Console.Out, less, 60, new NodePrinter(_parser).GetNodeName, false);
tprint.PrintTree(_parser.GetRoot(), 0, 0);
}
return this;
}
示例2: CanRetrieveNearestElement
public void CanRetrieveNearestElement()
{
var root = new Element();
var e2 = new Element("E2", ">");
var e3 = new Element("#yahoo");
var e1 = new Element(".hello");
var e1_sibling = new Element(".goodbye");
var e1_siblingb = new Element(".helloAgain");
root.Add(e1);
root.Add(e1_sibling);
root.Add(e1_siblingb);
root.Add(new Variable("@RootVariable", new Color(1, 1, 1)));
e1.Add(e2);
e2.Add(e3);
e2.Add(new Variable("@Variable", new Color(1, 1, 1)));
e2.Add(new Variable("@NumVariable", new Number(10)));
var nearestEl = e3.Nearest("@Variable");
Assert.AreEqual(nearestEl.ToString(), "@Variable");
//TODO: Remove this nonsense it isnt a test its just to see ToCSS output
var nodes = new List<INode>
{
new Variable("@Variable", new Color(1, 1, 1)),
new Operator("+"),
new Number(2)
};
e1.Add(new Property("color", nodes));
e1_sibling.Add(new Property("color", nodes));
e1_siblingb.Add(new Property("color", nodes));
var nodesb = new List<INode>
{
new Number("px", 4),
new Operator("*"),
new Variable("@NumVariable")
};
e2.Add(new Property("padding", nodesb));
var nodesc = new List<INode>
{
new Variable("@RootVariable", new Color(1, 1, 1)),
new Operator("+"),
new Variable("@Variable", new Color(1, 1, 1))
};
e3.Add(new Property("background-color", nodesc));
Console.WriteLine(root.Group().ToCss());
}