Code window in forum posts

Feature requested and implemented
Post Reply
User avatar
PeterN
Posts: 66
Joined: Mon Feb 08, 2021 7:56 pm
Location: Krefeld, Germany
Has thanked: 31 times
Been thanked: 37 times
Contact:

Code window in forum posts

Post by PeterN »

Hi CiccioCB,

fortunately you found a possibility to include the code=annex window in the forum.
That works best with short code snippets, but finds its limmitations in readabylity if the code has more than 100 lines.
In the old forum we could paste the syntax-colored code with its window hight from the toolkit. That is not supportet by bbCode now.

I did not find a hint for a solution at my first quick internet search.
cicciocb
Site Admin
Posts: 191
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 56 times
Been thanked: 154 times
Contact:

Re: Code window in forum posts

Post by cicciocb »

Hi Peter,
I experimented with the addition of another bbcode

I included [height=xxx] [/height] to limit the height of the text.

For that you can include this around the [code) bbcode.

Example of code as before

Code: [Local Link Removed for Guests]

onhtmlchange changeme
DTMF "0"

wait

freq:
print counter.freq(1), counter.freq(2)
return

butpress:
print "butpress", HtmlEventButton$
DTMF HtmlEventButton$
return

changeme:
print "changeme", HtmlEventVar$
return

sub DTMF(sim$)
  local z
  for z = 0 to 15
    if (SYMB$(z) = ucase$(sim$)) then
      pin.tone pin_T1, cols(z and 3)
      pin.tone pin_T2, rows(z >> 2)
      pause 2500 ' duration of the tone
      pin.tone pin_T1, 0
      pin.tone pin_T2, 0
      exit for
    end if
  next z
end sub
And the same limited to 200 pixels

Code: [Local Link Removed for Guests]

onhtmlchange changeme
DTMF "0"

wait

freq:
print counter.freq(1), counter.freq(2)
return

butpress:
print "butpress", HtmlEventButton$
DTMF HtmlEventButton$
return

changeme:
print "changeme", HtmlEventVar$
return

sub DTMF(sim$)
  local z
  for z = 0 to 15
    if (SYMB$(z) = ucase$(sim$)) then
      pin.tone pin_T1, cols(z and 3)
      pin.tone pin_T2, rows(z >> 2)
      pause 2500 ' duration of the tone
      pin.tone pin_T1, 0
      pin.tone pin_T2, 0
      exit for
    end if
  next z
end sub
Another solution could be to limit automatically at a given height.
This is probably the best choice but I need to investigate how do it (probably in the php code)
User avatar
PeterN
Posts: 66
Joined: Mon Feb 08, 2021 7:56 pm
Location: Krefeld, Germany
Has thanked: 31 times
Been thanked: 37 times
Contact:

Re: Code window in forum posts

Post by PeterN »

Ah!!
Thanks, the [height=xxx] [/height] does the job perfect!!
Post Reply