def _createAutoLinkRelaxWordEntryRE(word): """ Get compiled regular expression for one word in autoLink "relax" mode. Not part of public API. """ # Split into parts of contiguous alphanumeric characters parts = AutoLinkRelaxSplitRE.split(word) # Filter empty parts parts = [p for p in parts if p != u""] # Instead of original non-alphanum characters allow arbitrary # non-alphanum characters pat = ur"\b" + (AutoLinkRelaxJoinPAT.join(parts)) + ur"\b" regex = re.compile(pat, AutoLinkRelaxJoinFlags) return regex
class IndentInfo(object): __slots__ = ("level", "type") def __init__(self, type): self.level = 0 self.type = type #text = Forward() #italicized = QuotedString("*").setResultsName("italics") #bolded = QuotedString("**").setResultsName("bold") #urlRef = QuotedString("{{",endQuoteChar="}}").setResultsName("urlLink") #heading = QuotedString("==",endQuoteChar="==").setResultsName("heading") #horizontalLine = buildRegex(ur"----+[ \t]*$", "horizontalLine") #text << ZeroOrMore(FindFirst([heading, urlRef, bolded, italicized], None )) _CHECK_LEFT_RE = re.compile(ur"[ \t]*$", RE_FLAGS) def preActCheckNothingLeft(s, l, st, pe): # Technically we have to look behind, but this is not supported very # well by reg. ex., so we take the reverse string and look ahead revText = st.revText revLoc = len(s) - l # print "--preActCheckNothingLeft4", repr((revLoc, revText[revLoc: revLoc+20])) if not _CHECK_LEFT_RE.match(revText, revLoc): raise ParseException(s, l, "left of block markup (e.g. table) not empty") def createCheckNotIn(tokNames): tokNames = frozenset(tokNames) def checkNoContain(s, l, st, pe):
def __init__(self, wikiDocument, docPage): self.wikiDocument = wikiDocument @staticmethod def getWikiLanguageName(): return "wikidpad_empty_1_0" def isEquivTo(self, details): """ Compares with other details object if both are "equivalent" """ return self.getWikiLanguageName() == details.getWikiLanguageName() _RE_LINE_INDENT = re.compile(ur"^[ \t]*") class _TheHelper(object): @staticmethod def reset(): pass @staticmethod def getWikiLanguageName(): return "wikidpad_empty_1_0" # TODO More descriptive error messages (which character(s) is/are wrong?) @staticmethod # isValidWikiWord def checkForInvalidWikiWord(word, wikiDocument=None, settings=None): """