Example #1
0
        private void ParseSpecialCharacters(string content, ref int pos)
        {
            _whitespaceRemoval = WhitespaceRemoval.None;
            IsSelfClosing      = false;

            while (pos < content.Length)
            {
                if (ParseWhitespaceRemoval(content, ref pos))
                {
                    continue;
                }
                if (ParseSelfClosing(content, ref pos))
                {
                    continue;
                }

                break;
            }
        }
Example #2
0
        private bool ParseWhitespaceRemoval(string content, ref int pos)
        {
            if (_whitespaceRemoval != WhitespaceRemoval.None)
            {
                return(false);
            }

            switch (content[pos])
            {
            case '>':
                _whitespaceRemoval = WhitespaceRemoval.Surrounding;
                pos++;
                return(true);

            case '<':
                _whitespaceRemoval = WhitespaceRemoval.Internal;
                pos++;
                return(true);
            }
            return(false);
        }
Example #3
0
        public void Walk_TagWithWhitespaceSupression_SetsCorrectFlag(string templateLine, WhitespaceRemoval expectedSetting)
        {
            var tag = new HamlNodeTag(new HamlLine(templateLine, HamlRuleEnum.Tag, indent: ""));

            Assert.That(tag.WhitespaceRemoval, Is.EqualTo(expectedSetting));
        }
Example #4
0
        private bool ParseWhitespaceRemoval(string content, ref int pos)
        {
            if (_whitespaceRemoval != WhitespaceRemoval.None)
                return false;

            switch (content[pos])
            {
                case '>':
                    _whitespaceRemoval = WhitespaceRemoval.Surrounding;
                    pos++;
                    return true;
                case '<':
                    _whitespaceRemoval = WhitespaceRemoval.Internal;
                    pos++;
                    return true;
            }
            return false;
        }
Example #5
0
        private void ParseSpecialCharacters(string content, ref int pos)
        {
            _whitespaceRemoval = WhitespaceRemoval.None;
            IsSelfClosing = false;

            while (pos < content.Length)
            {
                if (ParseWhitespaceRemoval(content, ref pos)) continue;
                if (ParseSelfClosing(content, ref pos)) continue;

                break;
            }
        }
Example #6
0
        public void Walk_TagWithWhitespaceSupression_SetsCorrectFlag(string templateLine, WhitespaceRemoval expectedSetting)
        {
            var tag = new HamlNodeTag(new HamlLine(templateLine, HamlRuleEnum.Tag, "", 0));

            Assert.That(tag.WhitespaceRemoval, Is.EqualTo(expectedSetting));
        }