-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EXPERIMENTAL FEATURE: API Overview Page #72
Open
palnabarun
wants to merge
13
commits into
rorodata:master
Choose a base branch
from
palnabarun:apishowcase
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f30c5eb
Add utility to find the templates dir path
palnabarun 2769302
Adds functionality to render a showcase page
palnabarun fe2cd9a
Updates requirement.txt with Jinja2
palnabarun 07c2bd3
Moves the FileSystemLoader so that it is instantiated onle once.
palnabarun c3c929e
Moves the browser path to /docs
palnabarun d4bf9d6
Adds the browser UI template
palnabarun 817e3a6
Removes the instance of API name
palnabarun 35eee6e
Updates the index template with usage instructions
palnabarun 456b0f4
Adds support to show the host url in docs
palnabarun 8844d34
Updates docs template with reviews
palnabarun 6aacc8d
Uses jinja2.PackageLoader instead of FileSystemLoader along with comp…
palnabarun fa5dfcb
Refactors generate_showcase to render_docs
palnabarun dfeab61
Removes non-existing import
palnabarun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>{% if name %}{{ name }} | {% else %}{% endif %}firefly | API Browser</title> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> | ||
<style type="text/css"> | ||
.bs-example{ | ||
margin: 20px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<br> | ||
<h3>{% if name %}{{ name }} | {% else %}{% endif %}firefly | API Browser</h3> | ||
{% if version %} | ||
<p><b>Version: </b>{{ version }}</p> | ||
{% endif %} | ||
<div class="row"> | ||
<div class="col-md-6"> | ||
<div class="bs-firefly"> | ||
{% for function in functions %} | ||
<div class="panel-group" id="accordion"> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<h4 class="panel-title"> | ||
<div class="pull-right">{{ function.path }}</div> | ||
<a data-toggle="collapse" data-parent="#accordion" href="#collapse{{ loop.index }}">{{ function.name }}</a> | ||
</h4> | ||
</div> | ||
<div id="collapse{{ loop.index }}" class="panel-collapse collapse in"> | ||
<div class="panel-body"> | ||
<p> | ||
{% if function.doc %} | ||
{{ function.doc }} | ||
{% else %} | ||
<i>No docstring provided</i> | ||
{% endif %} | ||
</p> | ||
<h4>Parameters</h4> | ||
<ul> | ||
{% for param in function.parameters %} | ||
<li>{{ param.name }}</li> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
<div class="col-md-6"> | ||
<p>The API can be used by using firefly-client</p> | ||
<p>Install it using:</p> | ||
<div class="well"> | ||
<samp> | ||
$ pip install firefly | ||
</samp> | ||
</div> | ||
<p>Usage:</p> | ||
<div class="well"> | ||
<samp> | ||
>>> import firefly<br/> | ||
>>> client = firefly.Client('{{ host_url }}')<br/> | ||
>>> client.function_name(<parameters>)<br/> | ||
<function_response> | ||
</samp> | ||
</div> | ||
</div> | ||
</div> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> | ||
</body> | ||
</html> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please split this into There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that really needed? For future use cases? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ WebOb==1.7.2 | |
requests>=2.18.1 | ||
PyYAML==3.12 | ||
funcsigs==1.0.2 ; python_version < '3' | ||
Jinja2==2.10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't
render_docs
a better name for this function?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.