def wikiWrap(self, wikilang): """ Returns a string for this entry in a format ready for Wiktionary """ entry = ( structs.wiktionaryformats[wikilang]["langheader"] .replace("%%langname%%", langnames[wikilang][self.entrylang]) .replace("%%ISOLangcode%%", self.entrylang) + "\n" ) for pos in self.posorder: meanings = self.meanings[pos] entry += structs.wiktionaryformats[wikilang]["posheader"][pos] entry += "\n" if wikilang == "en": entry += meanings[0].term.wikiWrapAsExample(wikilang) + "\n\n" for meaning in meanings: entry += "#%s %s\n" % (meaning.getLabel(), meaning.definition) entry += meaning.wikiWrapExamples() entry += "\n" if wikilang == "nl": for meaning in meanings: term = meaning.term entry += meaning.getLabel() + term.wikiWrapAsExample(wikilang) + "; %s\n" % meaning.definition entry += meaning.wikiWrapExamples() entry += "\n" if meaning.hasSynonyms(): entry += "%s\n" % (structs.wiktionaryformats[wikilang]["synonymsheader"]) for meaning in meanings: entry += "*%s'''%s''': %s" % ( meaning.getLabel(), meaning.getConciseDef(), meaning.wikiWrapSynonyms(wikilang), ) entry += "\n" if meaning.hasTranslations(): entry += "%s\n" % (structs.wiktionaryformats[wikilang]["translationsheader"]) for meaning in meanings: entry += "%s'''%s'''\n%s\n\n" % ( meaning.getLabel(), meaning.getConciseDef(), meaning.wikiWrapTranslations(wikilang, self.entrylang), ) entry += "\n" return entry
def wikiWrap(self, wikilang): """ Returns a string for this entry in a format ready for Wiktionary """ entry = structs.wiktionaryformats[wikilang]['langheader'].replace( '%%langname%%', langnames[wikilang][self.entrylang]).replace( '%%ISOLangcode%%', self.entrylang) + '\n' for pos in self.posorder: meanings = self.meanings[pos] entry += structs.wiktionaryformats[wikilang]['posheader'][pos] entry += '\n' if wikilang == 'en': entry = entry + meanings[0].term.wikiWrapAsExample( wikilang) + '\n\n' for meaning in meanings: entry = entry + '#' + meaning.getLabel( ) + ' ' + meaning.definition + '\n' entry = entry + meaning.wikiWrapExamples() entry += '\n' if wikilang == 'nl': for meaning in meanings: term = meaning.term entry = entry + meaning.getLabel( ) + term.wikiWrapAsExample( wikilang) + '; ' + meaning.definition + '\n' entry = entry + meaning.wikiWrapExamples() entry += '\n' if meaning.hasSynonyms(): entry = entry + structs.wiktionaryformats[wikilang][ 'synonymsheader'] + '\n' for meaning in meanings: entry = entry + '*' + meaning.getLabel( ) + "'''" + meaning.getConciseDef( ) + "''': " + meaning.wikiWrapSynonyms(wikilang) entry += '\n' if meaning.hasTranslations(): entry = entry + structs.wiktionaryformats[wikilang][ 'translationsheader'] + '\n' for meaning in meanings: entry = entry + meaning.getLabel( ) + "'''" + meaning.getConciseDef( ) + "'''" + '\n' + meaning.wikiWrapTranslations( wikilang, self.entrylang) + '\n\n' entry += '\n' return entry
def wikiWrap(self, wikilang): """ Returns a string for this entry in a format ready for Wiktionary """ entry = structs.wiktionaryformats[wikilang]['langheader'].replace( '%%langname%%', langnames[wikilang][self.entrylang]).replace( '%%ISOLangcode%%', self.entrylang) + '\n' for pos in self.posorder: meanings = self.meanings[pos] entry += structs.wiktionaryformats[wikilang]['posheader'][pos] entry += '\n' if wikilang == 'en': entry += meanings[0].term.wikiWrapAsExample(wikilang) + '\n\n' for meaning in meanings: entry += '#%s %s\n' % (meaning.getLabel(), meaning.definition) entry += meaning.wikiWrapExamples() entry += '\n' if wikilang == 'nl': for meaning in meanings: term = meaning.term entry += meaning.getLabel() + term.wikiWrapAsExample( wikilang) + '; %s\n' % meaning.definition entry += meaning.wikiWrapExamples() entry += '\n' if meaning.hasSynonyms(): entry += '%s\n' % ( structs.wiktionaryformats[wikilang]['synonymsheader']) for meaning in meanings: entry += "*%s'''%s''': %s" % (meaning.getLabel(), meaning.getConciseDef(), meaning.wikiWrapSynonyms( wikilang)) entry += '\n' if meaning.hasTranslations(): entry += '%s\n' % ( structs.wiktionaryformats[wikilang]['translationsheader']) for meaning in meanings: entry += "%s'''%s'''\n%s\n\n" % ( meaning.getLabel(), meaning.getConciseDef(), meaning.wikiWrapTranslations(wikilang, self.entrylang)) entry += '\n' return entry