shoul / knecht

Mini cms for static block generator
Other
1 stars 0 forks source link

WYSIWYG editor #1

Open chripo opened 11 years ago

chripo commented 11 years ago

add WYSIWYG features

editing should work without js too.

posativ commented 11 years ago

I'm all for the ACE editor (includes reST highlighting for example). The WYG part can be done using the compiler backend (slow but should performe better for incremental compilers ;-)?

edit: it does not include reST by default, but it can use TextMate syntax highlighting bundles.

chripo commented 11 years ago

nice. i thought about a to way preview,

posativ commented 11 years ago

Another point against a JS live preview: Markdown extensions, engine specific, non-standard extensions (at least for Pelican, Nikola and Acrylamid) that will either not render or cause syntax errors.

I guess one can circumvent the markdown extension issue by using an editor that provides "MultiMarkdown" but there might be still certain edge cases that are differently handled. But on the other hand, full re-compilation is not a realtime preview, hence I suggest to offer a get_preview(path) API that has a fallback to recompilation/JS but can be overridden to ask the engine to only compile the provided filename and return the HTML (without updating the output files).

chripo commented 11 years ago

hence I suggest to offer a get_preview(path) API that has a fallback to recompilation/JS but can be overridden to ask the engine to only compile the provided filename and return the HTML (without updating the output files).

good point ;) the stub already exists https://github.com/shoul/knecht/commit/678b799ae323df7500b091800fa67db3ad8d90ba#L0R54 shall i file an issue?


Reply to this email directly or view it on GitHub: https://github.com/shoul/knecht/issues/1#issuecomment-14832804

posativ commented 11 years ago

Not sure whether I can provide a API directly in Acrylamid but I have already done this for a small utility I use to convert a post to HTML and then back to real plain text (for Language Tool):

from functools import partial
from acrylamid import core, readers, filters

env = Environment({'options': type('X', (), {'ignore': False})})
conf = core.load("conf.py")

def _render(conf, env, filepath):
    filters.initialize([], conf, env)
    post = readers.Entry(sys.argv[1], conf)

    html = post.source
    for item in post.filters + conf.filters:
        split = item.split('+')

        if split[0].startswith('no'):
            continue

        fx = filters.get_filters()[split[0]](conf, env, split[0])
        html = fx.transform(html, post, *split[1:])

    return html

render = partial(conf, env)

Not sure if I'll include this into Acrylamid directly as the actual rendering is always delayed but I'm willing to maintain the preview(self, file_path=None) implementation.