Exemple #1
0
    def format(self, gatherer = False, for_forum = False, for_mse = False, vdump = False):
        outstr = ''
        if gatherer:
            cardname = titlecase(transforms.name_unpass_1_dashes(self.__dict__[field_name]))
            if vdump and not cardname:
                cardname = '_NONAME_'
            if for_forum:
                outstr += '[b]'
            outstr += cardname
            if for_forum:
                outstr += '[/b]'

            coststr = self.__dict__[field_cost].format(for_forum = for_forum)
            if vdump or not coststr == '_NOCOST_':
                outstr += ' ' + coststr

            if self.__dict__[field_rarity]:
                if self.__dict__[field_rarity] in utils.json_rarity_unmap:
                    rarity = utils.json_rarity_unmap[self.__dict__[field_rarity]]
                else:
                    rarity = self.__dict__[field_rarity]
                outstr += ' (' + rarity + ')'

            if vdump:
                if not self.parsed:
                    outstr += ' _UNPARSED_'
                if not self.valid:
                    outstr += ' _INVALID_'
                
            outstr += '\n'

            basetypes = map(str.capitalize, self.__dict__[field_types])
            if vdump and len(basetypes) < 1:
                basetypes = ['_NOTYPE_']
            
            outstr += ' '.join(map(str.capitalize, self.__dict__[field_supertypes]) + basetypes)

            if self.__dict__[field_subtypes]:
                outstr += (' ' + utils.dash_marker + ' ' + 
                           ' '.join(self.__dict__[field_subtypes]).title())

            if self.__dict__[field_pt]:
                outstr += ' (' + utils.from_unary(self.__dict__[field_pt]) + ')'

            if self.__dict__[field_loyalty]:
                outstr += ' ((' + utils.from_unary(self.__dict__[field_loyalty]) + '))'

            outstr += '\n'

            if self.__dict__[field_text].text:
                mtext = self.__dict__[field_text].text
                mtext = transforms.text_unpass_1_choice(mtext, delimit = False)
                mtext = transforms.text_unpass_2_counters(mtext)
                #mtext = transforms.text_unpass_3_uncast(mtext)
                mtext = transforms.text_unpass_4_unary(mtext)
                mtext = transforms.text_unpass_5_symbols(mtext, for_forum)
                mtext = sentencecase(mtext)
                mtext = transforms.text_unpass_6_cardname(mtext, cardname)
                mtext = transforms.text_unpass_7_newlines(mtext)
                #mtext = transforms.text_unpass_8_unicode(mtext)
                newtext = Manatext('')
                newtext.text = mtext
                newtext.costs = self.__dict__[field_text].costs
                outstr += newtext.format(for_forum = for_forum)
            
                outstr += '\n'

            if vdump and self.__dict__[field_other]:
                if for_forum:
                    outstr += '[i]'
                else:
                    outstr += utils.dash_marker * 2
                    outstr += '\n'
                for idx, value in self.__dict__[field_other]:
                    outstr += '<' + str(idx) + '> ' + str(value)
                    outstr += '\n'
                if for_forum:
                    outstr = outstr[:-1] # hack off the last newline
                    outstr += '[/i]'
                    outstr += '\n'

        else:
            cardname = self.__dict__[field_name]
            #cardname = transforms.name_unpass_1_dashes(self.__dict__[field_name])
            if vdump and not cardname:
                cardname = '_NONAME_'
            outstr += cardname
            if self.__dict__[field_rarity]:
                if self.__dict__[field_rarity] in utils.json_rarity_unmap:
                    rarity = utils.json_rarity_unmap[self.__dict__[field_rarity]]
                else:
                    rarity = self.__dict__[field_rarity]
                outstr += ' (' + rarity.lower() + ')'
            if vdump:
                if not self.parsed:
                    outstr += ' _UNPARSED_'
                if not self.valid:
                    outstr += ' _INVALID_'
            outstr += '\n'
            
            coststr = self.__dict__[field_cost].format(for_forum = for_forum)
            if vdump or not coststr == '_NOCOST_':
                outstr += coststr
                outstr += '\n'

            outstr += ' '.join(self.__dict__[field_supertypes] + self.__dict__[field_types])
            if self.__dict__[field_subtypes]:
                outstr += ' ' + utils.dash_marker + ' ' + ' '.join(self.__dict__[field_subtypes])
            outstr += '\n'
            
            if self.__dict__[field_text].text:
                mtext = self.__dict__[field_text].text
                mtext = transforms.text_unpass_1_choice(mtext, delimit = True)
                #mtext = transforms.text_unpass_2_counters(mtext)
                #mtext = transforms.text_unpass_3_uncast(mtext)
                mtext = transforms.text_unpass_4_unary(mtext)
                mtext = transforms.text_unpass_5_symbols(mtext, for_forum)
                #mtext = transforms.text_unpass_6_cardname(mtext, cardname)
                mtext = transforms.text_unpass_7_newlines(mtext)
                #mtext = transforms.text_unpass_8_unicode(mtext)
                newtext = Manatext('')
                newtext.text = mtext
                newtext.costs = self.__dict__[field_text].costs
                outstr += newtext.format(for_forum = for_forum) + '\n'

            if self.__dict__[field_pt]:
                outstr += '(' + utils.from_unary(self.__dict__[field_pt]) + ')'
                outstr += '\n'

            if self.__dict__[field_loyalty]:
                outstr += '((' + utils.from_unary(self.__dict__[field_loyalty]) + '))'
                outstr += '\n'
                
            if vdump and self.__dict__[field_other]:
                outstr += utils.dash_marker * 2
                outstr += '\n'
                for idx, value in self.__dict__[field_other]:
                    outstr += '<' + str(idx) + '> ' + str(value)
                    outstr += '\n'

        if self.bside:
            outstr += utils.dash_marker * 8 + '\n'
            outstr += self.bside.format(gatherer = gatherer, for_forum = for_forum)

        return outstr
