From b73bd2afbde6bb9165377162325770f2a614619a Mon Sep 17 00:00:00 2001 From: Stephen Dranger Date: Fri, 11 Feb 2011 17:37:31 -0600 Subject: [PATCH] reworked parsing --- convo.py | 17 ++-- convo.pyc | Bin 25356 -> 25405 bytes dataobjs.pyc | Bin 11753 -> 11753 bytes generic.pyc | Bin 3575 -> 3575 bytes irc.pyc | Bin 13203 -> 13203 bytes logs/chums.js | 2 +- memos.py | 26 +++--- memos.pyc | Bin 31793 -> 31835 bytes menus.pyc | Bin 20542 -> 20542 bytes oyoyo/__init__.pyc | Bin 333 -> 333 bytes oyoyo/client.pyc | Bin 9728 -> 9728 bytes oyoyo/cmdhandler.pyc | Bin 8312 -> 8312 bytes oyoyo/helpers.pyc | Bin 5013 -> 5013 bytes oyoyo/ircevents.pyc | Bin 5693 -> 5693 bytes oyoyo/parse.pyc | Bin 2869 -> 2869 bytes parsetools.py | 161 ++++++++++++++++++++----------------- parsetools.pyc | Bin 6979 -> 8426 bytes pesterchum.py | 6 +- profiles/doctorHorrible.js | 1 + profiles/ghostDunk.js | 2 +- 20 files changed, 115 insertions(+), 100 deletions(-) create mode 100644 profiles/doctorHorrible.js diff --git a/convo.py b/convo.py index 84f797f..7a8364c 100644 --- a/convo.py +++ b/convo.py @@ -5,7 +5,7 @@ from PyQt4 import QtGui, QtCore from dataobjs import PesterProfile, Mood, PesterHistory from generic import PesterIcon, RightClickList -from parsetools import escapeBrackets, convertTags +from parsetools import convertTags class PesterTabWindow(QtGui.QFrame): def __init__(self, mainwindow, parent=None, convo="convo"): @@ -211,6 +211,7 @@ class PesterText(QtGui.QTextEdit): parent = self.parent() window = parent.mainwindow me = window.profile() + quirks = window.userprofile.quirks if parent.applyquirks else None if msg == "PESTERCHUM:BEGIN": parent.setChumOpen(True) msg = chum.pestermsg(me, systemColor, window.theme["convo/text/beganpester"]) @@ -238,6 +239,8 @@ class PesterText(QtGui.QTextEdit): window.chatlog.log(chum.handle, convertTags(msg, "bbcode")) self.append(convertTags(msg)) elif msg[0:3] == "/me" or msg[0:13] == "PESTERCHUM:ME": + if quirks: + msg = quirks.apply(msg) if msg[0:3] == "/me": start = 3 else: @@ -256,11 +259,10 @@ class PesterText(QtGui.QTextEdit): window.chatlog.log(chum.handle, convertTags(beginmsg, "bbcode")) self.append(convertTags(beginmsg)) - msg = escapeBrackets(msg) msg = "%s: %s" % (color, initials, msg) - self.append(convertTags(msg)) + self.append(convertTags(msg, quirkobj=quirks)) if chum is me: - window.chatlog.log(parent.chum.handle, convertTags(msg, "bbcode")) + window.chatlog.log(parent.chum.handle, convertTags(msg, "bbcode", quirkobj=quirks)) else: if window.idle: idlethreshhold = 60 @@ -514,16 +516,13 @@ class PesterConvo(QtGui.QFrame): if text == "" or text[0:11] == "PESTERCHUM:": return self.history.add(text) - # deal with quirks here - if self.applyquirks: - qtext = self.mainwindow.userprofile.quirks.apply(text) - text = qtext self.addMessage(text, True) # if ceased, rebegin if hasattr(self, 'chumopen') and not self.chumopen: self.mainwindow.newConvoStarted.emit(QtCore.QString(self.title()), True) # convert color tags - text = convertTags(text, "ctag") + quirkobj = self.mainwindow.userprofile.quirks if self.applyquirks else None + text = convertTags(text, "ctag", quirkobj) self.messageSent.emit(text, self.title()) self.textInput.setText("") diff --git a/convo.pyc b/convo.pyc index 636409ad07949ce4da047e6c033ca7676d231ebb..07ab907a9b8c46c7e6c955e42e9ee6bb6d769f35 100644 GIT binary patch delta 6188 zcmb7I3vg7`89rx|&1>`6yt4^;kPxylkPyQw2oeYZlu3Y_1Vq5N*}Wt;Z1yg@H&CX* zEsYNpsqO;T z8nB!I!wTwJ3Fcb?_3GDIOEOx}%vJx&dOM>Y%@Xx)c1H~_%BFtAXGHbxQJ2A~YN{{d@I5${yKoBh6zT(GR%jJ->n!%YWFElrM1vQ`A(s{9TP5-;jBdZdzz`i1lG~E~2910%P z%2a!OjeSU~)SJ6kQHGwrrT%({`v9>^39>50WE1cFG|fa2PC~lndWRp`3P%?Lbki5@ zR>vAgW0}Ip7G|E1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L7BR zA>o8Yyoig~Vy;dn*K>VZLJVt!LB%!igFQ;Iinak=tejo50R)w|x&Q^*f+EzXr3E;si&DI_d5CMTPRFb*qcm1mHS_u7jRRGqzXxw`*`P~&Hk zY*0;O!c!(^O0Nui3S^}$p#L?p*%OjgoITFn&{V+($)%ZeG}O!--TA7lQhhguWwEO2 zUt74jx77I(@f1&t=#PG~S{9uFoe`MFuL!BCP}I*=*=S-T`m~a2W6`;3VJ$TE0q^ Q#2WL;Jyk!hGOMco1y6x%$^ZZW diff --git a/dataobjs.pyc b/dataobjs.pyc index 22eeb008304b9b97cadbd2626f4faa39b48ff86e..f8076413aa336122e4428e9ceaea1a38c6d06c60 100644 GIT binary patch delta 15 XcmaDE{W6;E;wN6N4UHSw9_s=CKhp<;wN6NuK9r**+1|C06|#?H2?qr delta 16 Ycmew^{au><;wN6N>6-o<*+1|C06yjh$^ZZW diff --git a/irc.pyc b/irc.pyc index e4a65a510087af4df768c7fa422ef6360a2a92cd..62a8eb1dacfd9b430f6554df3ecd56d0d78e85b6 100644 GIT binary patch delta 16 XcmbQ7J~^HJ;wN6NuK9r**?WuuJx>P5 delta 16 YcmbQ7J~^HJ;wN6NMfU?XviBGR06%gE9smFU diff --git a/logs/chums.js b/logs/chums.js index 9e77160..ee55015 100644 --- a/logs/chums.js +++ b/logs/chums.js @@ -1 +1 @@ -{"macruralAlchemist": {"color": "#700000", "handle": "macruralAlchemist", "mood": "offline"}, "lyricalKeraunoscopic": {"color": "#00c000", "handle": "lyricalKeraunoscopic", "mood": "offline"}, "fireSwallow": {"color": "#80bb9a", "handle": "fireSwallow", "mood": "offline"}, "aquaMarinist": {"color": "#00caca", "handle": "aquaMarinist", "mood": "offline"}, "centaursTesticle": {"color": "#000056", "handle": "centaursTesticle", "mood": "offline"}, "mechanicalSpectacle": {"color": "#0000ff", "handle": "mechanicalSpectacle", "mood": "offline"}, "carcinoGeneticist": {"color": "#999999", "handle": "carcinoGeneticist", "mood": "offline"}, "greyscalePacifist": {"color": "#7f7f7f", "handle": "greyscalePacifist", "mood": "offline"}, "aquaticMarinist": {"color": "#00caca", "handle": "aquaticMarinist", "mood": "offline"}, "wovenWay": {"color": "#000000", "handle": "wovenWay", "mood": "offline"}, "insipidTranscient": {"color": "#145064", "handle": "insipidTranscient", "mood": "offline"}, "caffeinatedAnalyst": {"color": "#aa0000", "handle": "caffeinatedAnalyst", "mood": "offline"}, "pesterClient394": {"color": "#ff3737", "handle": "pesterClient394", "mood": "offline"}, "absoluteTranquility": {"color": "#000033", "handle": "absoluteTranquility", "mood": "offline"}, "nitroZealist": {"color": "#ff3737", "handle": "nitroZealist", "mood": "offline"}, "quintessentialArbalest": {"color": "#999999", "handle": "quintessentialArbalest", "mood": "offline"}, "agogPorphyry": {"color": "#522d80", "handle": "agogPorphyry", "mood": "offline"}, "grimAuxiliatrix": {"color": "#008141", "handle": "grimAuxiliatrix", "mood": "offline"}, "androidTechnician": {"color": "#0000ff", "handle": "androidTechnician", "mood": "offline"}, "ardentAbettor": {"color": "#c8b670", "handle": "ardentAbettor", "mood": "offline"}, "aceIsm": {"color": "#ffcc66", "handle": "aceIsm", "mood": "offline"}, "apocalypseArisen": {"color": "#a10000", "handle": "apocalypseArisen", "mood": "offline"}, "radicalApologist": {"color": "#ffaa00", "handle": "radicalApologist", "mood": "offline"}, "microMachines": {"color": "#aa00ff", "handle": "microMachines", "mood": "offline"}, "uroborosUnbound": {"color": "#00416a", "handle": "uroborosUnbound", "mood": "offline"}, "arachnidsGrip": {"color": "#005682", "handle": "arachnidsGrip", "mood": "offline"}, "percipientPedestrian": {"color": "#00ffff", "handle": "percipientPedestrian", "mood": "offline"}, "tentacleTherapist": {"color": "#cc66ff", "handle": "tentacleTherapist", "mood": "offline"}, "sucroseSaboteur": {"color": "#00e700", "handle": "sucroseSaboteur", "mood": "offline"}, "illuminatedWax": {"color": "#000000", "handle": "illuminatedWax", "mood": "offline"}, "moirailBunp": {"color": "#6a3d0f", "handle": "moirailBunp", "mood": "offline"}, "madLurker": {"color": "#000000", "handle": "madLurker", "mood": "offline"}, "testOut": {"color": "#c760cc", "handle": "testOut", "mood": "offline"}, "pesterClient3022": {"color": "#336600", "handle": "pesterClient3022", "mood": "offline"}, "hellerificJefferson": {"color": "#3300ff", "handle": "hellerificJefferson", "mood": "offline"}, "DocScratch": {"color": "#ffffff", "handle": "DocScratch", "mood": "offline"}, "recalcitrantDisaster": {"color": "#8b0068", "handle": "recalcitrantDisaster", "mood": "offline"}, "superGhost": {"color": "#800564", "handle": "superGhost", "mood": "offline"}, "arsenicCatnip": {"color": "#006400", "handle": "arsenicCatnip", "mood": "offline"}, "kaleidoscopicMind": {"color": "#ff6666", "handle": "kaleidoscopicMind", "mood": "offline"}, "noSense": {"color": "#1d0059", "handle": "noSense", "mood": "offline"}, "captainCaveman": {"color": "#7c414e", "handle": "captainCaveman", "mood": "offline"}, "gamblingGenocider": {"color": "#00ff00", "handle": "gamblingGenocider", "mood": "offline"}, "cuttlefishCuller": {"color": "#77003c", "handle": "cuttlefishCuller", "mood": "offline"}, "iw": {"color": "#ff0000", "handle": "iw", "mood": "offline"}, "masterG": {"color": "#77003c", "handle": "masterG", "mood": "offline"}, "elegantDiversion": {"color": "#14b40a", "handle": "elegantDiversion", "mood": "offline"}, "plasmaModerator": {"color": "#5685cc", "handle": "plasmaModerator", "mood": "offline"}, "carcinoGenetecist": {"color": "#7f7f7f", "handle": "carcinoGenetecist", "mood": "offline"}, "marineAquist": {"color": "#00caca", "handle": "marineAquist", "mood": "offline"}, "remoteBloodbath": {"color": "#c70000", "handle": "remoteBloodbath", "mood": "offline"}, "oilslickOrchid": {"color": "#743f7e", "handle": "oilslickOrchid", "mood": "offline"}, "acapellaWaterfall": {"color": "#000099", "handle": "acapellaWaterfall", "mood": "offline"}, "gallowsCalibrator": {"color": "#008282", "handle": "gallowsCalibrator", "mood": "offline"}, "rageInducer": {"color": "#00ffff", "handle": "rageInducer", "mood": "offline"}, "anguillaNuntia": {"color": "#ff007f", "handle": "anguillaNuntia", "mood": "offline"}, "greenZephyr": {"color": "#00ca40", "handle": "greenZephyr", "mood": "offline"}, "lawdEngrish": {"color": "#00ff00", "handle": "lawdEngrish", "mood": "offline"}, "pretentiousFantasia": {"color": "#ff66cf", "handle": "pretentiousFantasia", "mood": "offline"}, "counterRealist": {"color": "#10d985", "handle": "counterRealist", "mood": "offline"}, "maxiumumFatness": {"color": "#3366ff", "handle": "maxiumumFatness", "mood": "offline"}, "schlagzeugGator": {"color": "#61821f", "handle": "schlagzeugGator", "mood": "offline"}, "metaliAggressive": {"color": "#9289d5", "handle": "metaliAggressive", "mood": "offline"}, "midnightSparrow": {"color": "#ff55ff", "handle": "midnightSparrow", "mood": "offline"}, "magmaExploiter": {"color": "#d90000", "handle": "magmaExploiter", "mood": "offline"}, "zealousScarecrow": {"color": "#00c882", "handle": "zealousScarecrow", "mood": "offline"}, "gardenGnostic": {"color": "#00ff00", "handle": "gardenGnostic", "mood": "offline"}, "unknownTraveler": {"color": "#006666", "handle": "unknownTraveler", "mood": "offline"}, "utilitarianTurnabout": {"color": "#dd0000", "handle": "utilitarianTurnabout", "mood": "offline"}, "adiosToreador": {"color": "#aa5500", "handle": "adiosToreador", "mood": "offline"}} \ No newline at end of file +{"macruralAlchemist": {"color": "#700000", "handle": "macruralAlchemist", "mood": "offline"}, "lyricalKeraunoscopic": {"color": "#00c000", "handle": "lyricalKeraunoscopic", "mood": "offline"}, "fireSwallow": {"color": "#80bb9a", "handle": "fireSwallow", "mood": "offline"}, "aquaMarinist": {"color": "#00caca", "handle": "aquaMarinist", "mood": "offline"}, "centaursTesticle": {"color": "#000056", "handle": "centaursTesticle", "mood": "offline"}, "mechanicalSpectacle": {"color": "#0000ff", "handle": "mechanicalSpectacle", "mood": "offline"}, "carcinoGeneticist": {"color": "#999999", "handle": "carcinoGeneticist", "mood": "offline"}, "greyscalePacifist": {"color": "#7f7f7f", "handle": "greyscalePacifist", "mood": "offline"}, "aquaticMarinist": {"color": "#00caca", "handle": "aquaticMarinist", "mood": "offline"}, "iw": {"color": "#ff0000", "handle": "iw", "mood": "offline"}, "insipidTranscient": {"color": "#145064", "handle": "insipidTranscient", "mood": "offline"}, "caffeinatedAnalyst": {"color": "#aa0000", "handle": "caffeinatedAnalyst", "mood": "offline"}, "midnightSparrow": {"color": "#ff55ff", "handle": "midnightSparrow", "mood": "offline"}, "absoluteTranquility": {"color": "#000033", "handle": "absoluteTranquility", "mood": "offline"}, "nitroZealist": {"color": "#ff3737", "handle": "nitroZealist", "mood": "offline"}, "quintessentialArbalest": {"color": "#999999", "handle": "quintessentialArbalest", "mood": "offline"}, "noSense": {"color": "#1d0059", "handle": "noSense", "mood": "offline"}, "agogPorphyry": {"color": "#522d80", "handle": "agogPorphyry", "mood": "offline"}, "grimAuxiliatrix": {"color": "#008141", "handle": "grimAuxiliatrix", "mood": "offline"}, "androidTechnician": {"color": "#0000ff", "handle": "androidTechnician", "mood": "offline"}, "ardentAbettor": {"color": "#c8b670", "handle": "ardentAbettor", "mood": "offline"}, "aceIsm": {"color": "#ffcc66", "handle": "aceIsm", "mood": "offline"}, "apocalypseArisen": {"color": "#a10000", "handle": "apocalypseArisen", "mood": "offline"}, "radicalApologist": {"color": "#ffaa00", "handle": "radicalApologist", "mood": "offline"}, "microMachines": {"color": "#aa00ff", "handle": "microMachines", "mood": "offline"}, "uroborosUnbound": {"color": "#00416a", "handle": "uroborosUnbound", "mood": "offline"}, "arachnidsGrip": {"color": "#005682", "handle": "arachnidsGrip", "mood": "offline"}, "caligulasAquarium": {"color": "#6a006a", "handle": "caligulasAquarium", "mood": "offline"}, "percipientPedestrian": {"color": "#00ffff", "handle": "percipientPedestrian", "mood": "offline"}, "tentacleTherapist": {"color": "#cc66ff", "handle": "tentacleTherapist", "mood": "offline"}, "sucroseSaboteur": {"color": "#00e700", "handle": "sucroseSaboteur", "mood": "offline"}, "illuminatedWax": {"color": "#000000", "handle": "illuminatedWax", "mood": "offline"}, "moirailBunp": {"color": "#6a3d0f", "handle": "moirailBunp", "mood": "offline"}, "madLurker": {"color": "#000000", "handle": "madLurker", "mood": "offline"}, "testOut": {"color": "#c760cc", "handle": "testOut", "mood": "offline"}, "pesterClient3022": {"color": "#336600", "handle": "pesterClient3022", "mood": "offline"}, "hellerificJefferson": {"color": "#3300ff", "handle": "hellerificJefferson", "mood": "offline"}, "DocScratch": {"color": "#ffffff", "handle": "DocScratch", "mood": "offline"}, "recalcitrantDisaster": {"color": "#8b0068", "handle": "recalcitrantDisaster", "mood": "offline"}, "superGhost": {"color": "#800564", "handle": "superGhost", "mood": "offline"}, "arsenicCatnip": {"color": "#006400", "handle": "arsenicCatnip", "mood": "offline"}, "kaleidoscopicMind": {"color": "#ff6666", "handle": "kaleidoscopicMind", "mood": "offline"}, "zealousScarecrow": {"color": "#00c882", "handle": "zealousScarecrow", "mood": "offline"}, "captainCaveman": {"color": "#7c414e", "handle": "captainCaveman", "mood": "offline"}, "gamblingGenocider": {"color": "#00ff00", "handle": "gamblingGenocider", "mood": "offline"}, "cuttlefishCuller": {"color": "#77003c", "handle": "cuttlefishCuller", "mood": "offline"}, "wovenWay": {"color": "#000000", "handle": "wovenWay", "mood": "offline"}, "masterG": {"color": "#77003c", "handle": "masterG", "mood": "offline"}, "elegantDiversion": {"color": "#14b40a", "handle": "elegantDiversion", "mood": "offline"}, "plasmaModerator": {"color": "#5685cc", "handle": "plasmaModerator", "mood": "offline"}, "carcinoGenetecist": {"color": "#7f7f7f", "handle": "carcinoGenetecist", "mood": "offline"}, "marineAquist": {"color": "#00caca", "handle": "marineAquist", "mood": "offline"}, "remoteBloodbath": {"color": "#c70000", "handle": "remoteBloodbath", "mood": "offline"}, "oilslickOrchid": {"color": "#743f7e", "handle": "oilslickOrchid", "mood": "offline"}, "acapellaWaterfall": {"color": "#000099", "handle": "acapellaWaterfall", "mood": "offline"}, "gallowsCalibrator": {"color": "#008282", "handle": "gallowsCalibrator", "mood": "offline"}, "rageInducer": {"color": "#00ffff", "handle": "rageInducer", "mood": "offline"}, "anguillaNuntia": {"color": "#ff007f", "handle": "anguillaNuntia", "mood": "offline"}, "greenZephyr": {"color": "#00ca40", "handle": "greenZephyr", "mood": "offline"}, "lawdEngrish": {"color": "#00ff00", "handle": "lawdEngrish", "mood": "offline"}, "pretentiousFantasia": {"color": "#ff66cf", "handle": "pretentiousFantasia", "mood": "offline"}, "counterRealist": {"color": "#10d985", "handle": "counterRealist", "mood": "offline"}, "maxiumumFatness": {"color": "#3366ff", "handle": "maxiumumFatness", "mood": "offline"}, "schlagzeugGator": {"color": "#61821f", "handle": "schlagzeugGator", "mood": "offline"}, "metaliAggressive": {"color": "#9289d5", "handle": "metaliAggressive", "mood": "offline"}, "pesterClient394": {"color": "#ff3737", "handle": "pesterClient394", "mood": "offline"}, "magmaExploiter": {"color": "#d90000", "handle": "magmaExploiter", "mood": "offline"}, "gardenGnostic": {"color": "#00ff00", "handle": "gardenGnostic", "mood": "offline"}, "unknownTraveler": {"color": "#006666", "handle": "unknownTraveler", "mood": "offline"}, "utilitarianTurnabout": {"color": "#dd0000", "handle": "utilitarianTurnabout", "mood": "offline"}, "adiosToreador": {"color": "#aa5500", "handle": "adiosToreador", "mood": "offline"}} \ No newline at end of file diff --git a/memos.py b/memos.py index c44588d..10b7786 100644 --- a/memos.py +++ b/memos.py @@ -6,7 +6,7 @@ from datetime import time, timedelta, datetime from dataobjs import PesterProfile, Mood, PesterHistory from generic import PesterIcon, RightClickList from convo import PesterConvo, PesterInput, PesterText, PesterTabWindow -from parsetools import convertTags, escapeBrackets, addTimeInitial, timeProtocol +from parsetools import convertTags, addTimeInitial, timeProtocol def delta2txt(d, format="pc"): if format == "pc": @@ -227,6 +227,7 @@ class MemoText(PesterText): parent = self.parent() window = parent.mainwindow me = window.profile() + quirks = window.userprofile.quirks if parent.applyquirks else None msg = unicode(text) chumdb = window.chumdb if chum is not me: # SO MUCH WH1T3SP4C3 >:] @@ -268,6 +269,8 @@ class MemoText(PesterText): time.openCurrentTime() if msg[0:3] == "/me" or msg[0:13] == "PESTERCHUM:ME": + if quirks: + msg = quirks.apply(msg) if msg[0:3] == "/me": start = 3 else: @@ -279,9 +282,8 @@ class MemoText(PesterText): else: if chum is not me: msg = addTimeInitial(msg, parent.times[chum.handle].getGrammar()) - msg = escapeBrackets(msg) - self.append(convertTags(msg)) - window.chatlog.log(parent.channel, convertTags(msg, "bbcode")) + self.append(convertTags(msg, quirksobj=quirks)) + window.chatlog.log(parent.channel, convertTags(msg, "bbcode", quirks)) def changeTheme(self, theme): @@ -554,23 +556,19 @@ class PesterMemo(PesterConvo): if self.time.getTime() == None: self.sendtime() grammar = self.time.getGrammar() - # deal with quirks here - if self.applyquirks: - qtext = self.mainwindow.userprofile.quirks.apply(text) - else: - qtext = text - if qtext[0:3] != "/me": + if text[0:3] != "/me": initials = self.mainwindow.profile().initials() colorcmd = self.mainwindow.profile().colorcmd() - clientText = "%s%s%s: %s" % (colorcmd, grammar.pcf, initials, grammar.number, qtext) + clientText = "%s%s%s: %s" % (colorcmd, grammar.pcf, initials, grammar.number, text) # account for TC's parsing error - serverText = "%s: %s " % (colorcmd, initials, qtext) + serverText = "%s: %s " % (colorcmd, initials, text) else: - clientText = qtext + clientText = text serverText = clientText self.addMessage(clientText, True) # convert color tags - serverText = convertTags(unicode(serverText), "ctag") + quirks = self.mainwindow.userprofile.quirks if self.applyquirks else None + serverText = convertTags(unicode(serverText), "ctag", quirks) self.messageSent.emit(serverText, self.title()) self.textInput.setText("") @QtCore.pyqtSlot() diff --git a/memos.pyc b/memos.pyc index b63b81e0f583de58fc1b3887bf72bb0b0cbb1756..749749e17908b2ad2fa01f002a2299487c067911 100644 GIT binary patch delta 6717 zcmai2dvKi9b-#C|T}iu=wR-GItM|+D$`S#;Ww5Yp$rd)qwyylZGPbqe@00Y&t6fR^ z$ws!+RbrF4C1EC9NGK3!(&6EPlahtDPSZR(C8Xt*OokSc>CjF?^G7<6rj#(93GMlv zPrEBzhsf4X_nv$1z2}^JUc1kID1Y{$to`w?OT2SGI5Zd)%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lztnq67mkB7kfCqNYNJ_4r`iJt4nnbaDguoFDq zMBYCxc&K$6Zyhe5ch$~F6KKVI6Y=0QnxEC9HeG2#R0{2j5b6QkQ9Gxb+kS;1YJyW8 zR$v9^=!4dz?CJXhpU04^Kf8riEnhJIXF4EX^<} z7ZQXHM?c->OYOpy_;LBX`f)tF4O+ATEby*bNZlDTHiPo)q&56oQgAJCn$qTHiL3j5 zrvg+)s(1ZU(PYwy52tkFx71+m!&23Rx2vBg>*QBeX)4+FGN`8jydyIhp@&}j3h_kh zpnDfR-&U`sew=-S*iI4VG~-1Hwqr4sqwl%pS(EZ*tusg^UrV_SEJNgiKsP2w_t4M`|6H$ zS+&o*{UeTYQp;zYI!yk!>2ag3{zQG%HUh&C`5kg@Pm-z~WdBXQfBq~rkgw18uI1B$ zYuEYy#0OC?*3bM>P&*IfvM`Qs=K~jL3*I10EI2KwOpZi&C%HWBCDO8wl|RMfT>!$O zy$L{X?0lMf8l&d{R{`ADadBy;&2tJ`91Lp8PtvDUB61pxj@fB5NpGi+8Uj2B7y%rD zJkpbMmYPW#jRD31#|ijdW_DrD9y2GC^e%Husw?fg-Cv@KYt%W2Wg05CzL3tMQD1Wtm}fU*gA{K7 diff --git a/menus.pyc b/menus.pyc index 53c48cf284a8f3e5def281c8dc48cc5ef48bb3d1..a4bfd9e43db4e7752b84f8f599de194f71758089 100644 GIT binary patch delta 17 ZcmdnDfN|dfMz)Kec)8S1Y-F2m`BH2DTS delta 15 WcmdlgwpEPn;wN6NbFmxQ^tk~smj#mm diff --git a/parsetools.py b/parsetools.py index 91308d9..cb703f9 100644 --- a/parsetools.py +++ b/parsetools.py @@ -4,35 +4,40 @@ from datetime import timedelta from PyQt4 import QtGui _ctag_begin = re.compile(r'(?i)') +_ctag_end = re.compile(r'(?i)') _ctag_rgb = re.compile(r'\d+,\d+,\d+') -_urlre = re.compile(r"(?i)(http://[^\s<[]+)") +_urlre = re.compile(r"(?i)http://[^\s]+") _memore = re.compile(r" (#[A-Za-z0-9_]+)") def lexer(string, objlist): """objlist is a list: [(objecttype, re),...] list is in order of preference""" stringlist = [string] for (oType, regexp) in objlist: - newstringlist = copy(stringlist) + newstringlist = [] for (stri, s) in enumerate(stringlist): - tmp = [] + if type(s) not in [str, unicode]: + newstringlist.append(s) + continue lasti = 0 - for m in regexp.finditer(string): + for m in regexp.finditer(s): start = m.start() end = m.end() - tag = oType(group(0), *groups()) - tmp.append(string[lasti:start]) - tmp.append(tag) + tag = oType(m.group(0), *m.groups()) + if lasti != start: + newstringlist.append(s[lasti:start]) + newstringlist.append(tag) + lasti = end if lasti < len(string): - tmp.append(string[lasti:]) - stringlist = stringlist[0:stri]+tmp+stringlist[stri+1:] + newstringlist.append(s[lasti:]) stringlist = copy(newstringlist) return stringlist -def convertTags(string, format="html"): - if format not in ["html", "bbcode", "ctag"]: - raise ValueError("Color format not recognized") - def colorrepfunc(matchobj): - color = matchobj.group(1) +class colorBegin(object): + def __init__(self, string, color): + self.string = string + self.color = color + def convert(self, format): + color = self.color if _ctag_rgb.match(color) is not None: if format=='ctag': return "" % (color) @@ -51,69 +56,75 @@ def convertTags(string, format="html"): elif format == "ctag": (r,g,b,a) = qc.getRgb() return '' % (r,g,b) - string = _ctag_begin.sub(colorrepfunc, string) - endtag = {"html": "", "bbcode": "[/color]", "ctag": ""} - string = string.replace("", endtag[format]) - def urlrep(matchobj): - if format=="html": - return "%s" % (matchobj.group(1).replace("&", "&"), matchobj.group(1)) - elif format=="bbcode": - return "[url]%s[/url]" % (matchobj.group(1).replace("&", "&")) - elif format=="ctag": - return matchobj.group(1) - string = _urlre.sub(urlrep, string) - if format == "html": - string = _memore.sub(r" \1", string) - for (code, f) in smiledict.iteritems(): - string = string.replace(" %s" % (code), " " % (f)) - return string +class colorEnd(object): + def __init__(self, string): + self.string = string + def convert(self, format): + if format == "html": + return "" + elif format == "bbcode": + return "[/color]" + else: + return self.string +class hyperlink(object): + def __init__(self, string): + self.string = string + def convert(self, format): + if format == "html": + return "%s" % (self.string, self.string) + elif format == "bbcode": + return "[url]%s[/url]" % (self.string) + else: + return self.string +class smiley(object): + def __init__(self, string): + self.string = string + def convert(self, format): + if format == "html": + return "" % (smiledict[self.string]) + else: + return self.string -def escapeBrackets(string): - class beginTag(object): - def __init__(self, tag): - self.tag = tag - class endTag(object): - pass - newlist = [] - begintagpos = [(m.start(), m.end()) for m in _ctag_begin.finditer(string)] - lasti = 0 - for (s, e) in begintagpos: - newlist.append(string[lasti:s]) - newlist.append(beginTag(string[s:e])) - lasti = e - if lasti < len(string): - newlist.append(string[lasti:]) - tmp = [] - for o in newlist: - if type(o) is not beginTag: - l = o.split("") - tmp.append(l[0]) - l = l[1:] - for item in l: - tmp.append(endTag()) - tmp.append(item) - else: - tmp.append(o) - btlen = 0 - etlen = 0 - retval = "" - newlist = tmp - for o in newlist: - if type(o) is beginTag: - retval += o.tag.replace("&", "&") - btlen +=1 - elif type(o) is endTag: - if etlen >= btlen: - continue +def convertTags(string, format="html", quirkobj=None): + if format not in ["html", "bbcode", "ctag"]: + raise ValueError("Color format not recognized") + lexlist = [(colorBegin, _ctag_begin), (colorEnd, _ctag_end), + (hyperlink, _urlre), (hyperlink, _memore), + (smiley, _smilere)] + + lexed = lexer(string, lexlist) + balanced = [] + beginc = 0 + endc = 0 + for o in lexed: + if type(o) is colorBegin: + beginc += 1 + balanced.append(o) + elif type(o) is colorEnd: + if beginc >= endc: + endc += 1 + balanced.append(o) else: - retval += "" - etlen += 1 + balanced.append(o.string) else: - retval += o.replace("&", "&").replace("<", "<").replace(">", ">") - if btlen > etlen: - for i in range(0, btlen-etlen): - retval += "" - return retval + balanced.append(o) + if beginc > endc: + for i in range(0, beginc-endc): + balanced.append(colorEnd("")) + + escaped = "" + for o in balanced: + if type(o) in [str, unicode]: + if quirkobj: + o = quirkobj.apply(o) + if format == "html": + escaped += o.replace("&", "&").replace(">", ">").replace("<","<") + else: + escaped += o + else: + escaped += o.convert(format) + return escaped + def addTimeInitial(string, grammar): endofi = string.find(":") @@ -196,3 +207,5 @@ smiledict = { ":befuddled:": "what.gif", ":pumpkin:": "whatpumpkin.gif", ":trollcool:": "trollcool.gif"} + +_smilere = re.compile("|".join(smiledict.keys())) diff --git a/parsetools.pyc b/parsetools.pyc index 15d589a55a6cb29c5087bb2a1c45a4532717e6c5..7b8e8b963eeb360c93abbcd29102b66594ae4df1 100644 GIT binary patch literal 8426 zcmdT}&2t<_6@N1;X|=Mx9LtjIK)jA4dmY=_#3T;c$chuoi33Eo#|};;i>=w|-rbRA zXI9g*SfV5s5UAq7feTe|%DZFI9q)IG(k=D7SI#tsP2%ui|QUJ57m8A4^VwV>iei3lKK?Y zXQVdh+Qvek8=Dj^l3t+j6kj~J%8bP&ICQ`A2oe+i3qR`>2hD5*MUZs&ZLh?ju%nfZ zGT(wm0lJrc*bB`RT9tRhiz~tP%JQr4UR*WfeMmJ}HOJ6-q%K{~KXW`EY-d@wR;_OS z;E~z7B+zo@+~#{%HvB6;dhN>F^{q=614uA2dY0*%_{=pBcR_-@1K-mp34VZ+xjc<@E9EyDRbyRBsOy?D^Sa&?II;}^`A~n3Z8K;oCM*a&j=U$av52Y!J@h z!wiIo+TxOSXR+1=hxsneZ4^mkI|@x!4o%rFbE{U~tN^HkEZgtu%jHyGyu7@;yd{G? zEsV=as&raTn&ob)n>y8TphMuI$|Q=6Hi^CvMIvYdV z?{;;pG8U6&7^^VTX~yzoGC$2^6%R9{l_tHetdW+H!AQp*#;C%gA%oZ?j9ao#emdNh z>;z>c=geRv#znPPMBIju*6hood%ljn0xJGRxh4i(BvMlyA^1Ga|R-6lu~K zbEZ(9a;BUj+Oss~Oyc(?^cV3>I43YR>&OX%Budivbt{YmM!-Kz`TO|HX%re(5O$Ho z__-{VY!?gUS$PPUL;SID+{9<*Q9!96XLZpaZU}<=qW0?|M&2}L$pK{l3S$ti8yz)e z(0dV}=eQgeje0$d!>nF^1#QEOA*bYsNnj2zD}>_f)+9h0A?@H>=;oS_Q*W0jIe?GCqIb*}u+2L$hHtM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