Testar Syntax Highligt: WP-CodeBox

' Gambas class file

PUBLIC UrklippVSString AS Variant
PUBLIC bRam AS Boolean

PUBLIC SUB Form_Open()
  bRam = TRUE
  textDatumTid_vs.Text = CStr(Format(Now(), "yymmdd")) & "_" & CStr(Format(Now(), "hhmmss")) ' Tiden visades lite knasigt? Typ 40 min för lite?
  rbVisaMer_Click
  textRubrik_vs_Change
END

PUBLIC SUB textRubrik_vs_Change()
  IF rbVisaMer.Value THEN 
      theString("[Visa mer...]")
  END IF
 
  IF rbVisaEXIF.Value THEN 
        theString("[Visa EXIF:]")
  END IF
END

PUBLIC SUB knappTillUrklipp_Click()
    Clipboard.Copy(UrklippVSString)
    textDatumTid_vs.Text = CStr(Format(Now(), "yymmdd")) & "_" & CStr(Format(Now(), "hhmmss"))
END

PUBLIC SUB Form_Resize()
  textBefore_vs.Resize(ME.ClientW - 110, textBefore_vs.h)  
  textSkyl_vs.Resize(ME.ClientW - 110, ME.H - (Panel1.H + 170))  
  Panel1.Resize(ME.ClientW, Panel1.h)  
  Panel1.Top = (ME.H - Panel1.H) - 15
  textAfterText_vs.Resize(ME.ClientW - 110, textAfterText_vs.h) 
  knappTillUrklipp.Left = (ME.W - knappTillUrklipp.W) - 15
END

PUBLIC SUB textDatumTid_vs_Change()
  IF rbVisaMer.Value THEN 
      theString("[Visa mer...]")
  END IF
  
  IF rbVisaEXIF.Value THEN 
      theString("[Visa EXIF:]")
  END IF
END

PUBLIC SUB textSkyl_vs_Change()
  textSkyl_vs.Refresh
  UrklippVSString = Conv(textBefore_vs.text & textSkyl_vs.text & textAfterText_vs.text, "utf-8", "Latin1")
END

PUBLIC SUB rbVisaMer_Click()
  IF rbVisaMer.Value THEN 
      theString("[Visa mer...]")
  END IF
  
  IF rbVisaEXIF.Value THEN 
    theString("[Visa EXIF:]")
  END IF
END

PUBLIC SUB rbVisaEXIF_Click()
   IF rbVisaMer.Value THEN 
    theString("[Visa mer...]")
  END IF
  
  IF rbVisaEXIF.Value THEN 
    theString("[Visa EXIF:]")
  END IF
END

PUBLIC SUB theString(sVisa AS String)
      textBefore_vs.text = "" & sVisa & "

" textAfterText_vs.text = "

" UrklippVSString = Conv(textBefore_vs.text & textSkyl_vs.text & textAfterText_vs.text, "utf-8", "Latin1") END PUBLIC SUB cbRam_Click() IF bRam THEN bRam = FALSE ELSE bRam = TRUE END IF rbVisaMer_Click END

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: WP-CODEBOX Plugin

Note[090114 UTC 17:33]: I found some useful information on the blog post:
Styling code samples par deux’. I’m now on the right way. It feel like that.

But the code syntax highlighting is a little bit less or it could be some more colours.
The lines 83 to 85 is misleading. There is no comments (green). It is string code.
But, this is not real vb-code. It is gambas. So I have to live with some small misleading colours :me:

One more thing: Can I find a way to set the ’box’ to a max height?

Note[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.

Is there a way to get rid of this annoying fact?

Note[090114 UTC 20:42]: Ok, I solve the main problem. The code syntax is highlighted in a box.

And I solve the issue with to height box. I now have a box that is about 200 pix height.

How do I do that? I search at the internet an found a blog page:
Insérer du code dans un article, and yes it is in French.

And that post guide me to edit a file (two files):
/blogg/wp-conten/plugins/wp-codebox/main.php
is the first one. And in that one I change the row number 130 from:

$output .= "
";

to:

$output .= "
";

And after that i change the second file:
/blogg/wp-conten/plugins/wp-codebox/css/codebox.css
In that file I change the row number 72 in the following part of the code:

/* IE FIX */
.wp_codebox {
	overflow-x: auto;
	overflow-y: hidden;
	padding-bottom: expression(this.scrollWidth >   this.offsetWidth ?   15 :   0);
	width: 100%;
}

from:

    overflow-y: hidden;

to:

    overflow-y: auto;

And in the code part above this I add a row in the following part of code:

/* codebox */
.wp_codebox {
	color: #100;
	background-color: #f9f9f9;
	border: 1px solid silver;
	margin: 0 0 1.5em 0;
	overflow: auto;
}

Below the row ’overflow: auto;’ at row number 67 I add this line:

  max-height: 200px

So, the code snippet now looks like this:

/* codebox */
.wp_codebox {
  color: #100;
  background-color: #f9f9f9;
  border: 1px solid silver;
  margin: 0 0 1.5em 0;
  overflow: auto;
  max-height: 200px
}
/* IE FIX */
.wp_codebox {
  overflow-x: auto;
  overflow-y: auto;
  padding-bottom: expression(this.scrollWidth > this.offsetWidth ? 15 : 0);
  width: 100%;
}

I feel pretty good. :me:

I feel enough strong to see if I can solve the problem with character that change from ’&’ to ’&’ and ’>’ to ’>’ for some example.

And, why not, translate the PlugIn WP-CodeBox to Swedish?

2 svar på ”Testar Syntax Highligt: WP-CodeBox

  1. Jag gav mig INTE på: ”… det irriterande faktum att WordPress admin textredigerare per standard ändrar ‘mysko’ kod – när jag inte vill att den ska bli ändrad.”

    Jag roade mig i stället med att översätta den till svenska.

    Men den mesta översättningen hamnade ju på den s.k. admin-sidan och där är det ju bara jag som läser.

Lämna ett svar

Din e-postadress kommer inte publiceras.