diff --git a/code/models/DocumentationEntity.php b/code/models/DocumentationEntity.php index 95cff3f..94c240c 100755 --- a/code/models/DocumentationEntity.php +++ b/code/models/DocumentationEntity.php @@ -234,8 +234,8 @@ class DocumentationEntity extends ViewableData { } function getRelativeLink($version = false, $lang = false) { - if(!$version) $version = $this->getLatestVersion(); if(!$lang) $lang = 'en'; + if($version == $this->getLatestVersion()) $version = false; return Controller::join_links( DocumentationViewer::get_link_base(), diff --git a/tests/DocumentationPageTest.php b/tests/DocumentationPageTest.php index 830f908..e656edd 100755 --- a/tests/DocumentationPageTest.php +++ b/tests/DocumentationPageTest.php @@ -33,6 +33,9 @@ class DocumentationPageTest extends SapphireTest { // test with version. $entity = DocumentationService::register("versionlinks", BASE_PATH . "/sapphiredocs/tests/docs-v2.4/", '1'); + $entity->addVersion('2', BASE_PATH . "/sapphiredocs/tests/docs-v3.0/"); + $entity->setLatestVersion('2'); + $page = new DocumentationPage(); $page->setRelativePath('test.md'); $page->setEntity($entity); diff --git a/tests/DocumentationParserTest.php b/tests/DocumentationParserTest.php index 36d59f4..31dc735 100755 --- a/tests/DocumentationParserTest.php +++ b/tests/DocumentationParserTest.php @@ -205,7 +205,7 @@ HTML; $result ); } - + function testRetrieveMetaData() { $page = new DocumentationPage(); $page->setRelativePath('MetaDataTest.md');