Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When using title.module, it becomes very difficult to submit PHP/C/Java code snippets. The title module reformats array subscripts (that use square brackets), stripping the angle brackets and making a (usually non-existent) page title out of the contents.
This patch disables the effect of title.module inside code or pre tags.
Comment | File | Size | Author |
---|---|---|---|
#14 | title-2005-01-05-link-v01.patch | 1.79 KB | inducer@news.tiker.net |
#9 | title.module_1.diff | 2.24 KB | Philippe |
disable-title-filter-in-code-or-pre.patch | 1.7 KB | Eric Scouten | |
Comments
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentedThis is likely not limited to title.module. Perhaps this code belongs in a function in common.inc. The image.module (and its cousins) use similar syntax.
Comment #2
Eric Scouten CreditAttribution: Eric Scouten commentedActually, it's not so much of an issue with image.module (at least). title.module takes anything inside square brackets and attempts to make a title out of it (and, along the way, it removes the square brackets -- which can really mess up your understanding of the underlying code).
The syntax of image.module --and most other filter modules-- is [image: ... ], which is much less likely to appear in code snippets.
Comment #3
moshe weitzman CreditAttribution: moshe weitzman commentedi see ... yes, this patch does make sense IMO.
Comment #4
Dries CreditAttribution: Dries commentedThe fix looks slow and clumsy. I'd like to research alternatives first.
Comment #5
JonBob CreditAttribution: JonBob commentedThis seems to be fixed in CVS due to the new pre-filtering possibilities. The title module has been removed from core anyway.
Comment #6
(not verified) CreditAttribution: commentedComment #7
Philippe CreditAttribution: Philippe commentedThis issue is not fixed in CVS. Title filter still interacts badly with the code formatter. Title.module doesn't use any pre-formatting.
BTW, how come Anonymous can close our issues? I think that's not a good thing for the quality and reliability of the issue tracker.
Comment #8
ax CreditAttribution: ax commentedit's not exactly an anonymous user who closes issues. what you see are cron-initated automatic closures of issues 2 weeks after issues are marked "fixed".
i find this "closed by Anonymous" very confusing as well and filed a feature request to make this process more transparent. feel free to give it a shot :)
Comment #9
Philippe CreditAttribution: Philippe commentedI suggest we allow the delimiters to be set by the site administrator. He can then choose between [foobar] or [title:foobar] or <title>foobar</title> or whatever he likes. By allowing the admin to choose, WE are not responsible for breaking any existing pages. The ADMIN will be responsible, and we'll tell him about the risks in the configuration pages. The site admin can also choose the delimiters so that they interfere as little as possible with other filters (applied before or after the title filter).
Here's a first draft of how to do it. Missing issue is that we'll have to escape certain characters form the delimiters before using them in a regular expression. I'm not sure yet how to do that, but I'll figure it out.
Any ideas, comments...?
Comment #10
Stefan Nagtegaal CreditAttribution: Stefan Nagtegaal commentedCan't duplicate this anymore.. This is probably solved by the new
filter.module
where we can arrange the order of filtering/Marking as 'fixed'
Comment #11
Dries CreditAttribution: Dries commentedMoving this to the 'title project'.
I don't think the problem has been fixed though.
Comment #12
ax CreditAttribution: ax commentedhow can this be fixed when the title filter hasn't changed? you haven't setup a proper input format. try one with only the title filter, and you will get the same bad behaviour as before.
you haven't actually changed the bug-status to 'fixed', so i don't have to change it back :)
Comment #13
ax CreditAttribution: ax commentedthis is a good example of a race condition :) i started editing this issue, dries changed it in the meantime, and when i submitted it, dries' status changes got lost. guess we need to have a closer look at jeremies locking efforts.
changing the stati back as per dries (why 4.5.0 and not cvs?). hope he doesn't do anything to it in the meantime :)
Comment #14
inducer@news.tiker.net CreditAttribution: inducer@news.tiker.net commentedThe attached simplistic patch changes the title module to simply process links only if they are written [link:destination|title], instead of for any pair of square brackets. This breaks existing title.module content, so it's probably not the way to go.
Comment #15
Bèr Kessels CreditAttribution: Bèr Kessels commentedthis patch uses the (unofficial) convention in drupal to use [{modulename}:{var}|{var}]
please consider applying this patch. only *after* it is committed, or will get committed, i will make a small update.php to chenge existing link tokens to use the title: prefix
and please do not use the previous [link: since [link: is reserved by weblinks bundle (it is currenlty used in weblinks module)
Comment #16
Bèr Kessels CreditAttribution: Bèr Kessels commentedthis will also fix http://drupal.org/node/4824
Comment #17
ax CreditAttribution: ax commentedanyone still using this module? marking WON'T FIX - feel free to change.