Exemple #2
0
    def to_mse(self, print_raw = False, vdump = False):
        outstr = ''

        # need a 'card' string first
        outstr += 'card:\n'

        cardname = titlecase(transforms.name_unpass_1_dashes(self.__dict__[field_name]))
        outstr += '\tname: ' + cardname + '\n'

        if self.__dict__[field_rarity]:
            if self.__dict__[field_rarity] in utils.json_rarity_unmap:
                rarity = utils.json_rarity_unmap[self.__dict__[field_rarity]]
            else:
                rarity = self.__dict__[field_rarity]
            outstr += '\trarity: ' + rarity.lower() + '\n'

        if not self.__dict__[field_cost].none:            
            outstr += ('\tcasting cost: ' 
                       + self.__dict__[field_cost].format().replace('{','').replace('}','') 
                       + '\n')

        outstr += '\tsuper type: ' + ' '.join(self.__dict__[field_supertypes] 
                                              + self.__dict__[field_types]).title() + '\n'
        if self.__dict__[field_subtypes]:
            outstr += '\tsub type: ' + ' '.join(self.__dict__[field_subtypes]).title() + '\n'

        if self.__dict__[field_pt]:
            ptstring = utils.from_unary(self.__dict__[field_pt]).split('/')
            if (len(ptstring) > 1): # really don't want to be accessing anything nonexistent.
                outstr += '\tpower: ' + ptstring[0] + '\n'
                outstr += '\ttoughness: ' + ptstring[1] + '\n'

        if self.__dict__[field_text].text:
            mtext = self.__dict__[field_text].text
            mtext = transforms.text_unpass_1_choice(mtext, delimit = False)
            mtext = transforms.text_unpass_2_counters(mtext)
            mtext = transforms.text_unpass_3_uncast(mtext)
            mtext = transforms.text_unpass_4_unary(mtext)
            mtext = transforms.text_unpass_5_symbols(mtext, False)
            mtext = sentencecase(mtext)
            # I don't really want these MSE specific passes in transforms,
            # but they could be pulled out separately somewhere else in here.
            mtext = mtext.replace(utils.this_marker, '<atom-cardname><nospellcheck>'
                                  + utils.this_marker + '</nospellcheck></atom-cardname>')
            mtext = transforms.text_unpass_6_cardname(mtext, cardname)
            mtext = transforms.text_unpass_7_newlines(mtext)
            mtext = transforms.text_unpass_8_unicode(mtext)
            newtext = Manatext('')
            newtext.text = mtext
            newtext.costs = self.__dict__[field_text].costs
            newtext = newtext.format()

            # See, the thing is, I think it's simplest and easiest to just leave it like this.
            # What could possibly go wrong?
            newtext = newtext.replace('{','<sym-auto>').replace('}','</sym-auto>')
        else:
            newtext = ''

        # Annoying special case for bsides;
        # This could be improved by having an intermediate function that returned
        # all of the formatted fields in a data structure and a separate wrapper
        # that actually packed them into the MSE format.
        if self.bside:
            newtext = newtext.replace('\n','\n\t\t')
            outstr += '\trule text:\n\t\t' + newtext + '\n'

            outstr += '\tstylesheet: new-split\n'

            cardname2 = titlecase(transforms.name_unpass_1_dashes(
                self.bside.__dict__[field_name]))

            outstr += '\tname 2: ' + cardname2 + '\n'
            if self.bside.__dict__[field_rarity]:
                if self.bside.__dict__[field_rarity] in utils.json_rarity_unmap:
                    rarity2 = utils.json_rarity_unmap[self.bside.__dict__[field_rarity]]
                else:
                    rarity2 = self.bside.__dict__[field_rarity]
                outstr += '\trarity 2: ' + rarity2.lower() + '\n'

            if not self.bside.__dict__[field_cost].none:            
                outstr += ('\tcasting cost 2: ' 
                           + self.bside.__dict__[field_cost].format()
                           .replace('{','').replace('}','')
                           + '\n')

            outstr += ('\tsuper type 2: ' 
                       + ' '.join(self.bside.__dict__[field_supertypes] 
                                  + self.bside.__dict__[field_types]).title() + '\n')

            if self.bside.__dict__[field_subtypes]:
                outstr += ('\tsub type 2: ' 
                           + ' '.join(self.bside.__dict__[field_subtypes]).title() + '\n')

            if self.bside.__dict__[field_pt]:
                ptstring2 = utils.from_unary(self.bside.__dict__[field_pt]).split('/')
                if (len(ptstring2) > 1): # really don't want to be accessing anything nonexistent.
                    outstr += '\tpower 2: ' + ptstring2[0] + '\n'
                    outstr += '\ttoughness 2: ' + ptstring2[1] + '\n'

            if self.bside.__dict__[field_text].text:
                mtext2 = self.bside.__dict__[field_text].text
                mtext2 = transforms.text_unpass_1_choice(mtext2, delimit = False)
                mtext2 = transforms.text_unpass_2_counters(mtext2)
                mtext2 = transforms.text_unpass_3_uncast(mtext2)
                mtext2 = transforms.text_unpass_4_unary(mtext2)
                mtext2 = transforms.text_unpass_5_symbols(mtext2, False)
                mtext2 = sentencecase(mtext2)
                mtext2 = mtext2.replace(utils.this_marker, '<atom-cardname><nospellcheck>'
                                      + utils.this_marker + '</nospellcheck></atom-cardname>')
                mtext2 = transforms.text_unpass_6_cardname(mtext2, cardname2)
                mtext2 = transforms.text_unpass_7_newlines(mtext2)
                mtext2 = transforms.text_unpass_8_unicode(mtext2)
                newtext2 = Manatext('')
                newtext2.text = mtext2
                newtext2.costs = self.bside.__dict__[field_text].costs
                newtext2 = newtext2.format()
                newtext2 = newtext2.replace('{','<sym-auto>').replace('}','</sym-auto>')
                newtext2 = newtext2.replace('\n','\n\t\t')
                outstr += '\trule text 2:\n\t\t' + newtext2 + '\n'

        # Need to do Special Things if it's a planeswalker.
        # This code mostly works, but it won't get quite the right thing if the planeswalker
        # abilities don't come before any other ones. Should be fixed.
        elif "planeswalker" in str(self.__dict__[field_types]):
            outstr += '\tstylesheet: m15-planeswalker\n'

            # set up the loyalty cost fields using regex to find how many there are.
            i = 0
            lcost_regex = r'[-+]?\d+: ' # 1+ figures, might be 0.
            for lcost in re.findall(lcost_regex, newtext):
                i += 1
                outstr += '\tloyalty cost ' + str(i) + ': ' + lcost + '\n'
            # sub out the loyalty costs.
            newtext = re.sub(lcost_regex, '', newtext)

            # We need to uppercase again, because MSE won't magically capitalize for us
            # like it does after semicolons.
            # Abusing passes like this is terrible, should really fix sentencecase.
            newtext = transforms.text_pass_9_newlines(newtext)
            newtext = sentencecase(newtext)
            newtext = transforms.text_unpass_7_newlines(newtext)

            if self.__dict__[field_loyalty]:
                outstr += '\tloyalty: ' + utils.from_unary(self.__dict__[field_loyalty]) + '\n'

            newtext = newtext.replace('\n','\n\t\t')
            outstr += '\trule text:\n\t\t' + newtext + '\n'

        else:
            newtext = newtext.replace('\n','\n\t\t')
            outstr += '\trule text:\n\t\t' + newtext + '\n'

        # now append all the other useless fields that the setfile expects.
        outstr += '\thas styling: false\n\ttime created:2015-07-20 22:53:07\n\ttime modified:2015-07-20 22:53:08\n\textra data:\n\timage:\n\tcard code text:\n\tcopyright:\n\timage 2:\n\tcopyright 2:\n\tnotes:'

        return outstr
