Mynk-96 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/329041 )
Change subject: final commit after all editing ...................................................................... final commit after all editing Change-Id: I0acdd47f18c784a4db7406f9574c5ce5140039d2 --- M BiblioPlus.body.php 1 file changed, 59 insertions(+), 61 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BiblioPlus refs/changes/41/329041/1 diff --git a/BiblioPlus.body.php b/BiblioPlus.body.php index d674ac1..5d47ea4 100644 --- a/BiblioPlus.body.php +++ b/BiblioPlus.body.php @@ -800,17 +800,17 @@ * @return array: Formatted references. */ function renderBiblio( $input, $pdata, $force ) { - $refs = array(); - $list = $this->expandList( $this->splitBiblio( $input ) ); - $parseResult = $this->parseBiblio( $list ); - $entries = $parseResult['entries']; - $pmids = $parseResult['pmids']; - $isbns = $parseResult['isbns']; - $pmentries = array(); - $pmidsToFetch = array(); + $refs = array(); + $list = $this->expandList( $this->splitBiblio( $input ) ); + $parseResult = $this->parseBiblio( $list ); + $entries = $parseResult['entries']; + $pmids = $parseResult['pmids']; + $isbns = $parseResult['isbns']; + $pmentries = array(); + $pmidsToFetch = array(); - // caching features - $cache = wfGetMainCache(); + // caching features + $cache = wfGetMainCache(); foreach ( $pmids as $pmid ) { $cacheKey = wfMemcKey( 'Biblio', $pmid ); $res = $cache->get( $cacheKey ); @@ -845,7 +845,7 @@ $refs = array(); $errors = array(); - // go through all entries and extract data to format reference + //go through all entries and extract data to format reference foreach ( $entries as $ref ) { $key = $this->get( $ref, 'key' ); $annot = $this->parseAnnot( $pdata, $this->get( $ref, 'annot' ) ); @@ -872,63 +872,61 @@ $text = $isbnentries["$isbn"]; } elseif ( !is_null( $wikitext ) ) { // plain wikitext $text = $this->parseFreetext( $pdata, $wikitext ); - } else { - $index = $this->citationIndex( $key, $force ); - if ( $index >= 0 ) { - $refs[] = array( 'index' => $index, + } + $index = $this->citationIndex( $key, $force ); + if ( $index >= 0 ) + $refs[] = array( 'index' => $index, 'key' => $key, 'text' => $text, 'pmid' => $pmid, 'isbn' => $isbn, 'annot' => $annot, 'biburl' => $biburl ); - } - sort( $refs ); - reset( $refs ); - $sortedPmids = array(); - foreach ( $refs as $ref ) { - $pmid = $this->get( $ref, 'pmid' ); - if ( !is_null( $pmid ) ) { - $sortedPmids[] = $pmid; - } - } - $header = ''; - $footer = ''; - if ( count( $errors ) ) { - $header = $this->errorbox( implode( '<br>', $errors ) ); - } - if ( count( $sortedPmids ) > 1 ) { - $footer .= wfMessage( 'biblioplus-medline-abstracts' )->escaped() . ' ' . - $this->htmlInterLink( $this->pubMedUrl( $sortedPmids ), - $this->smallCaps( 'PubMed' ), wfMessage( 'biblioplus-pubmed-abstracts' )->escaped() ) . - ' | ' . $this->htmlInterLink( $this->hubMedUrl( $sortedPmids ), - $this->smallCaps( 'HubMed' ), wfMessage( 'biblioplus-hubmed-abstracts' )->escaped() ); - $footer = $this->noprint( $footer ); - } - $result = array(); - foreach ( $refs as $ref ) { - $index = $this->get( $ref, 'index' ) + 1; - $key = $this->get( $ref, 'key' ); - $annot = $this->get( $ref, 'annot' ); - $text = $this->get( $ref, 'text' ); - $vkey = "<span style=\"color:#aaa\">[$key]</span>"; - if ( isset( $ref['biburl'] ) ) { - $biburl = htmlspecialchars( $ref['biburl'] ); - $vkey = '<a href="' .$biburl .'" class="extiw" style="text-decoration:none" title="' . - wfMessage( 'biblioplus-vkey-title' )->escaped() . '">' . $vkey . '</a>'; - } - $vkey = $this->noprint( $vkey ); - $vkey .= " $annot"; - $result[] = "<li id=\"bibkey_$key\" value=\"$index\"> $text $vkey\n</li>"; - } + } + sort( $refs ); + reset( $refs ); + $sortedPmids = array(); + foreach ( $refs as $ref ) { + $pmid = $this->get( $ref, 'pmid' ); + if ( !is_null( $pmid ) ) { + $sortedPmids[] = $pmid; + } + } + $header = ''; + $footer = ''; + if ( count( $errors ) ) { + $header = $this->errorbox( implode( '<br>', $errors ) ); + } + if ( count( $sortedPmids ) > 1 ) { + $footer .= wfMessage( 'biblioplus-medline-abstracts' )->escaped() . ' ' . + $this->htmlInterLink( $this->pubMedUrl( $sortedPmids ), + $this->smallCaps( 'PubMed' ), wfMessage( 'biblioplus-pubmed-abstracts' )->escaped() ) . + ' | ' . $this->htmlInterLink( $this->hubMedUrl( $sortedPmids ), + $this->smallCaps( 'HubMed' ), wfMessage( 'biblioplus-hubmed-abstracts' )->escaped() ); + $footer = $this->noprint( $footer ); + } + $result = array(); + foreach ( $refs as $ref ) { + $index = $this->get( $ref, 'index' ) + 1; + $key = $this->get( $ref, 'key' ); + $annot = $this->get( $ref, 'annot' ); + $text = $this->get( $ref, 'text' ); + $vkey = "<span style=\"color:#aaa\">[$key]</span>"; + if ( isset( $ref['biburl'] ) ) { + $biburl = htmlspecialchars( $ref['biburl'] ); + $vkey = '<a href="' .$biburl .'" class="extiw" style="text-decoration:none" title="' . + wfMessage( 'biblioplus-vkey-title' )->escaped() . '">' . $vkey . '</a>'; + } + $vkey = $this->noprint( $vkey ); + $vkey .= " $annot"; + $result[] = "<li id=\"bibkey_$key\" value=\"$index\"> $text $vkey\n</li>"; + } - // error_reporting($initial_error_reporting); - global $wgBiblioPlusVersion; - return $header . '<!-- Produced by BiblioPlus version ' . $wgBiblioPlusVersion . ' -->' . - '<ol>' . implode( '', $result ) . '</ol>' . $footer; - } - } - } + // error_reporting($initial_error_reporting); + global $wgBiblioPlusVersion; + return $header . '<!-- Produced by BiblioPlus version ' . $wgBiblioPlusVersion . ' -->' . + '<ol>' . implode( '', $result ) . '</ol>' . $footer; + } /********************** * Debugging functions -- To view, visit https://gerrit.wikimedia.org/r/329041 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0acdd47f18c784a4db7406f9574c5ce5140039d2 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/BiblioPlus Gerrit-Branch: master Gerrit-Owner: Mynk-96 <mayank.hars...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits