Last modified: 2013-12-03 16:48:17 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T45313, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 43313 - Crumbs contain (disambiguation) in names which duplicates locations already in breadcrumb path
Crumbs contain (disambiguation) in names which duplicates locations already i...
Status: PATCH_TO_REVIEW
Product: MediaWiki extensions
Classification: Unclassified
GeoCrumbs (Other open bugs)
master
All All
: Normal normal with 4 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
http://en.wikivoyage.org/wiki/Wikivoy...
:
Depends on: 42946
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-21 06:21 UTC by Carl Austin Bennett
Modified: 2013-12-03 16:48 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Carl Austin Bennett 2012-12-21 06:21:33 UTC
Moving this issue from [[voy:Wikivoyage talk:Breadcrumb navigation#Remove parenthesis at display]]...

In [[voy:Hamilton (Ohio)]], the GeoCrumb trail looks like:

North America > United States of America > Midwest (United States of America) > Ohio > Southwest Ohio > Butler County (Ohio) > Hamilton (Ohio)

This is redundantly redundant; the same path could be expressed succinctly as:

North America > United States of America > Midwest > Ohio > Southwest Ohio > Butler County > Hamilton

We already _know_ this is in Ohio because " > Ohio > " is in the trail, so any " (Ohio)" disambiguators in the town and county names can be hidden from the user without losing anything useful.


The breadcrumb trail is generated in GeoCrumbs.class.php in function makeTrail().

Adding code to this function to keep a $nameStack of place names already in the path and then hiding these where they appear in (brackets) elsewhere in the same trail would give:

        public function makeTrail( Title $title ) {
                $breadcrumbs = array();

                // avoid cyclic trails & define emergency break
                $nameStack = array();
                $idStack = array();
                $cnt = 20;

                while ( $title && $cnt-- ) {
                        $link = Linker::link( $title, $title->getSubpageText() );

                        // mark redirects with italics.
                        if ( $title->isRedirect() ) {
                                $link = Html::rawElement( 'i', array(), $link );
                        }
                        array_unshift( $breadcrumbs, $link );

                        if ( in_array( $title->getArticleID(), $idStack ) ) {
                                $breadcrumbs[0] = Html::rawElement( 'strike', array(), $breadcrumbs[0] );
                                break;
                        }

                        $nameStack[] = $title->getText();
                        $idStack[] = $title->getArticleID();
                        $title = $this->getParentRegion( $title );
                }

                // hide (disambiguator) in displayed titles if already in path
                foreach ($nameStack as $bname) {
                        foreach ($breadcrumbs as &$crumb)
                           $crumb = str_replace(" (" . $bname . ")</a>","</a>",$crumb);
                }

                return $breadcrumbs;
        }
Comment 2 Andre Klapper 2013-07-24 10:33:23 UTC
Patch in https://gerrit.wikimedia.org/r/#/c/39728/ needs rework...

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links