From f706a9d8a262e995dac26ae3dbbe973a3a92b9f4 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Sat, 27 Sep 2014 19:46:39 +1200 Subject: [PATCH] FIX: API links should be urlencoded() to prevent special characters causing issues --- code/DocumentationParser.php | 12 ++++++------ css/layout.css | 2 +- css/typography.css | 4 +++- tests/DocumentationParserTest.php | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/code/DocumentationParser.php b/code/DocumentationParser.php index 4e06c99..826191a 100755 --- a/code/DocumentationParser.php +++ b/code/DocumentationParser.php @@ -298,9 +298,9 @@ class DocumentationParser { $url = sprintf( self::$api_link_base, - $subject, - $page->getVersion(), - $page->getEntity()->getKey() + urlencode($subject), + urlencode($page->getVersion()), + urlencode($page->getEntity()->getKey()) ); $md = str_replace( @@ -325,9 +325,9 @@ class DocumentationParser { $subject = $links[1][$i]; $url = sprintf( self::$api_link_base, - $subject, - $page->getVersion(), - $page->getEntity()->getKey() + urlencode($subject), + urlencode($page->getVersion()), + urlencode($page->getEntity()->getKey()) ); $md = str_replace( diff --git a/css/layout.css b/css/layout.css index 7a87469..ec4cece 100644 --- a/css/layout.css +++ b/css/layout.css @@ -475,7 +475,7 @@ html { .documentation_children li { float: left; width: 33%; - margin: 0; + margin: 0 0 40px; padding: 0 3% 0 0; list-style: none; } diff --git a/css/typography.css b/css/typography.css index d4154f2..53f54c2 100644 --- a/css/typography.css +++ b/css/typography.css @@ -221,11 +221,13 @@ pre { pre code { background: none; font-weight: normal; + padding: 0; } code { font: 13px/15px Monaco, 'Bitstream Vera Sans Mono', Courier, monospace; - background: #dff1ff; + background: #fffde8; + padding: 2px; } code a { color: #4E5661; diff --git a/tests/DocumentationParserTest.php b/tests/DocumentationParserTest.php index f764be6..70fbec9 100755 --- a/tests/DocumentationParserTest.php +++ b/tests/DocumentationParserTest.php @@ -321,7 +321,7 @@ HTML; $result ); $this->assertContains( - '[DataObject::$has_one](http://api.silverstripe.org/search/lookup/?q=DataObject::$has_one&version=2.4&module=documentationparsertest)', + '[DataObject::$has_one](http://api.silverstripe.org/search/lookup/?q=DataObject%3A%3A%24has_one&version=2.4&module=documentationparsertest)', $result ); }