Example #1
0
    def depart_field(self, node):
        '''Simply calls the super method and then
        simply removes the just rendered field if it should be ignored
        '''
        # call super and reset flags (removing field if in ignore list)
        LT.depart_field(self, node)
        
        # process fbib field if something has to be done:
        field_name = self._current_field_name__.lower()
        field_value = self._current_field_body__
        # is a particular field which has to be rendered somewhere else?
        if field_name in ("author", "authors"):
            auth, auth_affil, affil = parse_authors(field_value)
            envdict = self.builder.app.env.metadata[self.builder.app.config.master_doc]
            envdict['authorsWithAffiliations'] = auth_affil
            envdict['affiliations'] = affil
            self.elements.update({'author': auth})
        elif field_name == "revision":
            self.elements.update({'release': field_value})
        elif field_name == "citations" or field_name == 'citation':
            envdict = self.builder.app.env.metadata[self.builder.app.config.master_doc]
            envdict['citations'] = field_value
        elif field_name == "abstract":
            self._abstract_text_reminder__ = field_value

        # remove field from built document if it has to be ignored
        if field_name in self._ignored_fieldnames__ and \
            self._current_field_start__ > -1:
            self.body = self.body[:self._current_field_start__]

        # reset values:
        self._current_field_name__ = self._current_field_body__ =''
        self._current_field_start__ = -1
Example #2
0
    def depart_field(self, node):
        '''Simply calls the super method and then
        simply removes the just rendered field if it should be ignored
        '''
        # call super and reset flags (removing field if in ignore list)
        LT.depart_field(self, node)

        # process fbib field if something has to be done:
        field_name = self._current_field_name__.lower()
        field_value = self._current_field_body__
        # is a particular field which has to be rendered somewhere else?
        if field_name in ("author", "authors"):
            auth, auth_affil, affil = parse_authors(field_value)
            envdict = self.builder.app.env.metadata[
                self.builder.app.config.master_doc]
            envdict['authorsWithAffiliations'] = auth_affil
            envdict['affiliations'] = affil
            self.elements.update({'author': auth})
        elif field_name == "revision":
            self.elements.update({'release': field_value})
        elif field_name == "citations" or field_name == 'citation':
            envdict = self.builder.app.env.metadata[
                self.builder.app.config.master_doc]
            envdict['citations'] = field_value
        elif field_name == "abstract":
            self._abstract_text_reminder__ = field_value

        # remove field from built document if it has to be ignored
        if field_name in self._ignored_fieldnames__ and \
            self._current_field_start__ > -1:
            self.body = self.body[:self._current_field_start__]

        # reset values:
        self._current_field_name__ = self._current_field_body__ = ''
        self._current_field_start__ = -1