mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 05:43:46 +03:00
Upload
This commit is contained in:
19
gamemodes/helix/docs/templates/landing.ltp
vendored
Normal file
19
gamemodes/helix/docs/templates/landing.ltp
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
<div class="landing">
|
||||
<h1>Helix Documentation</h1>
|
||||
</div>
|
||||
|
||||
<div class="wrapper">
|
||||
<p style="text-align: center;">Welcome to the documentation for Helix - the better gamemode framework.</p>
|
||||
<h2>Developers</h2>
|
||||
<p>The sidebar shows the entire contents of the documentation. Libraries, functions, etc are all searchable with the search box at the top of the sidebar. Migrating from Clockwork? Check out the <a href="{* ldoc.url('manual/converting-from-clockwork') *}">conversion guide</a> in the manual.</p>
|
||||
<h2>Server owners</h2>
|
||||
<p>If you're looking to get your Helix server up and running as soon as possible, check out the <a href="{* ldoc.url('manual/getting-started') *}">Getting Started</a> guide in the manual.</p>
|
||||
<h2>Community</h2>
|
||||
<p>Questions? Want to show off your work? Maybe drop a new plugin release? Come join our community <a href="https://discord.gg/2AutUcF" target="_blank">Discord server</a>.</p>
|
||||
<h2>Contributing</h2>
|
||||
<p>Helix is a large project and there are still a few things missing here and there. Contributions to the documentation - from function references, to simple typo fixes - are welcomed! Check out the <code>ix.storage</code> library's <a href="https://github.com/NebulousCloud/helix/blob/master/gamemode/core/libs/sh_storage.lua" target="_blank">source code</a> for a good example on how to write documentation. You'll need a basic understanding of <a href="https://guides.github.com/features/mastering-markdown/" target="_blank">Markdown</a>, since it's used extensively to generate the markup.</p>
|
||||
<p>If you'd like to contribute code, you can visit the <a href="https://github.com/NebulousCloud/helix/" target="_blank">GitHub repository</a> and make a pull request.</p>
|
||||
<h2>Learning</h2>
|
||||
<p>Getting started on developing with the Helix framework requires an intermediate level of Garry's Mod Lua knowledge. You'll want to learn the basics before you get starting making a schema. The <a href="https://wiki.facepunch.com/gmod/" target="_blank">Garry's Mod Wiki</a> is a good place to start.</p>
|
||||
</div>
|
||||
90
gamemodes/helix/docs/templates/ldoc.ltp
vendored
Normal file
90
gamemodes/helix/docs/templates/ldoc.ltp
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
|
||||
{%
|
||||
local baseUrl = ldoc.css:gsub("ldoc.css", "")
|
||||
local repo = "https://github.com/nebulouscloud/helix/"
|
||||
local pageTitle = mod and (ldoc.display_name(mod) .. " - " .. ldoc.title) or ldoc.title
|
||||
|
||||
local oldmarkup = ldoc.markup
|
||||
function ldoc.markup(text, item)
|
||||
return oldmarkup(text, item, ldoc.plain)
|
||||
end
|
||||
|
||||
function ldoc.url(path)
|
||||
return baseUrl .. path
|
||||
end
|
||||
|
||||
function ldoc.realm_icon(realm)
|
||||
return "<span class=\"realm " .. (realm or "") .. "\"></span>";
|
||||
end
|
||||
|
||||
function ldoc.is_kind_classmethod(kind)
|
||||
return kind ~= "libraries"
|
||||
end
|
||||
|
||||
function ldoc.repo_reference(item)
|
||||
return repo .. "tree/master" .. item.file.filename:gsub(item.file.base, "/gamemode") .. "#L" .. item.lineno
|
||||
end
|
||||
|
||||
local function moduleDescription(mod)
|
||||
if (mod.type == "topic") then
|
||||
return mod.body:gsub(mod.display_name, ""):gsub("#", ""):sub(1, 256) .. "..."
|
||||
end
|
||||
|
||||
return mod.summary
|
||||
end
|
||||
%}
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>{{pageTitle}}</title>
|
||||
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="{{pageTitle}}" />
|
||||
<meta property="og:site_name" content="Helix Documentation" />
|
||||
|
||||
{% if (mod) then %}
|
||||
<meta property="og:description" content="{{moduleDescription(mod)}}" />
|
||||
{% else %}
|
||||
<meta property="og:description" content="Documentation and function reference for the Helix framework." />
|
||||
{% end %}
|
||||
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Code+Pro" />
|
||||
<link rel="stylesheet" href="{* ldoc.css *}" />
|
||||
<link rel="stylesheet" href="{* ldoc.url('highlight.css') *}" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main>
|
||||
{(docs/templates/sidebar.ltp)}
|
||||
|
||||
<article>
|
||||
{% if (ldoc.root) then -- we're rendering the landing page (index.html) %}
|
||||
{(docs/templates/landing.ltp)}
|
||||
{% elseif (ldoc.body) then -- we're rendering non-code elements %}
|
||||
<div class="wrapper">
|
||||
{* ldoc.body *}
|
||||
</div>
|
||||
{% elseif (module) then -- we're rendering libary contents %}
|
||||
<div class="wrapper">
|
||||
{(docs/templates/module.ltp)}
|
||||
</div>
|
||||
{% end %}
|
||||
</article>
|
||||
</main>
|
||||
|
||||
<script type="text/javascript" src="{* ldoc.url('app.js') *}"></script>
|
||||
<script type="text/javascript" src="{* ldoc.url('highlight.min.js') *}"></script>
|
||||
<script type="text/javascript">
|
||||
var elements = document.querySelectorAll("pre code")
|
||||
|
||||
hljs.configure({
|
||||
languages: ["lua"]
|
||||
});
|
||||
|
||||
for (var i = 0; i < elements.length; i++)
|
||||
{
|
||||
hljs.highlightBlock(elements[i]);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
123
gamemodes/helix/docs/templates/module.ltp
vendored
Normal file
123
gamemodes/helix/docs/templates/module.ltp
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
|
||||
<header class="module">
|
||||
<h1>{{mod.name}}</h1>
|
||||
<h2>{* ldoc.markup(mod.summary) *}</h2>
|
||||
</header>
|
||||
|
||||
<p>{* ldoc.markup(mod.description) *}</p>
|
||||
|
||||
{% for kind, items in mod.kinds() do %}
|
||||
<h1 class="title">{{kind}}</h1>
|
||||
|
||||
{% for item in items() do %}
|
||||
<section class="method">
|
||||
<header>
|
||||
<a class="anchor" id="{{item.name}}">
|
||||
<h1>{* ldoc.realm_icon(item.tags.realm[1]) *}</span>{{ldoc.display_name(item)}}</h1>
|
||||
</a>
|
||||
|
||||
{% if (item.tags.internal) then %}
|
||||
<div class="notice error">
|
||||
<div class="title">Internal</div>
|
||||
<p>This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.</p>
|
||||
</div>
|
||||
{% end %}
|
||||
|
||||
{% if (item.module and item.module.type ~= "hooks") then %}
|
||||
<a class="reference" href="{* ldoc.repo_reference(item) *}">View source »</a>
|
||||
{% end %}
|
||||
|
||||
{% if (ldoc.descript(item):len() == 0) then %}
|
||||
<div class="notice warning">
|
||||
<div class="title">Incomplete</div>
|
||||
<p>Documentation for this section is incomplete and needs expanding.</p>
|
||||
</div>
|
||||
{% else %}
|
||||
<p>{* ldoc.markup(ldoc.descript(item)) *}</p>
|
||||
{% end %}
|
||||
</header>
|
||||
|
||||
{# function arguments #}
|
||||
{% if (item.params and #item.params > 0) then %}
|
||||
{% local subnames = mod.kinds:type_of(item).subnames %}
|
||||
|
||||
{% if (subnames) then %}
|
||||
<h3>{{subnames}}</h3>
|
||||
{% end %}
|
||||
|
||||
{% for argument in ldoc.modules.iter(item.params) do %}
|
||||
{% local argument, sublist = item:subparam(argument) %}
|
||||
|
||||
<ul>
|
||||
{% for argumentName in ldoc.modules.iter(argument) do %}
|
||||
{% local displayName = item:display_name_of(argumentName) %}
|
||||
{% local type = ldoc.typename(item:type_of_param(argumentName)) %}
|
||||
{% local default = item:default_of_param(argumentName) %}
|
||||
|
||||
<li>
|
||||
<span class="tag parameter">{{displayName}}</span>
|
||||
|
||||
{% if (type ~= "") then %}
|
||||
<span class="tag">{* type *}</span>
|
||||
{% end %}
|
||||
|
||||
{% if (default and default ~= true) then %}
|
||||
<span class="tag default">default: {{default}}</span>
|
||||
{% elseif (default) then %}
|
||||
<span class="tag default">optional</span>
|
||||
{% end %}
|
||||
|
||||
<p>{* ldoc.markup(item.params.map[argumentName]) *}</p>
|
||||
</li>
|
||||
{% end %}
|
||||
</ul>
|
||||
{% end %}
|
||||
{% end %}
|
||||
|
||||
{# function returns #}
|
||||
{% if ((not ldoc.no_return_or_parms) and item.retgroups) then %}
|
||||
{% local groups = item.retgroups %}
|
||||
|
||||
<h3>Returns</h3>
|
||||
<ul>
|
||||
{% for i, group in ldoc.ipairs(groups) do %}
|
||||
{% for returnValue in group:iter() do %}
|
||||
{% local type, ctypes = item:return_type(returnValue) %}
|
||||
{% type = ldoc.typename(type) %}
|
||||
|
||||
<li>
|
||||
{% if (type ~= "") then %}
|
||||
{* type *}
|
||||
{% else -- we'll assume that it will return a variable type if none is set %}
|
||||
<span class="tag type">any</span>
|
||||
{% end %}
|
||||
|
||||
<p>{* ldoc.markup(returnValue.text) *}</p>
|
||||
</li>
|
||||
{% end %}
|
||||
|
||||
{% if (i ~= #groups) then %}
|
||||
<div class="or"><span>OR</span></div>
|
||||
{% end %}
|
||||
{% end %}
|
||||
</ul>
|
||||
{% end %}
|
||||
|
||||
{% if (item.usage) then -- function usage %}
|
||||
<h3>Example Usage</h3>
|
||||
{% for usage in ldoc.modules.iter(item.usage) do %}
|
||||
<pre><code>{* usage *}</code></pre>
|
||||
{% end %}
|
||||
{% end %}
|
||||
|
||||
{% if (item.see) then %}
|
||||
<h3>See Also</h3>
|
||||
<ul>
|
||||
{% for see in ldoc.modules.iter(item.see) do %}
|
||||
<li><a href="{* ldoc.href(see) *}">{{see.label}}</a></li>
|
||||
{% end %}
|
||||
</ul>
|
||||
{% end %}
|
||||
</section>
|
||||
{% end %}
|
||||
{% end %}
|
||||
69
gamemodes/helix/docs/templates/sidebar.ltp
vendored
Normal file
69
gamemodes/helix/docs/templates/sidebar.ltp
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
|
||||
{%
|
||||
local function isKindExpandable(kind)
|
||||
return kind ~= "Manual"
|
||||
end
|
||||
%}
|
||||
|
||||
<nav>
|
||||
<header>
|
||||
{% if (not ldoc.root) then %}
|
||||
<h1><a href="{* ldoc.url('') *}">Helix Documentation</a></h1>
|
||||
{% end %}
|
||||
<input id="search" type="search" autocomplete="off" placeholder="Search..." />
|
||||
</header>
|
||||
|
||||
<section>
|
||||
{% for kind, mods, type in ldoc.kinds() do %}
|
||||
{% if (ldoc.allowed_in_contents(type, mod)) then %}
|
||||
<details class="category" open>
|
||||
<summary>
|
||||
<h2>{{kind}}</h2>
|
||||
</summary>
|
||||
|
||||
<ul>
|
||||
{% for currentMod in mods() do %}
|
||||
{% local name = ldoc.display_name(currentMod) %}
|
||||
<li>
|
||||
{% if (isKindExpandable(kind)) then %}
|
||||
<details {{currentMod.name == (mod or {}).name and "open" or ""}}>
|
||||
<summary><a href="{* ldoc.ref_to_module(currentMod) *}">{{name}}</a></summary>
|
||||
|
||||
<ul>
|
||||
{% else %}
|
||||
<a href="{* ldoc.ref_to_module(currentMod) *}">{{name}}</a>
|
||||
{% end %}
|
||||
|
||||
{% if (isKindExpandable(kind)) then
|
||||
currentMod.items:sort(function(a, b)
|
||||
return a.name < b.name
|
||||
end)
|
||||
end %}
|
||||
|
||||
{% for k, v in pairs(currentMod.items) do %}
|
||||
{% if (v.kind == "functions") then %}
|
||||
<li>
|
||||
{* ldoc.realm_icon(v.tags.realm[1]) *}
|
||||
<a href="{* ldoc.ref_to_module(currentMod) *}#{{v.name}}">
|
||||
{% if (ldoc.is_kind_classmethod(currentMod.kind)) then
|
||||
echo((v.name:gsub(".+:", "")))
|
||||
else
|
||||
echo((v.name:gsub(currentMod.name .. ".", "")))
|
||||
end %}
|
||||
</a>
|
||||
</li>
|
||||
{% end %}
|
||||
{% end %}
|
||||
|
||||
{% if (isKindExpandable(kind)) then %}
|
||||
</ul>
|
||||
</details>
|
||||
{% end %}
|
||||
</li>
|
||||
{% end %}
|
||||
</ul>
|
||||
</details>
|
||||
{% end %}
|
||||
{% end %}
|
||||
</section>
|
||||
</nav>
|
||||
Reference in New Issue
Block a user