Add slug info parsing.

This commit is contained in:
sv-ncp-3 root 2015-04-17 14:25:02 +02:00
parent ae5b8413a3
commit 3e3a8720c1
2 changed files with 13 additions and 1 deletions

View File

@ -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):

View File

@ -28,7 +28,10 @@
</head>
<body>
<p>
{{ text }}
{{ sluginfo }}
</p>
<p>
{{ maintext }}
</p>
</body>
</html>