Is it possible to have an option to disable Keyword URLs.

http://qbnz.com/highlighter/geshi-doc.html#disabling-urls

CommentFileSizeAuthor
#7 keywordurls_1.patch1.9 KBsoxofaan

Comments

soxofaan’s picture

Assigned: Unassigned » soxofaan
Status: Active » Postponed (maintainer needs more info)

Can you elaborate on why you want to disable Keyword URLs?
Which languages?
Are you thinking about a global option, per language or per snippet?

A workaround is to edit/copy the language definition files (e.g. geshi/php.php) in the GeSHi library and empty the URL parts (search for the "URLS" item).

denislabonkink’s picture

Disabling Keyword URLs will provide a clean html output and some Keyword URLs provided by GeShi by default are dead.

Well, as for the options, the more flexible the better but let do this incrementally.
How about starting with a global option, then per language and then finally per snippet?

denislabonkink’s picture

To those who want a quick workaround to disable completely Keyword URLs, just simply set add_url_to_keyword() function to always return an empty string. This function is located in geshi.php file of the Geshi library.

Here is the code:

function add_url_to_keyword($keyword, $group, $start_or_end) {
return ""; // <- ADD THIS TO COMPLETELY DISABLE KEYWORD URLs.
if (!$this->keyword_links) {
// Keyword links have been disabled
return;
}

soxofaan’s picture

Disabling Keyword URLs will provide a clean html output and some Keyword URLs provided by GeShi by default are dead.

What's unclean about the Keyword URL's?
And that some URLS are dead don't seem a big problem to me, as long as there are enough alive...

Well, as for the options, the more flexible the better but let do this incrementally.
How about starting with a global option, then per language and then finally per snippet?

I don't think that the more flexible would be "better". If things become too flexible, they can be a burden to manage/maintain.
I think a global option should be enough.

denislabonkink’s picture

Sorry for the repost. Haven't seen the "Reply" link.

Disabling Keyword URLs will provide a clean html output and some Keyword URLs provided by GeShi by default are dead.

Well, as for the options, the more flexible the better but let do this incrementally.
How about starting with a global option, then per language and then finally per snippet?

denislabonkink’s picture

What's unclean about the Keyword URL's?

What I mean by clean html output is that if the webmaster doesn't want Keyword URL's, then he/she doesn't want Keyword URL's to fill the webpage.

I don't think that the more flexible would be "better". If things become too flexible, they can be a burden to manage/maintain.
I think a global option should be enough.

A global option is fine with me as that is my need. I'm not familiar with Geshi library but if disabling per language and per snippet is allowed without hacking the library, then these options should also be in geshifilter module.

A side note: Aren't comments supposed to nest when using the Reply link?

soxofaan’s picture

Status: Postponed (maintainer needs more info) » Reviewed & tested by the community
StatusFileSize
new1.9 KB

patch in attachments adds a global option for this.

If you have suggestions about the UI strings, please comment:

[x] Enable GeSHi keyword URLs
For some languages GeSHi can link language keywords (e.g. standard functions) to their online documentation. (GeSHi documentation: Keyword URLs)

I'll commit this patch soon

I'm not familiar with Geshi library but if disabling per language and per snippet is allowed without hacking the library, then these options should also be in geshifilter module.

It can be done without hacking the GeSHi library. But I don't tend to do it, because it seems overkill to me. The use case you described of the webmaster that doesn't want Keyword URLs is language independent.
Also note that most language definitions do not have keyword URLs, so that would make the option useless in these cases, which is not very user friendly.

A side note: Aren't comments supposed to nest when using the Reply link?

comments in issue threads don't show up nested, I don't know why

soxofaan’s picture

Status: Reviewed & tested by the community » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

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