New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizable Features #4

Closed
neocotic opened this Issue Jun 3, 2011 · 11 comments

Comments

Projects
None yet
2 participants
@neocotic
Member

neocotic commented Jun 3, 2011

Look at implementing customizable features using a jquery-tmpl as a template system. This could replace existing logic for each feature and allow users to "roll their own".

@bmatzelle

This comment has been minimized.

Show comment
Hide comment
@bmatzelle

bmatzelle Jun 16, 2011

This feature is awesome. Would it be possible to add other information along with the URL? Perhaps the title of the page. So the template might look something like this:

${page.title} - ${page.url}

The ability to add line endings (\n and \r\n) would be great:

${page.title}\r\n${page.url}

or with a special eol (End Of Line) variable:

${page.title}${eol}${page.url}

Thanks for the consideration! Your extension rocks!

This feature is awesome. Would it be possible to add other information along with the URL? Perhaps the title of the page. So the template might look something like this:

${page.title} - ${page.url}

The ability to add line endings (\n and \r\n) would be great:

${page.title}\r\n${page.url}

or with a special eol (End Of Line) variable:

${page.title}${eol}${page.url}

Thanks for the consideration! Your extension rocks!

@neocotic

This comment has been minimized.

Show comment
Hide comment
@neocotic

neocotic Jun 17, 2011

Member

That is the plan exactly. I will use this template system for existing features and implement a method for users to add their own features using the template system, potentially even import/export functionality.

The template system will have access to many values relating to the URL and the current page. However, I've changed my mind from using jquery-tmpl as it didn't suit the needs of this extension and I'm now using mustache.js.

I've tried to put down most of my thoughts on this here so, if you're interested, please feel free to have a look.

I've also decided to change the next milestone to 0.1.0.0 (from 0.0.2.2) as I'm aiming for this to be the first major release due to it's complexity and the magnitude of the changes included. I won't be releasing a final version (e.g. 1.0.0.0) until I'm fully satisfied that with the code, quality and functionality it provides.

Member

neocotic commented Jun 17, 2011

That is the plan exactly. I will use this template system for existing features and implement a method for users to add their own features using the template system, potentially even import/export functionality.

The template system will have access to many values relating to the URL and the current page. However, I've changed my mind from using jquery-tmpl as it didn't suit the needs of this extension and I'm now using mustache.js.

I've tried to put down most of my thoughts on this here so, if you're interested, please feel free to have a look.

I've also decided to change the next milestone to 0.1.0.0 (from 0.0.2.2) as I'm aiming for this to be the first major release due to it's complexity and the magnitude of the changes included. I won't be releasing a final version (e.g. 1.0.0.0) until I'm fully satisfied that with the code, quality and functionality it provides.

@bmatzelle

This comment has been minimized.

Show comment
Hide comment
@bmatzelle

bmatzelle Jun 17, 2011

That's incredible. This will save me a TON of time. Thanks so much for all of this terrific work!

That's incredible. This will save me a TON of time. Thanks so much for all of this terrific work!

@neocotic

This comment has been minimized.

Show comment
Hide comment
@neocotic

neocotic Jul 13, 2011

Member

Now partly implemented in current (extremely unstable) code but will continue working on options page to enable testing and eventual release of 0.1.0.0. I also feel the need to add a help section/popup to help users get used to the syntax etc. involved in this bespoke version of Mustache.

Member

neocotic commented Jul 13, 2011

Now partly implemented in current (extremely unstable) code but will continue working on options page to enable testing and eventual release of 0.1.0.0. I also feel the need to add a help section/popup to help users get used to the syntax etc. involved in this bespoke version of Mustache.

@neocotic

This comment has been minimized.

Show comment
Hide comment
@neocotic

neocotic Jul 19, 2011

Member

Templates are now fully implemented and operational as well as having detailed documentation added to the extension's options page to help users create their own.

Customizable features are now fully implemented and the features section on the options page has been changed to support this.

Optimization has been carried out but will probably require further work as and when opportunities are identified.

Member

neocotic commented Jul 19, 2011

Templates are now fully implemented and operational as well as having detailed documentation added to the extension's options page to help users create their own.

Customizable features are now fully implemented and the features section on the options page has been changed to support this.

Optimization has been carried out but will probably require further work as and when opportunities are identified.

@neocotic neocotic closed this Jul 19, 2011

@bmatzelle

This comment has been minimized.

Show comment
Hide comment
@bmatzelle

bmatzelle Jul 20, 2011

This feature works like a champ! Excellent work!

This feature works like a champ! Excellent work!

@neocotic

This comment has been minimized.

Show comment
Hide comment
@neocotic

neocotic Jul 20, 2011

Member

Thanks :) How do you find the built-in documentation? I'm hoping to get some feedback as it was quite tricky to create content for and I've not created help documentation before.

Member

neocotic commented Jul 20, 2011

Thanks :) How do you find the built-in documentation? I'm hoping to get some feedback as it was quite tricky to create content for and I've not created help documentation before.

@bmatzelle

This comment has been minimized.

Show comment
Hide comment
@bmatzelle

bmatzelle Jul 20, 2011

Good enough that I could figure it out within a few minutes. I was a bit confused by the URL naming. "encoded", "source", etc weren't very intuitive. It might have been easier if they were under a "URL" category.

I had a couple UI comments:

  • The "name" field didn't allow underscores so the naming looks odd.
  • The shortcut feature wasn't accepting a few of my suggestions (Z, T, as I recall). I couldn't figure out why so I just when with a number.
  • I'd prefer if the fields had descriptions to the left, "Name:" and "Title" because I kept forgetting which was which after I filled in the field.