Exemple #3
0
    def to_mse(self, print_raw=False, vdump=False):
        outstr = ''

        # need a 'card' string first
        outstr += 'card:\n'

        cardname = titlecase(
            transforms.name_unpass_1_dashes(self.__dict__[field_name]))
        outstr += '\tname: ' + cardname + '\n'

        if self.__dict__[field_rarity]:
            if self.__dict__[field_rarity] in utils.json_rarity_unmap:
                rarity = utils.json_rarity_unmap[self.__dict__[field_rarity]]
            else:
                rarity = self.__dict__[field_rarity]
            outstr += '\trarity: ' + rarity.lower() + '\n'

        if not self.__dict__[field_cost].none:
            outstr += ('\tcasting cost: ' +
                       self.__dict__[field_cost].format().replace(
                           '{', '').replace('}', '') + '\n')

        outstr += '\tsuper type: ' + ' '.join(
            self.__dict__[field_supertypes] +
            self.__dict__[field_types]).title() + '\n'
        if self.__dict__[field_subtypes]:
            outstr += '\tsub type: ' + ' '.join(
                self.__dict__[field_subtypes]).title() + '\n'

        if self.__dict__[field_pt]:
            ptstring = utils.from_unary(self.__dict__[field_pt]).split('/')
            if (len(ptstring) > 1
                ):  # really don't want to be accessing anything nonexistent.
                outstr += '\tpower: ' + ptstring[0] + '\n'
                outstr += '\ttoughness: ' + ptstring[1] + '\n'

        if self.__dict__[field_text].text:
            mtext = self.__dict__[field_text].text
            mtext = transforms.text_unpass_1_choice(mtext, delimit=False)
            mtext = transforms.text_unpass_2_counters(mtext)
            mtext = transforms.text_unpass_3_uncast(mtext)
            mtext = transforms.text_unpass_4_unary(mtext)
            mtext = transforms.text_unpass_5_symbols(mtext, False, False)
            mtext = sentencecase(mtext)
            # I don't really want these MSE specific passes in transforms,
            # but they could be pulled out separately somewhere else in here.
            mtext = mtext.replace(
                utils.this_marker, '<atom-cardname><nospellcheck>' +
                utils.this_marker + '</nospellcheck></atom-cardname>')
            mtext = transforms.text_unpass_6_cardname(mtext, cardname)
            mtext = transforms.text_unpass_7_newlines(mtext)
            mtext = transforms.text_unpass_8_unicode(mtext)
            newtext = Manatext('')
            newtext.text = mtext
            newtext.costs = self.__dict__[field_text].costs
            newtext = newtext.format()

            # See, the thing is, I think it's simplest and easiest to just leave it like this.
            # What could possibly go wrong?
            newtext = newtext.replace('{', '<sym-auto>').replace(
                '}', '</sym-auto>')
        else:
            newtext = ''

        # Annoying special case for bsides;
        # This could be improved by having an intermediate function that returned
        # all of the formatted fields in a data structure and a separate wrapper
        # that actually packed them into the MSE format.
        if self.bside:
            newtext = newtext.replace('\n', '\n\t\t')
            outstr += '\trule text:\n\t\t' + newtext + '\n'

            outstr += '\tstylesheet: new-split\n'

            cardname2 = titlecase(
                transforms.name_unpass_1_dashes(
                    self.bside.__dict__[field_name]))

            outstr += '\tname 2: ' + cardname2 + '\n'
            if self.bside.__dict__[field_rarity]:
                if self.bside.__dict__[
                        field_rarity] in utils.json_rarity_unmap:
                    rarity2 = utils.json_rarity_unmap[
                        self.bside.__dict__[field_rarity]]
                else:
                    rarity2 = self.bside.__dict__[field_rarity]
                outstr += '\trarity 2: ' + rarity2.lower() + '\n'

            if not self.bside.__dict__[field_cost].none:
                outstr += ('\tcasting cost 2: ' +
                           self.bside.__dict__[field_cost].format().replace(
                               '{', '').replace('}', '') + '\n')

            outstr += ('\tsuper type 2: ' +
                       ' '.join(self.bside.__dict__[field_supertypes] +
                                self.bside.__dict__[field_types]).title() +
                       '\n')

            if self.bside.__dict__[field_subtypes]:
                outstr += ('\tsub type 2: ' + ' '.join(
                    self.bside.__dict__[field_subtypes]).title() + '\n')

            if self.bside.__dict__[field_pt]:
                ptstring2 = utils.from_unary(
                    self.bside.__dict__[field_pt]).split('/')
                if (
                        len(ptstring2) > 1
                ):  # really don't want to be accessing anything nonexistent.
                    outstr += '\tpower 2: ' + ptstring2[0] + '\n'
                    outstr += '\ttoughness 2: ' + ptstring2[1] + '\n'

            if self.bside.__dict__[field_text].text:
                mtext2 = self.bside.__dict__[field_text].text
                mtext2 = transforms.text_unpass_1_choice(mtext2, delimit=False)
                mtext2 = transforms.text_unpass_2_counters(mtext2)
                mtext2 = transforms.text_unpass_3_uncast(mtext2)
                mtext2 = transforms.text_unpass_4_unary(mtext2)
                mtext2 = transforms.text_unpass_5_symbols(mtext2, False, False)
                mtext2 = sentencecase(mtext2)
                mtext2 = mtext2.replace(
                    utils.this_marker, '<atom-cardname><nospellcheck>' +
                    utils.this_marker + '</nospellcheck></atom-cardname>')
                mtext2 = transforms.text_unpass_6_cardname(mtext2, cardname2)
                mtext2 = transforms.text_unpass_7_newlines(mtext2)
                mtext2 = transforms.text_unpass_8_unicode(mtext2)
                newtext2 = Manatext('')
                newtext2.text = mtext2
                newtext2.costs = self.bside.__dict__[field_text].costs
                newtext2 = newtext2.format()
                newtext2 = newtext2.replace('{', '<sym-auto>').replace(
                    '}', '</sym-auto>')
                newtext2 = newtext2.replace('\n', '\n\t\t')
                outstr += '\trule text 2:\n\t\t' + newtext2 + '\n'

        # Need to do Special Things if it's a planeswalker.
        # This code mostly works, but it won't get quite the right thing if the planeswalker
        # abilities don't come before any other ones. Should be fixed.
        elif "planeswalker" in str(self.__dict__[field_types]):
            outstr += '\tstylesheet: m15-planeswalker\n'

            # set up the loyalty cost fields using regex to find how many there are.
            i = 0
            lcost_regex = r'[-+]?\d+: '  # 1+ figures, might be 0.
            for lcost in re.findall(lcost_regex, newtext):
                i += 1
                outstr += '\tloyalty cost ' + str(i) + ': ' + lcost + '\n'
            # sub out the loyalty costs.
            newtext = re.sub(lcost_regex, '', newtext)

            # We need to uppercase again, because MSE won't magically capitalize for us
            # like it does after semicolons.
            # Abusing passes like this is terrible, should really fix sentencecase.
            newtext = transforms.text_pass_9_newlines(newtext)
            newtext = sentencecase(newtext)
            newtext = transforms.text_unpass_7_newlines(newtext)

            if self.__dict__[field_loyalty]:
                outstr += '\tloyalty: ' + utils.from_unary(
                    self.__dict__[field_loyalty]) + '\n'

            newtext = newtext.replace('\n', '\n\t\t')
            outstr += '\trule text:\n\t\t' + newtext + '\n'

        else:
            newtext = newtext.replace('\n', '\n\t\t')
            outstr += '\trule text:\n\t\t' + newtext + '\n'

        # now append all the other useless fields that the setfile expects.
        outstr += '\thas styling: false\n\ttime created:2015-07-20 22:53:07\n\ttime modified:2015-07-20 22:53:08\n\textra data:\n\timage:\n\tcard code text:\n\tcopyright:\n\timage 2:\n\tcopyright 2:\n\tnotes:'

        return outstr
