<commit_before><?php
/**
 * File containing the ezcDocumentDocbookToOdtFootnoteHandler class.
 *
 * @package Document
 * @version //autogen//
 * @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
 * @license http://ez.no/licenses/new_bsd New BSD License
 */

/**
 * Visit paragraphs.
 *
 * Visit docbook paragraphs and transform them into ODT paragraphs.
 *
 * @package Document
 * @version //autogen//
 */
class ezcDocumentDocbookToOdtFootnoteHandler extends ezcDocumentDocbookToOdtBaseHandler
{
    /**
     * Current footnote count.
     * 
     * @var int
     */
    protected $counter = 0;

    /**
     * Handle a node
     *
     * Handle / transform a given node, and return the result of the
     * conversion.
     *
     * @param ezcDocumentElementVisitorConverter $converter
     * @param DOMElement $node
     * @param mixed $root
     * @return mixed
     */
    public function handle( ezcDocumentElementVisitorConverter $converter, DOMElement $node, $root )
    {
        $label = $node->hasAttribute( 'label' ) ? $node->getAttribute( 'label' ) : ++$this->counter;

        // Adjust counter for inconsequently labeled notes
        if ( ctype_digit( $label ) && $label > $this->counter )
        {
            $this->counter = $label + 1;
        }

        $textNote = $root->ownerDocument->createElementNS(
            ezcDocumentOdt::NS_ODT_TEXT,
            'note'
        );
        $textNote->setAttributeNS(
            ezcDocumentOdt::NS_ODT_TEXT,
            'text:id',
            // OOO format
            'ftn' . $label
        );
        $textNote->setAttributeNS(
            ezcDocumentOdt::NS_ODT_TEXT,
            'text:note-class',
            'footnote'
        );

        $noteCitation = $root->ownerDocument->createElementNS(
            ezcDocumentOdt::NS_ODT_TEXT,
            'citation',
            $label
        );
        $textNote->appendChild( $noteCitation );

        $noteBody = $root->ownerDocument->createElementNS(
            ezcDocumentOdt::NS_ODT_TEXT,
            'note-body'
        );
        $textNote->appendChild( $noteBody );

        $root->appendChild( $textNote );

        $converter->visitChildren( $node, $noteBody );
        return $root;
    }
}

?><commit_msg>- Fixed footnote citation tag name.<commit_after><?php
/**
 * File containing the ezcDocumentDocbookToOdtFootnoteHandler class.
 *
 * @package Document
 * @version //autogen//
 * @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
 * @license http://ez.no/licenses/new_bsd New BSD License
 */

/**
 * Visit paragraphs.
 *
 * Visit docbook paragraphs and transform them into ODT paragraphs.
 *
 * @package Document
 * @version //autogen//
 */
class ezcDocumentDocbookToOdtFootnoteHandler extends ezcDocumentDocbookToOdtBaseHandler
{
    /**
     * Current footnote count.
     * 
     * @var int
     */
    protected $counter = 0;

    /**
     * Handle a node
     *
     * Handle / transform a given node, and return the result of the
     * conversion.
     *
     * @param ezcDocumentElementVisitorConverter $converter
     * @param DOMElement $node
     * @param mixed $root
     * @return mixed
     */
    public function handle( ezcDocumentElementVisitorConverter $converter, DOMElement $node, $root )
    {
        $label = $node->hasAttribute( 'label' ) ? $node->getAttribute( 'label' ) : ++$this->counter;

        // Adjust counter for inconsequently labeled notes
        if ( ctype_digit( $label ) && $label > $this->counter )
        {
            $this->counter = $label + 1;
        }

        $textNote = $root->ownerDocument->createElementNS(
            ezcDocumentOdt::NS_ODT_TEXT,
            'note'
        );
        $textNote->setAttributeNS(
            ezcDocumentOdt::NS_ODT_TEXT,
            'text:id',
            // OOO format
            'ftn' . $label
        );
        $textNote->setAttributeNS(
            ezcDocumentOdt::NS_ODT_TEXT,
            'text:note-class',
            'footnote'
        );

        $noteCitation = $root->ownerDocument->createElementNS(
            ezcDocumentOdt::NS_ODT_TEXT,
            'note-citation',
            $label
        );
        $noteCitation->setAttributeNS(
            ezcDocumentOdt::NS_ODT_TEXT,
            'text:label',
            $label
        );
        $textNote->appendChild( $noteCitation );

        $noteBody = $root->ownerDocument->createElementNS(
            ezcDocumentOdt::NS_ODT_TEXT,
            'note-body'
        );
        $textNote->appendChild( $noteBody );

        $root->appendChild( $textNote );

        $converter->visitChildren( $node, $noteBody );
        return $root;
    }
}

?>
{'fraction_non_alphanumeric': 0.11796189252836652, 'fraction_numerical': 0.004281738385784628, 'mean_word_length': 2.0960901259111995, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 42, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1367975', 'n_tokens_mistral': 1409, 'n_tokens_neox': 1331, 'n_words': 291}