Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
Merge commit '294e98a92edae383327f23f169a149e6600dee41' as 'templates…
Browse files Browse the repository at this point in the history
…/docs_gm-basic'
  • Loading branch information
jhm-ciberman committed Jul 22, 2019
2 parents 567415b + 294e98a commit d4d1942
Show file tree
Hide file tree
Showing 12 changed files with 384 additions and 0 deletions.
21 changes: 21 additions & 0 deletions templates/docs_gm-basic/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Javier "Ciberman" Mora

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
13 changes: 13 additions & 0 deletions templates/docs_gm-basic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# DocsGM Template: Basic

> This is a basic template for docs_gm documentation generator.
> For more info about docs_gm, see http://github.com/jhm-ciberman/docs_gm
It includes four designs:

- `onepage`: (The default design) Shows all the project scripts in one single HTML pages with a table of contents. It does not shows the folder structure. Ideal for smaller projects.
- `multipage`: Each script documentation is generated in a separate HTML file, and the index file contains a table of contents with links to each script page. It does not shows the project folder structure. Ideal for medium sizes projects.
- `modules-onepage`: Each script and each folder is generated in a separate HTML file. Each folder shows the folder children with the documentation of each script on the same page. It shows the folder structure. Ideal for big sized projects.
- `modules-multipage`: Each script and each folder is generated in a separate HTML file. Each folder shows the folder children with links to each one and to his parent folder. It shows the folder structure, but it requires more clicks to reach an specific script documentation. Ideal for huge sized projects.

This basic template is build using [Bootstrap 4](https://getbootstrap.com/).
5 changes: 5 additions & 0 deletions templates/docs_gm-basic/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions templates/docs_gm-basic/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "docs_gm-basic",
"version": "3.1.0",
"description": "A basic documentation template for docs_gm the fantastic documentation generator for GameMaker:Studio and GameMaker Studio 2",
"main": "template.json",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"docs_gm",
"template"
],
"repository": {
"type": "git",
"url": "git+https://github.com/jhm-ciberman/docs_gm-basic.git"
},
"author": "Javier \"Ciberman\" Mora <jhm.ciberman@gmail.com>",
"license": "MIT"
}
22 changes: 22 additions & 0 deletions templates/docs_gm-basic/src/macros/breadcrumb.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% macro breadcrumb(element) %}
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
{{ item(element, element) }}
</ol>
</nav>
{% endmacro %}

{% macro item(element, activeElement) %}

