Add slug info parsing.
This commit is contained in:
parent
ae5b8413a3
commit
3e3a8720c1
@ -38,6 +38,15 @@ class IPTCMessage(object):
|
||||
|
||||
def parseText(self):
|
||||
self.text = self.text.decode("latin1")
|
||||
lines = re.split(r'\r?\n', self.text)
|
||||
# Check the first 3 lines for slug info, and extract if there
|
||||
if lines[0][-1:] == "=" or lines[1][-1:] == "=" or lines[2][-1:] == "=":
|
||||
(self.sluginfo, self.maintext) = re.split(r'=\r?\n', self.text)
|
||||
self.sluginfo = self.sluginfo.strip()
|
||||
self.maintext = self.maintext.strip()
|
||||
else:
|
||||
self.sluginfo = ""
|
||||
self.maintext = self.text
|
||||
pass
|
||||
|
||||
def parsePostText(self):
|
||||
|
@ -28,7 +28,10 @@
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
{{ text }}
|
||||
{{ sluginfo }}
|
||||
</p>
|
||||
<p>
|
||||
{{ maintext }}
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user