It would be nice to have this module use <code> tags rather than <pre> tags, e.g. for compatibility with the Code Filter module.

Currently that's hard because CKEditor seems to treat <code> and <pre> tags very differently, and I found it easier to get this module working with <pre> for starters.

CommentFileSizeAuthor
#9 1156932-7.patch6.47 KBpwolanin

Comments

geerlingguy’s picture

...or, better yet, add two buttons: one for code, and one for pre...? User can enable whichever one he likes.

rkodrupal’s picture

the pre tag has been available in wysiwyg for ages ... using the style drop down menu ... only code is needed.

David_Rothstein’s picture

@rkodrupal, the style dropdown is really only appropriate for administrators, right? (Since it provides many options, some of which assume you have access to <h1> and other tags, and as far as I know there's no way to customize which options appear).

The use case here is more for a low-level site user who needs to be able to paste code samples into their posts.

rkodrupal’s picture

good point. i keep forgetting about those pesky users.
k

greg.1.anderson’s picture

Switching to code will fix #1156926: Unclicking the code button doesn't work, so I think this is probably the way to go. I think I would be satisfied if code mode made the unmodified [return] key work like [shift]+[return], and insert a br rather than making a new paragraph. Of course, you couldn't use the Code Filter module if your code tags had escaped HTML inside; then you'd get double-escaped text, which would not render correctly. Maybe the HTML inside the code tags could be unescaped on save, and re-escaped on load, so that the editor behaved correctly while editing, and the code filter could do its job at display time? Or maybe the ckeditor code plugin should use neither code nor pre, but have a third, new tag that is used?

I'm not completely sure. Mostly, what I want is a button that works right for dropping in code in wysiwyg mode, but it would also be a good nice-to-have if it would interoperate with plaintext editing.

David_Rothstein’s picture

Alex Bronstein actually wrote some code a little while ago (but did not post it here) that allows the administrator to choose between <pre> and <code> tags.

I need to carve out some time soon to review/commit some of the other patches that are now in the issue queue (thanks by the way!), then dig up Alex's code and see if it still works then :) Hopefully it will.

pwolanin’s picture

Status: Active » Needs review

Here's Alex's changes extracted.

pwolanin’s picture

Version: 6.x-1.0-beta1 » 6.x-1.x-dev
pwolanin’s picture

StatusFileSize
new6.47 KB

oops - forgot the patch

pwolanin’s picture

Status: Needs review » Fixed

committed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.