From bde8f18e871e7686c7ceb777d42aa0cbcd8a96a4 Mon Sep 17 00:00:00 2001 From: "Espen A. Kristiansen" Date: Sun, 9 Aug 2009 22:44:26 +0200 Subject: [PATCH] Added source code syntax highlighting. --- .gitignore | 1 + README.rst | 19 ++++++++++-- plonetheme/fui/browser/configure.zcml | 6 ++++ .../fui/browser/javascripts/prettify.js | 23 ++++++++++++++ .../fui/browser/stylesheets/prettify.css | 30 +++++++++++++++++++ .../fui/profiles/default/cssregistry.xml | 6 ++++ .../fui/profiles/default/jsregistry.xml | 5 ++++ .../main_template.pt | 2 +- setup.py | 2 +- 9 files changed, 90 insertions(+), 4 deletions(-) create mode 100755 plonetheme/fui/browser/javascripts/prettify.js create mode 100755 plonetheme/fui/browser/stylesheets/prettify.css diff --git a/.gitignore b/.gitignore index c02abc1..397c622 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ *~ plonetheme.fui.egg-info/ dist/ +.DS_Store diff --git a/README.rst b/README.rst index b4733ba..d958f03 100644 --- a/README.rst +++ b/README.rst @@ -48,6 +48,12 @@ You can install this theme in Plone using buildout. Bordered image float right|img|bordered-float-right +Code syntax highlighting +------------------------ + +The theme loads prettify.js (http://code.google.com/p/google-code-prettify/). +Add the *prettify* class to your
 blocks to get syntax hightlighting.
+
 
 Getting the dynamic click-to-edit feature back
 ----------------------------------------------
@@ -57,9 +63,18 @@ This feature is disabled with a tal definition in
 re-enable it, you can simply remove the entire file.
 
 
-Release a new version (for developers)
---------------------------------------
+
+
+For developers
+--------------
 
 Release a new version to pypi.python.org with::
 
     ~$ python setup.py egg_info -RDb "" sdist upload
+
+
+You can run plone in the foreground with:
+
+    ~$ plonectl fg
+
+Note that resources are not added unless you reinstall the product.
diff --git a/plonetheme/fui/browser/configure.zcml b/plonetheme/fui/browser/configure.zcml
index 254f847..e6204f5 100644
--- a/plonetheme/fui/browser/configure.zcml
+++ b/plonetheme/fui/browser/configure.zcml
@@ -50,4 +50,10 @@
       layer=".interfaces.IThemeSpecific"
       />
 
+  
+
 
diff --git a/plonetheme/fui/browser/javascripts/prettify.js b/plonetheme/fui/browser/javascripts/prettify.js
new file mode 100755
index 0000000..8fc4c93
--- /dev/null
+++ b/plonetheme/fui/browser/javascripts/prettify.js
@@ -0,0 +1,23 @@
+function H(){var x=navigator&&navigator.userAgent&&/\bMSIE 6\./.test(navigator.userAgent);H=function(){return x};return x}(function(){function x(b){b=b.split(/ /g);var a={};for(var c=b.length;--c>=0;){var d=b[c];if(d)a[d]=null}return a}var y="break continue do else for if return while ",U=y+"auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile ",D=U+"catch class delete false import new operator private protected public this throw true try ",
+I=D+"alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename typeof using virtual wchar_t where ",J=D+"boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient ",V=J+"as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var ",
+K=D+"debugger eval export function get null set undefined var with Infinity NaN ",L="caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END ",M=y+"and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None ",N=y+"alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END ",
+O=y+"case done elif esac eval fi function in local set then until ",W=I+V+K+L+M+N+O;function X(b){return b>="a"&&b<="z"||b>="A"&&b<="Z"}function u(b,a,c,d){b.unshift(c,d||0);try{a.splice.apply(a,b)}finally{b.splice(0,2)}}var Y=(function(){var b=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=","~","break","case","continue",
+"delete","do","else","finally","instanceof","return","throw","try","typeof"],a="(?:(?:(?:^|[^0-9.])\\.{1,3})|(?:(?:^|[^\\+])\\+)|(?:(?:^|[^\\-])-)";for(var c=0;c:&])/g,"\\$1")}a+="|^)\\s*$";return new RegExp(a)})(),P=/&/g,Q=//g,Z=/\"/g;function $(b){return b.replace(P,"&").replace(Q,"<").replace(R,">").replace(Z,""")}function E(b){return b.replace(P,"&").replace(Q,"<").replace(R,">")}var aa=
+/</g,ba=/>/g,ca=/'/g,da=/"/g,ea=/&/g,fa=/ /g;function ga(b){var a=b.indexOf("&");if(a<0)return b;for(--a;(a=b.indexOf("&#",a+1))>=0;){var c=b.indexOf(";",a);if(c>=0){var d=b.substring(a+3,c),g=10;if(d&&d.charAt(0)==="x"){d=d.substring(1);g=16}var e=parseInt(d,g);if(!isNaN(e))b=b.substring(0,a)+String.fromCharCode(e)+b.substring(c+1)}}return b.replace(aa,"<").replace(ba,">").replace(ca,"'").replace(da,'"').replace(ea,"&").replace(fa," ")}function S(b){return"XMP"===b.tagName}
+function z(b,a){switch(b.nodeType){case 1:var c=b.tagName.toLowerCase();a.push("<",c);for(var d=0;d");for(var e=b.firstChild;e;e=e.nextSibling)z(e,a);if(b.firstChild||!/^(?:br|link|img)$/.test(c))a.push("");break;case 2:a.push(b.name.toLowerCase(),'="',$(b.value),'"');break;case 3:case 4:a.push(E(b.nodeValue));break}}var F=null;function ha(b){if(null===F){var a=document.createElement("PRE");
+a.appendChild(document.createTextNode('\n'));F=!/=0;i-="                ".length)d.push("                ".substring(0,i));g=e+1;break;
+case "\n":a=0;break;default:++a}}if(!d)return c;d.push(c.substring(g));return d.join("")}}var ja=/(?:[^<]+|
 
+ 
+
 
diff --git a/plonetheme/fui/skins/plonetheme_fui_custom_templates/main_template.pt b/plonetheme/fui/skins/plonetheme_fui_custom_templates/main_template.pt
index 516ccba..db3e751 100644
--- a/plonetheme/fui/skins/plonetheme_fui_custom_templates/main_template.pt
+++ b/plonetheme/fui/skins/plonetheme_fui_custom_templates/main_template.pt
@@ -63,7 +63,7 @@
 
   
+		tal:define="kss_inline_editable python:False;" onload="prettyPrint()">
     
diff --git a/setup.py b/setup.py index 5a9196c..5d3faf0 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import os -version = '2.0.2' +version = '2.1.0' setup(name='plonetheme.fui', version=version,