Codeviewer 1.4.3
Kl 20:21 av Familjen Carlström i CodeViewer, WordPress
currently
1,783 views
Codeviewer is updated to version 1.4.3. Downloads at the CodeViewer-post below:
.funkyblue { color:#0000AF; }
currently
1,783 views
Codeviewer is updated to version 1.4.3. Downloads at the CodeViewer-post below:
The original version is developed by Aaron Schaefer (http://elasticdog.com/) and AJ (http://flash.terra.ee/?p=11). This version is slighly modified by me to be usable with a WUSIWUG-editor.
Code Viewer is a WordPress plugin that pulls source code from an external file and displays it, optionally adding a link to download the code directly. The plugin displays the code with proper indentation, line numbers, and automatic long-line wrapping. The plugin also works well with a WYSIWYG-editor and has GeSHi-support.
When using Code Viewer, you no longer have to worry about typing countless entity references in order to make your code “HTML friendly” or to simulate tabs…it’s all done automatically with PHP and a little CSS. By inserting line numbers on your page, the plugin also eliminates the problem of long, non-breaking lines screwing up your layout. In addition, line numbers make convenient reference points when discussing code samples.
Last, but not least…because you’re pulling the source code from an external file (rather than having it embedded directly in your entry), the same code can be repeated on numerous pages, and you only have to type it in once. This not only saves you time, but when you update the code in the centralized file, all instances of that code will be updated along with it.
MD5 Sum (http://www.download.com/WinMD5Sum/3000-2381_4-10115915.html) let you check that no manipulation is done to the file.
Code Viewer basically searches your entry for a custom tag named [viewcode ] [/viewcode], that tells the server to look at an external file and parse it line-by-line into an ordered list. It can be placed anywhere a block-level tag is valid but the tag must be properly closed.
Note that there should not be a white space character after viewcode and before ]. I have problems to show this tag correctly into this post without showing everything as code!
To better illustrate its usage, the tag used in this entry (to show the codeviewer.css listing above) was:[viewcode ] src=codeviewer.css geshi=css[/viewcode]
/***************************************
* This file shall be put into the directory* wp-content/plugins/code-viewer* Created by Håkan Carlström* www.familjencarlstrom.se***************************************/ol.codelist{border:1px solid #303130;background-color:#FEFEFE;font-size:13px;font-family:'Courier New',Courier,monospace;}ol.codelist li.even{background-color: #aebbc6;}ol.codelist li.odd{}ol.codelist li.tab0 { padding-left: 2px; }ol.codelist li.tab1 { padding-left: 26px; }ol.codelist li.tab2 { padding-left: 50px; }ol.codelist li.tab3 { padding-left: 74px; }ol.codelist li.tab4 { padding-left: 98px; }ol.codelist li.tab5 { padding-left: 122px; }ol.codelist li.tab6 { padding-left: 146px; }ol.codelist li.tab7 { padding-left: 170px; }ol.codelist li code { color: 222; }ol.codelist div {margin: 0;padding: 1px 2px;}ol.codelist div.tab0 { padding-left: 2px; }ol.codelist div.tab1 { padding-left: 26px; }ol.codelist div.tab2 { padding-left: 50px; }ol.codelist div.tab3 { padding-left: 74px; }ol.codelist div.tab4 { padding-left: 98px; }ol.codelist div.tab5 { padding-left: 122px; }ol.codelist div.tab6 { padding-left: 146px; }ol.codelist div.tab7 { padding-left: 170px; }ol.codelist li.sourcelink {color: 000;font: 115% Georgia, "Times New Roman", Times, serif;list-style: none;margin-left: -32px;padding-top: .85em;text-align: center;}ol.warning{}
This CSS-file is included in the above rar-file of CodeViewer.
[viewcode ] src="URL" link=display lines=visible scroll=display scrollheight=height showsyntax=display geshi=language[/viewcode]
URL attribute is required.
link attribute is optional.
yes), or not be displayed (no). If the link attribute is left out of the tag completely, the value defaults to no.lines attribute is optional.
scroll attribute is optional.
yes), or not be displayed (no). If the scroll attribute is left out of the tag completely, the value defaults to no.scrollheight attribute is optional.
showsyntax attribute is optional.
yes), or not be displayed (no). If the showsyntax attribute is left out of the tag completely, the value defaults to no.geshi attribute is optional.
All attribute values can be surrounded with double quotes (") or single quotes(').
Here are some examples of valid syntax recognized by Code Viewer.
Note that all of these examples point to the same file (assuming the $default_path variable is set to "http://www.familjencarlstrom.se/WordPress/Mods/"):
[viewcode ] src=http://www.familjencarlstrom.se/WordPress/Mods/codeviewer/codeviewer.css link=yes[/viewcode]
[viewcode ] src="http://www.familjencarlstrom.se/WordPress/Mods/codeviewer/codeviewer.css"[/viewcode]
[viewcode ] src="codeviewer/codeviewer.css" lines=1-30 scroll=yes scrollheight=200px [/viewcode]
[viewcode ] src="codeviewer/codeviewer.css" lines=1-5,10-15 showsyntax=no [/viewcode]
[viewcode ] src=codeviewer/codeviewer.css[/viewcode]
[viewcode ] src=codeviewer/codeviewer.css geshi=css[/viewcode]
The above examples is verified working 2007-07-17. Make sure the WYSIWYG-editor dont add links (which is the usual) to the http://-argument when using absolute path.
By others
The original version is developed by Aaron Schaefer (http://elasticdog.com/) and AJ (http://flash.terra.ee/?p=11). This version is slighly modified by me to be usable with a WUSIWUG-editor.
Code Viewer is licensed under the GPL v2.