mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-02-02 22:35:55 +01:00
Added descriptions and brief descriptions for most of the classes in the web module.
This commit is contained in:
parent
88df1db348
commit
ae19991c63
@ -1,8 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="BBCodeParser" inherits="Reference" version="3.7">
|
||||
<brief_description>
|
||||
A class that parses bbcode into a class structure for easy manipulation, or processing.
|
||||
</brief_description>
|
||||
<description>
|
||||
The BBCodeParser class works the same way as the HTMLParser class, except it parses BBCode, which is a bit simpler, so some complexity was removed.
|
||||
BBCode was created for providing a safer and simpler format for formatting post on forums. It is very similar to html.
|
||||
For example: [code][b]This text should would be bold if this bbcode was interpreted.[/b] [size=14]This text would have a font size of 14.[/size] etc.[/code]
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -1,8 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="BBCodeParserAttribute" inherits="Reference" version="3.7">
|
||||
<brief_description>
|
||||
[BBCodeParser] stores bbcode attributes using this class.
|
||||
</brief_description>
|
||||
<description>
|
||||
[BBCodeParser] stores bbcode attributes using this class.
|
||||
It has helper methods for searching and modifying data.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -1,8 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="BBCodeParserTag" inherits="Reference" version="3.7">
|
||||
<brief_description>
|
||||
[BBCodeParser] stores bbcode tags using this class.
|
||||
</brief_description>
|
||||
<description>
|
||||
[BBCodeParser] stores bbcode tags using this class.
|
||||
It has helper methods for searching and modifying data.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -1,8 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="FileCache" inherits="Reference" version="3.7">
|
||||
<brief_description>
|
||||
The FileCache class provide functionality for file and directory caching for the web module.
|
||||
</brief_description>
|
||||
<description>
|
||||
The FileCache class provide functionality for file and directory caching for the web module.
|
||||
It can evaluate a folder, and save all file paths into memory.
|
||||
Using this functionality can increase performance in certain scenarios, as the application does not have to use a syscall to evaluate whether a file exists or not, and also helps with avoiding directory traversal attacks, as relative paths are not going to be expanded by accident.
|
||||
(A directory traversal attach would be if an application receives this get request: [code]server.net/../../../etc/passwd[/code], and it would result in success, if the app then returns the contents of the "passwd" file, which is outside of the root folder of the server.)
|
||||
[FileCache] has a drawback for now, as it doesn't yet watch for changes in the folder, so if files change it needs to be manually refreshed.
|
||||
It can also save contents of files into memory if needed using the [code]set_cached_body()[/code] helper method.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -1,8 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="FormField" inherits="Resource" version="3.7">
|
||||
<brief_description>
|
||||
[FormField] represents one field in a html form, like a password or user name input.
|
||||
</brief_description>
|
||||
<description>
|
||||
[FormField] represents one field in a html form, like a password or user name input.
|
||||
It contains a list of FormFieldEntries that actually check constraints using polymorphism.
|
||||
It also contains helper methods to allow for simpler construction.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -1,8 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="FormFieldEntry" inherits="Resource" version="3.7">
|
||||
<brief_description>
|
||||
Used by [FormField]s to implement html form validation capabilities.
|
||||
</brief_description>
|
||||
<description>
|
||||
Used by [FormField]s to implement html form validation capabilities.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -1,8 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="FormValidator" inherits="Resource" version="3.7">
|
||||
<brief_description>
|
||||
The [FormValidator] implements html form validation capabilities.
|
||||
</brief_description>
|
||||
<description>
|
||||
The [FormValidator] implements html form validation capabilities. This helps with forcing constraints to input provided by users through HTML forms. [FormValidator] is the main class, it contains helper methods for adding form fields, and validations.
|
||||
Construction of a simple validator:
|
||||
[code]var lv : FormValidator = FormValidator.new()
|
||||
|
||||
lv.new_field("username", "Username").need_to_exist()
|
||||
.need_to_be_alpha_numeric().need_minimum_length(5).need_maximum_length(20)
|
||||
|
||||
var pw : FormField = lv.new_field("password", "Password")
|
||||
pw.need_to_exist()
|
||||
pw.need_to_have_lowercase_character().need_to_have_uppercase_character()
|
||||
pw.need_minimum_length(5)
|
||||
|
||||
#validation
|
||||
var errors : PoolStringArray = lv.validate(request)
|
||||
if (errors.size() > 0):
|
||||
for i in range(errors.size()):
|
||||
print(errors[i])[/code]
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -1,8 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="HTMLBuilder" inherits="Reference" version="3.7">
|
||||
<brief_description>
|
||||
A class that can be used to easily build html from code.
|
||||
</brief_description>
|
||||
<description>
|
||||
A class that can be used to easily build html from code.
|
||||
This class has helper methods for all valid HTML tags. It have an another set, but with a c prefix, these methods write the closing tag. All of these helpers return an [HTMLTag], this allows for the addition of arguments into the tags. This [HTMLTag] should not be stored, it's reused internally. Some of these methods also have alternates with parameters for the most common attributes, like the link tag (a) has a helper method that takes the link, class, id as an argument for convenience.
|
||||
Other helper methods, like [code]input_*[/code] are also available, these should simplify the creation of forms.
|
||||
The [code]w()[/code] helper method is provided for appending strings directly at the end. The [code]wn[/code], [code]wns[/code], etc. helpers can be used to append numbers (converted to string) to the output.
|
||||
Helper methods are also provided for the easy addition of csrf tokens to forms. These can protect from forged form submissions.
|
||||
[code]var a : float = _model.predict()
|
||||
va b : HTMLBuilder = HTMLBuilder.new()
|
||||
|
||||
b.h5().attrib("align", "center")
|
||||
b.w("The model predicted:").br()
|
||||
b.w("Current: ").wn(a).w(" Units")
|
||||
b.w(".").br()
|
||||
b.ch5()
|
||||
|
||||
request.body += b.result[/code]
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -1,8 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="HTMLPaginator" inherits="Reference" version="3.7">
|
||||
<brief_description>
|
||||
A class that can be used to generate html pagination.
|
||||
</brief_description>
|
||||
<description>
|
||||
A class that can be used to generate html pagination.
|
||||
Pagination means page selection links on HTML pages when more than one page is available.
|
||||
The [code]get_current()[/code] helper can be used to get the generated HTML for the current page. [code]start()[/code] and [code]next()[/code] helpers are also provided as an enumerator like interface. They are convenient if pages can be built and cached during startup for example.
|
||||
A Renderer [HTMLPaginator] can be set to an another [HTMLPaginator] class. If a renderer [HTMLPaginator] is set, then it's render methods will be used to render the links instead of the built in of the current class. This enables customization of styles for core classes, in a relatively simple and in a less error prone way.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -1,8 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="HTMLParser" inherits="Reference" version="3.7">
|
||||
<brief_description>
|
||||
A class that parses html into a class structure for easy manipulation, or processing.
|
||||
</brief_description>
|
||||
<description>
|
||||
A class that parses html into a class structure for easy manipulation, or processing.
|
||||
The HTMLParser class parses HTML using a simple algorithm in one pass into a simple class structure. It handles erroneous HTML documents relatively well. It does not know and check HTML tag validity, it will just handles all of them in a generic way.
|
||||
A String containing HTML data can ba parsed using it's parse() method. The resulting class structure can then be accessed via it's root member variable.
|
||||
[code]var p : HTMLParser = HTMLParser.new()
|
||||
p.parse(data)
|
||||
var article_tag : HTMLParserTag = p.root.get_first("article")
|
||||
save_data(article_tag.to_string())
|
||||
var n_link_tag : HTMLParserTag = p.root.get_first("a", "rel", "next")
|
||||
String next_link = n_link_tag.get_attribute_value("href")[/code]
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
@ -10,22 +20,26 @@
|
||||
<method name="convert_to_string" qualifiers="const">
|
||||
<return type="String" />
|
||||
<description>
|
||||
The HTML document can be turned back into well formatted HTML using this method.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_root">
|
||||
<return type="HTMLParserTag" />
|
||||
<description>
|
||||
The resulting root [HTMLParserTag].
|
||||
</description>
|
||||
</method>
|
||||
<method name="parse">
|
||||
<return type="void" />
|
||||
<argument index="0" name="data" type="String" />
|
||||
<description>
|
||||
Parses the given data as html.
|
||||
</description>
|
||||
</method>
|
||||
<method name="print" qualifiers="const">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Equivalent to [code]print(convert_to_string())[/code].
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
|
@ -1,8 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="HTMLParserAttribute" inherits="Reference" version="3.7">
|
||||
<brief_description>
|
||||
[HTMLParser] stores html attributes using this class.
|
||||
</brief_description>
|
||||
<description>
|
||||
[HTMLParser] stores html attributes using this class.
|
||||
It has helper methods for searching and modifying data.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -1,8 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="HTMLParserTag" inherits="Reference" version="3.7">
|
||||
<brief_description>
|
||||
[HTMLParser] stores html tags using this class.
|
||||
</brief_description>
|
||||
<description>
|
||||
[HTMLParser] stores html tags using this class.
|
||||
It has helper methods for searching and modifying data.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -1,8 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="HTMLTag" inherits="Reference" version="3.7">
|
||||
<brief_description>
|
||||
The HTMLTag class helps with the creation of HTML tags. HTMLBuilder uses it internally.
|
||||
</brief_description>
|
||||
<description>
|
||||
The HTMLTag class helps with the creation of HTML tags. HTMLBuilder uses it internally.
|
||||
It has helper methods for most of the available HTML attributes, some of these were omitted from the UML diagram, to improve readability. It supports simple and complex tags. Self-closing tags are considered simple (like <br>).
|
||||
If an attribute is not directly implemented, the [code]attrib(attr, val)[/code] helper method is available.
|
||||
It also contains the f() helper method that returns the owner [HTMLBuilder], for ease of use.
|
||||
[code]var b : HTMLBuilder = HTMLBuilder.new()
|
||||
#<a href="/main" class="main_link">link text</a>:
|
||||
b.a().href("/main").cls("main_link").f().w("link").ca()
|
||||
request.body += b.result[/code]
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -1,8 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="HTTPServerEnums" inherits="Object" version="3.7">
|
||||
<brief_description>
|
||||
Contains Enums used by the web module.
|
||||
</brief_description>
|
||||
<description>
|
||||
Contains Enums used by the web module.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -1,8 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="MarkdownRenderer" inherits="Reference" version="3.7">
|
||||
<brief_description>
|
||||
Renders markdown as HTML.
|
||||
</brief_description>
|
||||
<description>
|
||||
Renders markdown as HTML.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -1,8 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="SessionSetupWebServerMiddleware" inherits="WebServerMiddleware" version="3.7">
|
||||
<brief_description>
|
||||
The [SessionSetupWebServerMiddleware] will look up [HTTPSession]s for a particular request using the stored session id.
|
||||
</brief_description>
|
||||
<description>
|
||||
The [SessionSetupWebServerMiddleware] will look up [HTTPSession]s for a particular request from the stored session id automatically.
|
||||
It will take session id ([code]session_id[/code] key) from a request's cookie (if exists), and it will set the HTTPSession belonging to that id to the Request's session variable. Note that it will not create sessions automatically.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -1,8 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="WebServerCookie" inherits="Reference" version="3.7">
|
||||
<brief_description>
|
||||
Used by [WebServerRequest]s, to set or delete cookies on the client.
|
||||
</brief_description>
|
||||
<description>
|
||||
Used by [WebServerRequest]s, to set or delete cookies on the client.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
Loading…
Reference in New Issue
Block a user