summaryrefslogtreecommitdiff
path: root/mammoth/styles/parser/style_mapping_parser.py
blob: 8c84496a8ac03cd8d94238751952ff4e80c37c75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from .tokeniser import TokenType
from .document_matcher_parser import parse_document_matcher
from .html_path_parser import parse_html_path
from ...styles import Style


def parse_style_mapping(tokens):
    document_matcher = parse_document_matcher(tokens)
    tokens.skip(TokenType.WHITESPACE)
    tokens.skip(TokenType.SYMBOL, "=>")
    tokens.try_skip(TokenType.WHITESPACE)
    html_path = parse_html_path(tokens)
    tokens.skip(TokenType.END)
    
    return Style(document_matcher, html_path)