It would be nice to be able to specify a customized class to use for theming individual images.

For example:
[inline:2 class=left]

In this case, the img tag would contain class="inline.left" instead of the current default: class="inline" The theme's CSS file would then specify float=left; for this class.

I've spent some time working on this. I'm OK with PHP, but I'm rather weak when it comes to regular expressions. I've tried several things to try to get "inline" and "2" and "left" into separate variables, but haven't been successful so far. So, the attached patch does not work. It is just a starting point, so you can see how my idea would work if I could get the regular expression written correctly. In fact, it contains an unmodified version of the reg exp. The problem is complicated (for me) by the fact that the current syntax for the tag is [inline:file_num-or-file_name=title] instead of something like [inline:file_num title:title_text].

I'm going to keep working on this... but would appreciate the help of someone who knows what they're doing when it comes to regular expressions...

Thanks,
Steve

CommentFileSizeAuthor
inline_custom_class.patch1.79 KBshouchen

Comments

sun’s picture

Remember that parameter separators have to be unique. A space or colon are both symbols which may be used in filesystems. Nearly every Windows user uses spaces in filenames. And as far as I know, a colon following a filename points to a included file stream. I don't know if PHP is taking that into account or if the inline module should.
You might have a look at other Drupal filters to find a working solution attempt.

Just my 2 cents.

shouchen’s picture

sun,

Thanks for the valuable feedback.

What do you think about keeping the basic syntax the same, as in [tag:filenum_or_filename=title] but creating some new tags: inline.left, inline.right; inline.whatever... Then, the module would use the TAG as the CLASS (if it begins with "inline"). One other question... could we create an inline.css file that contains a entries for "inline", "inline.left", and "inline.right". If a user wanted to use a different tag... like 'inline.mystyle', they would just have to add that to the .css file. Sound good? If so... how do we get Drupal to see the .css file?

-Steve

sun’s picture

You might have a look on these issues regarding filter syntax:

New inline filter code
Ability to inline other media files

In short, img_assist has a well working filter syntax which allows to alter the resulting code including attributes. In my opinion there should be an unique syntax for all 'inline' Drupal filters provided by a core function.

shouchen’s picture

Status: Needs work » Closed (duplicate)

Basically a duplicate of http://drupal.org/node/32838