Kevin M. Brooks (lucretio) wrote in suggestions,
Kevin M. Brooks
lucretio
suggestions

User-defined macros

Title
User-defined macros

Short, concise description of the idea
Allow the creation and modification of user-defined macros, which could be used in journal entries. This would be a paid-user benefit.

Full description of the idea
User-defined macros could be used to reduce extraneous or redundant typing by allow (paid) users a symbol (followed by optional arguments) instead of long, boring, repetive text.

Syntax:

I would like to hear opinions about possible syntax.

example:
for creation (on macros.bml or similar): my_macro1 = "here is arg1, " + $data1 + ", and arg2, " + $data2;
for use (in journal entry): Hello, I'm using my macro: macro::my_macro1("arg1","arg2");. Yee.

Or it could be like BML:
create:

my_macro<=
    here is arg1, %%data1%%, and here is arg2, %%data2%%
<=my_macro
use:
<?macro:my_macro arg1|arg2 macro:my_macro?>
If it's going to be like BML, there'd have to be something to distinguish it from predifined BML blocks (i.e. something like my "macro:" prefix).

An ordered list of benefits

  • Increases ease of use for inserting repetive or common strings, such as URI's, links, images, etc.
  • Additional paid-user benefit
  • An ordered list of problems/issues involved

  • A syntax would need to be decided upon.
  • An organized list, or a few short paragraphs detailing suggestions for implementation

  • Create a /macros.bml for creating and editing macros. There'd be a text field similar to the overrides text-field on /modify_do.bml.
  • Create another table (probably called 'macros') that would hold userid, macro id (?), macro name, macro contents, etc.
  • Create a function for finding macros in an entry and expanding the macros.
  • On update.bml, when the post is submitted, replace the macro with the expanded text.
  • Tags: ~ historical
    Subscribe
    • Post a new comment

      Error

      Anonymous comments are disabled in this journal

      default userpic

      Your reply will be screened

      Your IP address will be recorded 

    • 7 comments