mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-26 17:06:51 +00:00
Add highlight plugin to /dev wiki
This commit is contained in:
parent
521e7f9b62
commit
12896ef1c4
@ -26,8 +26,7 @@ The scripts are designed to be executed with the current directory being the `Ti
|
||||
|
||||
The `package.json` in the root of the `build.jermolene.github.io` repository contains a dependency declaration that specifies the latest official released version of TiddlyWiki to be used when building the release targets:
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
"dependencies": {
|
||||
"tiddlywiki": "5.1.2"
|
||||
}
|
||||
@ -47,7 +46,7 @@ Some of the scripts use the following environment variables:
|
||||
|
||||
Builds the `tiddlywiki.com` target files. By default, it uses the version of tiddlywiki specified in the `package.json` file. This can be overridden with the ''TW5_BUILD_TIDDLYWIKI'' environment variable. The following command would select the latest prerelease version of tiddlywiki from the `TiddlyWiki5` directory:
|
||||
|
||||
```
|
||||
```bash
|
||||
TW5_BUILD_TIDDLYWIKI=./tiddlywiki.js
|
||||
```
|
||||
|
||||
|
@ -5,7 +5,7 @@ title: Data-Storage
|
||||
|
||||
TW has two approaches to save the user data. These approaches depends on way you use TW. either you use node.js as a server for TW its saves the tiddlers as plain text in different files or you use TW as standalone in a browser it persists the data within the HTML-File in two Div-Areas depending on whether the encryption of the TiddlyWiki is activated or not. If the TiddlyWiki is not encrypted the data is stored in the Div-Area called "~StoreArea". Every created Tiddler is stored in a own Div-area with a few custom values. An example of a saved Tiddler is shown below (\prettyref{lst:data-div}).
|
||||
|
||||
```
|
||||
```html
|
||||
<div created="20140611153703343" modified="20140611153734589" tags="testTag" testfield="testvalue" title="TestTiddler" type="text/plain">
|
||||
<pre>testText</pre>
|
||||
</div>
|
||||
|
@ -7,7 +7,7 @@ title: Datamodel
|
||||
|
||||
The micro-kernel creates a TiddlyWiki specific data-structure called tiddler. Here you have to separate the different definition of tiddlers. In the architectural view a tiddler is a JavaScript object holding some data. In the overall concept a tiddler is similar to a wiki page in a normal wiki application like wikipedia. In this section we describe the architectural view of a tiddler. The listing below shows the JSON representation of a tiddler object. During the runtime of the TiddlyWiki everything is saved an object like this. Without any plug-in the architecture is not able to persist any kind of data. All the data is stored in a store. This store is a JavaScript object. This store is constructed like a Map with a bunch of key value pairs. Every tiddler has its name as the key in the map and the JavaScript-Object as the value. The tiddler concept is the main data-model within TiddlyWiki, everything from data up to plug-ins is stored as a tiddler.
|
||||
|
||||
```
|
||||
```javascript
|
||||
{"fields":{
|
||||
"text":"example Text",
|
||||
"title":"Infrastruktur",
|
||||
|
@ -8,7 +8,7 @@ title: Messages
|
||||
Messages are events that are triggered by the user. They are generated by widgets for example when the user clicks on a ~ButtonWidget.
|
||||
Each message has a type property like "tm-delete-tiddler" and a parameter.
|
||||
|
||||
```
|
||||
```js
|
||||
{type: "tm-delete-tiddler", param: "MyOldTiddler"}
|
||||
```
|
||||
|
||||
|
@ -8,7 +8,7 @@ title: Module System
|
||||
After the boot kernel provides the functions used to load tiddlers, the rest of the TiddlyWiki application is loaded as modules.
|
||||
A module is a tiddler which has the type ``application/javascript`` and contains CommonJS compatible JavaScript code. This means a single module provides its public structures and functions in a variable called ``export``. Other modules can obtain these structures and functions by using a global ``require`` function.
|
||||
|
||||
```
|
||||
```js
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
// ...
|
||||
ButtonWidget.prototype = new Widget();
|
||||
|
@ -9,7 +9,7 @@ The first stage of WikiText processing is the parser.
|
||||
A Parser is provided by a module with ``module-type: parser`` and is responsible to transform block of text to a parse-tree.
|
||||
The parse-tree consists of nested nodes like
|
||||
|
||||
```
|
||||
```js
|
||||
{type: "element", tag: <string>, attributes: {}, children: []} - an HTML element
|
||||
{type: "text", text: <string>} - a text node
|
||||
{type: "entity", value: <string>} - an HTML entity like © for a copyright symbol
|
||||
@ -26,14 +26,15 @@ But the html-rule has another special purpose. By parsing the HTML tag syntax it
|
||||
It the recognises them by the $ character at the beginning of the tag name and instead of producing "element" nodes
|
||||
it uses the tag name for the type:
|
||||
|
||||
```
|
||||
```js
|
||||
{type: "list", tag: "$list", attributes: {}, children: []} - a list element
|
||||
```
|
||||
|
||||
The [[Widgets]] part will reveal why this makes sense and how each node is transformed into a widget.
|
||||
Another special characteristic of the html-rule or the parse nodes in general is the attributes property.
|
||||
Attributes in the parse-tree are not stored as simple strings but they are nodes of its own to make indirect text references available as attributes as described in [[Widgets]]:
|
||||
|
||||
```
|
||||
```js
|
||||
{type: "string", value: <string>} - literal string
|
||||
{type: "indirect", textReference: <textReference>} - indirect through a text reference
|
||||
```
|
@ -5,7 +5,7 @@ title: Persist data
|
||||
|
||||
TiddlyWiki supports a wide range of methods to persist your data. One of this methods is the HTML5 fallback saver. This methods works on almost every browser. With this method a copy of the entire wiki will be downloaded by the browser. This means you get a new file everytime you hit the save button. To avoid this and because every Browser has a different API to allow writing direct to the file system there a some plugins for the different browsers. These plug-ins allow the user to save direct to the current open TiddlyWiki-File. The Listing below shows the HTML5-compliant to save the changes via the HTML5 fallback saver by downloading the TW as a complete HTML-file.
|
||||
|
||||
```
|
||||
```js
|
||||
DownloadSaver.prototype.save = function(text,method,callback) {
|
||||
...
|
||||
var link = document.createElement("a");
|
||||
|
@ -17,9 +17,10 @@ This way every time a tiddler or the wiki store itself changes, each widget can
|
||||
|
||||
Another way of updating are text reference attributes (text references explained in [[Transclusion and TextReference]]):
|
||||
|
||||
```
|
||||
```js
|
||||
{type: "indirect", textReference: <textReference>}
|
||||
```
|
||||
|
||||
When a widget got a attribute which is a text reference and the refresh function is called, it can check if the text reference references a changed tiddler and update accordingly.
|
||||
|
||||
Nearly every state of the UI is stored in tiddlers. A search mechanism for example would use a ~EditTextWidget which shows an text input field for the search string and a ListWidget to show the results.
|
||||
|
@ -7,7 +7,7 @@ title: Startup Process
|
||||
|
||||
Modules with ``module-type: startup`` have to export a function named ``startup`` and may export a name property to identify this module. The startup function will be executed by the boot kernel at the end of the boot process.
|
||||
|
||||
```
|
||||
```js
|
||||
// From boot.js:
|
||||
// Gather up any startup modules
|
||||
$tw.boot.remainingStartupModules = []; // Array of startup modules
|
||||
|
@ -27,6 +27,7 @@ Filters are noted as strings and can look like
|
||||
```
|
||||
[tag[task]!tag[done]interesting[very]]
|
||||
```
|
||||
|
||||
This example would (implicitly) put all available tiddlers into the pipe.
|
||||
The first operator ``tag[task]`` would only pass tiddlers which are tagged with "task".
|
||||
The ``!tag[done]`` operator is negated and only passes tiddlers which are not tagged with "done".
|
||||
@ -39,6 +40,7 @@ An example would be the search-operator. This filter operator looks for the sear
|
||||
If the provided filter operators are not enough, a developer can add new filters by adding a module with the ``filteroperator`` type.
|
||||
|
||||
!!! System Tags
|
||||
|
||||
Tags and the filter mechanism are used throughout the core plug-in for internal puproses.
|
||||
Tags which start with ``$:/`` are normally hidden from the casual user, similar to [[System Tiddlers]]
|
||||
|
||||
|
@ -14,9 +14,10 @@ When a widget gets a parse node with child nodes it must create the correspondin
|
||||
All this functionality is basically provided with the base widget. But when creating the widget for a parse node it loads additional modules with ``module-type: widget``. These modules can export multiple widgets which extend the base widget and can override it's methods like the rendering and refresh functions.
|
||||
As described in [[Parser]] each parse node contains a "type" property. This type directly determines which widget module is used.
|
||||
|
||||
```
|
||||
```js
|
||||
{type: "text", text: <string>} - a text node
|
||||
```
|
||||
|
||||
Would be transformed to a [[TextWidget|$:/core/modules/widgets/text.js]].
|
||||
(Note that the ~TextWidget module exports a property "text".)
|
||||
|
||||
|
@ -28,21 +28,21 @@ Choose a location in your file system (eg TW5) for your plugin project; issue co
|
||||
|
||||
!!! 1. Create the directory
|
||||
|
||||
```
|
||||
```bash
|
||||
mkdir TW5
|
||||
|
||||
```
|
||||
|
||||
!!! 2. Make a local read-only copy of the ~TiddlyWiki5 repository
|
||||
|
||||
```
|
||||
```bash
|
||||
git clone https://github.com/Jermolene/TiddlyWiki5.git TW5
|
||||
|
||||
```
|
||||
|
||||
!!! 3. Make a directory for your plugin
|
||||
|
||||
```
|
||||
```bash
|
||||
cd TW5
|
||||
cd plugins
|
||||
mkdir yourname
|
||||
@ -53,20 +53,20 @@ mkdir pluginname
|
||||
|
||||
!!! 4. Make a local copy of your plugin repository
|
||||
|
||||
```
|
||||
```bash
|
||||
git clone https://github.com/yourgithub/pluginname.git pluginname
|
||||
|
||||
```
|
||||
!!! 5. Go to your files
|
||||
|
||||
```
|
||||
```bash
|
||||
cd pluginname
|
||||
|
||||
```
|
||||
|
||||
Create the file plugin.info with content:
|
||||
|
||||
```
|
||||
```js
|
||||
{
|
||||
"title": "$:/plugins/yourgithub/pluginname",
|
||||
"description": "summary of the plugin's purpose",
|
||||
@ -89,7 +89,7 @@ Modify `editions/tw5.com/tiddlywiki.info` to include a reference to your plugin
|
||||
|
||||
From the TW5 directory issue the command
|
||||
|
||||
```
|
||||
```bash
|
||||
node ./tiddlywiki.js editions/tw5.com --build index
|
||||
```
|
||||
|
||||
@ -101,18 +101,18 @@ From `plugins/yourname/pluginname/` issue commands to:
|
||||
|
||||
!!! 1. Add all files
|
||||
|
||||
```
|
||||
```bash
|
||||
git add -A
|
||||
```
|
||||
|
||||
!!! 2. Commit to your local repository
|
||||
|
||||
```
|
||||
```bash
|
||||
git commit -am "something meaningful about this check in"
|
||||
```
|
||||
|
||||
!!! 3. Copy local changes to github
|
||||
|
||||
```
|
||||
```bash
|
||||
git push
|
||||
```
|
||||
|
@ -28,7 +28,7 @@ type: text/vnd.tiddlywiki
|
||||
|
||||
Content of `plugin.info` for Joe Bloggs' Welsh translation:
|
||||
|
||||
```
|
||||
```js
|
||||
{
|
||||
"title": "$:/languages/cy-GB",
|
||||
"name": "cy-GB",
|
||||
|
@ -37,7 +37,7 @@ Click the link to the plugin tiddler to open it. Assuming it doesn't currently e
|
||||
|
||||
Then in the body of the tiddler, insert:
|
||||
|
||||
```
|
||||
```js
|
||||
{"tiddlers": {}}
|
||||
```
|
||||
|
||||
@ -51,7 +51,7 @@ Create the payload tiddlers by clicking on the links in the ''HelloThere'' tiddl
|
||||
|
||||
Open the browser developer console, and type the following JavaScript statement, but first change the first parameter to the name of your plugin. The second parameter is an optional array of tiddler titles to be added to the plugin:
|
||||
|
||||
```
|
||||
```js
|
||||
$tw.utils.repackPlugin("$:/plugins/yourname/pluginname",["$:/plugins/yourname/pluginname/mywidget.js"])
|
||||
```
|
||||
|
||||
@ -67,7 +67,7 @@ To test the plugin, first make sure that it has been packed. Then save changes a
|
||||
|
||||
Once you've built the plugin for the first time you can omit the second parameter to `repackPlugin()` unless you are adding a new tiddler:
|
||||
|
||||
```
|
||||
```js
|
||||
$tw.utils.repackPlugin("$:/plugins/yourname/pluginname")
|
||||
```
|
||||
|
||||
@ -75,7 +75,7 @@ $tw.utils.repackPlugin("$:/plugins/yourname/pluginname")
|
||||
|
||||
To remove tiddlers from the plugin specify their titles in the optional third parameter:
|
||||
|
||||
```
|
||||
```jss
|
||||
$tw.utils.repackPlugin("$:/plugins/yourname/pluginname",null,["$:/plugins/yourname/pluginname/mywidget.js"])
|
||||
```
|
||||
|
||||
|
@ -20,7 +20,7 @@ One blank line is used to separate blocks of code. Occasional blank lines are pe
|
||||
|
||||
See the following example for layout of basic JavaScript constructs:
|
||||
|
||||
```
|
||||
```js
|
||||
/*
|
||||
Multiline comments are used to introduce a block of code such as a function definition
|
||||
*/
|
||||
|
@ -11,7 +11,7 @@ type: text/vnd.tiddlywiki
|
||||
## The appropriate copy of [[node-webkit]] for your platform, downloaded from https://github.com/rogerwang/node-webkit
|
||||
## Your TiddlyWiki HTML file as `index.html`
|
||||
## A file called `package.json` with the following content:
|
||||
##> {{packge.json for node-webkit}}
|
||||
##> {{package.json for node-webkit}}
|
||||
# Run the [[node-webkit]] application
|
||||
#* If it doesn't work, you may need to unblock the application before your operating system will run it
|
||||
#** OS X: see http://support.apple.com/kb/PH14369
|
||||
|
@ -9,7 +9,7 @@ title: TiddlyWiki5 Development Environment
|
||||
|
||||
[[Installing TiddlyWiki5]] with NPM downloads a snapshot release of TiddlyWIki5. To use a development copy of the TiddlyWiki5 repository instead of the copy installed by [[NPM]], use this command within the root of the TiddlyWiki5 repo:
|
||||
|
||||
```
|
||||
```bash
|
||||
npm link
|
||||
```
|
||||
|
||||
@ -17,7 +17,7 @@ npm link
|
||||
|
||||
As releases are made during development it is necessary to adjust the version number of the TiddlyWiki5 core. This is done with the [[npm version|https://npmjs.org/doc/version.html]] command. For example:
|
||||
|
||||
```
|
||||
```bash
|
||||
npm version 5.0.0-alpha.10
|
||||
```
|
||||
|
||||
|
@ -5,7 +5,9 @@ type: text/vnd.tiddlywiki
|
||||
|
||||
The hook mechanism provides a way for plugins to intercept and modify default functionality. Hooks are added as follows:
|
||||
|
||||
``$tw.hooks.addHook(name,handler);``
|
||||
```js
|
||||
$tw.hooks.addHook(name,handler);
|
||||
```
|
||||
|
||||
Multiple handlers can be assigned to the same name using repeated calls. When a hook is invoked by name all registered functions will be called sequentially in their order of addition.
|
||||
|
||||
@ -15,7 +17,7 @@ Though not essential care should be taken to ensure that hooks are added before
|
||||
|
||||
A working example of a hook that adds "test" to the default tiddlers.
|
||||
|
||||
```javascript
|
||||
```js
|
||||
$tw.hooks.addHook("th-opening-default-tiddlers-list",function(list) {
|
||||
list.push("test");
|
||||
return list;
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"description": "Developer documentation from http://tiddlywiki.com/dev/",
|
||||
"plugins": [
|
||||
"tiddlywiki/highlight",
|
||||
"tiddlywiki/cecily",
|
||||
"tiddlywiki/googleanalytics",
|
||||
"tiddlywiki/nodewebkitsaver",
|
||||
|
Loading…
Reference in New Issue
Block a user