[MODDB] phpBB Syntax Highlighter - 1.0.12
Author: UseLess
Modification Description: Syntax highlighting (using GeShi) with support for 132 programming/scripting languages
Modification Version: 1.0.12
Styles: Prosilver
Languages: English
Demo URL: Here
Home Page: http://www.phpbbstyles.co.uk/info/
Download link: Attached Below.
MODDB Post: http://www.phpbb.com/community/viewtopi ... &t=1697035
Quote from: Note
The Long Description:
Due to a recent suggestion by mrbaseball34 the mod has been altered a little. You now have a choice of how you want the output to be shown. By using the BBCode tag [syntax] on it's own you will get the output displayed with line numbers, there is no syntax highlighting, and you can also specify the following options:
Basic Syntax allowed options
- start = " x " - Line number to start at
- filename = " filename for code when downloaded "
- highlight = " line numbers to highlight seperated with , or - for consecutive lines " - NOT used if a language is specified
- You may also use [ highlight ] ... [ /highlight ] to highlight part of a line, to highlight a full line use the option above
If you specify a language, for syntax highlighting, by using the following option: lang=mysql then the following options may be specified:
Language Syntax allowed options
- lang = " php | delphi | css | mysql | html4strict " - over 130 languages supported
- start = " x " - Line number to start at
- filename = " filename for code when downloaded "
- lines = " geshi-n | n | geshi-f | f " - how lines are to be shown, with line numbers and with fancy line numbers
- fancy = " 5 " - Specifies that every 5th line is to be fancy, only used if the lines option is set to 'geshi-f' or 'f'
By default if a language is specified then it will be shown without line numbers, if you want line numbers then add a lines option.
You may now also use the language as a BBCode tag, this is disabled by default, so you can use:
or you can also specify options:
You can replace 'delphi' in the above examples with any of the supported languages, i.e.:
If you do not wish to specify any other attributes then you may use the 1st format below. If you wish to specify 1 or more attributes then you must use the 2nd format and specify 'lang="delphi"' with 'delphi' being the syntax to use or use the language as the tag.
There is also an option to download the code, if a filename is specified this will be used instead of the default code id.
Usage
Notes
- The Demo on this site uses the Full BBCode parser which has more BBCode tags, however the Syntax Highlighting is the same.
- There is an 'install.txt' file located in the 'contrib' dir for those that are not fans of the ModX format
- There is an 'update.txt' file located in the 'contrib' dir for those that want to update from a previous version
- Quickest way to install the mod is to copy the contents of the 'root' dir to the root of your forum.
- Then make the alterations to the 3 files
- Then refresh the Theme data from the ACP
- Then clear the cache, or you could just refresh the Template data from the ACP.
Thanks are due to:
- CyberAlien - for releasing the original BBCode parser to the public.
- baboon - for (at time of posting this) a part complete Spanish translation
- mrbaseball34 - for the idea to use the language as a BBCode tag
- Bigwebmaster - for pointing out some errors I'd missed... and the fact that 'debug mode' is there for a reason.
SubSilver 2:
Now supports SubSilver 2 you'll obviously need the mod and then this:
#-----[ OPEN ]-------------------------------------------------------
#
styles/subsilver2/template/overall_header.html
#
#-----[ FIND ]-------------------------------------------------------
#
<title>{SITENAME} • <!-- IF S_IN_MCP -->{L_MCP} • <!-- ELSEIF S_IN_UCP -->{L_UCP} • <!-- ENDIF -->{PAGE_TITLE}</title>
#
#-----[ AFTER, ADD ]-------------------------------------------------
#
<script type="text/javascript" src="{T_TEMPLATE_PATH}/xs_bbcode_fn.js"></script>
<script type="text/javascript" src="{ROOT_PATH}classes/scripts/select_expand_bbcodes.js"></script>
#
#-----[ FIND ]-------------------------------------------------------
#
<link rel="stylesheet" href="{T_STYLESHEET_LINK}" type="text/css" />
#
#-----[ AFTER, ADD ]-------------------------------------------------
#
<link rel="stylesheet" href="{T_THEME_PATH}/ul_syntax_highlighter.css" type="text/css" />
#
#-----[ SAVE/CLOSE ALL FILES ]---------------------------------------
#
# EoM
And this, download the file and place it in: styles/subsilver2/theme/ul_syntax_highlighter.css you must make sure the filename of the CSS file is 'ul_syntax_highlighter.css'.
[css filename="ul_syntax_highlighter.css"]/*
SubSilver 2
XS Syntax Highlighter CSS
*/
.postbody .syntax {
color: #444;
display: block;
margin: 5px auto;
width: 98%;
border: solid 1px #D0D0D0;
background-color: #FFF;
padding: 5px;
font-size: 1.0em;
font-family: Courier, 'Courier New', sans-serif;
line-height: 1.2em;
}
.postbody .syntax-header {
margin: 0;
margin-bottom: 5px;
padding-left: 3px;
padding-bottom: 3px;
border-bottom: solid 1px #E0E0E0;
font-size: 1.0em;
line-height: 1.2em;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: normal;
color: #808080;
}
.syntax-header a:link,
.syntax-header a:visited
{
color: #666;
text-decoration: none;
border-bottom: dotted 1px #666;
}
.syntax-header a:hover,
.syntax-header a:active
{
color: #FF1010;
text-decoration: none;
border-bottom: dotted 1px #FF1010;
}
.syntax-content {
padding: 0;
}
.syntax-list {
margin-top: 3px;
margin-right: 0;
margin-bottom: 3px;
}
li.syntax-row {
margin-left: 12px;
white-space: normal;
border-top: 1px #E0E0E0 solid;
color: #BBB;
wrap-option: emergency;
}
.syntax-row-text {
color: #444;
}
div.syntax li.syntax-row-highlight {
color: #FF1010;
border-color: #D8D8D8;
}
div.syntax li.syntax-row-highlight .syntax-row-text, span.syntax-row-highlight {
color: #FF1010;
}
li.syntax-row-first {
border-top: none;
}
/* Mini Table */
.minitable {
color: #444;
display: block;
margin: 5px 20px;
border: solid 1px #D0D0D0;
background-color: #FFF;
font-size: 12px;
}
.minitable-header {
background: #fff url({T_THEME_PATH}/images/bg_header.gif) top left repeat-x;
margin: 0;
margin-bottom: 5px;
padding-left: 5px;
padding-top: 7px;
padding-right: 5px;
border-bottom: solid 1px #D0D0D0;
font-size: 12px;
line-height: 1.2em;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
color: #EDEFF4;
height: 21px;
}
.minitable-hideme {
font-size: 10px;
line-height: 1.2em;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
color: #EEE;
float: right;
}
.minitable-hideme a, .minitable-hideme a:visited {
color: #eee;
text-decoration: none;
}
.minitable-hideme a:hover {
color: #fff;
text-decoration: none;
}
.minitable-contents {
padding-left: 5px;
padding-right: 5px;
padding-bottom: 5px;
line-height: 1.5;
text-align: left;
}
/* Hide content */
.hide-contents,
.hide-contents .quote-message {
color: #757575;
background-color: #F2F2F2;
border: 2px dotted #DEDEDE;
text-align: left;
padding: 5px;
}[/css]
Updates
- updated to version 1.0.12 changes:
- Now works in MCP when viewing reported posts preview
- Fixed other issues when DEBUG mode was enabled
- added method to remove the link stuff added by phpBB
- updated to version 1.0.11 changes:
- if the basic tag is used, i.e. [syntax] then the mod will add line numbers, as it previously did
- changed 'syntax=' to 'lang='
- if either [syntax=<lang name>] or [syntax lang=<lang name>] is used then, by default, no line numbers will be shown, see below for line number option
- added lines option can be either 'lines=geshi-n' for normal geshi generated line numbers or 'lines=geshi-f' for fancy lines also generated by geshi
- added fancy option which can only be used with the 'geshi-f' above to specify which lines should be fancy, i.e. if 5 is specified then every 5th line will be fancy
- updated to version 1.0.9 changes:
- issues pointed out by phpBB.com MOD team resolved and resubmitted for validation
- to update to latest version:
- updated to version 1.0.8 changes:
- updated GeSHi to version 1.0.8.4
- to update see post below
- updated to version 1.0.7 fixed various issues (see install.xml history section for details)
- Updated GeSHi to version 1.0.8.3 (now supports 132 languages) changed mod version to 0.0.3
- Changed status to RC and updated version to 1.0.4, made the following changes
- fixed bug in bbc_download.php
- altered CSS
- Removed static text and added them to 'language/en/common.php'
- Changed name of CSS Class to avoid possible future conflicts