Coder Social home page Coder Social logo

plugindevelopment's Introduction

TiddlyWiki5 Plugin Development Example

This repo is a stripped down version of what I use to create plugins and make a plugin library.

It has a few components:

  1. its own copy of the TiddlyWiki5 repo, this way you can do anything you want here, including modifying the core, and you won't break anything else.
  2. A script to start a wiki in a node server.
  3. A script to create an empty plugin that you can then edit to make whatever you want.
  4. A script to create new wikis that you can use to test plugins.
  5. A script that you can use to create a plugin library with the plugins you have created.
  6. A script to add plugins to the wikis

If there is a new version of tiddlywiki available run Setup.sh again and it will ask if you wish to update tiddlywiki or not, press 1 for yes or 2 for no.

Setup

  1. Clone this repo using git clone --recurse-submodules https://github.com/inmysocks/PluginDevelopment.git
  2. Go into the PluginDevelopment folder cd PluginDevelopment
  3. Run ./Setup.sh

Using this

Making a plugin

''Note:'' Making a plugin also makes a wiki that includes the new plugin, so you can test the plugin without having to make anything new.

./MakePlugin.sh PluginName

To initialise a plugin run the script MakePlugin.sh, it will create a plugin in the folder ./Plugins/PluginAuthor/PluginName, where the author name is the name given during setup and the plugin name is the name given to the command.

If for some reason you want to use a different author name for a plugin and don't want to change the default name you can give the author name as the second argument.

./MakePlugin.sh PluginName DifferentAuthorName

If you do this the plugin will be created in the folder ./Plugins/DifferentAuthorName/PluginName.

This also creates a wiki that using the server edition that has your plugin as a place where you can test and document it. The wiki is located in the folder ./Wikis/PluginAuthor/PluginName, to start the wiki run ./start PluginName and it will start the wiki server on the default port 8080.

If you want to use a different port you can give it as the second argument like this:

./start PluginAuthor/PluginName 8181

where you can change 8181 to whatever port you wish to use.

Remember that changes made to the plugin will not update in the wiki unless you stop the server and restart it.

Making a plugin library

To make a plugin library use the script MakePluginLibrary.sh which will create the plugin library in the folder ./PluginLibrary/output.

TODO add notes about how to host the plugin library.

Short version, if you have a webhost that can host static files you can just copy the contents of the PluginLibrary/output folder into a folder on your host and then the url for the library will be whatever the url for that folder on your host is.

TODO add information about how to make a plugin library tiddler

Making wikis

If you want to make a wiki without a plugin you can use the ./MakeWiki.sh script.

Typing

./MakeWiki.sh wikiName

will make a wiki is the ./Wikis/wikiName folder using the empty edition.

If you want to use another edition you can give it as the second argument:

./MakeWiki.sh wikiName server

will make a wiki called wikiName using the server edition.

Other Information

The plugin library tiddlywiki.info file

The file ./PluginLibrary/tiddlywiki.info is a normal tiddlywiki.info file with the arguments in the build command to create a plugin library.

The filter

[prefix[$:/]] -[prefix[$:/plugins/tiddlywiki/]] -[prefix[$:/themes/tiddlywiki/]] -[prefix[$:/languages/]]

on line 29 determines which plugins are added to the plugin library created. It adds everything other than the core plugins and any languages. If you want to add languages using this you have to modify this filter to either allow all languages or add on the language(s) individually.

plugindevelopment's People

Contributors

inmysocks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

plugindevelopment's Issues

[BUG] The index.html of plugin library seems incorrect

After successful creating plugins and testing them, I create plugin library using:

./MakePluginLibrary.sh and the output directory with library was created. It has

  • index.html
  • recipes/library

So everything was successful!
Then I used github pages to host static files, and did all configuration
I used the library in tiddlywiki.com but I noticed library is empty.

I investigated the index.html and I see the below

var assetList = ;