Exemple #4
0
    def format(self,
               gatherer=False,
               for_forum=False,
               vdump=False,
               for_html=False):
        linebreak = '\n'
        if for_html:
            linebreak = '<hr>' + linebreak

        outstr = ''
        if for_html:
            outstr += '<div class="card-text">\n'

        if gatherer:
            cardname = titlecase(
                transforms.name_unpass_1_dashes(self.__dict__[field_name]))
            if vdump and not cardname:
                cardname = '_NONAME_'
            # in general, for_html overrides for_forum
            if for_html:
                outstr += '<b>'
            elif for_forum:
                outstr += '[b]'
            outstr += cardname
            if for_html:
                outstr += '</b>'
            elif for_forum:
                outstr += '[/b]'

            coststr = self.__dict__[field_cost].format(for_forum=for_forum,
                                                       for_html=for_html)
            if vdump or not coststr == '_NOCOST_':
                outstr += ' ' + coststr

            if for_html and for_forum:
                #force for_html to false to create tootip with forum spoiler
                outstr += (
                    '<div class="hover_img"><a href="#">[F]</a> <span><p>' +
                    self.format(gatherer=gatherer,
                                for_forum=for_forum,
                                for_html=False,
                                vdump=vdump).replace('\n', '<br>') +
                    '</p></span></div><a href="#top" style="float: right;">back to top</a>'
                )

            if self.__dict__[field_rarity]:
                if self.__dict__[field_rarity] in utils.json_rarity_unmap:
                    rarity = utils.json_rarity_unmap[
                        self.__dict__[field_rarity]]
                else:
                    rarity = self.__dict__[field_rarity]
                outstr += ' (' + rarity + ')'

            if vdump:
                if not self.parsed:
                    outstr += ' _UNPARSED_'
                if not self.valid:
                    outstr += ' _INVALID_'

            outstr += linebreak

            basetypes = map(str.capitalize, self.__dict__[field_types])
            if vdump and len(basetypes) < 1:
                basetypes = ['_NOTYPE_']

            outstr += ' '.join(
                map(str.capitalize, self.__dict__[field_supertypes]) +
                basetypes)

            if self.__dict__[field_subtypes]:
                outstr += (' ' + utils.dash_marker + ' ' +
                           ' '.join(self.__dict__[field_subtypes]).title())

            if self.__dict__[field_pt]:
                outstr += ' (' + utils.from_unary(
                    self.__dict__[field_pt]) + ')'

            if self.__dict__[field_loyalty]:
                outstr += ' ((' + utils.from_unary(
                    self.__dict__[field_loyalty]) + '))'

            if self.__dict__[field_text].text:
                outstr += linebreak

                mtext = self.__dict__[field_text].text
                mtext = transforms.text_unpass_1_choice(mtext, delimit=False)
                mtext = transforms.text_unpass_2_counters(mtext)
                #mtext = transforms.text_unpass_3_uncast(mtext)
                mtext = transforms.text_unpass_4_unary(mtext)
                mtext = transforms.text_unpass_5_symbols(
                    mtext, for_forum, for_html)
                mtext = sentencecase(mtext)
                mtext = transforms.text_unpass_6_cardname(mtext, cardname)
                mtext = transforms.text_unpass_7_newlines(mtext)
                #mtext = transforms.text_unpass_8_unicode(mtext)
                newtext = Manatext('')
                newtext.text = mtext
                newtext.costs = self.__dict__[field_text].costs

                outstr += newtext.format(for_forum=for_forum,
                                         for_html=for_html)

            if vdump and self.__dict__[field_other]:
                outstr += linebreak

                if for_html:
                    outstr += '<i>'
                elif for_forum:
                    outstr += '[i]'
                else:
                    outstr += utils.dash_marker * 2

                first = True
                for idx, value in self.__dict__[field_other]:
                    if for_html:
                        if not first:
                            outstr += '<br>\n'
                        else:
                            first = False
                    else:
                        outstr += linebreak
                    outstr += '(' + str(idx) + ') ' + str(value)

                if for_html:
                    outstr += '</i>'
                if for_forum:
                    outstr += '[/i]'

        else:
            cardname = self.__dict__[field_name]
            #cardname = transforms.name_unpass_1_dashes(self.__dict__[field_name])
            if vdump and not cardname:
                cardname = '_NONAME_'
            outstr += cardname

            coststr = self.__dict__[field_cost].format(for_forum=for_forum,
                                                       for_html=for_html)
            if vdump or not coststr == '_NOCOST_':
                outstr += ' ' + coststr

            if vdump:
                if not self.parsed:
                    outstr += ' _UNPARSED_'
                if not self.valid:
                    outstr += ' _INVALID_'

            if for_html and for_forum:
                #force for_html to false to create tootip with forum spoiler
                outstr += (
                    '<div class="hover_img"><a href="#">[F]</a> <span><p>' +
                    self.format(gatherer=gatherer,
                                for_forum=for_forum,
                                for_html=False,
                                vdump=vdump).replace('\n', '<br>') +
                    '</p></span></div><a href="#top" style="float: right;">back to top</a>'
                )

            outstr += linebreak

            outstr += ' '.join(self.__dict__[field_supertypes] +
                               self.__dict__[field_types])
            if self.__dict__[field_subtypes]:
                outstr += ' ' + utils.dash_marker + ' ' + ' '.join(
                    self.__dict__[field_subtypes])

            if self.__dict__[field_rarity]:
                if self.__dict__[field_rarity] in utils.json_rarity_unmap:
                    rarity = utils.json_rarity_unmap[
                        self.__dict__[field_rarity]]
                else:
                    rarity = self.__dict__[field_rarity]
                outstr += ' (' + rarity.lower() + ')'

            if self.__dict__[field_text].text:
                outstr += linebreak

                mtext = self.__dict__[field_text].text
                mtext = transforms.text_unpass_1_choice(mtext, delimit=True)
                #mtext = transforms.text_unpass_2_counters(mtext)
                #mtext = transforms.text_unpass_3_uncast(mtext)
                mtext = transforms.text_unpass_4_unary(mtext)
                mtext = transforms.text_unpass_5_symbols(
                    mtext, for_forum, for_html)
                #mtext = transforms.text_unpass_6_cardname(mtext, cardname)
                mtext = transforms.text_unpass_7_newlines(mtext)
                #mtext = transforms.text_unpass_8_unicode(mtext)
                newtext = Manatext('')
                newtext.text = mtext
                newtext.costs = self.__dict__[field_text].costs

                outstr += newtext.format(for_forum=for_forum,
                                         for_html=for_html)

            if self.__dict__[field_pt]:
                outstr += linebreak
                outstr += '(' + utils.from_unary(self.__dict__[field_pt]) + ')'

            if self.__dict__[field_loyalty]:
                outstr += linebreak
                outstr += '((' + utils.from_unary(
                    self.__dict__[field_loyalty]) + '))'

            if vdump and self.__dict__[field_other]:
                outstr += linebreak

                if for_html:
                    outstr += '<i>'
                else:
                    outstr += utils.dash_marker * 2

                first = True
                for idx, value in self.__dict__[field_other]:
                    if for_html:
                        if not first:
                            outstr += '<br>\n'
                        else:
                            first = False
                    else:
                        outstr += linebreak
                    outstr += '(' + str(idx) + ') ' + str(value)

                if for_html:
                    outstr += '</i>'

        if self.bside:
            if for_html:
                outstr += '\n'
                # force for_forum to false so that the inner div doesn't duplicate the forum
                # spoiler of the bside
                outstr += self.bside.format(gatherer=gatherer,
                                            for_forum=False,
                                            for_html=for_html,
                                            vdump=vdump)
            else:
                outstr += linebreak
                outstr += utils.dash_marker * 8
                outstr += linebreak
                outstr += self.bside.format(gatherer=gatherer,
                                            for_forum=for_forum,
                                            for_html=for_html,
                                            vdump=vdump)

        # if for_html:
        #     if for_forum:
        #         outstr += linebreak
        #         # force for_html to false to create a copyable forum spoiler div
        #         outstr += ('<div>'
        #                    + self.format(gatherer=gatherer, for_forum=for_forum, for_html=False, vdump=vdump).replace('\n', '<br>')
        #                    + '</div>')
        if for_html:
            outstr += "</div>"

        return outstr
