Creates new instance of TadLibarary class. The construction specifies default settings values, and merges in the values form the settings file. It will also automatically load test libraries if the loading setting for test libraries is enabled.
A set of key value pairs which describe a name for an action (key) and the name of the Drafts action to be run (value). This is used by actions that, for example, allow the user to select from a subset of actions via a prompt, and then run the action.
An array of the library authors. Any value held in the settings file is overridden by the internal library processing, and is set to TAD_AUTHORS.
Delimiter for cross-links in a back links section of a draft.
Prefix for a cross-link in a back links section of a draft.
Used to denote the end of a back links section in a draft.
Used to denote the start of a back links section in a draft.
Suffix for a cross-link in a back links section of a draft.
The name to give the Beautifier.js library when it is downloaded locally.
The default is beautifier
, and so the library will be downloaded to beautfier.js
.
The `.js extension should be omitted form the library name.
The name of the JSON file in the /Library/Scripts/
folder that overrides the default library
settingds for the beautifier library. Can be specified with or without the .json
file extension.
The default is beautifier.json
.
The URL to download the Beautifier.js library from when updating.
Used to specify the maximum number of characters shown in the list of drafts in the
draft.TA_getRecentDraftData()
listing.
A set of key value pairs which describe the string of characters for a slash command (key), and the details of the command (value). These are used by the library's slash command functionality.
When debug messages are enabled, any debug messages written to the console log using one of the library's debug functions will prefix the console item with this string.
When error messages are written to the console log using one of the library's error logging functions, the message will prefix the console item with this string.
When information messages are written to the console log using one of the library's information logging functions, the message will prefix the console item with this string.
When success messages are written to the console log using one of the library's success logging functions, the message will prefix the console item with this string.
When warning messages are written to the console log using one of the library's warning logging functions, the message will prefix the console item with this string.
The copyright information for the library.
This includes the copyright period, author list, and a reference to the main web site, ThoughtAsylum.
Any value held in the settings file is overridden by the internal library processing, and is set to "Copyright " + this.copyrightPeriod + ": " + this.authors.join(", ") + " (ThoughtAsylum)."
.
The period for which the license copyright is applied.
Development of the library began in 2018, and copyright is taken to extend from that year to the current.
Any value held in the settings file is overridden by the internal library processing, and is set to "2018 - " + dtNow.getFullYear()
.
The name to give the cryptographic JavaScript library when it is downloaded locally.
The default is crypto-js
, and so the library will be downloaded to crypto-js.js
.
The `.js extension should be omitted form the library name.
The URL to download the cryptographic JavaScript library from when updating.
The path to the library persistent data file.
Enables a debug mode state
The natural default for this is off. You can set it on and off at the start of a script, for the duration of that script by using this
line: tadLib.debugEnabled = true
;
A set of JSON that describes a particular type of special draft. In this case the draft is one used for writing Discourse posts. The are drafts is described by a set of properties that can be used by library functions as a point of reference when working with this type of draft.
The properties for such a draft are:
tags
: an array of tag names for tags that would be associated with the draft.syntax
: the draft syntax that would be used for this type of draft.extension
: the file extension that would be used if this type of draft were to be exported to a file.A set of JSON that describes a particular type of special draft. In this case the draft is one used for writing GitHub Markdown content. The are drafts is described by a set of properties that can be used by library functions as a point of reference when working with this type of draft.
The properties for such a draft are:
tags
: an array of tag names for tags that would be associated with the draft.syntax
: the draft syntax that would be used for this type of draft.extension
: the file extension that would be used if this type of draft were to be exported to a file.
/**A set of JSON that describes a particular type of special draft. In this case the draft is one used for writing JavaScript. The are drafts is described by a set of properties that can be used by library functions as a point of reference when working with this type of draft.
The properties for such a draft are:
tags
: an array of tag names for tags that would be associated with the draft.syntax
: the draft syntax that would be used for this type of draft.extension
: the file extension that would be used if this type of draft were to be exported to a file.A set of JSON that describes a particular type of special draft. In this case the draft is one used for writing Markdown content. The are drafts is described by a set of properties that can be used by library functions as a point of reference when working with this type of draft.
The properties for such a draft are:
tags
: an array of tag names for tags that would be associated with the draft.syntax
: the draft syntax that would be used for this type of draft.extension
: the file extension that would be used if this type of draft were to be exported to a file.
/**A set of JSON that describes a particular type of special draft. In this case the draft is one used for writing MultiMarkdown content. The are drafts is described by a set of properties that can be used by library functions as a point of reference when working with this type of draft.
The properties for such a draft are:
tags
: an array of tag names for tags that would be associated with the draft.syntax
: the draft syntax that would be used for this type of draft.extension
: the file extension that would be used if this type of draft were to be exported to a file.
/**A set of JSON that describes a particular type of special draft. In this case the draft is one used for writing plain text content. The are drafts is described by a set of properties that can be used by library functions as a point of reference when working with this type of draft.
The properties for such a draft are:
tags
: an array of tag names for tags that would be associated with the draft.syntax
: the draft syntax that would be used for this type of draft.extension
: the file extension that would be used if this type of draft were to be exported to a file.
/**A set of JSON that describes a particular type of special draft. In this case the draft is one used for writing simple list content. The are drafts is described by a set of properties that can be used by library functions as a point of reference when working with this type of draft.
The properties for such a draft are:
tags
: an array of tag names for tags that would be associated with the draft.syntax
: the draft syntax that would be used for this type of draft.extension
: the file extension that would be used if this type of draft were to be exported to a file.
/**A set of JSON that describes a particular type of special draft. In this case the draft is one used for writing a Taskpaper list. The are drafts is described by a set of properties that can be used by library functions as a point of reference when working with this type of draft.
The properties for such a draft are:
tags
: an array of tag names for tags that would be associated with the draft.syntax
: the draft syntax that would be used for this type of draft.extension
: the file extension that would be used if this type of draft were to be exported to a file.Used by the editor
function TA_repeatDuplicateCurrentLineAsk
. It specified the default number of line
duplications to offer to the user when prompted to duplicate lines a number of times.
A set of URL encoding mappings used by the String
function TA_encodeURI()
to encode additional characters
beyond those converted by encodeURIComponent()
.
The file name of the library.
The URL where the latest version of the library can be downloaded.
The path to the library meta data file.
The string displayed as the title on a debug message box - see app.TA_msgDebug()
.
The string displayed as the title on an error message box - see app.TA_msgError()
.
The string displayed as the title on an information message box - see app.TA_msgInfo()
.
The string displayed as the title on an warning message box - see app.TA_msgWarn()
.
The folder which will be used for the search of a draft with a matching tag for running. See runTag
.
The syntax to be applied to a draft for content execution.
The name of a tag used for identifying current in-situ code testing.
The name of a tag used to identify scripts. The intent is that while you only have one draft assigned therunTag
at any time, this tag would be assigned to all that have been runnable to help you identify them after switching
the runTag
to another draft.
The string used to separate elements in a date stamp.
The string used to separate a date stamp and a time stamp in a full timestamp.
The string used to separate elements in a time stamp.
The path to the library settings file.
The url of the web site for the library. Any value held in the settings file is overridden by the internal library processing, and is set to TAD_SOURCE.
The string that deontes a completed basic task.
e.g. X
The suffix for a basic task marker.
e.g. ]
The string that deontes a basic task has not been completed.
e.g.
The prefix for a basic task marker.
e.g. - [
The draft syntax to use when utilising basic tasks
The string used to define the query for drafts based templates. This could be for example
"inbox"
, "archive"
, or "all"
.
Specifies an array of tag names used to define the query for drafts based templates.
This could be for example be "[template"]
.
Used to specify whether when additional library files are loaded for testing, if an audio/visual notification should be
triggered. The default is true
, and will trigger the information message and sound to be activated.
Used to specify whether additional library files should be loaded for testing.
Typically this should be kept as false
, unless you were developing further extensions to the library.
But, it is available should anyone wish to add and manage the requirement of their own libraries in this way.
The list of libraries to be loaded is specified by the path stored in the testLibsListPath
property.
Used to specify a list of additional library files that may be loaded for testing.
The path should be to a plain text file where the file name for each library file to be loaded should be
stored on separate lines. They should be the only things on those lines. No comments, indents, etc.
Typically this should be left as is and is for use by the library developer(s).
However, it is available should anyone wish to add and manage the requirement of their own libraries in this way.
The loading of the libraries occurs at initialisation of the global libarary object and only when the testLibsEnable
property is set to true
; which given when the libraries are loaded and it being false
by default, it must be
specified in the settings file prior to triggering the script/action.
The version of the library. This is useful when checking if you have the latest version, or for identifying a version where there may have been a bug, new feature added/deprecated, etc. Any value held in the settings file is overridden by the internal library processing, and set to TAD_VERSION.
Used to quickly replace the TAD-Library action contents from the tad.js library file.
// Example
tadLib.TA_buildLibraryAction();
Copy a set of options for displaying a set of settings to the clipboard. The user has the option to copy the loaded library settings as text, as stringified text (JSON), or the saved settings from file as stringified text (JSON). The function returns the copied text.
// Example
tadLib.TA_copySettings();
Copy the current settings for the library object to the clipboard.
The settings are returned with a property and its description separated by an equality character (=
)
between them, and with each key-value pair on a separate line. The results are also sorted alphabetically.
Any settings that are themselves objects are simply returned as an object.
The function returns the copied text.
// Example
tadLib.TA_copySettingsLoaded();
Copy the current settings for the library object as a text representation of JSON to the clipboard. The text copied is a 'stringified' version of the library object. The function returns the copied text.
// Example
tadLib.TA_copySettingsLoadedJSON();
Copy the persistent library settings that are saved to file, as a text representation of JSON to the clipboard.
The settings are read from the JSON file specified by the settingsPath
property.
These settings can be different from the currently loaded settings in that there may be default settings in the
locaded settings that overide those in the settings file, are defaults from the file that have not yet been
saved, or settings that have been updated by the flow of a script since loading the settings from file.
The function returns the copied text.
// Example
tadLib.TA_copySettingsSavedJSON();
Display a set of options for displaying a set of settings and show the selected settings. The user has the option to display the loaded library settings as text, as stringified text (JSON), or the saved settings from file as stringified text (JSON). The function returns the displayed text.
// Example
tadLib.TA_displaySettings();
Display the current settings for the library object in a pop up.
The settings are returned with a property and its description separated by an equality character (=
)
between them, and with each key-value pair on a separate line. The results are also sorted alphabetically.
Any settings that are themselves objects are simply returned as an object.
The function returns the displayed text.
// Example
tadLib.TA_displaySettingsLoaded();
Display the current settings for the library object as a text representation of JSON in a pop up. The text displayed is a 'stringified' version of the library object. The function returns the displayed text.
// Example
tadLib.TA_displaySettingsLoadedJSON();
Display the persistent library settings fthat are saved to file, as a text representation of JSON in a pop up.
The settings are read from the JSON file specified by the settingsPath
property.
These settings can be different from the currently loaded settings in that there may be default settings in the
locaded settings that overide those in the settings file, are defaults from the file that have not yet been
saved, or settings that have been updated by the flow of a script since loading the settings from file.
The function returns the displayed text.
// Example
tadLib.TA_displaySettingsSavedJSON();
Display TADpoLe version information in an HTML prompt window.
Information includes the current local version number, current online version nunmber, and and assessment of
which is ahead. The TADpoLe logo is also displayed in the window alongside the information. The user may close the
window by selecting OK, or pressing ESC
on their keyboard.
// Example
tadLib.TA_displayVersionInfo();
Get the library settings of the library object as a string of text.
The settings are returned with a property and its description separated by an equality character (=
)
between them, and with each key-value pair on a separate line. The results are also sorted alphabetically.
Any settings that are themselves objects are simply returned as an object. If you want to view all details at all
levels, a better way to do this is to stringify()
the library object.
for convenience.
// Example
tadLib.TA_getSettingsLoaded();
Get the persistent library settings that are saved to file as a JSON formatted string of text.
The settings are read from the JSON file specified by the settingsPath
property.
These settings can be different from the currently loaded settings in that there may be default settings in the
locaded settings that overide those in the settings file, are defaults from the file that have not yet been
saved, or settings that have been updated by the flow of a script since loading the settings from file.
// Example
tadLib.TA_getSettingsSavedJSON();
Initialises the library settings.
Settings are stored in the file specified by the settingsPath
property.
This is called at the point of creating a new library object, and should never need to be called outside of that.
The location of the library settings file is set as /Library/Scripts/tad.json
by deafult, within the Drafts standard folder structure.
Load additional library files for testing.
Libraries to load are stored one per line in the file specified by the testLibsListPath
property.
Returns true if libraries are loaded.
Saves the latest library settings to file.
Settings are stored in the file specified by the settingsPath
property.
// Example
tadLib.TA_save();
Returns the version number of the latest version of TADpoLe published online.
The value is read from https://tadpole.thoughtasylum.com/assets/library/tad-ver.txt
and is returned as a number, not a string.
The file and value are automatically added to the web site by the automated build process for the library.
// Example
alert(tadLib.TA_versionOnline());
TadLibrary (Library)
This is a class that holds information about this library and allows interactions such as reading and updating the information.