Unverified Commit a61ac989 authored by Maxime Lefrançois's avatar Maxime Lefrançois
Browse files

better styling management

parent 44226593
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -300,7 +300,7 @@ def manage_ctx(


def extract_run(run: Run, ctx: RunContext):
    # invariant: last character of last item in ctx.content is a non-blank character
    # invariant: last character of last item in ctx.content is a non-word character

    # manage opening/closing tags
    manage_ctx(ctx, run, Markup.STRONG)
@@ -312,7 +312,7 @@ def extract_run(run: Run, ctx: RunContext):
    text = run.text.replace(" ", " ")

    # extract white space before and after
    before, text, after = re.match(r"^(\s*)(.*?)(\s*)$", text, re.DOTALL).groups()
    before, text, after = re.match(r"^(\W*)(.*?)(\W*)$", text, re.DOTALL).groups()
    if before:
        ctx.buffer_blank.append(before)

@@ -596,7 +596,7 @@ class TS2MDExtractor:
    ):
        ctx = RunContext(extract_format)
        # keep track of spaces, as md markup needs to be right before/after non-space characters
        # invariant: last character of last item in ctx.content is a non-blank character
        # invariant: last character of last item in ctx.content is a non-word character

        # We cannot use python-docx method iter_inner_content, as it only considers runs and hyperlinks.
        # For example elements <fldSimple> are ignored 
+181 −176

File changed.

Preview size limit exceeded, changes collapsed.