• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

GeSHi Syntax Highlighter

Status
Not open for further replies.
Yeah, I was thinking about that, but the issue is with both the edits... 1. you need to make that little change the JavaScript (which you can't do programmatically) and 2. the template you need to edit has no template hook for it, so... kind of out of luck with being able to do it as a setting that does it for you. :(
 
Thanks Shawn,
I will have to keep in mind these changes because it will be overwritten with an upgrade and template revert.
 
If you want to add additional languages you pick to the dialog, you need to make 2 changes... First you would need to edit the js/tinymce/themes/xenforo/js/code.js file and change this:
Code:
default:    tag = 'CODE';
to this:
Code:
default:    tag = $('#ctrl_type').val();
Unfortunately there's not a way around the JavaScript file edit...

The other change would be to edit the editor_dialog_code template to add whatever specific languages you want to the <select> element. For example:

Code:
<option value="code=javascript">JavaScript</option>
<option value="code=ruby">Ruby</option>
<option value="code=sql">SQL</option>
etc...
Is it possible to make the default CODE changes to CODE=cpp ?
 
Is it possible to make the default CODE changes to CODE=cpp ?
If you go into library/DigitalPointSyntaxHighlighter/BbCode/Formatter/Base.php
and change this:
PHP:
if (!$tag['option']) $tag['option'] = 'text';
to this:
PHP:
if (!$tag['option']) $tag['option'] = 'cpp';
That should do it.
 
If you go into library/DigitalPointSyntaxHighlighter/BbCode/Formatter/Base.php
and change this:
PHP:
if (!$tag['option']) $tag['option'] = 'text';
to this:
PHP:
if (!$tag['option']) $tag['option'] = 'cpp';
That should do it.
That did it, Shawn.
Thanks a lot.
 
Probably wouldn't be too difficult, but I think you then risk making it cluttered and less usable if you have 201 languages in the drop-down list.
Shawn
This seems to have a problem when I post the code tag around codes that have font and color formatting. Try to wrap it around this block and it will display all the formatting bbcodes

double invnorms_cume(double u)
{
/* returns the inverse of cumulative normal distribution function
Reference> The Full Monte, by Boris Moro, Union Bank of Switzerland
RISK 1995(2)*/

staticdouble a[4]={2.50662823884,
-18.61500062529,
41.39119773534,
-25.44106049637};
staticdouble b[4]={-8.47351093090,
23.08336743743,
-21.06224101826,
3.13082909833};
staticdouble c[9]={0.3374754822726147,
0.9761690190917186,
0.1607979714918209,
0.0276438810333863,
0.0038405729373609,
0.0003951896511919,
0.0000321767881768,
0.0000002888167364,
0.0000003960315187};
double x,r;
x=u-0.5;
if (fabs(x)<0.42)
{
r=x*x;
r=x*(((a[3]*r+a[2])*r+a[1])*r+a[0])/
((((b[3]*r+b[2])*r+b[1])*r+b[0])*r+1.0);
return(r);
}
r=u;
if(x>0.0) r=1.0-u;
r=log(-log(r));
r=c[0]+r*(c[1]+r*(c[2]+r*(c[3]+r*(c[4]+r*(c[5]+r*(c[6]+
r*(c[7]+r*c[8])))))));
if(x<0.0) r=-r;
return(r);
}
 
I've noticed an issue where code blocks lose the code block look and just have the tag name at the top and the highlighting.
Example: http://forums.getspout.org/wiki/custom-blocks/

I'm not sure if this is this plugin or the XenCarta addon. I haven't looked into it much yet.
 

Attachments

  • codeblocks.webp
    codeblocks.webp
    81.2 KB · Views: 34
  • codeblocks2.webp
    codeblocks2.webp
    75.4 KB · Views: 31
Hard to say, but if it's only within the pages the addon creates, it's probably that the addon isn't including the normal CSS files for BBCode...
 
Status
Not open for further replies.
Top Bottom