|
@ -284,6 +284,9 @@ missing!" ) |
|
|
if self.entry.has( "Titel" ): |
|
|
if self.entry.has( "Titel" ): |
|
|
self._titel_raw = self.entry.get("Titel").value |
|
|
self._titel_raw = self.entry.get("Titel").value |
|
|
|
|
|
|
|
|
|
|
|
# Only use part before possible "<br" |
|
|
|
|
|
self.remove_lines(self._titel_raw) |
|
|
|
|
|
|
|
|
# Remove possible ref-tags |
|
|
# Remove possible ref-tags |
|
|
for ref in self._titel_raw.ifilter_tags(matches="ref"): |
|
|
for ref in self._titel_raw.ifilter_tags(matches="ref"): |
|
|
self._titel_raw.remove( ref ) |
|
|
self._titel_raw.remove( ref ) |
|
@ -356,6 +359,9 @@ missing!" ) |
|
|
if self.entry.has( "Interpret" ): |
|
|
if self.entry.has( "Interpret" ): |
|
|
self._interpret_raw = self.entry.get("Interpret").value |
|
|
self._interpret_raw = self.entry.get("Interpret").value |
|
|
|
|
|
|
|
|
|
|
|
# Only use part before possible "<br" |
|
|
|
|
|
self.remove_lines(self._interpret_raw) |
|
|
|
|
|
|
|
|
# Remove possible ref-tags |
|
|
# Remove possible ref-tags |
|
|
for ref in self._interpret_raw.ifilter_tags(matches="ref"): |
|
|
for ref in self._interpret_raw.ifilter_tags(matches="ref"): |
|
|
self._interpret_raw.remove( ref ) |
|
|
self._interpret_raw.remove( ref ) |
|
@ -458,6 +464,25 @@ missing!" ) |
|
|
else: |
|
|
else: |
|
|
return str(keywords[0]) |
|
|
return str(keywords[0]) |
|
|
|
|
|
|
|
|
|
|
|
def remove_lines(self, wikicode): |
|
|
|
|
|
""" |
|
|
|
|
|
Removes linebreaks (<br>) and everything after them in given wikicode |
|
|
|
|
|
""" |
|
|
|
|
|
# Catch wrong typed param |
|
|
|
|
|
if not isinstance(wikicode, mwparser.wikicode.Wikicode): |
|
|
|
|
|
raise TypeError(str(type(self)) + "._remove_lines() expects " + |
|
|
|
|
|
"parameter 'wikicode' of type " + |
|
|
|
|
|
"'mwparserfromhell.wikicode.Wikicode', " + |
|
|
|
|
|
str(type(wikicode)) + " was given!") |
|
|
|
|
|
|
|
|
|
|
|
# Find first linebreak |
|
|
|
|
|
br = next(wikicode.ifilter_tags(matches="br"), None) |
|
|
|
|
|
|
|
|
|
|
|
# If there is one, get its position and slice nodes-list |
|
|
|
|
|
if br: |
|
|
|
|
|
brpos = wikicode.nodes.index(br) |
|
|
|
|
|
wikicode.nodes = wikicode.nodes[0:brpos] |
|
|
|
|
|
|
|
|
def __str__( self ): |
|
|
def __str__( self ): |
|
|
""" |
|
|
""" |
|
|
Returns str repression for Object |
|
|
Returns str repression for Object |
|
|