OpenDCL Forums

OpenDCL => Site Management => Topic started by: BazzaCAD on March 18, 2009, 04:44:50 PM

Title: AutoLISP Syntax Highlighter on the forums
Post by: BazzaCAD on March 18, 2009, 04:44:50 PM
With some hard work from Owen (and myself), we now have a CODE tag that will automatically highlight your AutoLISP & OpenDCL code.
Here's a small example.

Code (autolisp) Select

;;This is a comment
(setq a 5)
(setq b (1+ a))
(setq c "this is a string")
(vl-load-com)
(OR (dcl_PROJECT_LOAD "Proj1" T) (EXIT))
(dcl_Form_Show Proj1_Form1)


Try not to paste super huge of code blocks. About 200 lines is the max. without bogging down the page load.

All you have to do is hit the CODE button, now renames to "Insert AutoLISP code" (see image below), then paste your code in between the CODE tags.
If you still need the old generic code block without the Highlighting, just remove the =autolisp from the tag.

You'll notice some of the special operators "+ 1+ * - 1- / = < > <= >=" etc.. & ;| multi-line comments |; don't highlight.


Title: Re: AutoLISP Syntax Highlighter on the forums
Post by: Kerry on March 18, 2009, 05:43:23 PM

Excellent Result Barry abd Owen.

Did you get the MultiLine comment sorted ?? or is it too process intensive ?
Title: Re: AutoLISP Syntax Highlighter on the forums
Post by: owenwengerd on March 18, 2009, 05:59:32 PM
I had it in there, but it bogged things down too much, so I removed it again.
Title: Re: AutoLISP Syntax Highlighter on the forums
Post by: xshrimp on May 26, 2011, 07:07:11 AM
bug?? &#59
how to fix?


Code (autolisp) Select
(setq a (strcat ";" a));add a ";" in front of the string if not already present  
(not (wcmatch a (strcat "*;" b ";*"))) ;is 'dir' already present in search path?  

Title: Re: AutoLISP Syntax Highlighter on the forums
Post by: owenwengerd on May 28, 2011, 08:06:41 AM
It should be fixed now.
Title: Re: AutoLISP Syntax Highlighter on the forums
Post by: qjchen on October 06, 2011, 06:38:15 AM
~~ Thank you, great.
Let me test
Code (autolisp) Select

;;; and lwpolyline
if (> a b )
(defun objectpoint_text (obj);;;;test
 (if (= (cdr (assoc 0 obj)) "TEXT")
   (tbox-cab obj)
 )
)
(setq textHeight (vlax-get (vlax-ename->vla-object x) 'Height))



I am also learning how to use SyntaxHighlighter 3.0.83 in my pages
but I find that when I use this
this.regexList = [
            { regex:  /;.*$/gm,                   css: 'comments'  },
then, in the highlight, all < is convert into <;   and > into >;    vlax-ename->vla-object x   into vlax-ename->;vla-object x

but in your great site, there is no problem exist, great~
Title: Re: AutoLISP Syntax Highlighter on the forums
Post by: owenwengerd on October 06, 2011, 03:45:48 PM
It gets complicated because special characters will be represented as HTML codes (i.e. &lt;) in the raw HTML.