Skip to content

Commit

Permalink
up: add some static pages html files for run apidoc demo
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Aug 18, 2022
1 parent 00661b8 commit 8ab9e9b
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/Lib/Parser/Text/PhpConstInlineParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __invoke(string $str): array
$this->valueType = is_numeric($value) ? Type::INTEGER : Type::STRING;
}

$comment = ltrim($comment, '// ');
$comment = ltrim($comment, '/ ');
if (!$this->withKey) {
return [$name, $value, $comment];
}
Expand Down
66 changes: 66 additions & 0 deletions public/pages/apidoc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Elements in HTML</title>
<!-- Embed elements Elements via Web Component -->
<script src="https://unpkg.com/@stoplight/elements/web-components.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@stoplight/elements/styles.min.css">
</head>
<body>
<div class="" id="mosaic-provider-react-aria-0-1">
<div data-overlay-container="true" class="">
<div class="sl-flex sl-flex-col sl-h-screen sl-bg-canvas">
<div class="sl-inverted sl-flex sl-flex-shrink-0 sl-items-center sl-h-2xl sl-px-5 sl-bg-canvas-pure">
<div class="sl-stack sl-stack--horizontal sl-stack--4 sl-flex sl-flex-row sl-items-center sl-w-1/3"><span
class="sl-text-lg sl-leading-none sl-font-semibold">API docs</span>
<div style="height: 28px;"><span><span></span></span></div>
</div>
<div class="sl-flex sl-justify-center sl-w-1/3">
<div class="sl-stack sl-stack--horizontal sl-stack--2 sl-flex sl-flex-1 sl-flex-row sl-items-center">
<div class="sl-input sl-flex-1 sl-relative sl-bg-canvas-100 sl-rounded">
<label for="react-aria-0-2" class="sl-relative sl-w-1/6 sl-pl-2.5"> URL</label>
<input placeholder="URL to an OpenAPI document..."
type="text" id="react-aria-0-2"
class="sl-relative sl-z-10 sl-w-5/6 sl-h-md sl-text-base sl-pr-2.5 sl-pl-2.5 sl-rounded sl-border-transparent hover:sl-border-input focus:sl-border-primary sl-border"
value="https://api.apis.guru/v2/specs/github.com/1.1.4/openapi.yaml">
</div>
<button type="button"
class="sl-button sl-h-md sl-text-base sl-font-medium sl-px-2.5 sl-bg-canvas hover:sl-bg-canvas-50 active:sl-bg-canvas-100 sl-rounded sl-border-button sl-border disabled:sl-opacity-60">
Try It!
</button>
</div>
</div>
<div class="sl-stack sl-flex sl-flex-1 sl-flex-row sl-justify-end sl-items-center sl-w-1/3">
<a target="__blank"
href="https://github.com/inhere"
type="button"
class="sl-button sl-h-md sl-text-base sl-font-medium sl-px-2.5 hover:sl-bg-canvas-50 active:sl-bg-canvas-100 sl-text-muted hover:sl-text-body focus:sl-text-body sl-rounded sl-border-transparent sl-border disabled:sl-opacity-70">
Github
</a>
</div>
</div>
<div class="sl-overflow-y-hidden sl-flex-1">
<elements-api id="docs" router="hash" layout="sidebar"></elements-api>
</div>
</div>
</div>
</div>
<!--<elements-api-->
<!-- apiDescriptionUrl="https://api.apis.guru/v2/specs/github.com/1.1.4/openapi.yaml"-->
<!-- router="hash"-->
<!-- layout="sidebar"-->
<!--/>-->

<script>
const docs = document.getElementById('docs');
(async () => {
const text = await fetch('https://api.apis.guru/v2/specs/github.com/1.1.4/openapi.yaml').then(res => res.text())
docs.apiDescriptionDocument = text;
})();


</script>
</body>
</html>
13 changes: 13 additions & 0 deletions public/pages/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>hello</h1>
<pre>kite </pre>
</body>
</html>

0 comments on commit 8ab9e9b

Please sign in to comment.