Re: [racket-users] colorizing code in html - scribble or the GUI?

2016-03-15 Thread Stephen Chang
You can also submit the code to pasterack.org, which uses the scribble
css. Each paste page also gives the html source of the code and output
on the side, which you can copy to anywhere you want.

On Tue, Mar 15, 2016 at 7:11 PM, Sanjeev Sharma  wrote:
> is there a quick & dirty way to use scribble or the drracket GUI to generate 
> html for random code snippets?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: custom keybindings (AltGr)

2016-03-15 Thread Matthew Flatt
Thanks for looking into this problem in depth! Although I'll suggest an
alternate implementation, your patch was helpful for me to understand
the problems and goals.

To generate an event when AltGr- doesn't produce a character, I
think a better approach here is to call ToUnicode(). That seems to work
as a check for whether a meaning is assigned to a key combination. It
avoids using state to try to match key-up events with key-down events,
and it should work better with key repeats.

For making Ctl-Alt- work as AltGr-, I think I see what you want,
based on how programs like Notepad interpret key combinations. I think
other users will still want to distinguish Ctl-Alt- and AltGr-
for keyboard shortcuts, though, along the same lines that Emacs
distinguishes them. So we'll probably need to make that an option,
similar to the `special-option-key` setting for OS X.

Can you try the enclosed "key.rkt" to see whether it works the way you
want? This version defines `control+alt-always-as-altgr?` as #t to
simulate an option for making Ctl-Alt- work as AltGr-.

At Mon, 7 Mar 2016 15:16:23 +, Bert De Ketelaere wrote:
> Hello,
> 
> 
> after looking around trying to fix my previous 
> problem
>  
> I found that DrRacket really is not sending any event for AltGr+(Key x) 
> combinations if this combination doesn't actually produces a char.
> 
> I tried changing the win32/key.rkt file in gui-lib so DrRacket would get 
> these 
> events and en passant I tried to make DrRacket behave more like other Win 
> programs when it comes to keyboard input.
> 
> 
> my attempt is at:
> 
> https://github.com/bdeket/gui/commit/994a5655a9f913b7388e0c74c1b6203659b645d3
> 
> 
> A few problems remain:
> 
> Ctrl+Alt+(key x): where this combination doesn't produce a char, x is 
> produced 
> instead of nothing
> 
> Ctrl+Alt+(key x) or AltGr+(key x): the release event is now hijacked and 
> sends 
> another keypress-event.
> 
> This is a problem, but I don't know how to fix this, and I prefer this 
> over the previous state where key-events where ignored
> 
> 
> Unfortunately I didn't understand all the code that was already there, and I 
> didn't find standard tests to test this.
> 
> Are there tests for the key-events?
> 
> 
> Kind regards,
> 
> Bert
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


key.rkt
Description: Binary data


Re: [racket-users] colorizing code in html - scribble or the GUI?

2016-03-15 Thread Matthew Butterick

On Mar 15, 2016, at 4:11 PM, Sanjeev Sharma  wrote:

> is there a quick & dirty way to use scribble or the drracket GUI to generate 
> html for random code snippets?


If you have Pygments installed, `pollen/unstable/pygments` and 
`pollen/template/html` can be used together to colorize code snippets (Racket 
or otherwise) & convert to HTML. (Your HTML page would also need a Pygments CSS 
file for the color theme.)

;
#lang at-exp racket
(require pollen/unstable/pygments pollen/template/html)

(->html @highlight['racket]{
 (define (foo x) (+ x 1))
})

(->html @highlight['python]{
 def foo(x):
 return x + 1
})

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] colorizing code in html - scribble or the GUI?

2016-03-15 Thread Sanjeev Sharma
is there a quick & dirty way to use scribble or the drracket GUI to generate 
html for random code snippets?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.