def _intlink_repl(self, raw, content, cnt_object): match = self.__intlink_re.match(content) subj_st = match.group('_subj') text = match.group('_subj_text') fragment = match.group('_subj_frag') if subj_st is None: subj_st = u'' if text is None: text = subj_st if fragment is not None: text += u'#' + fragment subject = article.Subject.fromString(subj_st) link_cls = "wiki-undefined" if self.__art_mgr.contains(subject): link_cls = "wiki-defined" href = u'/' + unicode(subject) if fragment is not None: href += u'#' + formatter.getId(fragment) subj_st += u'#' + fragment self.__formatter.startElement(raw, u'a', {'href': href, 'title': subj_st, 'class': link_cls}) self.__formatter.text(raw, text) self.__formatter.endElement(raw, u'a')
def _intlink_repl(self, raw, content, cnt_object): match = self.__intlink_re.match(content) subj_st = match.group('_subj') text = match.group('_subj_text') fragment = match.group('_subj_frag') if subj_st is None: subj_st = u'' if text is None: text = subj_st if fragment is not None: text += u'#' + fragment subject = article.Subject.fromString(subj_st) link_cls = "wiki-undefined" if self.__art_mgr.contains(subject): link_cls = "wiki-defined" href = u'/' + unicode(subject) if fragment is not None: href += u'#' + formatter.getId(fragment) subj_st += u'#' + fragment self.__formatter.startElement(raw, u'a', { 'href': href, 'title': subj_st, 'class': link_cls }) self.__formatter.text(raw, text) self.__formatter.endElement(raw, u'a')
def _heading_repl(self, raw, content, cnt_object): heading = content.strip() depth = 1 while heading[depth] == '=': depth += 1 depth = min(6, depth) title = heading[depth:-depth].strip() heading_id = formatter.getId(title) self.__closeAll(raw) self.__formatter.startElement(raw, u'h%d' % depth, {'id': heading_id}) #self.__formatter.text(raw, title) self.__blockStack.append(u'h%d' % depth) self.__scan(raw, title) self.__blockStack.pop() self.__formatter.endElement(raw, u'h%d' % depth)