mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
First pass at an --editions
command
Also added a “description” field for wiki folders. Right now there’s too many editions listed. I think we should by default only list editions whose `tiddlywiki.info` file has `showInListings` set to `true`, and have an `--editions all` command that lists everything. @pmario please could you check that the editions in your `TIDDLYWIKI_EDITION_PATH` are correctly listed?
This commit is contained in:
parent
3d07b11894
commit
04d26e6fae
8
core/language/en-GB/Help/editions.tid
Normal file
8
core/language/en-GB/Help/editions.tid
Normal file
@ -0,0 +1,8 @@
|
||||
title: $:/language/Help/editions
|
||||
description: Lists the available editions of TiddlyWiki
|
||||
|
||||
Lists the names and descriptions of the available editions. You can create a new wiki of a specified edition with the `--init` command.
|
||||
|
||||
```
|
||||
--editions
|
||||
```
|
@ -20,4 +20,4 @@ Note:
|
||||
* The init command will fail if the wiki folder is not empty
|
||||
* The init command removes any `includeWikis` definitions in the edition's `tiddlywiki.info` file
|
||||
* When multiple editions are specified, editions initialised later will overwrite any files shared with earlier editions (so, the final `tiddlywiki.info` file will be copied from the last edition)
|
||||
* `--help editions` returns a list of available editions
|
||||
* `--editions` returns a list of available editions
|
||||
|
62
core/modules/commands/editions.js
Normal file
62
core/modules/commands/editions.js
Normal file
@ -0,0 +1,62 @@
|
||||
/*\
|
||||
title: $:/core/modules/commands/editions.js
|
||||
type: application/javascript
|
||||
module-type: command
|
||||
|
||||
Command to list the available editions
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.info = {
|
||||
name: "editions",
|
||||
synchronous: true
|
||||
};
|
||||
|
||||
var Command = function(params,commander) {
|
||||
this.params = params;
|
||||
this.commander = commander;
|
||||
};
|
||||
|
||||
Command.prototype.execute = function() {
|
||||
var fs = require("fs"),
|
||||
path = require("path"),
|
||||
self = this;
|
||||
// Enumerate the edition paths
|
||||
var editionPaths = $tw.getLibraryItemSearchPaths($tw.config.editionsPath,$tw.config.editionsEnvVar),
|
||||
editions = {};
|
||||
for(var editionIndex=0; editionIndex<editionPaths.length; editionIndex++) {
|
||||
var editionPath = editionPaths[editionIndex];
|
||||
// Enumerate the folders
|
||||
var entries = fs.readdirSync(editionPath);
|
||||
for(var entryIndex=0; entryIndex<entries.length; entryIndex++) {
|
||||
var entry = entries[entryIndex];
|
||||
// Check if directories have a valid tiddlywiki.info
|
||||
if(!editions[entry] && $tw.utils.isDirectory(path.resolve(editionPath,entry))) {
|
||||
var info;
|
||||
try {
|
||||
info = JSON.parse(fs.readFileSync(path.resolve(editionPath,entry,"tiddlywiki.info"),"utf8"));
|
||||
} catch(ex) {
|
||||
}
|
||||
if(info) {
|
||||
editions[entry] = info.description || "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Output the list
|
||||
this.commander.streams.output.write("Available editions:\n\n");
|
||||
$tw.utils.each(editions,function(description,name) {
|
||||
self.commander.streams.output.write(" " + name + ": " + description + "\n");
|
||||
});
|
||||
this.commander.streams.output.write("\n");
|
||||
return null;
|
||||
};
|
||||
|
||||
exports.Command = Command;
|
||||
|
||||
})();
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Demo of the experimental TiddlyWiki Classic parser plugin",
|
||||
"plugins": [
|
||||
"tiddlywiki/tw2parser"
|
||||
],
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Demo of the CodeMirror plugin",
|
||||
"plugins": [
|
||||
"tiddlywiki/codemirror"
|
||||
],
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Demo of the D3 plugin",
|
||||
"plugins": [
|
||||
"tiddlywiki/d3"
|
||||
],
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Server configuration of the German (Österreich) edition",
|
||||
"plugins": [
|
||||
"tiddlywiki/tiddlyweb",
|
||||
"tiddlywiki/filesystem"
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "German (Österreich) edition",
|
||||
"plugins": [
|
||||
"tiddlywiki/github-fork-ribbon",
|
||||
"tiddlywiki/browser-sniff"],
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Base German edition",
|
||||
"plugins": [
|
||||
"tiddlywiki/github-fork-ribbon",
|
||||
"tiddlywiki/browser-sniff"],
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Developer documentation from http://tiddlywiki.com/dev/",
|
||||
"plugins": [
|
||||
"tiddlywiki/cecily",
|
||||
"tiddlywiki/googleanalytics",
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Empty edition",
|
||||
"plugins": [
|
||||
],
|
||||
"themes": [
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "French (France) edition",
|
||||
"plugins": [
|
||||
],
|
||||
"themes": [
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Demo of the highlight plugin",
|
||||
"plugins": [
|
||||
"tiddlywiki/highlight"
|
||||
],
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Demo of the KaTeX plugin",
|
||||
"plugins": [
|
||||
"tiddlywiki/katex"
|
||||
],
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Demo of the Markdown plugin",
|
||||
"plugins": [
|
||||
"tiddlywiki/markdown"
|
||||
],
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Content for the current prerelease",
|
||||
"plugins": [
|
||||
"tiddlywiki/cecily",
|
||||
"tiddlywiki/googleanalytics",
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Basic client-server edition",
|
||||
"plugins": [
|
||||
"tiddlywiki/tiddlyweb",
|
||||
"tiddlywiki/filesystem",
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Demo of TahoeLAFS plugin",
|
||||
"plugins": [
|
||||
"tiddlywiki/tahoelafs"
|
||||
],
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "TiddlyWiki core tests",
|
||||
"plugins": [
|
||||
"tiddlywiki/jasmine"
|
||||
],
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "TiddlyWiki Common-JS tests",
|
||||
"plugins": [
|
||||
],
|
||||
"themes": [
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Edition for people translating TiddlyWiki",
|
||||
"plugins": [
|
||||
"tiddlywiki/translators"
|
||||
],
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Tools for building TiddlyWiki Classic files from individual tiddlers",
|
||||
"plugins": [
|
||||
"tiddlywiki/classictools"
|
||||
]
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Server configuration of the tw5.com edition",
|
||||
"plugins": [
|
||||
"tiddlywiki/tiddlyweb",
|
||||
"tiddlywiki/filesystem",
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Documentation from http://tiddlywiki.com",
|
||||
"plugins": [
|
||||
"tiddlywiki/cecily",
|
||||
"tiddlywiki/googleanalytics",
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Demo of Tank integration",
|
||||
"plugins": [
|
||||
"tiddlywiki/tiddlyweb"
|
||||
],
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Base edition for TiddlySpace integration",
|
||||
"plugins": [
|
||||
"tiddlywiki/tiddlyweb"
|
||||
],
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "TiddlyWiki upgrader edition",
|
||||
"plugins": [
|
||||
"tiddlywiki/upgrade"
|
||||
],
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Chinese (Simplified) edition",
|
||||
"plugins": [
|
||||
],
|
||||
"themes": [
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"description": "Chinese (Traditional) edition",
|
||||
"plugins": [
|
||||
],
|
||||
"themes": [
|
||||
|
@ -21,4 +21,4 @@ Anmerkung:
|
||||
* Der --init Befehl löscht alle `includeWikis` Definitionen aus der neuen `tiddlywiki.info` Datei
|
||||
* Wenn mehrere Editionen importiert werden, wird die zuletzt importierte `tidlywiki.info` Datei aktiv sein. Alle anderen weden überschrieben.
|
||||
|
||||
* `--help editions` listet alle verfügbaren Editionen auf.
|
||||
* `--editions` listet alle verfügbaren Editionen auf.
|
||||
|
@ -20,4 +20,4 @@ Note :
|
||||
* La commande //init// échoue si le dossier wiki n'est pas vide
|
||||
* La commande //init// supprime les éventuelles définitions `includeWikis` du fichier `tiddlywiki.info` de l'édition spécifiée
|
||||
* Lorsque plusieurs éditions sont spécifiées, chaque édition écrase les fichiers qu'elle a en commun avec les précédentes (par conséquent, le fichier `tiddlywiki.info` proviendra de la dernière édition spécifiée)
|
||||
* `--help editions` renvoie une liste des éditions disponibles
|
||||
* `--editions` renvoie une liste des éditions disponibles
|
||||
|
@ -20,4 +20,4 @@ Note:
|
||||
* Il comando init fallirà se la direcotry del wiki non è vuota
|
||||
* Il comando init rimuove qualsiasi definizione `includeWikis` nell'edizione del file `tiddlywiki.info`
|
||||
* Se sono specificate edizioni multiple, l'edizione inizializzata dopo sovrascrive tutti i file condivisi con le edizioni precedenti (il file finale `tiddlywiki.info` sarà copiato dall'ultima edizione)
|
||||
* `--help editions` restituisce una lista delle edizioni disponibili
|
||||
* `--editions` restituisce una lista delle edizioni disponibili
|
||||
|
@ -20,4 +20,4 @@ tiddlywiki ./MyWikiFolder --init empty
|
||||
* wiki フォルダが空ではない場合、init コマンドは失敗します。
|
||||
* init コマンドは指定エディションの `tiddlywiki.info` ファイルに指定されている `includeWikis` は除外します。
|
||||
* 複数のエディションを指定した場合、先に指定したエディションに含まれているファイルは、後に指定したエディションに同名のファイルが含まれていると上書きされます。つまり最終的な `tiddlywiki.info` は最後に指定したエディションのものが使用されます。
|
||||
* `--help editions` で使用できるエディションの一覧を表示します。
|
||||
* `--editions` で使用できるエディションの一覧を表示します。
|
||||
|
@ -20,4 +20,4 @@ Note:
|
||||
* The init command will fail if the wiki folder is not empty
|
||||
* The init command removes any `includeWikis` definitions in the edition's `tiddlywiki.info` file
|
||||
* When multiple editions are specified, editions initialised later will overwrite any files shared with earlier editions (so, the final `tiddlywiki.info` file will be copied from the last edition)
|
||||
* `--help editions` returns a list of available editions
|
||||
* `--editions` returns a list of available editions
|
||||
|
@ -20,4 +20,4 @@ tiddlywiki ./MyWikiFolder --init empty
|
||||
* 若 wiki 文件夹不是空的,则初始化命令将失败
|
||||
* 初始化命令会删除 'tiddlywiki.info' 文件内所有 'includeWikis' 的定义。
|
||||
* 当指定多个版本时,这些版本于初始化后,将覆写早期版本共用的所有文件 (故此最终的 `tiddlywiki.info` 文件将是从最近的版本复制而得)
|
||||
* `--help editions` 传回所有可用版本的清单。
|
||||
* `--editions` 传回所有可用版本的清单。
|
||||
|
@ -20,4 +20,4 @@ tiddlywiki ./MyWikiFolder --init empty
|
||||
* 若 wiki 資料夾不是空的,則初始化命令將失敗
|
||||
* 初始化命令會刪除 'tiddlywiki.info' 檔內所有 'includeWikis' 的定義。
|
||||
* 當指定多個版本時,這些版本於初始化後,將覆寫早期版本共用的所有檔案 (故此最終的 `tiddlywiki.info` 檔案將是從最近的版本複製而得)
|
||||
* `--help editions` 傳回所有可用版本的清單。
|
||||
* `--editions` 傳回所有可用版本的清單。
|
||||
|
Loading…
Reference in New Issue
Block a user