Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

web: Sync generated JS classref with docs repository

Fabio Alessandrelli6c935d509ae7
diff --git a/doc/Makefile b/doc/Makefile
index 4e8f11dec28..7158967c3b3 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -28,4 +28,4 @@ rstjs:
rm -rf "$(OUTPUTDIR)/rstjs"
mkdir -p "$(OUTPUTDIR)/rstjs"
npm --prefix "$(JSDIR)" ci
- npm --prefix "$(JSDIR)" run docs > "$(OUTPUTDIR)/rstjs/html5_shell_classref.rst"
+ npm --prefix "$(JSDIR)" run --silent docs > "$(OUTPUTDIR)/rstjs/html5_shell_classref.rst"
diff --git a/platform/web/js/engine/config.js b/platform/web/js/engine/config.js
index ad52a2ae973..013a76530df 100644
--- a/platform/web/js/engine/config.js
+++ b/platform/web/js/engine/config.js
@@ -67,7 +67,7 @@ const InternalConfig = function (initConfig) { // eslint-disable-line no-unused-
* The canvas resize policy determines how the canvas should be resized by Godot.
*
* ``0`` means Godot won't do any resizing. This is useful if you want to control the canvas size from
- * javascript code in your template.
+ * JavaScript code in your template.
*
* ``1`` means Godot will resize the canvas on start, and when changing window size via engine functions.
*
@@ -155,7 +155,7 @@ const InternalConfig = function (initConfig) { // eslint-disable-line no-unused-
/**
* A callback function for handling Godot's ``OS.execute`` calls.
*
- * This is for example used in the Web Editor template to switch between project manager and editor, and for running the game.
+ * This is for example used in the Web Editor template to switch between Project Manager and editor, and for running the game.
*
* @callback EngineConfig.onExecute
* @param {string} path The path that Godot's wants executed.
diff --git a/platform/web/js/engine/engine.js b/platform/web/js/engine/engine.js
index 00dd5c9241e..9575681c4ff 100644
--- a/platform/web/js/engine/engine.js
+++ b/platform/web/js/engine/engine.js
@@ -72,7 +72,7 @@ const Engine = (function () {
* if it hasn't been loaded yet. See :js:meth:`Engine.load`.
*
* @param {string=} basePath Base path of the engine to load.
- * @return {Promise} A ``Promise`` that resolves once the engine is loaded and initialized.
+ * @return {Promise} A Promise that resolves once the engine is loaded and initialized.
*/
init: function (basePath) {
if (initPromise) {
@@ -141,7 +141,7 @@ const Engine = (function () {
* Fails if a canvas cannot be found on the page, or not specified in the configuration.
*
* @param {EngineConfig} override An optional configuration override.
- * @return {Promise} Promise that resolves once the engine started.
+ * @return {Promise} A Promise that resolves once the engine started.
*/
start: function (override) {
this.config.update(override);
@@ -191,7 +191,7 @@ const Engine = (function () {
* properties set (normally done by the editor during export).
*
* @param {EngineConfig} override An optional configuration override.
- * @return {Promise} Promise that resolves once the game started.
+ * @return {Promise} A Promise that resolves once the game started.
*/
startGame: function (override) {
this.config.update(override);
diff --git a/platform/web/js/engine/features.js b/platform/web/js/engine/features.js
index c366683dfaa..20b0500436e 100644
--- a/platform/web/js/engine/features.js
+++ b/platform/web/js/engine/features.js
@@ -38,7 +38,7 @@ const Features = {
* This value is dependent on Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy headers sent by the server.
*
* @returns {boolean} If the engine is running in a Secure Context.
- * @function Engine.isSecureContext
+ * @function Engine.isCrossOriginIsolated
*/
isCrossOriginIsolated: function () {
return window['crossOriginIsolated'] === true;
diff --git a/platform/web/js/jsdoc2rst/publish.js b/platform/web/js/jsdoc2rst/publish.js
index ad9c0fbaaa6..2c6ed5af896 100644
--- a/platform/web/js/jsdoc2rst/publish.js
+++ b/platform/web/js/jsdoc2rst/publish.js
@@ -4,6 +4,18 @@
const fs = require('fs');
+const HEADER = `\
+.. _doc_html5_shell_classref:
+
+:github_url: hide
+
+.. DO NOT EDIT THIS FILE!!!
+.. Generated automatically from Godot engine sources.
+.. Generator: https://github.com/godotengine/godot/blob/master/platform/web/js/jsdoc2rst/publish.js.
+.. JavaScript source: https://github.com/godotengine/godot/tree/master/platform/web/js/engine.
+
+`;
+
class JSDoclet {
constructor(doc) {
this.doc = doc;
@@ -217,7 +229,7 @@ function make_rst_object(f, obj) {
// Format members table and descriptions
const data = [['type', 'name']].concat(obj.members.map((m) => [m.type, `:js:attr:\`${m.name}\``]));
- f.write(make_header('Properties', '^'));
+ f.write(make_header('Properties', '~'));
format_table(f, data, 0);
make_rst_attribute(f, obj, 0, brief);
@@ -257,10 +269,10 @@ function make_rst_class(f, obj) {
const sfuncs = funcs.filter((m) => m.is_static());
const ifuncs = funcs.filter((m) => !m.is_static());
- f.write(make_header('Static Methods', '^'));
+ f.write(make_header('Static Methods', '~'));
format_table(f, sfuncs.map((m) => make_data(m)));
- f.write(make_header('Instance Methods', '^'));
+ f.write(make_header('Instance Methods', '~'));
format_table(f, ifuncs.map((m) => make_data(m)));
const sig = make_rst_signature(obj);
@@ -320,7 +332,7 @@ function generate(f, docs) {
}
});
- f.write('.. _doc_html5_shell_classref:\n\n');
+ f.write(HEADER);
globs.forEach((obj) => write_base_object(f, obj));
}