Compare commits
33 Commits
2.0.0-beta
...
master
Author | SHA1 | Date |
---|---|---|
Maxime Rainville | 71d7345a3b | |
Guy Sartorelli | 446bb12a88 | |
Guy Marriott | 619d3e9dd7 | |
Guy Marriott | de147fb1a2 | |
Guy Marriott | 5e8b45f200 | |
Mateusz Uzdowski | 8d1523346e | |
Guy Marriott | fc7c658b00 | |
Guy Marriott | a5f7e6f22d | |
Mateusz Uzdowski | f259e97e13 | |
Robbie Averill | eba2d4536c | |
Robbie Averill | 5f7a4f7e23 | |
Robbie Averill | a539c38091 | |
Robbie Averill | 57857836e9 | |
Robbie Averill | 6dd75a2884 | |
Guy Marriott | 171652b338 | |
Robbie Averill | e0c20ddf2b | |
Sam Minnee | 03ec3d287e | |
Ingo Schommer | 8f7ebf42a0 | |
Sam Minnee | f7377865d4 | |
Sam Minnée | 691f5dddb8 | |
Sam Minnee | e28613b1be | |
Petar Simic | e8ab218ffc | |
Robbie Averill | 2600e55047 | |
Sacha Judd | 4b18922674 | |
Dylan Wagstaff | fccde14751 | |
Robbie Averill | d51ece7308 | |
Robbie Averill | b8cfbc204e | |
Sacha Judd | eae8c0e571 | |
Franco Springveldt | 7d22660989 | |
Robbie Averill | 42f57bc67e | |
Robbie Averill | ff15115d5e | |
Sacha Judd | 1784471238 | |
Robbie Averill | fe8b9a37b5 |
25
.travis.yml
25
.travis.yml
|
@ -1,29 +1,26 @@
|
|||
# See https://github.com/silverstripe-labs/silverstripe-travis-support for setup details
|
||||
# See https://github.com/silverstripe/silverstripe-travis-support for setup details
|
||||
|
||||
sudo: false
|
||||
dist: trusty
|
||||
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
|
||||
env:
|
||||
- DB=MYSQL CORE_RELEASE=3
|
||||
- DB=MYSQL CORE_RELEASE=3.7
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: 7.0
|
||||
include:
|
||||
- php: '7.1'
|
||||
env: DB=MYSQL CORE_RELEASE=3.7
|
||||
- php: '7.2'
|
||||
env: DB=MYSQL CORE_RELEASE=3.7
|
||||
- php: '7.3'
|
||||
env: DB=MYSQL CORE_RELEASE=3.7
|
||||
|
||||
before_script:
|
||||
- composer self-update || true
|
||||
- git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support
|
||||
- git clone git://github.com/silverstripe/silverstripe-travis-support.git ~/travis-support
|
||||
- php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss
|
||||
- cd ~/builds/ss
|
||||
- composer install
|
||||
|
||||
script:
|
||||
- vendor/bin/phpunit docsviewer/tests
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
# Documentation Viewer Module
|
||||
|
||||
## ABANDONED
|
||||
|
||||
This package is abandoned. See [silverstripe/doc.silverstripe.org](https://github.com/silverstripe/doc.silverstripe.org) instead.
|
||||
|
||||
[![Build Status](https://secure.travis-ci.org/silverstripe/silverstripe-docsviewer.png?branch=master)](http://travis-ci.org/silverstripe/silverstripe-docsviewer)
|
||||
|
||||
## Maintainer Contact
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
class DocumentationHelper
|
||||
{
|
||||
/**
|
||||
* String helper for cleaning a file name to a readable version.
|
||||
* String helper for cleaning a file name to a readable version.
|
||||
*
|
||||
* @param string $name to convert
|
||||
*
|
||||
|
@ -95,9 +95,9 @@ class DocumentationHelper
|
|||
|
||||
/**
|
||||
* Helper function to normalize paths to unix style directory separators
|
||||
*
|
||||
*
|
||||
* @param string
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function normalizePath($path)
|
||||
|
@ -111,9 +111,9 @@ class DocumentationHelper
|
|||
|
||||
/**
|
||||
* Helper function to make normalized paths relative
|
||||
*
|
||||
*
|
||||
* @param string
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function relativePath($path)
|
||||
|
|
|
@ -90,7 +90,9 @@ class DocumentationManifest
|
|||
$this->registeredEntities = new ArrayList();
|
||||
|
||||
$this->cache = SS_Cache::factory(
|
||||
'DocumentationManifest', 'Core', array(
|
||||
'DocumentationManifest',
|
||||
'Core',
|
||||
array(
|
||||
'automatic_serialization' => true,
|
||||
'lifetime' => null
|
||||
)
|
||||
|
@ -159,7 +161,8 @@ class DocumentationManifest
|
|||
* @var DocumentationEntity $entity
|
||||
*/
|
||||
$entity = Injector::inst()->create(
|
||||
'DocumentationEntity', $key
|
||||
'DocumentationEntity',
|
||||
$key
|
||||
);
|
||||
|
||||
$entity->setPath(DocumentationHelper::normalizePath(Controller::join_links($path, $lang, '/')));
|
||||
|
@ -242,7 +245,9 @@ class DocumentationManifest
|
|||
}
|
||||
|
||||
Config::inst()->update(
|
||||
'DocumentationManifest', 'register_entities', $entities
|
||||
'DocumentationManifest',
|
||||
'register_entities',
|
||||
$entities
|
||||
);
|
||||
|
||||
$this->automaticallyPopulated = true;
|
||||
|
@ -371,7 +376,8 @@ class DocumentationManifest
|
|||
|
||||
foreach ($grouped as $entity) {
|
||||
uasort(
|
||||
$entity, function ($a, $b) {
|
||||
$entity,
|
||||
function ($a, $b) {
|
||||
// ensure parent directories are first
|
||||
$a['filepath'] = str_replace('index.md', '', $a['filepath']);
|
||||
$b['filepath'] = str_replace('index.md', '', $b['filepath']);
|
||||
|
@ -412,13 +418,15 @@ class DocumentationManifest
|
|||
*/
|
||||
protected function stripLinkBase($link)
|
||||
{
|
||||
return ltrim(
|
||||
str_replace(
|
||||
Config::inst()->get('DocumentationViewer', 'link_base'),
|
||||
'',
|
||||
$link
|
||||
), '/'
|
||||
);
|
||||
// Trim baseURL
|
||||
$link = preg_replace('/^' . preg_quote(Director::baseURL(), '/') .'/', '', $link);
|
||||
|
||||
// Trim link_base
|
||||
if ($linkBase = Config::inst()->get('DocumentationViewer', 'link_base')) {
|
||||
$link = preg_replace('/^' . preg_quote($linkBase, '/') .'\/?/', '', $link);
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -452,7 +460,12 @@ class DocumentationManifest
|
|||
{
|
||||
$fromLink = $this->stripLinkBase($from);
|
||||
$toLink = $this->stripLinkBase($to);
|
||||
$this->redirects[$fromLink] = $toLink;
|
||||
|
||||
// If the redirect "from" is already registered with a "to", don't override it. This ensures
|
||||
// that the first version processed is treated as the canonical version.
|
||||
if (!isset($this->redirects[$fromLink])) {
|
||||
$this->redirects[$fromLink] = $toLink;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -461,7 +474,10 @@ class DocumentationManifest
|
|||
public function handleFolder($basename, $path, $depth)
|
||||
{
|
||||
$folder = Injector::inst()->create(
|
||||
'DocumentationFolder', $this->entity, $basename, $path
|
||||
'DocumentationFolder',
|
||||
$this->entity,
|
||||
$basename,
|
||||
$path
|
||||
);
|
||||
|
||||
// Add main folder link
|
||||
|
@ -491,7 +507,9 @@ class DocumentationManifest
|
|||
{
|
||||
$page = Injector::inst()->create(
|
||||
'DocumentationPage',
|
||||
$this->entity, $basename, $path
|
||||
$this->entity,
|
||||
$basename,
|
||||
$path
|
||||
);
|
||||
|
||||
// populate any meta data
|
||||
|
@ -552,6 +570,19 @@ class DocumentationManifest
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a clean domain-relative URL form a docuetn URL
|
||||
*/
|
||||
protected function buildUrl($url)
|
||||
{
|
||||
return Controller::join_links(
|
||||
Director::baseURL(),
|
||||
Config::inst()->get('DocumentationViewer', 'link_base'),
|
||||
$url,
|
||||
'/'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the next page from the given page.
|
||||
*
|
||||
|
@ -572,7 +603,7 @@ class DocumentationManifest
|
|||
if ($grabNext && strpos($page['filepath'], $entityBase) !== false) {
|
||||
return new ArrayData(
|
||||
array(
|
||||
'Link' => Controller::join_links(Config::inst()->get('DocumentationViewer', 'link_base'), $url),
|
||||
'Link' => $this->buildUrl($url),
|
||||
'Title' => $page['title']
|
||||
)
|
||||
);
|
||||
|
@ -583,7 +614,7 @@ class DocumentationManifest
|
|||
} elseif (!$fallback && strpos($page['filepath'], $filepath) !== false) {
|
||||
$fallback = new ArrayData(
|
||||
array(
|
||||
'Link' => Controller::join_links(Config::inst()->get('DocumentationViewer', 'link_base'), $url),
|
||||
'Link' => $this->buildUrl($url),
|
||||
'Title' => $page['title'],
|
||||
'Fallback' => true
|
||||
)
|
||||
|
@ -618,7 +649,7 @@ class DocumentationManifest
|
|||
if ($previousUrl) {
|
||||
return new ArrayData(
|
||||
array(
|
||||
'Link' => Controller::join_links(Config::inst()->get('DocumentationViewer', 'link_base'), $previousUrl),
|
||||
'Link' => $this->buildUrl($previousUrl),
|
||||
'Title' => $previousPage['title']
|
||||
)
|
||||
);
|
||||
|
@ -667,7 +698,6 @@ class DocumentationManifest
|
|||
}
|
||||
|
||||
$output = new ArrayList();
|
||||
$base = Config::inst()->get('DocumentationViewer', 'link_base');
|
||||
$entityPath = $this->normalizeUrl($entityPath);
|
||||
$recordPath = $this->normalizeUrl($recordPath);
|
||||
$recordParts = explode('/', trim($recordPath, '/'));
|
||||
|
@ -703,7 +733,7 @@ class DocumentationManifest
|
|||
$output->push(
|
||||
new ArrayData(
|
||||
array(
|
||||
'Link' => Controller::join_links($base, $url, '/'),
|
||||
'Link' => $this->buildUrl($url),
|
||||
'Title' => $page['title'],
|
||||
'LinkingMode' => $mode,
|
||||
'Summary' => $page['summary'],
|
||||
|
|
|
@ -21,7 +21,7 @@ class DocumentationManifestFileFinder extends SS_FileFinder
|
|||
);
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function acceptDir($basename, $pathname, $depth)
|
||||
{
|
||||
|
|
|
@ -125,7 +125,6 @@ class DocumentationParser
|
|||
$inner = true;
|
||||
}
|
||||
} elseif (preg_match('/^[\ ]{0,3}?[\t](.*)/', $line, $matches)) {
|
||||
|
||||
// inner line of block, or first line of standard markdown code block
|
||||
// regex removes first tab (any following tabs are part of the code).
|
||||
if (!$started) {
|
||||
|
@ -248,7 +247,9 @@ class DocumentationParser
|
|||
if (substr($url, 0, 1) == '/') {
|
||||
$relativeUrl = DocumentationHelper::normalizePath(
|
||||
str_replace(
|
||||
BASE_PATH, '', Controller::join_links(
|
||||
BASE_PATH,
|
||||
'',
|
||||
Controller::join_links(
|
||||
$page->getEntity()->getPath(),
|
||||
$url
|
||||
)
|
||||
|
@ -326,11 +327,11 @@ class DocumentationParser
|
|||
$html_format = '<a href="http://api.silverstripe.org/search/lookup/?q=%s&version=%s&module=%s">%s</a>';
|
||||
|
||||
// parse api links without backticks into html
|
||||
foreach($regexs as $type => $regex) {
|
||||
foreach ($regexs as $type => $regex) {
|
||||
preg_match_all($regex, $markdown, $links);
|
||||
if($links) {
|
||||
foreach($links[0] as $i => $match) {
|
||||
if($type === 'no_title') {
|
||||
if ($links) {
|
||||
foreach ($links[0] as $i => $match) {
|
||||
if ($type === 'no_title') {
|
||||
$title = $links[1][$i];
|
||||
$link = $links[1][$i];
|
||||
// change backticked links to avoid being parsed in the same way as non-backticked links
|
||||
|
@ -349,8 +350,8 @@ class DocumentationParser
|
|||
|
||||
// recover backticked links with no titles
|
||||
preg_match_all('#XYZ(.*)?XYZ#', $markdown, $links);
|
||||
if($links) {
|
||||
foreach($links[0] as $i => $match) {
|
||||
if ($links) {
|
||||
foreach ($links[0] as $i => $match) {
|
||||
$link = $links[1][$i];
|
||||
$markdown = str_replace($match, '`[api:'.$link.']`', $markdown);
|
||||
}
|
||||
|
@ -358,8 +359,8 @@ class DocumentationParser
|
|||
|
||||
// recover backticked links with titles
|
||||
preg_match_all('#XX(.*)?YY(.*)?ZZ#', $markdown, $links);
|
||||
if($links) {
|
||||
foreach($links[0] as $i => $match) {
|
||||
if ($links) {
|
||||
foreach ($links[0] as $i => $match) {
|
||||
$title = $links[1][$i];
|
||||
$link = $links[2][$i];
|
||||
$markdown = str_replace($match, '`['.$title.'](api:'.$link.')`', $markdown);
|
||||
|
@ -367,7 +368,6 @@ class DocumentationParser
|
|||
}
|
||||
|
||||
return $markdown;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -488,7 +488,7 @@ class DocumentationParser
|
|||
$fileBaseLink,
|
||||
$url
|
||||
);
|
||||
} else if (preg_match('/^#/', $url)) {
|
||||
} elseif (preg_match('/^#/', $url)) {
|
||||
// for relative links begining with a hash use the current page link
|
||||
$relativeUrl = Controller::join_links($baselink, $page->getRelativeLink(), $url);
|
||||
} else {
|
||||
|
@ -521,5 +521,4 @@ class DocumentationParser
|
|||
|
||||
return $md;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* A mapping store of given permalinks to the full documentation path or useful
|
||||
* A mapping store of given permalinks to the full documentation path or useful
|
||||
* for customizing the shortcut URLs used in the viewer.
|
||||
*
|
||||
* Redirects the user from example.com/foo to example.com/en/module/foo
|
||||
|
@ -25,7 +25,7 @@ class DocumentationPermalinks
|
|||
* ));
|
||||
* </code>
|
||||
*
|
||||
* Do not need to include the language or the version current as it
|
||||
* Do not need to include the language or the version current as it
|
||||
* will add it based off the language or version in the session
|
||||
*
|
||||
* @param array
|
||||
|
|
|
@ -8,20 +8,20 @@ set_include_path(
|
|||
require_once 'Zend/Search/Lucene.php';
|
||||
|
||||
/**
|
||||
* Documentation Search powered by Lucene. You will need Zend_Lucene installed
|
||||
* Documentation Search powered by Lucene. You will need Zend_Lucene installed
|
||||
* on your path.
|
||||
*
|
||||
* To rebuild the indexes run the {@link RebuildLuceneDocsIndex} task. You may
|
||||
* To rebuild the indexes run the {@link RebuildLuceneDocsIndex} task. You may
|
||||
* wish to setup a cron job to remake the indexes on a regular basis.
|
||||
*
|
||||
* This class has the ability to generate an OpenSearch RSS formatted feeds
|
||||
* This class has the ability to generate an OpenSearch RSS formatted feeds
|
||||
* simply by using the URL:
|
||||
*
|
||||
* <code>
|
||||
* yoursite.com/search/?q=Foo&format=rss. // Format can either be specified as rss or left off.
|
||||
* </code>
|
||||
*
|
||||
* To get a specific amount of results you can also use the modifiers start and
|
||||
* To get a specific amount of results you can also use the modifiers start and
|
||||
* limit:
|
||||
*
|
||||
* <code>
|
||||
|
@ -127,7 +127,7 @@ class DocumentationSearch
|
|||
* Folder name for indexes (in the temp folder).
|
||||
*
|
||||
* @config
|
||||
* @var string
|
||||
* @var string
|
||||
*/
|
||||
private static $index_location;
|
||||
|
||||
|
@ -363,7 +363,7 @@ class DocumentationSearch
|
|||
}
|
||||
|
||||
/**
|
||||
* OpenSearch MetaData fields. For a list of fields consult
|
||||
* OpenSearch MetaData fields. For a list of fields consult
|
||||
* {@link self::get_meta_data()}
|
||||
*
|
||||
* @param array
|
||||
|
@ -406,7 +406,7 @@ class DocumentationSearch
|
|||
}
|
||||
|
||||
/**
|
||||
* Renders the search results into a template. Either the search results
|
||||
* Renders the search results into a template. Either the search results
|
||||
* template or the Atom feed.
|
||||
*/
|
||||
public function renderResults()
|
||||
|
@ -428,7 +428,8 @@ class DocumentationSearch
|
|||
$title = ($title = $this->getTitle()) ? ' - '. $title : "";
|
||||
|
||||
$link = Controller::join_links(
|
||||
$this->outputController->Link(), 'DocumentationOpenSearchController/description/'
|
||||
$this->outputController->Link(),
|
||||
'DocumentationOpenSearchController/description/'
|
||||
);
|
||||
|
||||
$data->setField('Title', $data->Title . $title);
|
||||
|
|
|
@ -62,7 +62,7 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
/**
|
||||
* @config
|
||||
*
|
||||
* @var string same as the routing pattern set through Director::addRules().
|
||||
* @var string Site-relative root URL of documentation. Same as the routing pattern set through Director::addRules().
|
||||
*/
|
||||
private static $link_base = 'dev/docs/';
|
||||
|
||||
|
@ -110,7 +110,7 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
)
|
||||
);
|
||||
Requirements::combine_files(
|
||||
'docs.css',
|
||||
'docs.css',
|
||||
array(
|
||||
DOCSVIEWER_DIR .'/css/highlight.css',
|
||||
DOCSVIEWER_DIR .'/css/normalize.css',
|
||||
|
@ -204,7 +204,8 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
// Strip off the base url
|
||||
//
|
||||
$base = ltrim(
|
||||
Config::inst()->get('DocumentationViewer', 'link_base'), '/'
|
||||
Config::inst()->get('DocumentationViewer', 'link_base'),
|
||||
'/'
|
||||
);
|
||||
|
||||
if ($base && strpos($url, $base) !== false) {
|
||||
|
@ -212,7 +213,6 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
ltrim($url, '/'),
|
||||
strlen($base)
|
||||
);
|
||||
} else {
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -275,6 +275,11 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
// return $redirect->redirect($cleaned, 302);
|
||||
// }
|
||||
if ($record = $this->getManifest()->getPage($url)) {
|
||||
// In SS 3 offsetSet() isn't implemented for some reason... this is a workaround
|
||||
$routeParams = $this->request->routeParams();
|
||||
$routeParams['Lang'] = $lang;
|
||||
$this->request->setRouteParams($routeParams);
|
||||
|
||||
$this->record = $record;
|
||||
$this->init();
|
||||
|
||||
|
@ -393,7 +398,8 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
|
||||
// add children
|
||||
$children = $this->getManifest()->getChildrenFor(
|
||||
$entity->getPath(), ($record) ? $record->getPath() : $entity->getPath()
|
||||
$entity->getPath(),
|
||||
($record) ? $record->getPath() : $entity->getPath()
|
||||
);
|
||||
} else {
|
||||
if ($current && $current->getKey() == $entity->getKey()) {
|
||||
|
@ -438,7 +444,7 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
public function replaceChildrenCalls($html)
|
||||
{
|
||||
$codes = new ShortcodeParser();
|
||||
$codes->register('CHILDREN', array($this, 'includeChildren'));
|
||||
$codes->register('CHILDREN', array($this, 'includeChildren'));
|
||||
|
||||
return $codes->parse($html);
|
||||
}
|
||||
|
@ -565,6 +571,7 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
public function Link($action = '')
|
||||
{
|
||||
$link = Controller::join_links(
|
||||
Director::baseURL(),
|
||||
Config::inst()->get('DocumentationViewer', 'link_base'),
|
||||
$this->getLanguage(),
|
||||
$action,
|
||||
|
@ -684,17 +691,19 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
/**
|
||||
* Returns an edit link to the current page (optional).
|
||||
*
|
||||
* @return string
|
||||
* @return string|false
|
||||
*/
|
||||
public function getEditLink()
|
||||
{
|
||||
$editLink = false;
|
||||
$entity = null;
|
||||
|
||||
$page = $this->getPage();
|
||||
|
||||
if ($page) {
|
||||
$entity = $page->getEntity();
|
||||
|
||||
if ($entity && isset(self::$edit_links[strtolower($entity->title)])) {
|
||||
|
||||
// build the edit link, using the version defined
|
||||
$url = self::$edit_links[strtolower($entity->title)];
|
||||
$version = $entity->getVersion();
|
||||
|
@ -704,13 +713,13 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
}
|
||||
|
||||
|
||||
if ($version == 'trunk' && (isset($url['options']['rewritetrunktomaster']))) {
|
||||
if ($version === 'trunk' && (isset($url['options']['rewritetrunktomaster']))) {
|
||||
if ($url['options']['rewritetrunktomaster']) {
|
||||
$version = "master";
|
||||
}
|
||||
}
|
||||
|
||||
return str_replace(
|
||||
$editLink = str_replace(
|
||||
array('%entity%', '%lang%', '%version%', '%path%'),
|
||||
array(
|
||||
$entity->title,
|
||||
|
@ -723,7 +732,9 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
$this->extend('updateDocumentationEditLink', $editLink, $entity);
|
||||
|
||||
return $editLink;
|
||||
}
|
||||
|
||||
|
||||
|
@ -738,7 +749,8 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
{
|
||||
return ($this->record)
|
||||
? $this->getManifest()->getNextPage(
|
||||
$this->record->getPath(), $this->getEntity()->getPath()
|
||||
$this->record->getPath(),
|
||||
$this->getEntity()->getPath()
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
@ -753,7 +765,8 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
{
|
||||
return ($this->record)
|
||||
? $this->getManifest()->getPreviousPage(
|
||||
$this->record->getPath(), $this->getEntity()->getPath()
|
||||
$this->record->getPath(),
|
||||
$this->getEntity()->getPath()
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
@ -783,7 +796,10 @@ class DocumentationViewer extends Controller implements PermissionProvider
|
|||
*/
|
||||
public function getDocumentationBaseHref()
|
||||
{
|
||||
return Config::inst()->get('DocumentationViewer', 'link_base');
|
||||
return Controller::join_links(
|
||||
Director::baseURL(),
|
||||
Config::inst()->get('DocumentationViewer', 'link_base')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,7 +34,8 @@ class DocumentationAdvancedSearchForm extends Form
|
|||
CheckboxSetField::create(
|
||||
'Versions',
|
||||
_t('DocumentationViewer.VERSIONS', 'Versions'),
|
||||
$versions, $searchedVersions
|
||||
$versions,
|
||||
$searchedVersions
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -137,12 +137,14 @@ class DocumentationEntity extends ViewableData
|
|||
{
|
||||
if ($this->getIsDefaultEntity()) {
|
||||
$base = Controller::join_links(
|
||||
Director::baseURL(),
|
||||
Config::inst()->get('DocumentationViewer', 'link_base'),
|
||||
$this->getLanguage(),
|
||||
'/'
|
||||
);
|
||||
} else {
|
||||
$base = Controller::join_links(
|
||||
Director::baseURL(),
|
||||
Config::inst()->get('DocumentationViewer', 'link_base'),
|
||||
$this->getLanguage(),
|
||||
$this->getKey(),
|
||||
|
@ -150,8 +152,6 @@ class DocumentationEntity extends ViewableData
|
|||
);
|
||||
}
|
||||
|
||||
$base = ltrim(str_replace('//', '/', $base), '/');
|
||||
|
||||
if ($short && $this->stable) {
|
||||
return $base;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* A specific documentation folder within a {@link DocumentationEntity}.
|
||||
* A specific documentation folder within a {@link DocumentationEntity}.
|
||||
*
|
||||
* Maps to a folder on the file system.
|
||||
* Maps to a folder on the file system.
|
||||
*
|
||||
* @package docsviewer
|
||||
* @subpackage model
|
||||
|
|
|
@ -87,7 +87,8 @@ class DocumentationPage extends ViewableData
|
|||
);
|
||||
|
||||
$titleParts = array_filter(
|
||||
$titleParts, function ($val) {
|
||||
$titleParts,
|
||||
function ($val) {
|
||||
if ($val) {
|
||||
return $val;
|
||||
}
|
||||
|
@ -261,12 +262,9 @@ class DocumentationPage extends ViewableData
|
|||
*/
|
||||
public function Link($short = false)
|
||||
{
|
||||
return ltrim(
|
||||
Controller::join_links(
|
||||
$this->entity->Link($short),
|
||||
$this->getRelativeLink()
|
||||
),
|
||||
'/'
|
||||
return Controller::join_links(
|
||||
$this->entity->Link($short),
|
||||
$this->getRelativeLink()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,16 +10,16 @@ class CheckDocsSourcesTask extends BuildTask
|
|||
|
||||
protected $description = "Check validity of all docs source files registered";
|
||||
|
||||
public function start()
|
||||
public function start()
|
||||
{
|
||||
if(!Director::is_cli()) {
|
||||
if (!Director::is_cli()) {
|
||||
echo "<ul>";
|
||||
}
|
||||
}
|
||||
|
||||
public function end()
|
||||
public function end()
|
||||
{
|
||||
if(Director::is_cli()) {
|
||||
if (Director::is_cli()) {
|
||||
echo "\nTotal errors: {$this->errors}\n";
|
||||
} else {
|
||||
echo "</ul>";
|
||||
|
@ -27,10 +27,10 @@ class CheckDocsSourcesTask extends BuildTask
|
|||
}
|
||||
}
|
||||
|
||||
public function showError($error)
|
||||
public function showError($error)
|
||||
{
|
||||
$this->errors++;
|
||||
if(Director::is_cli()) {
|
||||
if (Director::is_cli()) {
|
||||
echo "\n$error";
|
||||
} else {
|
||||
echo "<li>" . Convert::raw2xml($error) . "</li>";
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Rebuilds the search indexes for the documentation pages.
|
||||
* Rebuilds the search indexes for the documentation pages.
|
||||
*
|
||||
* For the hourly cron rebuild use RebuildLuceneDocusIndex_Hourly
|
||||
* For the hourly cron rebuild use RebuildLuceneDocusIndex_Hourly
|
||||
*
|
||||
* @package docsviewer
|
||||
* @subpackage tasks
|
||||
|
@ -87,25 +87,29 @@ class RebuildLuceneDocsIndex extends BuildTask
|
|||
|
||||
$doc->addField(
|
||||
Zend_Search_Lucene_Field::Keyword(
|
||||
'Version', $page->getEntity()->getVersion()
|
||||
'Version',
|
||||
$page->getEntity()->getVersion()
|
||||
)
|
||||
);
|
||||
|
||||
$doc->addField(
|
||||
Zend_Search_Lucene_Field::Keyword(
|
||||
'Language', $page->getEntity()->getLanguage()
|
||||
'Language',
|
||||
$page->getEntity()->getLanguage()
|
||||
)
|
||||
);
|
||||
|
||||
$doc->addField(
|
||||
Zend_Search_Lucene_Field::Keyword(
|
||||
'Entity', $page->getEntity()
|
||||
'Entity',
|
||||
$page->getEntity()
|
||||
)
|
||||
);
|
||||
|
||||
$doc->addField(
|
||||
Zend_Search_Lucene_Field::Keyword(
|
||||
'Link', $page->Link()
|
||||
'Link',
|
||||
$page->Link()
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -15,11 +15,17 @@
|
|||
},
|
||||
"require": {
|
||||
"silverstripe/framework": "~3.1",
|
||||
"erusev/parsedown-extra": "0.2.2",
|
||||
"erusev/parsedown": "~1.1.0",
|
||||
"erusev/parsedown-extra": "~0.2",
|
||||
"erusev/parsedown": "~1.1",
|
||||
"mnapoli/front-yaml": "^1.5"
|
||||
},
|
||||
"suggest": {
|
||||
"silverstripe/staticpublisher": "Allows publishing documentation as HTML"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.x-dev"
|
||||
}
|
||||
},
|
||||
"abandoned": true
|
||||
}
|
||||
|
|
|
@ -298,14 +298,6 @@ html {
|
|||
padding: 0 30px;
|
||||
}
|
||||
|
||||
#footer p {
|
||||
color: #798D85;
|
||||
}
|
||||
|
||||
#footer p a {
|
||||
color: #798D85;
|
||||
}
|
||||
|
||||
/*! Pagination */
|
||||
#page-numbers span,
|
||||
#page-numbers a {
|
||||
|
@ -479,19 +471,16 @@ html {
|
|||
.info,
|
||||
.notice,
|
||||
.note,
|
||||
.warningBox {
|
||||
.warningBox,
|
||||
form .message.good {
|
||||
background: #e6f5fc;
|
||||
}
|
||||
|
||||
.warning,
|
||||
.alert {
|
||||
background: #ffdcdb;
|
||||
color: #586667;
|
||||
}
|
||||
|
||||
.warning code,
|
||||
.alert code {
|
||||
color: #666;
|
||||
.alert,
|
||||
form .message.error {
|
||||
background: #f2dede;
|
||||
color: #a94442;
|
||||
}
|
||||
|
||||
.hint {
|
||||
|
@ -629,7 +618,7 @@ html {
|
|||
}
|
||||
|
||||
.next-prev a {
|
||||
color: #798D85;
|
||||
color: #586667;
|
||||
}
|
||||
|
||||
.next-prev p {
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
}
|
||||
};
|
||||
|
||||
$(window).load(updateTables);
|
||||
$(window).on('load', updateTables);
|
||||
$(window).on(
|
||||
"redraw",function() {
|
||||
switched = false;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class DocumentationEntityTest extends SapphireTest
|
||||
{
|
||||
public function dataCompare()
|
||||
public function dataCompare()
|
||||
{
|
||||
return array(
|
||||
array('3', '3.0', 1),
|
||||
|
@ -20,7 +20,7 @@ class DocumentationEntityTest extends SapphireTest
|
|||
* @param string $right
|
||||
* @param int $result
|
||||
*/
|
||||
public function testCompare($left, $right, $result)
|
||||
public function testCompare($left, $right, $result)
|
||||
{
|
||||
$leftVersion = new DocumentationEntity('Framework');
|
||||
$leftVersion->setVersion($left);
|
||||
|
|
|
@ -16,18 +16,24 @@ class DocumentationManifestTests extends SapphireTest
|
|||
|
||||
// explicitly use dev/docs. Custom paths should be tested separately
|
||||
Config::inst()->update(
|
||||
'DocumentationViewer', 'link_base', 'dev/docs'
|
||||
'DocumentationViewer',
|
||||
'link_base',
|
||||
'dev/docs'
|
||||
);
|
||||
|
||||
// disable automatic module registration so modules don't interfere.
|
||||
Config::inst()->update(
|
||||
'DocumentationManifest', 'automatic_registration', false
|
||||
'DocumentationManifest',
|
||||
'automatic_registration',
|
||||
false
|
||||
);
|
||||
|
||||
Config::inst()->remove('DocumentationManifest', 'register_entities');
|
||||
|
||||
Config::inst()->update(
|
||||
'DocumentationManifest', 'register_entities', array(
|
||||
'DocumentationManifest',
|
||||
'register_entities',
|
||||
array(
|
||||
array(
|
||||
'Path' => DOCSVIEWER_PATH . "/tests/docs/",
|
||||
'Title' => 'Doc Test',
|
||||
|
@ -189,7 +195,8 @@ class DocumentationManifestTests extends SapphireTest
|
|||
);
|
||||
|
||||
$this->assertDOSContains(
|
||||
$expected, $this->manifest->getChildrenFor(
|
||||
$expected,
|
||||
$this->manifest->getChildrenFor(
|
||||
DOCSVIEWER_PATH . '/tests/docs/en/'
|
||||
)
|
||||
);
|
||||
|
|
|
@ -42,7 +42,8 @@ class DocumentationPageTest extends SapphireTest
|
|||
|
||||
// single layer
|
||||
$this->assertEquals(
|
||||
'dev/docs/en/doctest/2.4/test/', $page->Link(),
|
||||
Director::baseURL() . 'dev/docs/en/doctest/2.4/test/',
|
||||
$page->Link(),
|
||||
'The page link should have no extension and have a language'
|
||||
);
|
||||
|
||||
|
@ -52,7 +53,7 @@ class DocumentationPageTest extends SapphireTest
|
|||
DOCSVIEWER_PATH . '/tests/docs/en/sort/'
|
||||
);
|
||||
|
||||
$this->assertEquals('dev/docs/en/doctest/2.4/sort/', $page->Link());
|
||||
$this->assertEquals(Director::baseURL() . 'dev/docs/en/doctest/2.4/sort/', $page->Link());
|
||||
|
||||
$page = new DocumentationFolder(
|
||||
$this->entity,
|
||||
|
@ -60,7 +61,7 @@ class DocumentationPageTest extends SapphireTest
|
|||
DOCSVIEWER_PATH . '/tests/docs/en/sort/1-basic.md'
|
||||
);
|
||||
|
||||
$this->assertEquals('dev/docs/en/doctest/2.4/sort/basic/', $page->Link());
|
||||
$this->assertEquals(Director::baseURL() . 'dev/docs/en/doctest/2.4/sort/basic/', $page->Link());
|
||||
}
|
||||
|
||||
public function testGetBreadcrumbTitle()
|
||||
|
|
|
@ -23,7 +23,9 @@ class DocumentationParserTest extends SapphireTest
|
|||
|
||||
// explicitly use dev/docs. Custom paths should be tested separately
|
||||
Config::inst()->update(
|
||||
'DocumentationViewer', 'link_base', 'dev/docs/'
|
||||
'DocumentationViewer',
|
||||
'link_base',
|
||||
'dev/docs/'
|
||||
);
|
||||
|
||||
$this->entity = new DocumentationEntity('DocumentationParserTest');
|
||||
|
@ -172,7 +174,7 @@ HTML;
|
|||
);
|
||||
|
||||
$this->assertContains(
|
||||
'[link: subfolder index](dev/docs/en/documentationparsertest/2.4/subfolder/)',
|
||||
'[link: subfolder index](' . Director::baseURL() . 'dev/docs/en/documentationparsertest/2.4/subfolder/)',
|
||||
$result
|
||||
);
|
||||
|
||||
|
@ -184,11 +186,11 @@ HTML;
|
|||
);
|
||||
|
||||
$this->assertContains(
|
||||
'[link: subfolder index](dev/docs/en/documentationparsertest/2.4/subfolder/)',
|
||||
'[link: subfolder index](' . Director::baseURL() . 'dev/docs/en/documentationparsertest/2.4/subfolder/)',
|
||||
$result
|
||||
);
|
||||
$this->assertContains(
|
||||
'[link: subfolder page](dev/docs/en/documentationparsertest/2.4/subfolder/subpage/)',
|
||||
'[link: subfolder page](' . Director::baseURL() . 'dev/docs/en/documentationparsertest/2.4/subfolder/subpage/)',
|
||||
$result
|
||||
);
|
||||
$this->assertContains(
|
||||
|
@ -197,12 +199,12 @@ HTML;
|
|||
);
|
||||
|
||||
$this->assertContains(
|
||||
'[link: with anchor](dev/docs/en/documentationparsertest/2.4/test/#anchor)',
|
||||
'[link: with anchor](' . Director::baseURL() . 'dev/docs/en/documentationparsertest/2.4/test/#anchor)',
|
||||
$result
|
||||
);
|
||||
|
||||
$this->assertContains(
|
||||
'[link: relative anchor](dev/docs/en/documentationparsertest/2.4/test/#relative-anchor)',
|
||||
'[link: relative anchor](' . Director::baseURL() . 'dev/docs/en/documentationparsertest/2.4/test/#relative-anchor)',
|
||||
$result
|
||||
);
|
||||
|
||||
|
@ -213,33 +215,33 @@ HTML;
|
|||
|
||||
// @todo this should redirect to /subpage/
|
||||
$this->assertContains(
|
||||
'[link: relative](dev/docs/en/documentationparsertest/2.4/subfolder/subpage.md/)',
|
||||
'[link: relative](' . Director::baseURL() . 'dev/docs/en/documentationparsertest/2.4/subfolder/subpage.md/)',
|
||||
$result
|
||||
);
|
||||
|
||||
$this->assertContains(
|
||||
'[link: absolute index](dev/docs/en/documentationparsertest/2.4/)',
|
||||
'[link: absolute index](' . Director::baseURL() . 'dev/docs/en/documentationparsertest/2.4/)',
|
||||
$result
|
||||
);
|
||||
|
||||
// @todo this should redirect to /
|
||||
$this->assertContains(
|
||||
'[link: absolute index with name](dev/docs/en/documentationparsertest/2.4/index/)',
|
||||
'[link: absolute index with name](' . Director::baseURL() . 'dev/docs/en/documentationparsertest/2.4/index/)',
|
||||
$result
|
||||
);
|
||||
|
||||
$this->assertContains(
|
||||
'[link: relative index](dev/docs/en/documentationparsertest/2.4/)',
|
||||
'[link: relative index](' . Director::baseURL() . 'dev/docs/en/documentationparsertest/2.4/)',
|
||||
$result
|
||||
);
|
||||
|
||||
$this->assertContains(
|
||||
'[link: relative parent page](dev/docs/en/documentationparsertest/2.4/test/)',
|
||||
'[link: relative parent page](' . Director::baseURL() . 'dev/docs/en/documentationparsertest/2.4/test/)',
|
||||
$result
|
||||
);
|
||||
|
||||
$this->assertContains(
|
||||
'[link: absolute parent page](dev/docs/en/documentationparsertest/2.4/test/)',
|
||||
'[link: absolute parent page](' . Director::baseURL() . 'dev/docs/en/documentationparsertest/2.4/test/)',
|
||||
$result
|
||||
);
|
||||
|
||||
|
@ -249,27 +251,27 @@ HTML;
|
|||
);
|
||||
|
||||
$this->assertContains(
|
||||
'[link: absolute index](dev/docs/en/documentationparsertest/2.4/)',
|
||||
'[link: absolute index](' . Director::baseURL() . 'dev/docs/en/documentationparsertest/2.4/)',
|
||||
$result
|
||||
);
|
||||
|
||||
$this->assertContains(
|
||||
'[link: relative index](dev/docs/en/documentationparsertest/2.4/subfolder/)',
|
||||
'[link: relative index](' . Director::baseURL() . 'dev/docs/en/documentationparsertest/2.4/subfolder/)',
|
||||
$result
|
||||
);
|
||||
|
||||
$this->assertContains(
|
||||
'[link: relative parent page](dev/docs/en/documentationparsertest/2.4/subfolder/subpage/)',
|
||||
'[link: relative parent page](' . Director::baseURL() . 'dev/docs/en/documentationparsertest/2.4/subfolder/subpage/)',
|
||||
$result
|
||||
);
|
||||
|
||||
$this->assertContains(
|
||||
'[link: relative grandparent page](dev/docs/en/documentationparsertest/2.4/test/)',
|
||||
'[link: relative grandparent page](' . Director::baseURL() . 'dev/docs/en/documentationparsertest/2.4/test/)',
|
||||
$result
|
||||
);
|
||||
|
||||
$this->assertContains(
|
||||
'[link: absolute page](dev/docs/en/documentationparsertest/2.4/test/)',
|
||||
'[link: absolute page](' . Director::baseURL() . 'dev/docs/en/documentationparsertest/2.4/test/)',
|
||||
$result
|
||||
);
|
||||
}
|
||||
|
@ -294,7 +296,9 @@ HTML;
|
|||
);
|
||||
|
||||
$expected = Controller::join_links(
|
||||
Director::absoluteBaseURL(), DOCSVIEWER_DIR, '/tests/docs/en/subfolder/_images/image.png'
|
||||
Director::absoluteBaseURL(),
|
||||
DOCSVIEWER_DIR,
|
||||
'/tests/docs/en/subfolder/_images/image.png'
|
||||
);
|
||||
|
||||
$this->assertContains(
|
||||
|
@ -304,15 +308,20 @@ HTML;
|
|||
|
||||
$this->assertContains(
|
||||
sprintf(
|
||||
'[parent image link](%s)', Controller::join_links(
|
||||
Director::absoluteBaseURL(), DOCSVIEWER_DIR, '/tests/docs/en/_images/image.png'
|
||||
'[parent image link](%s)',
|
||||
Controller::join_links(
|
||||
Director::absoluteBaseURL(),
|
||||
DOCSVIEWER_DIR,
|
||||
'/tests/docs/en/_images/image.png'
|
||||
)
|
||||
),
|
||||
$result
|
||||
);
|
||||
|
||||
$expected = Controller::join_links(
|
||||
Director::absoluteBaseURL(), DOCSVIEWER_DIR, '/tests/docs/en/_images/image.png'
|
||||
Director::absoluteBaseURL(),
|
||||
DOCSVIEWER_DIR,
|
||||
'/tests/docs/en/_images/image.png'
|
||||
);
|
||||
|
||||
$this->assertContains(
|
||||
|
@ -350,11 +359,10 @@ HTML;
|
|||
array('[Title](api:DataObject::populateDefaults())',sprintf($html_format, 'DataObject::populateDefaults()', 'Title'))
|
||||
);
|
||||
|
||||
foreach($test_cases as $test_case) {
|
||||
foreach ($test_cases as $test_case) {
|
||||
$expected_html = $test_case[1];
|
||||
$this->assertContains($expected_html, $parsed_page);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function testHeadlineAnchors()
|
||||
|
|
|
@ -13,20 +13,26 @@ class DocumentationSearchTest extends FunctionalTest
|
|||
|
||||
Config::nest();
|
||||
|
||||
// explicitly use dev/docs. Custom paths should be tested separately
|
||||
// explicitly use dev/docs. Custom paths should be tested separately
|
||||
Config::inst()->update(
|
||||
'DocumentationViewer', 'link_base', 'dev/docs'
|
||||
'DocumentationViewer',
|
||||
'link_base',
|
||||
'dev/docs'
|
||||
);
|
||||
|
||||
// disable automatic module registration so modules don't interfere.
|
||||
Config::inst()->update(
|
||||
'DocumentationManifest', 'automatic_registration', false
|
||||
'DocumentationManifest',
|
||||
'automatic_registration',
|
||||
false
|
||||
);
|
||||
|
||||
Config::inst()->remove('DocumentationManifest', 'register_entities');
|
||||
Config::inst()->update('DocumentationSearch', 'enabled', true);
|
||||
Config::inst()->update(
|
||||
'DocumentationManifest', 'register_entities', array(
|
||||
'DocumentationManifest',
|
||||
'register_entities',
|
||||
array(
|
||||
array(
|
||||
'Path' => DOCSVIEWER_PATH . "/tests/docs-search/",
|
||||
'Title' => 'Docs Search Test', )
|
||||
|
@ -54,8 +60,8 @@ class DocumentationSearchTest extends FunctionalTest
|
|||
$response = $c->handleRequest(new SS_HTTPRequest('GET', 'description/'), DataModel::inst());
|
||||
// $this->assertEquals(404, $response->getStatusCode());
|
||||
|
||||
// test we get a response to the description. The meta data test will
|
||||
// check that the individual fields are valid but we should check urls
|
||||
// test we get a response to the description. The meta data test will
|
||||
// check that the individual fields are valid but we should check urls
|
||||
// are there
|
||||
|
||||
Config::inst()->update('DocumentationSearch', 'enabled', true);
|
||||
|
|
|
@ -22,18 +22,24 @@ class DocumentationViewerTest extends FunctionalTest
|
|||
|
||||
// explicitly use dev/docs. Custom paths should be tested separately
|
||||
Config::inst()->update(
|
||||
'DocumentationViewer', 'link_base', 'dev/docs/'
|
||||
'DocumentationViewer',
|
||||
'link_base',
|
||||
'dev/docs/'
|
||||
);
|
||||
|
||||
// disable automatic module registration so modules don't interfere.
|
||||
Config::inst()->update(
|
||||
'DocumentationManifest', 'automatic_registration', false
|
||||
'DocumentationManifest',
|
||||
'automatic_registration',
|
||||
false
|
||||
);
|
||||
|
||||
Config::inst()->remove('DocumentationManifest', 'register_entities');
|
||||
|
||||
Config::inst()->update(
|
||||
'DocumentationManifest', 'register_entities', array(
|
||||
'DocumentationManifest',
|
||||
'register_entities',
|
||||
array(
|
||||
array(
|
||||
'Path' => DOCSVIEWER_PATH . "/tests/docs/",
|
||||
'Title' => 'Doc Test',
|
||||
|
@ -151,9 +157,9 @@ class DocumentationViewerTest extends FunctionalTest
|
|||
$response = $v->handleRequest(new SS_HTTPRequest('GET', 'en/doc_test/2.3/'), DataModel::inst());
|
||||
|
||||
$expected = array(
|
||||
'dev/docs/en/doc_test/2.3/sort/' => 'Sort',
|
||||
'dev/docs/en/doc_test/2.3/subfolder/' => 'Subfolder',
|
||||
'dev/docs/en/doc_test/2.3/test/' => 'Test'
|
||||
Director::baseURL() . 'dev/docs/en/doc_test/2.3/sort/' => 'Sort',
|
||||
Director::baseURL() . 'dev/docs/en/doc_test/2.3/subfolder/' => 'Subfolder',
|
||||
Director::baseURL() . 'dev/docs/en/doc_test/2.3/test/' => 'Test'
|
||||
);
|
||||
|
||||
$actual = $v->getMenu()->first()->Children->map('Link', 'Title');
|
||||
|
@ -168,9 +174,9 @@ class DocumentationViewerTest extends FunctionalTest
|
|||
|
||||
// menu should contain all the english entities
|
||||
$expected = array(
|
||||
'dev/docs/en/doc_test/2.4/' => 'Doc Test',
|
||||
'dev/docs/en/documentationvieweraltmodule1/' => 'DocumentationViewerAltModule1',
|
||||
'dev/docs/en/documentationvieweraltmodule2/' => 'DocumentationViewerAltModule2'
|
||||
Director::baseURL() . 'dev/docs/en/doc_test/2.4/' => 'Doc Test',
|
||||
Director::baseURL() . 'dev/docs/en/documentationvieweraltmodule1/' => 'DocumentationViewerAltModule1',
|
||||
Director::baseURL() . 'dev/docs/en/documentationvieweraltmodule2/' => 'DocumentationViewerAltModule2'
|
||||
);
|
||||
|
||||
$this->assertEquals($expected, $v->getMenu()->map('Link', 'Title'));
|
||||
|
|
|
@ -16,20 +16,26 @@ class DocumentationViewerVersionWarningTest extends SapphireTest
|
|||
|
||||
Config::nest();
|
||||
|
||||
// explicitly use dev/docs. Custom paths should be tested separately
|
||||
// explicitly use dev/docs. Custom paths should be tested separately
|
||||
Config::inst()->update(
|
||||
'DocumentationViewer', 'link_base', 'dev/docs'
|
||||
'DocumentationViewer',
|
||||
'link_base',
|
||||
'dev/docs'
|
||||
);
|
||||
|
||||
// disable automatic module registration so modules don't interfere.
|
||||
Config::inst()->update(
|
||||
'DocumentationManifest', 'automatic_registration', false
|
||||
'DocumentationManifest',
|
||||
'automatic_registration',
|
||||
false
|
||||
);
|
||||
|
||||
Config::inst()->remove('DocumentationManifest', 'register_entities');
|
||||
|
||||
Config::inst()->update(
|
||||
'DocumentationManifest', 'register_entities', array(
|
||||
'DocumentationManifest',
|
||||
'register_entities',
|
||||
array(
|
||||
array(
|
||||
'Path' => DOCSVIEWER_PATH . "/tests/docs/",
|
||||
'Title' => 'Doc Test',
|
||||
|
|
Loading…
Reference in New Issue