{# Call item() macro recursively #}
{% if element.parent %}
{{ item(element.parent, activeElement)}}
{% endif %}

{% if element === activeElement %}
<li class="breadcrumb-item active" aria-current="page">{{ element.name }}</li>
{% else %}
<li class="breadcrumb-item"><a href="{{ linkTo(element) }}">{{ element.name }}</a></li>
{% endif %}

{% endmacro %}
60 changes: 60 additions & 0 deletions templates/docs_gm-basic/src/macros/script.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{#
This has the HTML to display a SINGLE gml function documentation
It's called a fragment, because its a fragment of page, not a complete page,
and it's INCLUDED from another njk files.
#}

{% macro show(script) %}

{# Shows the script name #}
<h3 id="{{ script.name }}">{{ script.name }}</h3>

<p><b>Syntax: </b></p>
<pre class="lang-js"><code>{{ script.signature }}</code></pre>

{# Shows the script arguments (only if there any argument to show} #}
{% if script.params.length > 0 %}
<div class="table-responsive">
<table class="table table-bordered table-striped js-options-table js-options-table">
<thead>
<tr>
<th>Argument name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
{# Loop all over the scripts arguments (params) and shows them #}
{% for param in script.params %}
<tr>
<td>{{ param.name }}</td>
<td>{{ param.type }}</td>
<td>{{ param.description }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}

{# Shows the script return value #}
{% if script.returns %}
<p><b>Returns:</b> ({{ script.returns.type }}) {{ script.returns.description }} </p>
{% endif %}

{# Show the script description #}
{% if script.description %}
<div class ="description">
<p><b>Description: </b></p>
{{ script.description }}
</div>
{% endif %}

{# Loop over all script examples and shows them #}
{% for example in script.examples %}
<p><b>Example: {{ example.caption }}</b></p>
<pre class="lang-js"><code>{{ example.code }}</code></pre>
{% endfor %}

{% endmacro %}

42 changes: 42 additions & 0 deletions templates/docs_gm-basic/src/modules-multipage.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{% extends "src/parent.njk" %}
{% import "src/macros/script.njk" as scriptMacro %}
{% import "src/macros/breadcrumb.njk" as breadcrumbMacro %}

{# Overrides the block named "content" that is declared in the parent.njk file #}
{% block content %}

{# Main header of the page #}
<h1>{{ project.name }} Documentation</h1>

{{ breadcrumbMacro.breadcrumb(element) }}



{% if element.type == "script" %}
{# If the current element is a script, prints the script documentation #}
{{ scriptMacro.show(element) }}

{% elif element.type == "folder" %}

<h2>{{ element.name }}</h2>

{{ element.description }}

{# Prints the table of contents #}
<ul class="nav flex-column">
{% for res in element.children %}
<li class="nav-item">
{% if res.type === "folder" %}
<a class="nav-link" href="{{ linkTo(res) }}">Folder: {{ res.name }}</a>
{% elif res.type === "script" %}
<a class="nav-link" href="{{ linkTo(res) }}">{{ res.name }}</a>
{% endif %}
</li>
{% endfor %}
</ul>

{% endif %}

{% endblock content %}


47 changes: 47 additions & 0 deletions templates/docs_gm-basic/src/modules-onepage.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{% extends "src/parent.njk" %}
{% import "src/macros/script.njk" as scriptMacro %}
{% import "src/macros/breadcrumb.njk" as breadcrumbMacro %}

{# Overrides the block named "content" that is declared in the parent.njk file #}
{% block content %}

{# Main header of the page #}
<h1>{{ project.name }} Documentation</h1>

{{ breadcrumbMacro.breadcrumb(element) }}

<h2>{{ element.name }}</h2>

{{ element.description }}

{# Prints the table of contents #}
<ul class="nav flex-column">
{% for res in element.children %}
<li class="nav-item">
{% if res.type === "folder" %}
<a class="nav-link" href="{{ linkTo(res) }}">Folder: {{ res.name }}</a>
{% elif res.type === "script" %}
<a class="nav-link" href="#{{ res.name }}">{{ res.name }}</a>
{% endif %}
</li>
{% endfor %}
</ul>

{# Loops over all the scripts of the folder #}
{% for res in element.children %}
{% if res.type === "script" %}
{# Prints an horizontal separator line #}
<hr />

{{ scriptMacro.show(res) }}

{% endif %}
{% else %}

<p> This project has no documented scripts </p>

{% endfor %}

{% endblock content %}


30 changes: 30 additions & 0 deletions templates/docs_gm-basic/src/multipage.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{% extends "src/parent.njk" %}
{% import "src/macros/script.njk" as scriptMacro %}

{# Overrides the block named "content" that is declared in the parent.njk file #}
{% block content %}

{# Main header of the page #}
<h1>{{ project.name }} Documentation</h1>

{% if element.type == "folder" %}
{# If the current element is a folder, prints the table of contents #}
<ul class="nav flex-column">
{% for resource in element.all %}
<li class="nav-item">
<a class="nav-link" href="{{ linkTo(resource) }}">{{ resource.name }}</a>
</li>
{% endfor %}
</ul>
{% elif element.type == "script" %}
{# If the current element is a script, prints the script documentation #}
<a href="{{ linkTo(project.root) }}">Back to index page</a>

{{ scriptMacro.show(element) }}

{% endif %}


{% endblock content %}


35 changes: 35 additions & 0 deletions templates/docs_gm-basic/src/onepage.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{% extends "src/parent.njk" %}
{% import "src/macros/script.njk" as scriptMacro %}

{# Overrides the block named "content" that is declared in the parent.njk file #}
{% block content %}

{# Main header of the page #}
<h1>{{ project.name }} Documentation</h1>

{# Prints the table of contents #}
<ul class="nav flex-column">
{% for script in project.root.all %}
<li class="nav-item">
<a class="nav-link" href="#{{ script.name }}">{{ script.name }}</a>
</li>
{% endfor %}
</ul>

{# Loops over all the scripts of the project #}
{% for script in project.root.all %}

{# Prints an horizontal separator line #}
<hr />

{{ scriptMacro.show(script) }}

{% else %}

<p> This project has no documented scripts </p>

{% endfor %}

{% endblock content %}


66 changes: 66 additions & 0 deletions templates/docs_gm-basic/src/parent.njk
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">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>{% block title %}{{ project.name }} Docs{% endblock %}</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<style>
/* Sticky footer styles
-------------------------------------------------- */
html {
position: relative;
min-height: 100%;
}
body {
/* Margin bottom by footer height */
margin-bottom: 60px;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
line-height: 60px; /* Vertically center the text there */
background-color: #f5f5f5;
}
/* Custom page CSS
-------------------------------------------------- */
/* Not required for template or sticky footer method. */
body > .container {
padding: 0 15px 60px;
}
.footer > .container {
padding-right: 15px;
padding-left: 15px;
}
code {
font-size: 80%;
}
</style>
</head>
<body>

<div class="container">
{# This is the default content for the "content" block. We will override this content in the index-onepage.njk file. #}
{% block content %}
<h1>Oops, this is an empty page</h1>
{% endblock %}
</div>
<footer class="footer">
<div class="container">
<span class="text-muted">Documentation generated with <a href="https://jhm-ciberman.github.io/docs_gm/" target="_blank">docs_gm</a></span>
</div>
</footer>
</body>
</html>
24 changes: 24 additions & 0 deletions templates/docs_gm-basic/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"author": "Javier \"Ciberman\" Mora",
"description": "A basic HTML documentation template",
"web": "https://github.com/jhm-ciberman/docs_gm-basic",
"defaultDesign": "onepage",
"designs": {
"onepage": {
"displayName": "One Page",
"index": "src/onepage.njk"
},
"multipage": {
"displayName": "MultiPage",
"index": "src/multipage.njk"
},
"modules-onepage": {
"displayName": "Onepage Modules",
"index": "src/modules-onepage.njk"
},
"modules-multipage": {
"displayName": "Multipage Modules",
"index": "src/modules-multipage.njk"
}
}
}

0 comments on commit d4d1942

Please sign in to comment.