Esempio n. 1
0
 public void AddStyle(IToken token)
 {
     _styles.Merge(token);
     if (token is PlainStyle && _defaultStyles?.Count > 0)
     {
         _styles.MergeRange(_defaultStyles);
     }
 }
Esempio n. 2
0
            public IEnumerable <IToken> ParagraphStyles(Document document)
            {
                var styleId = Styles.OfType <ListStyleId>().FirstOrDefault();

                if (styleId == null || !document.ListStyles.TryGetValue(styleId.Value, out var listStyle))
                {
                    return(Styles
                           .Where(t => !HtmlVisitor.IsSpanElement(t)));
                }

                var levelNum = Styles.OfType <ListLevelNumber>().FirstOrDefault() ?? new ListLevelNumber(0);
                var result   = new StyleList(listStyle.Style.Levels[levelNum.Value]
                                             .Where(t => t.Type == TokenType.ParagraphFormat));

                result.MergeRange(Styles
                                  .Where(t => !HtmlVisitor.IsSpanElement(t)));
                return(result);
            }