Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def breakLinks(body, kwargs, onlyGT=False):
- Thread = kwargs['Thread']
- board = kwargs['board']
- reply = kwargs['reply']
- body = strip_tags(body)
- lines = body.split("\n")
- reg = re.compile(r"(>>\d+)")
- for p, i in enumerate(lines):
- #line linking
- if onlyGT == False:
- l = reg.split(i)
- # Strip bullshit that'll fuck everything up
- l = [str(x).strip() for x in l]
- l = filter(None, l)
- l = [x.strip(' ') for x in l]
- p
- newLine = []
- if ">>" in i:
- for j,k in enumerate(l):
- if k.startswith(">>"):
- try:
- ID = k.split(">>")[len(k.split(">>")) - 1]
- except:
- ID = ""
- temp = ">>" + ID
- newLine.append("".join(temp))
- newLine.append(" ")
- else:
- newLine.append(k)
- newLine.append(" ")
- lines[p] = "".join(newLine)
- else:
- pass
- if str(i).startswith(">") and not str(i).startswith(">>"):
- lines[p] = "".join(["<span class='quote'>", i, "</span>"])
- body = "".join(lines)
- return body
Advertisement
Add Comment
Please, Sign In to add comment