Support for user-created templates

Status: Implemented

Created by bcammo 01 Jul 2010 01:47

rating: +7+x

**STE **

I would like the ability to create my own templates/code snippets that I can import straight into the editor just like the other modules. This would make it much easier when you need to add reusable complicated div structures / other bits of code.

I'm not sure if this is possible, but I imagine it working something like this:

  1. The user creates the template and saves it as my-template.ste, in a folder called templates.
  2. In the settings, you have an option called user templates, where the user needs to locate the templates folder.
  3. The user can then insert the template straight into their document from the menu insert » templates » my-template.

What do you think??

(Off-topic: Shane, do you think I could get a copy of the STE logo so that I can add it to the app locally? Oh, and how're the exams going??)

Cheers,
Bryce


wdavatar?user=leiger
leiger

01 Jul 2010 04:16. Edited 1 times. (Edit, Permalink)
Would this be similar in some ways to this? Adding buttons and macros with custom keyboard shortcuts

The only major difference between the two is that you'd like to store the templates in an external file, whilst Franknarf is asking for the same thing stored within STE itself. I can do both, so I'm interested to know which one you'd prefer.

Included page "inc:signature" does not exist (create it now)

wdavatar?user=leiger
leiger

01 Jul 2010 04:19. Edited 1 times. (Edit, Permalink)
I'm managing exams OK at the moment. Realistically should be studying for yet another exam tomorrow but as you can see, I'm tired of doing that and ended up checking my email … which led me here :)

If you'd like to get a copy of the STE logo you can use the same one I am using in the application itself. I think I have a higher quality one on this computer, but the one you already have is probably big enough just for an icon? Just open the STE.jar file with any archive application (I recommend 7-Zip, though it's Windows only), and extract logo.gif. It's 95 x 61 pixels.

Edit: It'd be awesome if you could add instructions for Mac OS X to this page: Adding STE to a taskbar or panel

Included page "inc:signature" does not exist (create it now)

wdavatar?user=bcammo
bcammo

01 Jul 2010 04:40. Edited 0 times. (Edit, Permalink)
Oh, I hadn't seen that post :) I think keeping it all within the editor itself is much more user friendly than my suggestion, but I guess it depends which would be easier to implement.

I had tried to get into the contents of the .jar file, not realising I needed to use an extractor - now I know!

Good luck tomorrow :)

Bryce

Included page "inc:signature" does not exist (create it now)

wdavatar?user=leiger
leiger

01 Jul 2010 06:17. Edited 2 times. (Edit, Permalink)
Thanks :)

As for implementing one of them… integrating it into STE would be easier but I'm at the moment I'm only able to do it for a static number of templates. For example, I'd have to put a limit of 10 or something. I'll have to find a way to do it dynamically…

If I was to store it on the file system I know of a way to allow a dynamic number of templates… but I only know the principle of it. Not 100% sure how to actually do it with code :)
Well… not the way I'd like to do it anyway - which is to store all templates in a single file. I think that's a better option as I only need to open one file when loading the list of templates.

So either way I need to do some more research…

Included page "inc:signature" does not exist (create it now)

wdavatar?user=leiger
leiger

13 Dec 2010 01:06. Edited 0 times. (Edit, Permalink)
Okay, here is what I am thinking at the moment.

  • Any registered Wikidot.com user can create an extension in the STE Extensions Gallery
  • The extension will be "installed" to your computer, and every time STE starts it automatically checks for updates
    • If you have an internet connection, the extension is updated automatically. You must update if an update is available.
    • If you don't have an internet connection, nothing happens. It will try to update and fail, but show no error message. You'll still be able to use whatever version of the extension that you have saved to the computer though.

For developers, extensions will be powered by a simple language that I create - designed to be simple and easy for anyone to learn. For example:1

import wdeditor:post:100

That would attempt to import a page. Each command is separated by a line break so several things can be done at once.

Included page "inc:signature" does not exist (create it now)

[[footnoteblock]]

wdavatar?user=bcammo
bcammo

