Example #1
0
 private void ProcessInlineTags(HamlLine line, List <HamlLine> result)
 {
     if (IsRuleThatAllowsInlineContent(line.HamlRule))
     {
         int contentIndex = GetEndOfTagIndex('%' + line.Content) - 1;
         if (contentIndex < line.Content.Length - 1)
         {
             string subTag = line.Content.Substring(contentIndex).TrimStart();
             line.Content = line.Content.Substring(0, contentIndex).Trim();
             subTag       = AddImplicitDivTag(subTag);
             var subTagRule = HamlRuleFactory.ParseHamlRule(ref subTag);
             var subLine    = new HamlLine(subTag, subTagRule, line.Indent + "\t", line.SourceFileLineNo, true);
             ProcessInlineTags(subLine, result);
         }
     }
     result.Insert(0, line);
 }
Example #2
0
        public IEnumerable <HamlLine> ParseHamlLine(string currentLine, int currentLineIndex)
        {
            int whiteSpaceIndex = 0;

            while (whiteSpaceIndex < currentLine.Length &&
                   (currentLine[whiteSpaceIndex] == ' ' || currentLine[whiteSpaceIndex] == '\t'))
            {
                whiteSpaceIndex++;
            }

            string indent  = currentLine.Substring(0, whiteSpaceIndex);
            string content = (whiteSpaceIndex == currentLine.Length) ? "" : currentLine.Substring(whiteSpaceIndex);

            content = AddImplicitDivTag(content);
            var hamlRule = HamlRuleFactory.ParseHamlRule(ref content);

            var result = new List <HamlLine>();
            var line   = new HamlLine(content, hamlRule, indent, currentLineIndex, false);

            ProcessInlineTags(line, result);
            return(result);
        }