def handleMatch(self, m): el = etree.Element('a') if not self.edit: data = {} data["book"] = self.book data["progress"] = m.group(3) el.set("data", encrypt_json(data)) el.set("url", url_for('choice_back')) el.set("type", "back") el.set("class", "choice") el.set("href", "javascript:;") else: el.set("href", "javascript: alert(\"Back choices are disabled while editing the page.\");") el.text = m.group(4) return el
def handleMatch(self, m): el = etree.Element('a') if self.edit: page = get_page_id_by_title(self.book, m.group(2)) if page: el.set("href", url_for('my_page', id=self.book, page=page)) else: el.set("href", url_for('new_page', id=self.book, title=m.group(2))) else: data = {} data["book"] = self.book data["title"] = m.group(2) el.set("data", encrypt_json(data)) el.set("url", url_for('choice')) el.set("type", "choice") el.set("class", "choice") el.set("href", "javascript:;") el.text = m.group(3) return el
def handleMatch(self, m): el = etree.Element('a') if not self.edit: data = {} data["book"] = self.book data["rand"] = m.group(2) data["progress"] = m.group(4) data["success"] = m.group(5) data["successProgress"] = m.group(7) data["failure"] = m.group(8) data["failureProgress"] = m.group(10) el.set("data", encrypt_json(data)) el.set("url", url_for('choice_random')) el.set("type", "random") el.set("class", "choice") el.set("href", "javascript:;") else: el.set("href", "javascript: alert(\"Random choices are disabled while editing the page.\");") el.text = m.group(11) return el