Quantcast
Channel: Embedded Components and Tools Blog Center » Component Technology
Viewing all articles
Browse latest Browse all 8

How to build Dean Lee’s Syntax Highlighter from latest components

$
0
0

Ron Fredericks writes: In my last two posts:

During my research to solve the word wrap problem, I discovered a few more issues leading me to update Dean’s plugin with the latest version of GeSHI (an open-source project: Generic Syntax Highlighter for php. Highlight many languages, including PHP, CSS, HTML, SQL, Java, Assembler, and C for XHTML compliant output) and removal of unused files. I thought other WordPress bloggers might like to take advantage of the latest code too, so I document the steps needed to build a clean plugin with the latest components.

Flow Chart / Swim Lanes Widget
Below is a Flash widget I built to document the steps needed so you can roll your own up-to-date plugin. Follow these steps and you won’t have to be a programmer to get the benefits from the latest versions of these program components. The widget actively links to the latest PHP files and CSS classes:


Why Roll Your Own Plugin?
I have been working with components and tools on various projects long enough to realize a common problem. Whenever components are used from different projects, such as Dean’s plugin integrated with the GeSHi language components, each file and/or component continues to receive bug fixes and enhancements in real-time without regard to the other components and files. This is natural because each component’s project is managed by a different group.

So now I have an idea on how to fix this evolving problem of diverging code bases: create a flow-chart showing how to assemble the individual components into a final product. Use swim-lanes to highlight the different component resources being used. Document the whole work-flow into a Flash document so links to other web pages and/or live video’s can be included as hot-links to demonstrate the process.

Detailed Notes on the Problems Solved Here
Here are the issues I solve in this blog post:

  • The version of GeSHi included with Dean’s code-base is now obsolete. The latest version of GeSHi includes a few bug fixes and a few new supported languages for syntax highlighting. By the time you read this blog post, perhaps GeSHi will have yet an even more improved and stable code base.
  • One of the optional modules supplied by GeSHi, PHP samples found in the “contrib” directory; include a recently-identified security risk if included on a web server – such as your WordPress blog installation. Dean’s plugin includes this GeSHi directory by default.
  • Dean’s plugin also includes a Mac temporary file called .DS_Store that is not used by WordPress either.

The Components and Their Versions
Dean’s original code has the following versions:

My rebuilt version of Dean’s plugin has the following components and version detail:

A Final Note
The GeSHi code base continues to go through updates. At some point the logic behind my approach – mix and match the latest code from all resources required for Dean’s WordPress plugin – might break down. Perhaps GeSHi will adopt a new interface that’s not suitable to Dean’s WordPress plugin code, for example. In any case, if you are having trouble getting Dean’s plugin to work, I suggest the following:

Revert back to Dean’s complete code base. Install it as he suggests and try it. If Dean’s original code base does not work, then maybe you are not following the install instructions correctly or perhaps WordPress itself is at an incompatible version. If the plugin works, then try replacing code one step at a time. With each new file change, try your updated WordPress plugin to see if it still can be deactivated, reactivated, and highlights code correctly in a blog post. When the offending component has been identified, let me know so we can work out a new swim-lane diagram for others to follow.

Technorati Tags: , , , , , , , , , , , ,


Viewing all articles
Browse latest Browse all 8

Trending Articles