13 Dec 2010 01:28. Edited 0 times. (Edit, Permalink)
Ooh, it sounds so sophisticated! I'm assuming users can 'invoke' an extension by a menu command or button?

My only concern is having to download any updates when STE starts - especially if the gallery is filled with lots of extensions specific to an individual's site. Do you have an estimate of how big the download would be for say 20 extensions? Otherwise it sounds great.

Included page "inc:signature" does not exist (create it now)

wdavatar?user=leiger
leiger

13 Dec 2010 01:39. Edited 1 times. (Edit, Permalink)
You will be downloading a Wikidot page for each extension - consisting of a title, content and some other meta data (tags, parent, etc). It's just text… so it'll be a very small download for each extension.

I could also make extension updates done manually - no automatic updating at all.

Going further… I could let you decide whether you want it done automatically or manually on a per-user basis.

But as always… the more customisation I give, the longer it takes to build and the more complicated it is to maintain and to fix any bugs that might crop up.

Edit: Running an extension will most likely be possible by clicking on an item in the menu, yes. Keyboard shortcuts are more complicated - because unlike the other menu items I have no idea what each will do … it depends on the extensions you have installed.

Included page "inc:signature" does not exist (create it now)

wdavatar?user=bcammo
bcammo

13 Dec 2010 01:48. Edited 0 times. (Edit, Permalink)
Perhaps I misread your first post (I must have been too excited) - re-reading the post, I interpret it like this: the download will only consist of extensions that we have installed, and we can select to install any number of extensions from the gallery - including zero. In this case, having all the extensions updated automatically is fine with me - I see no need for the option to do it manually.

And I think just menu commands would be sufficient.

Included page "inc:signature" does not exist (create it now)

wdavatar?user=leiger
leiger

13 Dec 2010 01:53. Edited 0 times. (Edit, Permalink)
Yes, you understand correctly. Perhaps I didn't explain myself properly the first time.

You visit the website and decide what extensions you want, then install them to your copy of STE if you want them. At this stage you will need to provide a page name to install it, and STE will use the API to import that page (or "extension").

Included page "inc:signature" does not exist (create it now)

wdavatar?user=leiger
leiger

19 Dec 2010 19:06. Edited 1 times. (Edit, Permalink)
I have successfully been able to get this working in my development tests. All that remains is to add a UI for it so that it can be used in a released version of the application.

The first version may require an Internet connection and re-download the extension every time you use it. That way, I can give you the functionality ASAP … then I'll spend some more time getting it to work offline and release that a bit later (probably after Christmas Day, but before the New Year).
Update: Done already. Found an easy way to do it.

DEVELOPERS

Anyone that wants to create an extension for STE should also think about creating a small image/icon to represent it. The image will not be used in STE, but it will be used for the extensions gallery. The image should be 100x100.

To submit an extension, you'll need:

  • A name for it
  • The image I mentioned above
  • A short description about what it does
  • Your extension's code!

More info to come when I actually finish this and release it… but feel free to ask any questions and I'll answer them.

Included page "inc:signature" does not exist (create it now)

wdavatar?user=ed-johnson
Ed Johnson

20 Dec 2010 00:37. Edited 0 times. (Edit, Permalink)
Do you have a basic markup designed yet? I'm curious and would love some more teasers! ;)

Included page "inc:signature" does not exist (create it now)

wdavatar?user=leiger
leiger

20 Dec 2010 04:01. Edited 4 times. (Edit, Permalink)
Yes, I have some basic markup. I'd rather keep that for the release though as it's subject to change if I run into problems with it.

I still need to write the code for automatic updating of extensions, but I'll probably leave that for a future release…

And… you will be able to give someone else your extension config file and they'll automatically have the same extensions installed as you, without the need to download them. So if you have a computer that isn't connected to the Internet, you can transfer extensions via a USB drive.

Included page "inc:signature" does not exist (create it now)

Post Reply

Add reply on "Support for user-created templates"

CSS Theme, Images and Code on this website are © Shane Smith 2010-2012. All forum posts by users and documentation licensed under Creative Commons BY-NC-SA 3.0 License.