Commit 741efe72 authored by Leon Arnott's avatar Leon Arnott
Browse files

Fixed another documentation bug whereby capitalisation of type names in macros signatures was lost.

Also, a few type-checks in the main codebase were made slightly more resilient for some reason.
parent e32b2c9e9811
...@@ -50,7 +50,7 @@ define([ ...@@ -50,7 +50,7 @@ define([
/* /*
If result is a ChangerCommand, please run it. If result is a ChangerCommand, please run it.
*/ */
if (result && typeof result === "object" && result.changer) { if (result && typeof result === "object" && ChangerCommand.isPrototypeOf(result)) {
const enabled = this.renderInto( const enabled = this.renderInto(
/* /*
The use of popAttr prevents the hook from executing normally The use of popAttr prevents the hook from executing normally
...@@ -275,7 +275,7 @@ define([ ...@@ -275,7 +275,7 @@ define([
|| Array.isArray(result) || Array.isArray(result)
|| Colour.isPrototypeOf(result))) || Colour.isPrototypeOf(result)))
// However, commands will cleanly "detach" without any error resulting. // However, commands will cleanly "detach" without any error resulting.
|| (result && result.TwineScript_Print && !result.changer)) { || (result && result.TwineScript_Print && !ChangerCommand.isPrototypeOf(result))) {
/* /*
TwineScript_Print(), when called by printBuiltinValue(), typically emits TwineScript_Print(), when called by printBuiltinValue(), typically emits
side-effects. These will occur... now. side-effects. These will occur... now.
...@@ -321,7 +321,7 @@ define([ ...@@ -321,7 +321,7 @@ define([
/* /*
The only remaining values should be unattached changers, or booleans. The only remaining values should be unattached changers, or booleans.
*/ */
else if (!(result.changer || typeof result === "boolean")) { else if (!(ChangerCommand.isPrototypeOf(result) || typeof result === "boolean")) {
Utils.impossible('Section.runExpression', "The expression evaluated to an unknown value: " + result.toSource()); Utils.impossible('Section.runExpression', "The expression evaluated to an unknown value: " + result.toSource());
} }
} }
...@@ -730,7 +730,7 @@ define([ ...@@ -730,7 +730,7 @@ define([
Honestly, having non-changer descriptor-altering objects Honestly, having non-changer descriptor-altering objects
is a bit displeasingly rough-n-ready, but it's convenient... is a bit displeasingly rough-n-ready, but it's convenient...
*/ */
if (!changer.changer) { if (!ChangerCommand.isPrototypeOf(changer)) {
Object.assign(desc, changer); Object.assign(desc, changer);
} }
else { else {
......
...@@ -290,7 +290,7 @@ define(['utils', 'datatypes/hookset', 'internaltypes/twineerror'], ({impossible, ...@@ -290,7 +290,7 @@ define(['utils', 'datatypes/hookset', 'internaltypes/twineerror'], ({impossible,
/* /*
First, check for the "either" type descriptor. First, check for the "either" type descriptor.
*/ */
if (obj.innerType) { if (Object.getPrototypeOf(obj) === Object.prototype && obj.innerType) {
if (obj.pattern === "either") { if (obj.pattern === "either") {
if(!Array.isArray(obj.innerType)) { if(!Array.isArray(obj.innerType)) {
impossible("typeName",'"either" pattern had non-array inner type'); impossible("typeName",'"either" pattern had non-array inner type');
......
...@@ -278,7 +278,7 @@ const ...@@ -278,7 +278,7 @@ const
const {1:category, 2:categoryOrder} = (categoryTag.exec(text) || {}); const {1:category, 2:categoryOrder} = (categoryTag.exec(text) || {});
const [,...aka] = ((macroAliases.exec(text) || [''])[0].match(macroEmpty) || []).map(e=> (new RegExp(macroEmpty).exec(e) || [])[1]) || []; const aka = ((macroAliases.exec(text) || [''])[0].match(macroEmpty) || []).map(e=> (new RegExp(macroEmpty).exec(e) || [])[1]) || [];
text = processTextTerms(text, name, {typeNames: true, macroNames:true}); text = processTextTerms(text, name, {typeNames: true, macroNames:true});
...@@ -314,8 +314,8 @@ function processTextTerms(text, name, allow) { ...@@ -314,8 +314,8 @@ function processTextTerms(text, name, allow) {
headingMatch = /<h2[^]+?<\/h2>/g.exec(text); headingMatch = /<h2[^]+?<\/h2>/g.exec(text);
const linkFn = { const linkFn = {
markdown: (name, type, text = name.toLowerCase()) => "[" + text + "](#" + type + "_" + name + ")", markdown: (name, type, text = name) => "[" + text + "](#" + type + "_" + name.toLowerCase() + ")",
dokuwiki: (name, type, text = name.toLowerCase()) => "[[harlowe:" + name + "|" + text + "]]", dokuwiki: (name, type, text = name) => "[[harlowe:" + name.toLowerCase() + "|" + text + "]]",
}[process.argv.includes("--doku") ? "dokuwiki" : "markdown"]; }[process.argv.includes("--doku") ? "dokuwiki" : "markdown"];
text = text =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment