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
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
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
def processCode(y): el = El("code", html.escape(str(y))) el.attr("class", "html") return el
def processCodeCols(x): ret = El("p", x.string) ret.attr("style", "column-count:" + x["nbcols"]+";") ret.attr("style", "-moz-column-count:" + x["nbcols"]+";") return ret
def processIntLink(el): link = El("a", el.string) link.attr("href", "#/" + el["num"]) return link
def processExtLink(el): link = El("a", el.string) link.attr("href", el["href"]) return link