Exemple #5
0
    def format(self, gatherer = False, for_forum = False, vdump = False, for_html = False):
        linebreak = '\n'
        if for_html:
            linebreak = '<hr>' + linebreak

        outstr = ''
        if for_html:
            outstr += '<div class="card-text">\n'

        if gatherer:
            cardname = titlecase(transforms.name_unpass_1_dashes(self.__dict__[field_name]))
            if vdump and not cardname:
                cardname = '_NONAME_'
            # in general, for_html overrides for_forum
            if for_html: 
                outstr += '<b>'
            elif for_forum:
                outstr += '[b]'
            outstr += cardname
            if for_html: 
                outstr += '</b>'
            elif for_forum:
                outstr += '[/b]'

            coststr = self.__dict__[field_cost].format(for_forum=for_forum, for_html=for_html)
            if vdump or not coststr == '_NOCOST_':
                outstr += ' ' + coststr

            if self.__dict__[field_rarity]:
                if self.__dict__[field_rarity] in utils.json_rarity_unmap:
                    rarity = utils.json_rarity_unmap[self.__dict__[field_rarity]]
                else:
                    rarity = self.__dict__[field_rarity]
                outstr += ' (' + rarity + ')'

            if vdump:
                if not self.parsed:
                    outstr += ' _UNPARSED_'
                if not self.valid:
                    outstr += ' _INVALID_'
                
            outstr += linebreak

            basetypes = map(str.capitalize, self.__dict__[field_types])
            if vdump and len(basetypes) < 1:
                basetypes = ['_NOTYPE_']
            
            outstr += ' '.join(map(str.capitalize, self.__dict__[field_supertypes]) + basetypes)

            if self.__dict__[field_subtypes]:
                outstr += (' ' + utils.dash_marker + ' ' + 
                           ' '.join(self.__dict__[field_subtypes]).title())

            if self.__dict__[field_pt]:
                outstr += ' (' + utils.from_unary(self.__dict__[field_pt]) + ')'

            if self.__dict__[field_loyalty]:
                outstr += ' ((' + utils.from_unary(self.__dict__[field_loyalty]) + '))'

            if self.__dict__[field_text].text:
                outstr += linebreak

                mtext = self.__dict__[field_text].text
                mtext = transforms.text_unpass_1_choice(mtext, delimit = False)
                mtext = transforms.text_unpass_2_counters(mtext)
                #mtext = transforms.text_unpass_3_uncast(mtext)
                mtext = transforms.text_unpass_4_unary(mtext)
                mtext = transforms.text_unpass_5_symbols(mtext, for_forum, for_html)
                mtext = sentencecase(mtext)
                mtext = transforms.text_unpass_6_cardname(mtext, cardname)
                mtext = transforms.text_unpass_7_newlines(mtext)
                #mtext = transforms.text_unpass_8_unicode(mtext)
                newtext = Manatext('')
                newtext.text = mtext
                newtext.costs = self.__dict__[field_text].costs

                outstr += newtext.format(for_forum = for_forum, for_html = for_html)
            
            if vdump and self.__dict__[field_other]:
                outstr += linebreak

                if for_html:
                    outstr += '<i>'
                elif for_forum:
                    outstr += '[i]'
                else:
                    outstr += utils.dash_marker * 2

                first = True
                for idx, value in self.__dict__[field_other]:
                    if for_html:
                        if not first:
                            outstr += '<br>\n'
                        else:
                            first = False
                    else:
                        outstr += linebreak
                    outstr += '(' + str(idx) + ') ' + str(value)
                    
                if for_html:
                    outstr += '</i>'
                if for_forum:
                    outstr += '[/i]'

        else:
            cardname = self.__dict__[field_name]
            #cardname = transforms.name_unpass_1_dashes(self.__dict__[field_name])
            if vdump and not cardname:
                cardname = '_NONAME_'
            outstr += cardname

            coststr = self.__dict__[field_cost].format(for_forum=for_forum, for_html=for_html)
            if vdump or not coststr == '_NOCOST_':
                outstr += ' ' + coststr

            if vdump:
                if not self.parsed:
                    outstr += ' _UNPARSED_'
                if not self.valid:
                    outstr += ' _INVALID_'
            
            outstr += linebreak

            outstr += ' '.join(self.__dict__[field_supertypes] + self.__dict__[field_types])
            if self.__dict__[field_subtypes]:
                outstr += ' ' + utils.dash_marker + ' ' + ' '.join(self.__dict__[field_subtypes])

            if self.__dict__[field_rarity]:
                if self.__dict__[field_rarity] in utils.json_rarity_unmap:
                    rarity = utils.json_rarity_unmap[self.__dict__[field_rarity]]
                else:
                    rarity = self.__dict__[field_rarity]
                outstr += ' (' + rarity.lower() + ')'
            
            if self.__dict__[field_text].text:
                outstr += linebreak

                mtext = self.__dict__[field_text].text
                mtext = transforms.text_unpass_1_choice(mtext, delimit = True)
                #mtext = transforms.text_unpass_2_counters(mtext)
                #mtext = transforms.text_unpass_3_uncast(mtext)
                mtext = transforms.text_unpass_4_unary(mtext)
                mtext = transforms.text_unpass_5_symbols(mtext, for_forum, for_html)
                #mtext = transforms.text_unpass_6_cardname(mtext, cardname)
                mtext = transforms.text_unpass_7_newlines(mtext)
                #mtext = transforms.text_unpass_8_unicode(mtext)
                newtext = Manatext('')
                newtext.text = mtext
                newtext.costs = self.__dict__[field_text].costs

                outstr += newtext.format(for_forum=for_forum, for_html=for_html)

            if self.__dict__[field_pt]:
                outstr += linebreak
                outstr += '(' + utils.from_unary(self.__dict__[field_pt]) + ')'

            if self.__dict__[field_loyalty]:
                outstr += linebreak
                outstr += '((' + utils.from_unary(self.__dict__[field_loyalty]) + '))'
                
            if vdump and self.__dict__[field_other]:
                outstr += linebreak

                if for_html:
                    outstr += '<i>'
                else:
                    outstr += utils.dash_marker * 2

                first = True
                for idx, value in self.__dict__[field_other]:
                    if for_html:
                        if not first:
                            outstr += '<br>\n'
                        else:
                            first = False
                    else:
                        outstr += linebreak
                    outstr += '(' + str(idx) + ') ' + str(value)

                if for_html:
                    outstr += '</i>'

        if self.bside:
            if for_html:
                outstr += '\n'
                # force for_forum to false so that the inner div doesn't duplicate the forum
                # spoiler of the bside
                outstr += self.bside.format(gatherer=gatherer, for_forum=False, for_html=for_html, vdump=vdump)
            else:
                outstr += linebreak
                outstr += utils.dash_marker * 8
                outstr += linebreak
                outstr += self.bside.format(gatherer=gatherer, for_forum=for_forum, for_html=for_html, vdump=vdump)

        if for_html:
            if for_forum:
                outstr += linebreak
                # force for_html to false to create a copyable forum spoiler div
                outstr += ('<div>' 
                           + self.format(gatherer=gatherer, for_forum=for_forum, for_html=False, vdump=vdump).replace('\n', '<br>')
                           + '</div>')
            outstr += "</div>"

        return outstr
