Is it possible to 'escape' a double bracket in Freelinking? I can't seem to find a way. In most wiki's there is the possibility to use something like <nowiki>...</nowiki> or <code>... or ![[ ... ]] to indicate that the text is not a link.

Is it something that might be implemented?

Comments

simplymenotu’s picture

Assigned: Unassigned » simplymenotu
Status: Active » Closed (works as designed)

Hi gmak,

If you don't want to turn CamelCase words into links, you can turn that off.
The default is "on".

You can still use freelinking delimiters ( [[ ) to link text and web sites.

-lgm

gmak’s picture

I think, perhaps my question wasn't clear.

The specific condition is that I'm trying to create a page which explains how to use 'freelinking'. So I need to write something like:

"to create a link, put [[ ... ]] around the word you wish to link from"

The problem is that the brackets won't appear to the reader, because it will have created a link. So they would see:

"to create a link, put ... around the word you with to link from"

In traditional wiki's you have the ability to 'escape' the double bracket by either a special tag or some escape character. Some examples are:

![[ ... ]]
[[ ... ]]
[[ ... ]]

So my question (feature request?) is whether there is a way that we can 'escape' the double brackets?

In looking at the code, it seems like this would be an additional 'if' statement with a regular expression condition, but I'm not enough of a coder to attempt that.

Thanks

gmak’s picture

Oops,

I realise I forgot to format some of the above to show code. The examples are:

![[ ... ]]
<nowiki>[[ ... ]] </nowiki>
<code>[[ ... ]]

mtndan’s picture

Hi, was this ever resolved? I've got the same request for version 5

bsherwood’s picture

Title: using [[ in text » Prevent parsing of [[ text in node
Version: 4.7.x-1.x-dev » master
Assigned: simplymenotu » Unassigned
Status: Closed (works as designed) » Active

Just updating some of the information.

I would also like to know the current status of this. Is there a way to prevent the parsing of freelinking tags on a link by link basis?

arhak’s picture

what about using the html entity unicode for brackets (I don't know which is)
for example, I can write the example of a code block in this comment even when the code tag will be filtered:
<code>some code</code>
that's because I used the "less than" symbol as html entity &lt;

eafarris’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

eafarris’s picture

Status: Closed (fixed) » Active

Works, but shows the bang, per #409830: Using ! to show the [[brackets]] in wiki. Re-opening.

Grayside’s picture

Status: Active » Postponed

The bang needs to be replaced when found, instead of simply skipping the segment of text when it finds the bang. The best approach is probably to go back into the text after the "live" freelinks are found and preg_replace the exclamation marks out of the text.

Grayside’s picture

Version: master » 6.x-1.x-dev
Status: Postponed » Fixed

This is fixed in 1.x-dev and 3.0-alpha3. Please test 1.x in particular so the fix can be officially released.

Also, 1.x-dev supports "\" as well as "!" to escape the link. The 3.x line currently supports only "\".

Status: Fixed » Closed (fixed)

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

timjh’s picture

Category: support » bug
Status: Closed (fixed) » Active

A single quote is missing after ...content"... near the end of line 333 of freelinking.module (6.x-1.x-dev on 2010-01-27). The omission causes a PHP syntax error on enabling the module. Once fixed, the module seems to work OK.

$output .= '<li>' . t('[[this is the target|this is the source]] - will present "this is the source" as a link to "this is the target", or a page to create that content.") . '</li>';

should read

$output .= '<li>' . t('[[this is the target|this is the source]] - will present "this is the source" as a link to "this is the target", or a page to create that content."') . '</li>';
Grayside’s picture

Status: Active » Closed (fixed)

That seems to be a separate issue, so I'll tackle it in the dedicated issue #702728: Double quote in line 333 causes WSOD.

Sarenc’s picture

Version: 6.x-1.x-dev » 7.x-3.x-dev

it would be great if this could be re-enabled for 7.x

Sarenc’s picture

Status: Closed (fixed) » Active

A quick and dirty way to do this:

/**
 * Implements filter process callback
 */
function _freelinking_process($text, $filter) {
  $freelinking = freelinking_get_plugins();
  $defaultplugin = variable_get('freelinking_default', 'nodetitle');
  $syntax = variable_get('freelinking_match_syntax', 'double_bracket');
  $regex = _freelinking_match_pattern();
  
  $nowiki_text = preg_replace('!<nowiki>(.*?)</nowiki>!is', '', $text);
  
  // Loop through every freelink format
  // Space at text start prevents match failure at start.
  preg_match_all($regex[$syntax], ' ' . $nowiki_text, $matches, PREG_SET_ORDER);

Basically removes the nowiki text before looking for matches. This isn't idea though, if a match was found outside nowiki tags but the same match existed within the nowiki tags it will be converted. I tried to think of a way to use PREG_OFFSET_CAPTURE but that doesn't make sense. Ideally the nowiki would be excluded in the regex in _freelinking_match_pattern() but I'm not so good with regex :\

  • gisle committed 9792bed on 7.x-3.x
    #84685 by gisle: Fixed prevent parsing of [[ text in node.
    
gisle’s picture

Assigned: Unassigned » gisle
Issue summary: View changes
Status: Active » Needs review

This is fixed in the latest snapshot of the 7.x-3.x branch.

To prevent parsing of [[ text in node, you should tag the freekink with the nowiki indicator.

For example: [[nowiki:this is not a freelink]] wil be rendered as [[this is not a freelink]].

gisle’s picture

Version: 7.x-3.x-dev » 7.x-3.5
Status: Needs review » Fixed

This is included in the 7.x-3.5 release.

Status: Fixed » Closed (fixed)

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