{"id":494,"date":"2009-01-14T17:29:26","date_gmt":"2009-01-14T16:29:26","guid":{"rendered":"http:\/\/blogg.ngn.nu\/index.php\/2009\/01\/14\/testar-syntax-highligt-wp-codebox\/"},"modified":"2009-01-14T22:55:31","modified_gmt":"2009-01-14T21:55:31","slug":"testar-syntax-highligt-wp-codebox","status":"publish","type":"post","link":"https:\/\/blogg.ngn.nu\/index.php\/2009\/01\/14\/testar-syntax-highligt-wp-codebox\/","title":{"rendered":"Testar Syntax Highligt: WP-CodeBox"},"content":{"rendered":"<pre colla=\"+\" lang=\"vb\">' Gambas class file\r\n\r\nPUBLIC UrklippVSString AS Variant\r\nPUBLIC bRam AS Boolean\r\n\r\nPUBLIC SUB Form_Open()\r\n  bRam = TRUE\r\n  textDatumTid_vs.Text = CStr(Format(Now(), \"yymmdd\")) & \"_\" & CStr(Format(Now(), \"hhmmss\")) ' Tiden visades lite knasigt? Typ 40 min f\u00f6r lite?\r\n  rbVisaMer_Click\r\n  textRubrik_vs_Change\r\nEND\r\n\r\nPUBLIC SUB textRubrik_vs_Change()\r\n  IF rbVisaMer.Value THEN \r\n      theString(\"[Visa mer...]\")\r\n  END IF\r\n \r\n  IF rbVisaEXIF.Value THEN \r\n        theString(\"[Visa EXIF:]\")\r\n  END IF\r\nEND\r\n\r\nPUBLIC SUB knappTillUrklipp_Click()\r\n    Clipboard.Copy(UrklippVSString)\r\n    textDatumTid_vs.Text = CStr(Format(Now(), \"yymmdd\")) & \"_\" & CStr(Format(Now(), \"hhmmss\"))\r\nEND\r\n\r\nPUBLIC SUB Form_Resize()\r\n  textBefore_vs.Resize(ME.ClientW - 110, textBefore_vs.h)  \r\n  textSkyl_vs.Resize(ME.ClientW - 110, ME.H - (Panel1.H + 170))  \r\n  Panel1.Resize(ME.ClientW, Panel1.h)  \r\n  Panel1.Top = (ME.H - Panel1.H) - 15\r\n  textAfterText_vs.Resize(ME.ClientW - 110, textAfterText_vs.h) \r\n  knappTillUrklipp.Left = (ME.W - knappTillUrklipp.W) - 15\r\nEND\r\n\r\nPUBLIC SUB textDatumTid_vs_Change()\r\n  IF rbVisaMer.Value THEN \r\n      theString(\"[Visa mer...]\")\r\n  END IF\r\n  \r\n  IF rbVisaEXIF.Value THEN \r\n      theString(\"[Visa EXIF:]\")\r\n  END IF\r\nEND\r\n\r\nPUBLIC SUB textSkyl_vs_Change()\r\n  textSkyl_vs.Refresh\r\n  UrklippVSString = Conv(textBefore_vs.text & textSkyl_vs.text & textAfterText_vs.text, \"utf-8\", \"Latin1\")\r\nEND\r\n\r\nPUBLIC SUB rbVisaMer_Click()\r\n  IF rbVisaMer.Value THEN \r\n      theString(\"[Visa mer...]\")\r\n  END IF\r\n  \r\n  IF rbVisaEXIF.Value THEN \r\n    theString(\"[Visa EXIF:]\")\r\n  END IF\r\nEND\r\n\r\nPUBLIC SUB rbVisaEXIF_Click()\r\n   IF rbVisaMer.Value THEN \r\n    theString(\"[Visa mer...]\")\r\n  END IF\r\n  \r\n  IF rbVisaEXIF.Value THEN \r\n    theString(\"[Visa EXIF:]\")\r\n  END IF\r\nEND\r\n\r\nPUBLIC SUB theString(sVisa AS String)\r\n      textBefore_vs.text = \"<a id=\" &#038;\r\n      Chr(34)&#038; \r\n      textRubrik_vs.text &#038; \r\n      Chr(34)&#038; \r\n      \" style=\" &#038; \r\n      Chr(34)&#038; \r\n      \"background-color: #ffffcc; cursor: pointer\" &#038; \r\n      Chr(34)&#038; \r\n      \" onclick=\" &#038;\r\n      Chr(34)&#038; \r\n      \"expand(this.id+'\" &#038; \r\n      \"_\" &#038; textDatumTid_vs.text &#038; \r\n      \"', this);\" &#038; \r\n      Chr(34)&#038; \r\n      \">\" & sVisa & \"<\/a><div id=\" &#038; \r\n      Chr(34)&#038; \r\n      textRubrik_vs.text &#038; \r\n      \"_\" &#038; \r\n      textDatumTid_vs.text &#038; \r\n      Chr(34)&#038; \r\n      \" style=\" &#038; Chr(34)&#038; \r\n      IIf(bRam, \"border: 1px solid grey; display: none\", \"display: none\")&#038; \r\n      Chr(34)&#038; \r\n      \"><p>\"\r\n \r\n    textAfterText_vs.text = \"<\/p><\/div><!-- Slut \" & textRubrik_vs.text & \" -->\"\r\n\r\n    UrklippVSString = Conv(textBefore_vs.text & textSkyl_vs.text & textAfterText_vs.text, \"utf-8\", \"Latin1\")\r\nEND\r\n\r\nPUBLIC SUB cbRam_Click()\r\n IF bRam THEN \r\n  bRam = FALSE  \r\n ELSE \r\n  bRam = TRUE\r\n END IF \r\n \r\n rbVisaMer_Click\r\nEND<\/pre>\n<p> This post is here because the WP-CodeBox code writer, Erik Wang, could be able to read it and help my out. I have post a comment on his blog post: <a href=\"http:\/\/www.ericbess.com\/ericblog\/2008\/03\/03\/wp-codebox\/\" title=\"Permalink\">WP-CODEBOX Plugin<\/a><\/p>\n<p><strong>Note<\/strong>[090114 UTC 17:33]: I found some useful information on the blog post:<br \/>\n&#8217;<a href=\"http:\/\/blog.clearskys.net\/2008\/12\/16\/styling-code-samples-par-deux\/\" target=\"_blank\" rel=\"nofollow\">Styling code samples par deux<\/a>&#8217;. I&#8217;m now on the right way. It feel like that.<\/p>\n<p>But the code syntax highlighting is a little bit less or it could be some more colours.<br \/>\nThe lines 83 to 85 is misleading. There is no comments (green). It is string code.<br \/>\nBut, this is not real vb-code. It is gambas. So I have to live with some small misleading colours :me:<\/p>\n<p>One more thing: Can I find a way to set the &#8217;box&#8217; to a max height?<\/p>\n<p><strong>Note<\/strong>[090114 UTC 17:43]: Another irritating thing that is not depending on the PlugIn WP-CodeBox is that I have to paste the code from scratch every time I update this post.<\/p>\n<p>Is there a way to get rid of this annoying fact?<\/p>\n<p><strong>Note<\/strong>[090114 UTC 20:42]: Ok, I solve the main problem. The code syntax is highlighted in a box.<\/p>\n<p>And I solve the issue with to height box. I now have a box that is about 200 pix height.<\/p>\n<p>How do I do that? I search at the internet an found a blog page:<br \/>\n<a href=\"http:\/\/www.duretz.net\/2008\/10\/29\/inserer-du-code-dans-un-article\/\" target=\"_blank\">Ins\u00e9rer du code dans un article<\/a>, and yes it is in French.<\/p>\n<p>And that post guide me to edit a file (two files):<br \/>\n\/blogg\/wp-conten\/plugins\/wp-codebox\/main.php<br \/>\nis the first one. And in that one I change the row number 130 from:<\/p>\n<pre colla=\"+\" lang=\"php\" line=\"130\">$output .= \"<div class=\\\"wp_codebox\\\">\";<\/pre>\n<p>to:<\/p>\n<pre colla=\"+\" lang=\"php\" line=\"130\">$output .= \"<div style=\\\"display: block;\\\" class=\\\"wp_codebox\\\">\";<\/pre>\n<p>And after that i change the second file:<br \/>\n\/blogg\/wp-conten\/plugins\/wp-codebox\/css\/codebox.css<br \/>\nIn that file I change the row number 72 in the following part of the code:<\/p>\n<pre colla=\"+\" lang=\"css\" line=\"69\">\/* IE FIX *\/\r\n.wp_codebox {\r\n\toverflow-x: auto;\r\n\toverflow-y: hidden;\r\n\tpadding-bottom: expression(this.scrollWidth >   this.offsetWidth ?   15 :   0);\r\n\twidth: 100%;\r\n}\r\n\r\n<\/pre>\n<p>from:<\/p>\n<pre colla=\"+\" lang=\"css\" line=\"72\">    overflow-y: hidden;<\/pre>\n<p>to:<\/p>\n<pre colla=\"+\" lang=\"css\" line=\"72\">    overflow-y: auto;<\/pre>\n<p>And in the code part above this I add a row in the following part of code:<\/p>\n<pre colla=\"+\" lang=\"css\" line=\"60\">\/* codebox *\/\r\n.wp_codebox {\r\n\tcolor: #100;\r\n\tbackground-color: #f9f9f9;\r\n\tborder: 1px solid silver;\r\n\tmargin: 0 0 1.5em 0;\r\n\toverflow: auto;\r\n}\r\n<\/pre>\n<p>Below the row &#8217;<code>overflow: auto;<\/code>&#8217; at row number 67 I add this line:<\/p>\n<pre colla=\"+\" lang=\"css\" line=\"67\">  max-height: 200px<\/pre>\n<p>So, the code snippet now looks like this:<\/p>\n<pre colla=\"+\" lang=\"css\" line=\"60\">\/* codebox *\/\r\n.wp_codebox {\r\n  color: #100;\r\n  background-color: #f9f9f9;\r\n  border: 1px solid silver;\r\n  margin: 0 0 1.5em 0;\r\n  overflow: auto;\r\n  max-height: 200px\r\n}\r\n\/* IE FIX *\/\r\n.wp_codebox {\r\n  overflow-x: auto;\r\n  overflow-y: auto;\r\n  padding-bottom: expression(this.scrollWidth > this.offsetWidth ? 15 : 0);\r\n  width: 100%;\r\n}\r\n<\/pre>\n<p>I feel pretty good. :me:<\/p>\n<p>I feel enough strong to see if I can solve the problem with character that change from &#8217;&#038;&#8217; to &#8217;&amp;amp;&#8217; and &#8217;>&#8217; to &#8217;&amp;gt;&#8217; for some example.<\/p>\n<p>And, why not, translate the PlugIn WP-CodeBox to Swedish?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8217; Gambas class file PUBLIC UrklippVSString AS Variant PUBLIC bRam AS Boolean PUBLIC SUB Form_Open() bRam = TRUE textDatumTid_vs.Text = CStr(Format(Now(), &#8221;yymmdd&#8221;)) &#038; &#8221;_&#8221; &#038; CStr(Format(Now(), &#8221;hhmmss&#8221;)) &#8217; Tiden visades lite knasigt? Typ 40 min f\u00f6r lite? rbVisaMer_Click textRubrik_vs_Change END &hellip; <a href=\"https:\/\/blogg.ngn.nu\/index.php\/2009\/01\/14\/testar-syntax-highligt-wp-codebox\/\">Forts\u00e4tt l\u00e4sa <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[899],"tags":[572,373,307],"class_list":["post-494","post","type-post","status-publish","format-standard","hentry","category-bloggutv","tag-css-stilmall-for-xhtml","tag-gambas","tag-php"],"_links":{"self":[{"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/posts\/494","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/comments?post=494"}],"version-history":[{"count":1,"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/posts\/494\/revisions"}],"predecessor-version":[{"id":9883,"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/posts\/494\/revisions\/9883"}],"wp:attachment":[{"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/media?parent=494"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/categories?post=494"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/tags?post=494"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}