I have some other UI ideas but I'm a UI expert as well as a developer and I don't want to invent more work for you. I started a few open source projects myself (PHPMailer, RapidSVN, Nini, Gow) and I know how much work it is and how thankless it can be :)

Good enough that I could figure it out within a few minutes. I was a bit confused by the URL naming. "encoded", "source", etc weren't very intuitive. It might have been easier if they were under a "URL" category.

I had a couple UI comments:

  • The "name" field didn't allow underscores so the naming looks odd.
  • The shortcut feature wasn't accepting a few of my suggestions (Z, T, as I recall). I couldn't figure out why so I just when with a number.
  • I'd prefer if the fields had descriptions to the left, "Name:" and "Title" because I kept forgetting which was which after I filled in the field.

I have some other UI ideas but I'm a UI expert as well as a developer and I don't want to invent more work for you. I started a few open source projects myself (PHPMailer, RapidSVN, Nini, Gow) and I know how much work it is and how thankless it can be :)

@neocotic

This comment has been minimized.

Show comment
Hide comment
@neocotic

neocotic Jul 20, 2011

Member

Thanks for the feedback as all of this is very useful, I have raised issue #9 to track these problems and I will take everything you've just said on board. Please also feel free to add any further ideas to that issue and I'll promise to consider them. Even if they get added later on it's good to have lists of ideas.

Also, can you add a comment to #9 elaborating what you mean about a "URL" category. I could deprecate "source" and "encoded" and add "url" and "encodedUrl" respectively if you think that's easier to understand. I used "source" as it is the name used by the URI Parser that generates a lot of the attributes available but I'm open to suggestions.

Member

neocotic commented Jul 20, 2011

Thanks for the feedback as all of this is very useful, I have raised issue #9 to track these problems and I will take everything you've just said on board. Please also feel free to add any further ideas to that issue and I'll promise to consider them. Even if they get added later on it's good to have lists of ideas.

Also, can you add a comment to #9 elaborating what you mean about a "URL" category. I could deprecate "source" and "encoded" and add "url" and "encodedUrl" respectively if you think that's easier to understand. I used "source" as it is the name used by the URI Parser that generates a lot of the attributes available but I'm open to suggestions.

@bmatzelle

This comment has been minimized.

Show comment
Hide comment

Done!

@neocotic

This comment has been minimized.

Show comment
Hide comment
@neocotic

neocotic Aug 4, 2011

Member

I'm just leaving this here so that I remember what needs changed should I ever need to update mustache.js as I'm soon going to be deleting the wiki (as it's all now hosted on my site).

Mustache Differences

Modifications have been made to the mustache.js file that is used by this extension which make the syntax ever slightly different from standard mustache. These changes have been made to improve usability form in the following way;

By default mustache.js escapes all values when using the standard double mustache syntax (e.g. {{escaped}}). Characters which will be escaped: & \ " < >. To disable escaping, simply use triple mustaches like {{{unescaped}}}. For example, using {{variable}} inside a template for 5 > 2 will result in 5 &gt; 2, where as the usage of {{{variable}}} will result in 5 > 2.

HOWEVER, in this implementation using a single mustache disables escaping (e.g. {unescaped}) and using the standard double mustache still escapes all values. This change is to make templates used by this extension easier for the user to read and write as, I believe, more often than not, character escaping will not be as desired as it is in most of its uses. Using the previous example with the modifications; using {variable} inside a template for 5 > 2 will result in 5 > 2, where as the usage of {{variable}} will result in 5 &gt; 2.

In order to implement this the following changes were made to mustache.js;

  • Renderer.otag and Renderer.ctag are changed to { and } respectively. This ensures that single mustache is now the standard syntax.
  • The tag_replace_callback function within Renderer.render_tags is modified to swap the contents of the default and triple mustache cases. This ensures that the (now) standard single mustache now has escaping disabled.
Member

neocotic commented Aug 4, 2011

I'm just leaving this here so that I remember what needs changed should I ever need to update mustache.js as I'm soon going to be deleting the wiki (as it's all now hosted on my site).

Mustache Differences

Modifications have been made to the mustache.js file that is used by this extension which make the syntax ever slightly different from standard mustache. These changes have been made to improve usability form in the following way;

By default mustache.js escapes all values when using the standard double mustache syntax (e.g. {{escaped}}). Characters which will be escaped: & \ " < >. To disable escaping, simply use triple mustaches like {{{unescaped}}}. For example, using {{variable}} inside a template for 5 > 2 will result in 5 &gt; 2, where as the usage of {{{variable}}} will result in 5 > 2.

HOWEVER, in this implementation using a single mustache disables escaping (e.g. {unescaped}) and using the standard double mustache still escapes all values. This change is to make templates used by this extension easier for the user to read and write as, I believe, more often than not, character escaping will not be as desired as it is in most of its uses. Using the previous example with the modifications; using {variable} inside a template for 5 > 2 will result in 5 > 2, where as the usage of {{variable}} will result in 5 &gt; 2.

In order to implement this the following changes were made to mustache.js;

  • Renderer.otag and Renderer.ctag are changed to { and } respectively. This ensures that single mustache is now the standard syntax.
  • The tag_replace_callback function within Renderer.render_tags is modified to swap the contents of the default and triple mustache cases. This ensures that the (now) standard single mustache now has escaping disabled.

This was referenced Feb 16, 2012

neocotic added a commit that referenced this issue May 20, 2013

@neocotic neocotic added the accepted label Nov 15, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment