Пример #1
0
def processParagraphe(obj):
    el = El("p")
    for c in obj.contents:
        if not processTitle(c, el):
            if not_empty_string(c):
                el.insert(El("span", c.string))
            elif is_a_tag(c):
                el.insert(inlineNames(c.name, c))
    return el
Пример #2
0
def processFinalPage(part):
    """
        EAST has a tag for the final page, with no equivalences in Reveal
        It should be processed as a part with specific tags
    """
    fp = El("Section")
    if(part is not None):
        for child in part.contents:
            if child.name == "PARAGRAPHE": fp.insert(processParagraphe(child))
            if child.name == "EMAIL": fp.insert(El("h4", child))
    return fp
Пример #3
0
def processPart(part, el):
    """
    Process part processing
    Calls for all sub part parsers
    :param part:  the part to be parsed
    :param el: fragment of the final page
    """
    el.insert(El("section", El("h1", part.TITRE.string)))
    for section in part.find_all("SECTION"):
        s = El("section")
        for child in section.contents:
            if not isinstance(child, NavigableString):
                s.insert(blockNames(child.name, child))
        el.insert(s)
Пример #4
0
def processList(obj):
    el = El("ul")
    mode = ""
    if obj.get("type") is not None:
        el.attr("class", obj["type"])
    if obj.get("couleur_texte") is not None:
        el.attr("style", "color: " + obj["couleur_texte"]+";")
    if obj.get("mode") is not None:
        mode = getMode(obj.get("mode"))
    for c in obj.children:
        if not processTitle(c, el):
            if not_empty_string(c):
                el.insert(El("h3", c.string))
            elif is_a_tag(c):
                el.insert(processListElement(c, mode))

    return el
Пример #5
0
def generateHtmlFile(entry, disableStyle):
    xml = BeautifulSoup(entry, "xml")
    Style.enableStyle(disableStyle is not 1)
    El.enableStyle(disableStyle is not 1)
    p = Params("non", "oui")
    page = xml.find("PAGE")
    if page is not None:
       processCSSPage(page,p.stl)
    titles = xml.find("TITLES")
    if titles is not None:
       processCSSTitles(titles, p.stl)
    el = El("div")
    el.attr("class", "slides")
    EAST = xml.contents[0]
    el.insert(processTitlePage(EAST.find("PAGE_TITRE")))
    for part in EAST.find_all("PARTIE"):
        processPart(part, el)
    el.insert(processFinalPage(EAST.find("PAGE_CONCLUSION")))
    ret = BeautifulSoup(html_doc(p, str(el)), 'html.parser')
    return ret
Пример #6
0
def processTitlePage(part):
    """
    EAST has a tag for title page, with no equivalences in Reveal
    It should be processed as a part, but with specific tags
    """
    tp = El("Section")
    if part is not None:
        tp.insert(El("h1", part.TITRE.string))
        if part.SOUS_TITRE:
            tp.insert(El("h3", part.SOUS_TITRE.string))
        if part.AUTEUR:
            tp.insert(El("h5", part.AUTEUR.string))
        if part.EMAIL:
            tp.insert(El("h6", El("small", part.EMAIL.string)))
    return tp
Пример #7
0
def processListDef(y):
    el = El("dl")
    for child in y.contents:
        if child.name == "TITRE":
            el.insert(El("h3", child.string))
        elif child.name == "DEF":
            el.insert(El("dd", child.string))
        elif child.name == "TERME":
            el.insert(El("dt", child.string))
    return el
Пример #8
0
def processListElement(obj, mode):
    el = El("li")
    el.attr("class", mode)
    for c in obj.children:
        if not_empty_string(c):
            el.insert(El("span", c.string))
        if is_a_tag(c):
            if c.name == "LISTE":
                el.insert(processList(c))
            else:
                el.insert(inlineNames(c.name, c))
    return el