MartinPacker / md2pptx

Markdown To PowerPoint converter
MIT License
226 stars 36 forks source link

Footer Does Not Resolve Ampersand Symbol #168

Open MartinPacker opened 2 months ago

MartinPacker commented 2 months ago

Footer populated from Heading Level 2. & shown where & should be.

MartinPacker commented 2 months ago

Relevant code - currently at line 425:

def substituteFooterVariables(footerText, liveFooters):
    # Decide if the footer should be a live link to the section slide
    wantLiveFooter = (
        (prs.lastSectionSlide is not None)
        & (footerText.find("<section") > -1)
        & (liveFooters == "yes")
    )

    # Substitute any section title occurrences
    sectionTitleLines = prs.lastSectionTitle.split("<br/>")

    footerText = footerText.replace("<section>", sectionTitleLines[0])
    footerText = footerText.replace("<section1>", sectionTitleLines[0])

    if len(sectionTitleLines) > 1:
        footerText = footerText.replace("<section2>", sectionTitleLines[1])

    if len(sectionTitleLines) > 2:
        footerText = footerText.replace("<section3>", sectionTitleLines[2])

    # Substitute any presentation title occurrences
    presTitleLines = prs.lastPresTitle.split("<br/>")
    footerText = footerText.replace("<presTitle>", presTitleLines[0])
    footerText = footerText.replace("<presTitle1>", presTitleLines[0])

    if len(presTitleLines) > 1:
        footerText = footerText.replace("<presTitle2>", presTitleLines[1])

    if len(presTitleLines) > 2:
        footerText = footerText.replace("<presTitle3>", presTitleLines[2])

    # Substitute any presentation subtitle occurrences
    presSubtitleLines = prs.lastPresSubtitle.split("<br/>")

    footerText = footerText.replace("<presSubtitle>", presSubtitleLines[0])
    footerText = footerText.replace("<presSubtitle1>", presSubtitleLines[0])

    if len(presSubtitleLines) > 1:
        footerText = footerText.replace("<presSubtitle2>", presSubtitleLines[1])

    if len(presSubtitleLines) > 2:
        footerText = footerText.replace("<presSubtitle3>", presSubtitleLines[2])

    # Make newlines happen
    footerText = footerText.replace("<br/>", "\n")

    return footerText, wantLiveFooter
MartinPacker commented 2 months ago

It's not just the section title but the presentation title that need symbol substitution.

MartinPacker commented 1 month ago

Fix pushed.