Example #1
0
        protected Config.DocumentHeader CreateHeaderFromBlock(Block block)
        {
            var header = new Config.DocumentHeader();

            switch (block.BlockType)
            {
            case BlockType.h1:
                header.Level = 1; break;

            case BlockType.h2:
                header.Level = 2; break;

            case BlockType.h3:
                header.Level = 3; break;

            case BlockType.h4:
                header.Level = 4; break;

            case BlockType.h5:
                header.Level = 5; break;

            case BlockType.h6:
                header.Level = 6; break;

            default:
                throw new InvalidOperationException("block wasn't a header!");
            }
            header.Title = block.Content;
            return(header);
        }
Example #2
0
 private static bool ContainsMatchingDocumentHeader(Config.DocumentHeader expectedHeader, IReadOnlyList <Config.DocumentHeader> collection)
 {
     return(collection.Any(h => h.Matches(expectedHeader)));
 }
Example #3
0
 protected Config.DocumentHeader CreateHeaderFromBlock(Block block)
 {
     var header = new Config.DocumentHeader();
     switch (block.BlockType)
     {
         case BlockType.h1:
             header.Level = 1; break;
         case BlockType.h2:
             header.Level = 2; break;
         case BlockType.h3:
             header.Level = 3; break;
         case BlockType.h4:
             header.Level = 4; break;
         case BlockType.h5:
             header.Level = 5; break;
         case BlockType.h6:
             header.Level = 6; break;
         default:
             throw new InvalidOperationException("block wasn't a header!");
     }
     header.Title = block.Content;
     return header;
 }
Example #4
0
 internal bool Matches(DocumentHeader found)
 {
     return(this.Level == found.Level && DoTitlesMatch(this.Title, found.Title));
 }
 internal bool Matches(DocumentHeader found)
 {
     return this.Level == found.Level && DoTitlesMatch(this.Title, found.Title);
 }