NamespaceRule.cs 796 Bytes
Newer Older
Eric Domke's avatar
Eric Domke committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using ExCSS.Model.Extensions;
// ReSharper disable once CheckNamespace


namespace ExCSS
{
    public class NamespaceRule : RuleSet
    {
        public NamespaceRule() 
        {
            RuleType = RuleType.Namespace;
        }

        public string Uri { get; set; }

        public string Prefix { get; set; }

        public override string ToString()
        {
            return ToString(false);
        }

        public override string ToString(bool friendlyFormat, int indentation = 0)
        {
            return string.IsNullOrEmpty(Prefix)
                 ? string.Format("@namespace '{0}';", Uri).NewLineIndent(friendlyFormat, indentation)
                 : string.Format("@namespace {0} '{1}';", Prefix, Uri).NewLineIndent(friendlyFormat, indentation);
        }
    }
}