Exemple #6
0
    def format(self, gatherer=False, for_forum=False, for_mse=False, vdump=False):
        outstr = ""
        if gatherer:
            cardname = titlecase(transforms.name_unpass_1_dashes(self.__dict__[field_name]))
            if vdump and not cardname:
                cardname = "_NONAME_"
            if for_forum:
                outstr += "[b]"
            outstr += cardname
            if for_forum:
                outstr += "[/b]"

            coststr = self.__dict__[field_cost].format(for_forum=for_forum)
            if vdump or not coststr == "_NOCOST_":
                outstr += " " + coststr

            if self.__dict__[field_rarity]:
                if self.__dict__[field_rarity] in utils.json_rarity_unmap:
                    rarity = utils.json_rarity_unmap[self.__dict__[field_rarity]]
                else:
                    rarity = self.__dict__[field_rarity]
                outstr += " (" + rarity + ")"

            if vdump:
                if not self.parsed:
                    outstr += " _UNPARSED_"
                if not self.valid:
                    outstr += " _INVALID_"

            outstr += "\n"

            basetypes = map(str.capitalize, self.__dict__[field_types])
            if vdump and len(basetypes) < 1:
                basetypes = ["_NOTYPE_"]

            outstr += " ".join(map(str.capitalize, self.__dict__[field_supertypes]) + basetypes)

            if self.__dict__[field_subtypes]:
                outstr += " " + utils.dash_marker + " " + " ".join(self.__dict__[field_subtypes]).title()

            if self.__dict__[field_pt]:
                outstr += " (" + utils.from_unary(self.__dict__[field_pt]) + ")"

            if self.__dict__[field_loyalty]:
                outstr += " ((" + utils.from_unary(self.__dict__[field_loyalty]) + "))"

            outstr += "\n"

            if self.__dict__[field_text].text:
                mtext = self.__dict__[field_text].text
                mtext = transforms.text_unpass_1_choice(mtext, delimit=False)
                mtext = transforms.text_unpass_2_counters(mtext)
                # mtext = transforms.text_unpass_3_uncast(mtext)
                mtext = transforms.text_unpass_4_unary(mtext)
                mtext = transforms.text_unpass_5_symbols(mtext, for_forum)
                mtext = sentencecase(mtext)
                mtext = transforms.text_unpass_6_cardname(mtext, cardname)
                mtext = transforms.text_unpass_7_newlines(mtext)
                # mtext = transforms.text_unpass_8_unicode(mtext)
                newtext = Manatext("")
                newtext.text = mtext
                newtext.costs = self.__dict__[field_text].costs
                outstr += newtext.format(for_forum=for_forum)

                outstr += "\n"

            if vdump and self.__dict__[field_other]:
                if for_forum:
                    outstr += "[i]"
                else:
                    outstr += utils.dash_marker * 2
                    outstr += "\n"
                for idx, value in self.__dict__[field_other]:
                    outstr += "<" + str(idx) + "> " + str(value)
                    outstr += "\n"
                if for_forum:
                    outstr = outstr[:-1]  # hack off the last newline
                    outstr += "[/i]"
                    outstr += "\n"

        else:
            cardname = self.__dict__[field_name]
            # cardname = transforms.name_unpass_1_dashes(self.__dict__[field_name])
            if vdump and not cardname:
                cardname = "_NONAME_"
            outstr += cardname
            if self.__dict__[field_rarity]:
                if self.__dict__[field_rarity] in utils.json_rarity_unmap:
                    rarity = utils.json_rarity_unmap[self.__dict__[field_rarity]]
                else:
                    rarity = self.__dict__[field_rarity]
                outstr += " (" + rarity.lower() + ")"
            if vdump:
                if not self.parsed:
                    outstr += " _UNPARSED_"
                if not self.valid:
                    outstr += " _INVALID_"
            outstr += "\n"

            coststr = self.__dict__[field_cost].format(for_forum=for_forum)
            if vdump or not coststr == "_NOCOST_":
                outstr += coststr
                outstr += "\n"

            outstr += " ".join(self.__dict__[field_supertypes] + self.__dict__[field_types])
            if self.__dict__[field_subtypes]:
                outstr += " " + utils.dash_marker + " " + " ".join(self.__dict__[field_subtypes])
            outstr += "\n"

            if self.__dict__[field_text].text:
                mtext = self.__dict__[field_text].text
                mtext = transforms.text_unpass_1_choice(mtext, delimit=True)
                # mtext = transforms.text_unpass_2_counters(mtext)
                # mtext = transforms.text_unpass_3_uncast(mtext)
                mtext = transforms.text_unpass_4_unary(mtext)
                mtext = transforms.text_unpass_5_symbols(mtext, for_forum)
                # mtext = transforms.text_unpass_6_cardname(mtext, cardname)
                mtext = transforms.text_unpass_7_newlines(mtext)
                # mtext = transforms.text_unpass_8_unicode(mtext)
                newtext = Manatext("")
                newtext.text = mtext
                newtext.costs = self.__dict__[field_text].costs
                outstr += newtext.format(for_forum=for_forum) + "\n"

            if self.__dict__[field_pt]:
                outstr += "(" + utils.from_unary(self.__dict__[field_pt]) + ")"
                outstr += "\n"

            if self.__dict__[field_loyalty]:
                outstr += "((" + utils.from_unary(self.__dict__[field_loyalty]) + "))"
                outstr += "\n"

            if vdump and self.__dict__[field_other]:
                outstr += utils.dash_marker * 2
                outstr += "\n"
                for idx, value in self.__dict__[field_other]:
                    outstr += "<" + str(idx) + "> " + str(value)
                    outstr += "\n"

        if self.bside:
            outstr += utils.dash_marker * 8 + "\n"
            outstr += self.bside.format(gatherer=gatherer, for_forum=for_forum)

        return outstr
