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.
I tried mixing wiki syntax and html and tried mixed filters to accommodate a goal of being able to use both wiki syntax and html, but had no success.
Comments
Comment #1
rnd CreditAttribution: rnd commentedI believe I fixed this. Let me warn you that this is my first post on durpal.org, let alone to suggest a patch. That being said I found that if you comment out a line and cange a third, liquid will stop escaping html code. Here is what my code for mw_sanitizer.inc now looks like from lines 428-436 (being new to this please forgive me if I'm not posting this in the prefered manner):
Hope this helps everyone out... I would immagine that Matt and I aren't the only ones out there who wanted this fixed!
Comment #2
rnd CreditAttribution: rnd commentedActually, I discovered that this alone still causes funky issues with <a> tags because Liquid automatically creates the <a> tags for any URL. I found the line that identifies URLs and modified it so that the RegEx pattern should not if the URL is surrounded by quotes (single or double somehow!) Once again, this is what my code looks like on line 803 of mw_parser.inc now:
yes, this is all one line, and yes I do have a kind of strange way of documenting code modifications... I know this... But it does have the advantage of not changing line number references in the future!
$bits = preg_split( '/(\b(?:[^"]'.$wgUrlProtocols.'[^"]))/S', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); #CHANGED!WAS: $bits = preg_split( '/(\b(?:'.$wgUrlProtocols.'))/S', $text, -1, PREG_SPLIT_DELIM_CAPTURE );
This should allow your users to create a link by copying and pasting a url, using an <a> tag or by using Wiki syntax.
Comment #3
matt_paz CreditAttribution: matt_paz commentedThanks RND!! 'Will take a look at implementing this and circle back
Comment #4
matt_paz CreditAttribution: matt_paz commentedI've been playing with it on and off for a few days now and it all looks good! Thanks again!
Regards,
Matt
Comment #5
rnd CreditAttribution: rnd commentedSo I may have encountered a strange side effect, or else it's just a problem with Liquid. We run a multisite implimentation of Drupal, and I occaisonally get the error below pop up on the sites when trying to access any page:
Fatal error: Call to undefined function arg() in /homepages/44/d157584041/htdocs/drupal-4.7.0/modules/liquid/liquid.module on line 116
Both times when this has happened, I have resolved it by renaming the liquid folder to liquid 2, then reloading, loging in, disabling liquid, naming it back to liquid and reenabling it. I haven't seen it repeat on the same drupal site twice, but it's still to early to tell if that is the case or not.
Comment #6
matt_paz CreditAttribution: matt_paz commentedHmmm. I haven't encountered that myself. So far, everything is working great. Will post here if I encounter it too.
Comment #7
fractile81 CreditAttribution: fractile81 commentedI've been using these modifications on my own site and have found a problem with the above patch, specifically the preg_split(). There is a bug where if you have, say, <td>http://example.com</td>, the td's > will become part of the URL and subsequently parts of the link (e.g. this example would become >http://example.com). I was able to get the desired functionality with the following changes in mw_parser.inc:
And that would do it. Appears to work rather well! Great research here, guys!
Comment #8
sorenp CreditAttribution: sorenp commentedMy intention is that Liquid should provide the Wiki infrastructure to Drupal rather than specific markups. For this reason, the development of the Liquid Filter module will focus on providing infrastructure for Liquid Wiki Filters rather than supporting any specific markups. As soon as the basic infrastructure has been set up, the Media Wiki Markup support in Liquid will be dropped. A new project will be started to take care of the Media Wiki Liquid Filter, but I will not take any responsibility for the development. Until then, the module will be included for testing purposes, but no active development will be done except for things connected to the Liquid Filter Interface.
I know there are other approaches running on Drupal when it comes to Wiki Markup Filters. My suggestion is that you take a look at those or, if you have the time, start a Liquid MedaWiki Markup Filter project.
// Soren
Comment #9
matt_paz CreditAttribution: matt_paz commentedI've switched over to the PearWiki_Filter. It offers a regular expression for ignoring content. Here is what we're using to ignore html ...
Please advise if you're aware of another alternative that would be better suited for ensuring ongoing interoperability with Liquid.