Browse Source

static docs fix

shalvah 4 years ago
parent
commit
8ca0922d3a

+ 2 - 2
resources/views/themes/default/index.blade.php

@@ -21,7 +21,7 @@
     <script>hljs.highlightAll();</script>
     <script>hljs.highlightAll();</script>
 
 
 @if($tryItOut['enabled'] ?? true)
 @if($tryItOut['enabled'] ?? true)
-    <script src="https://cdn.jsdelivr.net/npm/lodash@4.17.10/lodash.min.js"></script>
+    <script src="//cdn.jsdelivr.net/npm/lodash@4.17.10/lodash.min.js"></script>
     <script>
     <script>
         var baseUrl = "{{ $tryItOut['base_url'] ?? config('app.url') }}";
         var baseUrl = "{{ $tryItOut['base_url'] ?? config('app.url') }}";
     </script>
     </script>
@@ -34,7 +34,7 @@
 <a href="#" id="nav-button">
 <a href="#" id="nav-button">
       <span>
       <span>
         MENU
         MENU
-        <img src="/docs/images/navbar.png" alt="navbar-image" />
+        <img src="../docs/images/navbar.png" alt="navbar-image" />
       </span>
       </span>
 </a>
 </a>
 <div class="tocify-wrapper">
 <div class="tocify-wrapper">

+ 1 - 1
src/Extracting/Strategies/UrlParameters/GetFromLaravelAPI.php

@@ -97,7 +97,7 @@ class GetFromLaravelAPI extends Strategy
         if ($paramName == "id") {
         if ($paramName == "id") {
             // If $url is sth like /users/{id}, return "The ID of the user."
             // If $url is sth like /users/{id}, return "The ID of the user."
             // Make sure to replace underscores, so "side_projects" becomes "side project"
             // Make sure to replace underscores, so "side_projects" becomes "side project"
-            $thing = str_replace("_", " ",$this->getNameOfUrlThing($url, $paramName));
+            $thing = str_replace(["_", "-"], " ",$this->getNameOfUrlThing($url, $paramName));
             return "The ID of the $thing.";
             return "The ID of the $thing.";
         } else if (Str::is("*_id", $paramName)) {
         } else if (Str::is("*_id", $paramName)) {
             // If $url is sth like /something/{user_id}, return "The ID of the user."
             // If $url is sth like /something/{user_id}, return "The ID of the user."

+ 2 - 2
src/Writing/Writer.php

@@ -146,8 +146,8 @@ class Writer
         $contents = file_get_contents("$this->laravelTypeOutputPath/index.blade.php");
         $contents = file_get_contents("$this->laravelTypeOutputPath/index.blade.php");
 
 
         // Rewrite asset links to go through Laravel
         // Rewrite asset links to go through Laravel
-        $contents = preg_replace('#href=".*css/(.+?)"#', 'href="{{ asset("vendor/scribe/css/$1") }}"', $contents);
-        $contents = preg_replace('#src=".*(js|images)/(.+?)"#', 'src="{{ asset("vendor/scribe/$1/$2") }}"', $contents);
+        $contents = preg_replace('#href="\.\./docs/css/(.+?)"#', 'href="{{ asset("vendor/scribe/css/$1") }}"', $contents);
+        $contents = preg_replace('#src="\.\./docs/(js|images)/(.+?)"#', 'src="{{ asset("vendor/scribe/$1/$2") }}"', $contents);
         $contents = str_replace('href="../docs/collection.json"', 'href="{{ route("scribe.postman") }}"', $contents);
         $contents = str_replace('href="../docs/collection.json"', 'href="{{ route("scribe.postman") }}"', $contents);
         $contents = str_replace('href="../docs/openapi.yaml"', 'href="{{ route("scribe.openapi") }}"', $contents);
         $contents = str_replace('href="../docs/openapi.yaml"', 'href="{{ route("scribe.openapi") }}"', $contents);