Exemple #7
0
    def format(self, gatherer=False, for_forum=False, vdump=False, for_html=False):
        linebreak = "\n"
        if for_html:
            linebreak = "<hr>" + linebreak

        outstr = ""
        if for_html:
            outstr += '<div class="card-text'
            if len(self.get_colors()) > 1:
                outstr += ' multi"'
            elif "R" in self.get_colors():
                outstr += ' red"'
            elif "U" in self.get_colors():
                outstr += ' blue"'
            elif "B" in self.get_colors():
                outstr += ' black"'
            elif "G" in self.get_colors():
                outstr += ' green"'
            elif "W" in self.get_colors():
                outstr += ' white"'
            elif "land" in self.get_types():
                outstr += ' land"'
            else:
                outstr += ' colorless"'
            outstr += ">\n"

        if gatherer:
            cardname = titlecase(transforms.name_unpass_1_dashes(self.__dict__[field_name]))
            if vdump and not cardname:
                cardname = "_NONAME_"
            # in general, for_html overrides for_forum
            if for_html:
                outstr += "<b>"
            elif for_forum:
                outstr += "[b]"
            outstr += cardname
            if for_html:
                outstr += "</b>"
            elif for_forum:
                outstr += "[/b]"

            coststr = self.__dict__[field_cost].format(for_forum=for_forum, for_html=for_html)
            if vdump or not coststr == "_NOCOST_":
                outstr += " " + coststr

            if for_html and for_forum:
                # force for_html to false to create tootip with forum spoiler
                outstr += (
                    '<div class="hover_img"><a href="#">[F]</a> <span><p>'
                    + self.format(gatherer=gatherer, for_forum=for_forum, for_html=False, vdump=vdump).replace(
                        "\n", "<br>"
                    )
                    + '</p></span></div><a href="#top" style="float: right;">back to top</a>'
                )

            if self.__dict__[field_rarity]:
                if self.__dict__[field_rarity] in utils.json_rarity_unmap:
                    rarity = utils.json_rarity_unmap[self.__dict__[field_rarity]]
                else:
                    rarity = self.__dict__[field_rarity]
                outstr += " (" + rarity + ")"

            if vdump:
                if not self.parsed:
                    outstr += " _UNPARSED_"
                if not self.valid:
                    outstr += " _INVALID_"

            outstr += linebreak

            basetypes = map(str.capitalize, self.__dict__[field_types])
            if vdump and len(basetypes) < 1:
                basetypes = ["_NOTYPE_"]

            outstr += " ".join(map(str.capitalize, self.__dict__[field_supertypes]) + basetypes)

            if self.__dict__[field_subtypes]:
                outstr += " " + utils.dash_marker + " " + " ".join(self.__dict__[field_subtypes]).title()

            if self.__dict__[field_pt]:
                outstr += " (" + utils.from_unary(self.__dict__[field_pt]) + ")"

            if self.__dict__[field_loyalty]:
                outstr += " ((" + utils.from_unary(self.__dict__[field_loyalty]) + "))"

            if self.__dict__[field_text].text:
                outstr += linebreak

                mtext = self.__dict__[field_text].text
                mtext = transforms.text_unpass_1_choice(mtext, delimit=False)
                mtext = transforms.text_unpass_2_counters(mtext)
                # mtext = transforms.text_unpass_3_uncast(mtext)
                mtext = transforms.text_unpass_4_unary(mtext)
                mtext = transforms.text_unpass_5_symbols(mtext, for_forum, for_html)
                mtext = sentencecase(mtext)
                mtext = transforms.text_unpass_6_cardname(mtext, cardname)
                mtext = transforms.text_unpass_7_newlines(mtext)
                # mtext = transforms.text_unpass_8_unicode(mtext)
                newtext = Manatext("")
                newtext.text = mtext
                newtext.costs = self.__dict__[field_text].costs

                outstr += newtext.format(for_forum=for_forum, for_html=for_html)

            if vdump and self.__dict__[field_other]:
                outstr += linebreak

                if for_html:
                    outstr += "<i>"
                elif for_forum:
                    outstr += "[i]"
                else:
                    outstr += utils.dash_marker * 2

                first = True
                for idx, value in self.__dict__[field_other]:
                    if for_html:
                        if not first:
                            outstr += "<br>\n"
                        else:
                            first = False
                    else:
                        outstr += linebreak
                    outstr += "(" + str(idx) + ") " + str(value)

                if for_html:
                    outstr += "</i>"
                if for_forum:
                    outstr += "[/i]"

        else:
            cardname = self.__dict__[field_name]
            # cardname = transforms.name_unpass_1_dashes(self.__dict__[field_name])
            if vdump and not cardname:
                cardname = "_NONAME_"
            outstr += cardname

            coststr = self.__dict__[field_cost].format(for_forum=for_forum, for_html=for_html)
            if vdump or not coststr == "_NOCOST_":
                outstr += " " + coststr

            if vdump:
                if not self.parsed:
                    outstr += " _UNPARSED_"
                if not self.valid:
                    outstr += " _INVALID_"

            if for_html and for_forum:
                # force for_html to false to create tootip with forum spoiler
                outstr += (
                    '<div class="hover_img"><a href="#">[F]</a> <span><p>'
                    + self.format(gatherer=gatherer, for_forum=for_forum, for_html=False, vdump=vdump).replace(
                        "\n", "<br>"
                    )
                    + '</p></span></div><a href="#top" style="float: right;">back to top</a>'
                )

            outstr += linebreak

            outstr += " ".join(self.__dict__[field_supertypes] + self.__dict__[field_types])
            if self.__dict__[field_subtypes]:
                outstr += " " + utils.dash_marker + " " + " ".join(self.__dict__[field_subtypes])

            if self.__dict__[field_rarity]:
                if self.__dict__[field_rarity] in utils.json_rarity_unmap:
                    rarity = utils.json_rarity_unmap[self.__dict__[field_rarity]]
                else:
                    rarity = self.__dict__[field_rarity]
                outstr += " (" + rarity.lower() + ")"

            if self.__dict__[field_text].text:
                outstr += linebreak

                mtext = self.__dict__[field_text].text
                mtext = transforms.text_unpass_1_choice(mtext, delimit=True)
                # mtext = transforms.text_unpass_2_counters(mtext)
                # mtext = transforms.text_unpass_3_uncast(mtext)
                mtext = transforms.text_unpass_4_unary(mtext)
                mtext = transforms.text_unpass_5_symbols(mtext, for_forum, for_html)
                # mtext = transforms.text_unpass_6_cardname(mtext, cardname)
                mtext = transforms.text_unpass_7_newlines(mtext)
                # mtext = transforms.text_unpass_8_unicode(mtext)
                newtext = Manatext("")
                newtext.text = mtext
                newtext.costs = self.__dict__[field_text].costs

                outstr += newtext.format(for_forum=for_forum, for_html=for_html)

            if self.__dict__[field_pt]:
                outstr += linebreak
                outstr += "(" + utils.from_unary(self.__dict__[field_pt]) + ")"

            if self.__dict__[field_loyalty]:
                outstr += linebreak
                outstr += "((" + utils.from_unary(self.__dict__[field_loyalty]) + "))"

            if vdump and self.__dict__[field_other]:
                outstr += linebreak

                if for_html:
                    outstr += "<i>"
                else:
                    outstr += utils.dash_marker * 2

                first = True
                for idx, value in self.__dict__[field_other]:
                    if for_html:
                        if not first:
                            outstr += "<br>\n"
                        else:
                            first = False
                    else:
                        outstr += linebreak
                    outstr += "(" + str(idx) + ") " + str(value)

                if for_html:
                    outstr += "</i>"

        if self.bside:
            if for_html:
                outstr += "\n"
                # force for_forum to false so that the inner div doesn't duplicate the forum
                # spoiler of the bside
                outstr += self.bside.format(gatherer=gatherer, for_forum=False, for_html=for_html, vdump=vdump)
            else:
                outstr += linebreak
                outstr += utils.dash_marker * 8
                outstr += linebreak
                outstr += self.bside.format(gatherer=gatherer, for_forum=for_forum, for_html=for_html, vdump=vdump)

        # if for_html:
        #     if for_forum:
        #         outstr += linebreak
        #         # force for_html to false to create a copyable forum spoiler div
        #         outstr += ('<div>'
        #                    + self.format(gatherer=gatherer, for_forum=for_forum, for_html=False, vdump=vdump).replace('\n', '<br>')
        #                    + '</div>')
        if for_html:
            outstr += "</div>"

        return outstr