From 53d1b4a6f48a53c4c4ec4ac7031362b691c0366d Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Thu, 31 Oct 2019 21:10:28 -0700 Subject: Blacken the project (#141) --- examples/simpleWiki.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'examples/simpleWiki.py') diff --git a/examples/simpleWiki.py b/examples/simpleWiki.py index ca660c5..73c8116 100644 --- a/examples/simpleWiki.py +++ b/examples/simpleWiki.py @@ -8,22 +8,28 @@ Here is a simple Wiki input: Here's a URL to {{Pyparsing's Wiki Page->https://site-closed.wikispaces.com}} """ -def convertToHTML(opening,closing): - def conversionParseAction(s,l,t): + +def convertToHTML(opening, closing): + def conversionParseAction(s, l, t): return opening + t[0] + closing + return conversionParseAction -italicized = QuotedString("*").setParseAction(convertToHTML("","")) -bolded = QuotedString("**").setParseAction(convertToHTML("","")) -boldItalicized = QuotedString("***").setParseAction(convertToHTML("","")) -def convertToHTML_A(s,l,t): + +italicized = QuotedString("*").setParseAction(convertToHTML("", "")) +bolded = QuotedString("**").setParseAction(convertToHTML("", "")) +boldItalicized = QuotedString("***").setParseAction(convertToHTML("", "")) + + +def convertToHTML_A(s, l, t): try: - text,url=t[0].split("->") + text, url = t[0].split("->") except ValueError: - raise ParseFatalException(s,l,"invalid URL link reference: " + t[0]) + raise ParseFatalException(s, l, "invalid URL link reference: " + t[0]) return '{}'.format(url, text) -urlRef = QuotedString("{{",endQuoteChar="}}").setParseAction(convertToHTML_A) + +urlRef = QuotedString("{{", endQuoteChar="}}").setParseAction(convertToHTML_A) wikiMarkup = urlRef | boldItalicized | bolded | italicized -- cgit v1.2.1