/*\
title: $:/plugins/tiddlywiki/pluginlibrary/libraryserver.js
type: application/javascript
module-type: library

A simple HTTP-over-window.postMessage implementation of a standard TiddlyWeb-compatible server. It uses real HTTP to load the individual tiddler JSON files.

\*/
(function(){

While this should be the list of plugins

Error on folders with space in name

Assume you put the PluginDevelopment in a folder like below

C:/Jed Carty/PluginDevelopment

and then run the Setup.sh

It creates new folder asC:/Jed again!

When I removed the space and use the folder like

C:/JedCarty/PluginDevelopment
it works fine. Note to space in Jed Carty

Error in running Setup.sh

This is what I got on the terminal when I run Setup.sh

$ ./Setup.sh                                                                                                                                                                                   
Welcome to the setup script!                                                                                                                                                                   
                                                                                                                                                                                               
Run this script to help setup your development environment for tiddlywiki 5.                                                                                                                   
If you move your plugin development folder you must re-run this script.                                                                                                                        
                                                                                                                                                                                               
Patching tiddlywiki to work with this version of the plugin library                                                                                                                            
creator.                                                                                                                                                                                       
s/collectPublisherPlugins(path.resolve($tw.boot.corePath,$tw.config.pluginsPath))\;/var pluginsPaths = $tw.getLibraryItemSearchPaths($tw.config.pluginsPath,$tw.config.pluginsEnvVar);for(var u
=0; u<pluginsPaths.length; u++) {collectPublisherPlugins(pluginsPaths[u]);}/g                                                                                                                  
sed: can't read s/collectPublisherPlugins(path.resolve($tw.boot.corePath,$tw.config.pluginsPath))\;/var pluginsPaths = $tw.getLibraryItemSearchPaths($tw.config.pluginsPath,$tw.config.pluginsE
nvVar);for(var u=0; u<pluginsPaths.length; u++) {collectPublisherPlugins(pluginsPaths[u]);}/g: No such file or directory                                                                       
sed: can't read s/collectPublisherPlugins(path.resolve($tw.boot.corePath,$tw.config.themesPath))\;/var themesPaths = $tw.getLibraryItemSearchPaths($tw.config.themesPath,$tw.config.themesEnvVa
r);for(var u=0; u<themesPaths.length; u++) {collectPublisherPlugins(themesPaths[u]);}/g: No such file or directory                                                                             
sed: can't read s/collectPlugins(path.resolve($tw.boot.corePath,$tw.config.languagesPath))\;/var languagesPaths = $tw.getLibraryItemSearchPaths($tw.config.languagesPath,$tw.config.languagesEn
vVar);for(var u=0; u<languagesPaths.length; u++) {collectPlugins(languagesPaths[u]);}/g: No such file or directory                                                                             
                                                                                                                                                                                               
Enter the author name, this will be used as the author name for plugins you                                                                                                                    
create. It can be changed in the future by reruning this script or editing                                                                                                                     
Author.txt                                                                                                                                                                                     
                                                                                                                                                                                               
Author Name (press enter to leave as DEFAULTAUTHOR):                                                                                                                                           

Does not create Plugin Library

To reproduce

  1. Install the PluginDevelopment as described in readme.md
  2. It has its own Tiddlywiki under Tiddlywiki5 folder
  3. Run Setup.sh
  4. Run MakePlugin.sh to create a plugin
  5. Add one macro to new plugin to display Hi World...
  6. Create a Test Wiki, add the new plugin to test and it works fine
  7. Run MakePluginLibrary.sh
  8. A new PluginLibrary/output folder created which has index.html and recipes/library folder and inside that a tiddler.json and nothing else

Error on making first wiki

It seems one needs to make Wikis directory in advance
Run the MakeWiki.sh shows an error like below

Error: Error creating directory './Wikis/nella'
New wiki created in /c/Temp/PluginDevelopment-master/Wikis/ using empty edition

While it says a new wiki is created but it is not correct!

If I make the Wikis manually then it works fine

Setup error

#####@#####-####### MINGW64 ~
$ cd PluginDevelopment

#####@#####-####### MINGW64 ~/PluginDevelopment (master)
$ ./Setup.sh

Welcome to the setup script!

Run this script to help setup your development environment for tiddlywiki 5.
If you move your plugin development folder you must re-run this script.

Checking for newer versions of tiddlywiki
From https://github.com/Jermolene/TiddlyWiki5.git
You have the newest version, v5.1.22

Enter the author name, this will be used as the author name for plugins you
create. It can be changed in the future by reruning this script or editing
Author.txt

Author Name (press enter to leave as DEFAULTAUTHOR):
aaa

#####@#####-####### MINGW64 ~/PluginDevelopment (master)
$ ./MakePlugin.sh PluginTest
New empty plugin created in /c/Users/#####/PluginDevelopment/Plugins/aaa/PluginTest.
Error: Error creating directory 'C:/Users/#####/PluginDevelopment/Wikis/aaa/PluginTest'
Error creating wiki. If you make a bug report please include all the output after you ran MakeWiki.sh
sed: can't read ./Wikis/aaa/PluginTest/tiddlywiki.info: No such file or directory

Any help much appreciated. Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.