claudioc / jingo

Node.js based Wiki
MIT License
1.02k stars 184 forks source link

Added support for {{<directive>}} directives such as table of contents. #115

Closed creynold closed 8 years ago

creynold commented 8 years ago

I added a function applyDirectives which looks for {{.*}} including newlines. It then replaces the {{.*}} match with the return of functions from directives.js. As an example:

If the wiki text is:

{{sequence

A->B: something
}}

Then applyDirectives will pass the full text of the wiki and A->B: something respectively to the function directives.directiveMap.sequence. The return of this function will replace the braced text.

creynold commented 8 years ago

Don't want to step on anyone's toes.. I just saw a PR for TOC as well. Thought this way might allow for future flexibility as well as plugging in third party packages.

claudioc commented 8 years ago

No problem, it's just funny that after I had the "TOC" issue open for... ever? now two PR came in almost at the same time fixing it :)

Regarding the directive thing, I think it's a cool idea. I will take a look at it (testing and adding doc if needed) asap... unfortunately at the moment we are very busy releasing a product for December, which means I need to work on weekend too. Have patience.

Thanks!

creynold commented 8 years ago

Cool, thanks! No rush obviously :)