Custom Macro Hook
Added by Eric Thomas over 14 years ago
The file lib/redmine/wiki_formatting/macros.rb
provides the following for plugins to create custom macros:
Redmine::WikiFormatting::Macros.register do
desc "Glossary macro"
macro :glossary do |obj, args|
args, options = extract_macro_options(args, :phrase, :definition)
end
end
I'm trying to create a glossary macro such as the following:
{{glossary(GUI, phrase=Graphical User Interface, definition=A type of user interface item that allows people to interact with programs in more ways than typing.)}}
I've gotten it to work just fine except that none of the options can contain a comma (',') because it thinks that's the end of the option and is trying to move onto the next one.
So I have two questions: is it possible easily write a hook where one can either tweak how it reads the options or even just provide a way to escape the comma (such as '\,')?
Another idea I had was to put all options are separate lines so a new line would represent the end of the option, like the following:
{{glossary( GUI phrase=Graphical User Interface definition=A type of user interface item that allows people to interact with programs in more ways than typing. ) }}
Can anyone give me a little bit of direction on how to go about writing a hook to accomplish either one of these?
Thanks