/** * Need to create separate WCCitation object for each entry here!! * Enter description here ... * @param unknown_type $text * @param WCArticle $article */ public function render( &$text, WCReferenceStore $referenceStore ) { $references = $referenceStore->getReferences(); $entries = array(); # Render entries in biblio format. foreach( $references as $key => $reference ) { $citation = new WCCitation( $reference ); $citation->style = $this->citationStyle; $citation->citationType = $this->citationType; $citation->citationLength = WCCitationLengthEnum::$long; $entries[ $key ] = $citation->render(); } # Sort bibliography. $this->sortBibliography( $entries ); # Generate bibliography. $bibliography = '<ul class="bibliography"' . $this->styleHTML . '>' . PHP_EOL; foreach ( $entries as $key => $entry ) { $bibliography .= '<li id="' . $references[ $key ]->id . '">' . $entry[0] . '</li>' . PHP_EOL; } $bibliography .= '</ul>'; $text = str_replace( $this->marker, $bibliography, $text ); }
/** * Renders and inserts citations and other material, replacing all markers. * * @global type $wgWCCitationStyles * @param string $text = the current parsed text of the article */ public function render( &$text ) { # Update references, which might have changed due to consolidation, from referenceStore. foreach( $this->citations as $key => $citation ) { $citation->reference = $this->referenceStore->getReference($key); } # Render note marks, free-standing citations, and endnotes. $this->sectionStack[ $this->sectionStackPointer ]->render( $text, $this->citations, (boolean) $this->bibliography ); # Render bibliography. if ( $this->bibliography ) { $this->bibliography->render( $text, $this->referenceStore ); } }