mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
small tweaks for docs/JSON
This commit is contained in:
parent
1dccab89fa
commit
f843f52f83
@ -16,7 +16,7 @@
|
||||
|
||||
#include "jswrap_font_monofonto_120.h"
|
||||
#include "jswrap_graphics.h"
|
||||
|
||||
/* DO_NOT_INCLUDE_IN_DOCS - this is a special token for common.py */
|
||||
// Monofonto (digits and colon only, for clock display) at 2bpp. Nominal height: 145px, cap height: 120px, total height = 120px
|
||||
|
||||
// Fixed width: 73px
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
* Contains Custom Fonts
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* DO_NOT_INCLUDE_IN_DOCS - this is a special token for common.py */
|
||||
#include "jswrap_font_monofonto_16.h"
|
||||
#include "jswrap_graphics.h"
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
* Contains Custom Fonts
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* DO_NOT_INCLUDE_IN_DOCS - this is a special token for common.py */
|
||||
#include "jswrap_font_monofonto_18.h"
|
||||
#include "jswrap_graphics.h"
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
* Contains Custom Fonts
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* DO_NOT_INCLUDE_IN_DOCS - this is a special token for common.py */
|
||||
#include "jswrap_font_monofonto_23.h"
|
||||
#include "jswrap_graphics.h"
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
* Contains Custom Fonts
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* DO_NOT_INCLUDE_IN_DOCS - this is a special token for common.py */
|
||||
#include "jswrap_font_monofonto_28.h"
|
||||
#include "jswrap_graphics.h"
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
* Contains Custom Fonts
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* DO_NOT_INCLUDE_IN_DOCS - this is a special token for common.py */
|
||||
#include "jswrap_font_monofonto_36.h"
|
||||
#include "jswrap_graphics.h"
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
* Contains Custom Fonts
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* DO_NOT_INCLUDE_IN_DOCS - this is a special token for common.py */
|
||||
#include "jswrap_font_monofonto_96.h"
|
||||
#include "jswrap_graphics.h"
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ Builtin.prototype.getURL = function() {
|
||||
anchor = this.class;
|
||||
else if ("class" in this)
|
||||
anchor = "l_"+this.class+"_"+this.name;
|
||||
else
|
||||
else
|
||||
anchor = "l__global_"+this.name;
|
||||
return "http://www.espruino.com/Reference#"+anchor;
|
||||
};
|
||||
@ -44,12 +44,12 @@ function getBasicTernType(t) {
|
||||
}
|
||||
|
||||
/// Get full Tern type - for tern.js json format
|
||||
Builtin.prototype.getTernType = function() {
|
||||
Builtin.prototype.getTernType = function() {
|
||||
if (["class","library"].indexOf(this.type)>=0) {
|
||||
return "fn()";
|
||||
} else if (["function","method","staticmethod","constructor"].indexOf(this.type)>=0) {
|
||||
// it's a function
|
||||
var args = [];
|
||||
var args = [];
|
||||
if ("params" in this)
|
||||
args = this.params.map(function (p) {
|
||||
if (p[0]=="pin" && p[1]=="JsVar")
|
||||
@ -59,8 +59,8 @@ Builtin.prototype.getTernType = function() {
|
||||
var ret = "";
|
||||
if ("return_object" in this)
|
||||
ret = " -> +"+this.return_object
|
||||
else if ("return" in this)
|
||||
ret = " -> "+getBasicTernType(this.return[0]);
|
||||
else if ("return" in this)
|
||||
ret = " -> "+getBasicTernType(this.return[0]);
|
||||
return "fn("+args.join("\, ")+")"+ret;
|
||||
} else {
|
||||
return getBasicTernType(this.return[0]);
|
||||
@ -78,6 +78,9 @@ exports.getWrapperFiles = function (callback) {
|
||||
/// Extract the /*JSON ... */ comments from a file and parse them
|
||||
exports.readWrapperFile = function(filename) {
|
||||
var contents = fs.readFileSync(filename).toString();
|
||||
if (contents.includes("DO_NOT_INCLUDE_IN_DOCS")) {
|
||||
return [[],[]]; // don't include jswrap files with the no-docs marker in them
|
||||
}
|
||||
var builtins = [];
|
||||
var types = [];
|
||||
var comments = contents.match( /\/\*JSON(?:(?!\*\/).|[\n\r])*\*\//g );
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user