Perl syntax highlighting

2012-10-26 Thread William Blunn

Hello London Perl Mongers,

What do people reckon to use when wanting to do Perl syntax highlighting 
(Perl ? HTML), such as one might want to use in one's source code 
repository browser.


There is an existing repository browser installation at $employer which 
does Perl syntax highlighting, but I've found the existing highlighter 
to be a bit mediocre in as much as it doesn't handle some rather common 
cases. The people who look after the repository browser have been 
working on improving the syntax highlighter, and have so far managed to fix:


* a single quote in POD apparently being interpreted as the start of a 
string literal


* a single quote in a comment apparently being interpreted as the start 
of a string literal


but I am still suffering from

* a single quote in q{...} string apparently being interpreted as the 
start of a string literal


So I was wondering if there was a known good Perl syntax highligher. All 
suggestions gratefully received; suggestions of the form FooHighLight 
version = 2.71828 score bonus points.


(Before you ask, I don't (yet) know what syntax highligher is being used 
at the minute.)


Regards,

Bill



Re: Perl syntax highlighting

2012-10-26 Thread William Blunn
Sorry for the duplication; accidentally used wrong e-mail address but 
our wonderful moderator was just too darn efficient ☺ resulting in a 
race condition between the forwarding of my original message, and my 
re-post using the right address.


Apologies^2

2012-10-26 Thread William Blunn
Sorry for the Sorry for the duplicate --- looking at wrong folder, 
fingers faster than brain...


Re: Perl syntax highlighting

2012-10-26 Thread Randy J. Ray

On 10/26/12 12:43 AM, William Blunn wrote:

Hello London Perl Mongers,

What do people reckon to use when wanting to do Perl syntax highlighting
(Perl ? HTML), such as one might want to use in one's source code
repository browser.


I built a web-based tool around Perl::Critic for my employer, and for 
syntax-coloring I used PPI::HTML. I have yet to see it get confused by 
anything, and it has had to chew through some pretty atrocious Perl code...


https://metacpan.org/module/PPI::HTML

I don't remember all the details off-hand, and I can't share the code 
unfortunately. But tomorrow when I'm back in my office I might look it 
over and see if I can relate a few helpful hints.


Randy
--

Randy J. Ray  Sunnyvale, CA  http://www.rjray.org 
rj...@blackperl.com


twitter.com/rjray
Silicon Valley Scale Modelers: http://www.svsm.org


Re: Perl syntax highlighting

2012-10-26 Thread Dave Cross

Quoting William Blunn bill+london...@blunn.org:

So I was wondering if there was a known good Perl syntax highligher.  
All suggestions gratefully received; suggestions of the form  
FooHighLight version = 2.71828 score bonus points.


I don't know about known good, but here's what I use in various places.

On blogs.perl.org (Movable Type) we use a GCPrettify plugin[1] which  
is a wrapper around prettify.js[2].


On Perlhacks[3] (Wordpress), I use a plugin called Syntax Highlighter  
for WordPress[4] which is a wrapper around SyntaxHighlighter[5].


On my code web site[6] I use something I hacked together using  
PPI::HTML[7]. I should see if enough of that is useful enough to  
publish it somewhere.


I'm not sure if any of these solutions fix your specific issues.

Cheers,

Dave...

[1] https://github.com/movabletype/mt-plugin-gcprettify
[2] http://code.google.com/p/google-code-prettify/
[3] http://perlhacks.com/
[4] http://wppluginsj.sourceforge.jp/syntax-highlighter/
[5] http://alexgorbatchev.com/SyntaxHighlighter/
[6] See e.g. http://code.mag-sol.com/Array-Compare/dist/lib/Array/Compare.pm
[7] https://metacpan.org/module/PPI::HTML


Re: Perl syntax highlighting

2012-10-26 Thread Smylers
William Blunn writes:

 What do people reckon to use when wanting to do Perl syntax
 highlighting (Perl ? HTML), such as one might want to use in one's
 source code repository browser.

As a Vim user, I like Text::VimColor. This actually delegates the
highlighting to Vim, meaning that the colours output exactly match those
in my editor.

 * a single quote in POD apparently being interpreted as the start of a
 string literal
 
 * a single quote in a comment apparently being interpreted as the
 start of a string literal
 
 * a single quote in q{...} string apparently being interpreted as the
 start of a string literal

Vim gets all of those correct.

Smylers
-- 
New series of TV puzzle show 'Only Connect' (some questions by me)
Mondays at 20:30 on BBC4, or iPlayer: http://www.bbc.co.uk/onlyconnect


Fwd: UKUUG: [UKUUG-Announce] UKUUG - FLOSS UK - Un-Conference - Tomorrow! - London

2012-10-26 Thread Ian Norton
This might be of interest to some in London!

-- Forwarded message --
From: Jane Morrison off...@ukuug.org
Date: 26 October 2012 10:22
Subject: UKUUG: [UKUUG-Announce] UKUUG - FLOSS UK - Un-Conference -
Tomorrow! - London
To: annou...@ukuug.org

Still time to register and attend..


FLOSS UK unconference hosted by BCS Open Source SG (OSSG)

Saturday 27th October 2012

Venue: BCS, 5 Southampton Street, London WC2E 7HA

Book online (free, but registration required for refreshments and lunch
numbers) - http://flossuk.eventbrite.co.uk/

See map and travel information at: http://www.bcs.org/upload/pdf/london-office-
guide.pdf

On Twitter? We have an event on lanyrd.

This is our third un-conference and is very kindly being hosted by BCS OSSG.

What is an unconference?

An unconference is a conference where what happens is organised by the
delegates on the day. The event organisers have to arrange something, the main
one being a venue, but the rest is down to the delegates.  So all the hassle
of talk submissions, review and scheduling is taken away.

Typically at the start of the day everyone gets up in turn and says who they
are, what their interests are and what they'd like to do based on this people
write proposals on PostIt notes and stick these on a board a moderator may
read out the proposals in turn to gauge interest, and if sufficient the proposal
will be put on a scheduling board delegates may adjust the schedule to avoid
clashes, etc.

The unconference starts…

Experience shows that the unconference format results in high quality sessions
focussed on what delegates want.

There is no charge to attend but donations (on the door) will be accepted to
help fund the event. Everyone should be able to afford to come, and as it is a
one-day event you will not need to incur accommodation costs, though several
hotels are nearby for anyone who wishes to stay over.

Refreshments and lunch will be provided.

Why attend?

There are lots of reasons to attend the FLOSS UK Unconference 2012, including:
Keep abreast with new/emerging technologies
Network with some of the people who are responsible for developing critical
applications
Become part of the UK Open Source community - build up informal relationships
that can be invaluable in problem solving
Benefit from the experience of delegates with similar interests



--
FLOSS UK Secretariat
PO Box 37
Buntingford
Herts SG9 9UQ
Tel: 01763 273475
Fax: 01763 273255
off...@flossuk.org
off...@ukuug.org
www.flossuk.org
www.ukuug.org

A Company Limited by Guarantee
UKUUG Ltd. t/a FLOSS UK
Registered Office:
The Manor House
Buntingford
Herts SG9 9AB

Reg. No. 2506680

___
Announce mailing list
annou...@lists.ukuug.org
http://lists.ukuug.org/mailman/listinfo/announce
___
Council mailing list
coun...@lists.ukuug.org
http://lists.ukuug.org/mailman/listinfo/council


-- 
Ian Norton
Co-Leader North West England Perl Mongers (http://northwestengland.pm.org/)
Member of The Perl Foundation Marketing Committee
(http://www.perlfoundation.org/)
Member of FLOSS UK Council (http://www.flossuk.org/)



Re: Perl syntax highlighting

2012-10-26 Thread Zbigniew Łukasiak
On Fri, Oct 26, 2012 at 9:43 AM, William Blunn bill+london...@blunn.org wrote:
 Hello London Perl Mongers,

 What do people reckon to use when wanting to do Perl syntax highlighting
 (Perl ? HTML), such as one might want to use in one's source code repository
 browser.

 There is an existing repository browser installation at $employer which does
 Perl syntax highlighting, but I've found the existing highlighter to be a
 bit mediocre in as much as it doesn't handle some rather common cases. The
 people who look after the repository browser have been working on improving
 the syntax highlighter, and have so far managed to fix:

 * a single quote in POD apparently being interpreted as the start of a
 string literal

 * a single quote in a comment apparently being interpreted as the start of a
 string literal

 but I am still suffering from

 * a single quote in q{...} string apparently being interpreted as the start
 of a string literal

 So I was wondering if there was a known good Perl syntax highligher. All
 suggestions gratefully received; suggestions of the form FooHighLight
 version = 2.71828 score bonus points.

For https://github.com/zby/Nblog I use
http://alexgorbatchev.com/SyntaxHighlighter/ - it has the nice feature
that the code remains text, but I never tested it too exhaustively.

-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/


Re: UKUUG: [UKUUG-Announce] UKUUG - FLOSS UK - Un-Conference - Tomorrow! - London

2012-10-26 Thread Manuel Corpas
Is there a mail list to know about these event more in advance in the
future?
Cheers,
Manuel

--
*Dr Manuel Corpas *
Plant and Animal Genomes Project Leader
The Genome Analysis Centre | Norwich Research Park | Norwich | UK

Tel:  +44 1603 450 095
Fax: +44 1603 450 021
Web: http://goo.gl/OD9mP
Blog: http://manuelcorpas.com/
  http://www.facebook.com/corpasgenome https://twitter.com/#!/manuelcorpas
  http://www.linkedin.com/profile/view?id=5414661
https://plus.google.com/u/0/101146878928866340609/



On 26 October 2012 10:33, Ian Norton i.d.nor...@gmail.com wrote:

 This might be of interest to some in London!

 -- Forwarded message --
 From: Jane Morrison off...@ukuug.org
 Date: 26 October 2012 10:22
 Subject: UKUUG: [UKUUG-Announce] UKUUG - FLOSS UK - Un-Conference -
 Tomorrow! - London
 To: annou...@ukuug.org

 Still time to register and attend..


 FLOSS UK unconference hosted by BCS Open Source SG (OSSG)

 Saturday 27th October 2012

 Venue: BCS, 5 Southampton Street, London WC2E 7HA

 Book online (free, but registration required for refreshments and lunch
 numbers) - http://flossuk.eventbrite.co.uk/

 See map and travel information at:
 http://www.bcs.org/upload/pdf/london-office-
 guide.pdf

 On Twitter? We have an event on lanyrd.

 This is our third un-conference and is very kindly being hosted by BCS
 OSSG.

 What is an unconference?

 An unconference is a conference where what happens is organised by the
 delegates on the day. The event organisers have to arrange something, the
 main
 one being a venue, but the rest is down to the delegates.  So all the
 hassle
 of talk submissions, review and scheduling is taken away.

 Typically at the start of the day everyone gets up in turn and says who
 they
 are, what their interests are and what they'd like to do based on this
 people
 write proposals on PostIt notes and stick these on a board a moderator may
 read out the proposals in turn to gauge interest, and if sufficient the
 proposal
 will be put on a scheduling board delegates may adjust the schedule to
 avoid
 clashes, etc.

 The unconference starts…

 Experience shows that the unconference format results in high quality
 sessions
 focussed on what delegates want.

 There is no charge to attend but donations (on the door) will be accepted
 to
 help fund the event. Everyone should be able to afford to come, and as it
 is a
 one-day event you will not need to incur accommodation costs, though
 several
 hotels are nearby for anyone who wishes to stay over.

 Refreshments and lunch will be provided.

 Why attend?

 There are lots of reasons to attend the FLOSS UK Unconference 2012,
 including:
 Keep abreast with new/emerging technologies
 Network with some of the people who are responsible for developing critical
 applications
 Become part of the UK Open Source community - build up informal
 relationships
 that can be invaluable in problem solving
 Benefit from the experience of delegates with similar interests



 --
 FLOSS UK Secretariat
 PO Box 37
 Buntingford
 Herts SG9 9UQ
 Tel: 01763 273475
 Fax: 01763 273255
 off...@flossuk.org
 off...@ukuug.org
 www.flossuk.org
 www.ukuug.org

 A Company Limited by Guarantee
 UKUUG Ltd. t/a FLOSS UK
 Registered Office:
 The Manor House
 Buntingford
 Herts SG9 9AB

 Reg. No. 2506680

 ___
 Announce mailing list
 annou...@lists.ukuug.org
 http://lists.ukuug.org/mailman/listinfo/announce
 ___
 Council mailing list
 coun...@lists.ukuug.org
 http://lists.ukuug.org/mailman/listinfo/council


 --
 Ian Norton
 Co-Leader North West England Perl Mongers (http://northwestengland.pm.org/
 )
 Member of The Perl Foundation Marketing Committee
 (http://www.perlfoundation.org/)
 Member of FLOSS UK Council (http://www.flossuk.org/)




Re: UKUUG: [UKUUG-Announce] UKUUG - FLOSS UK - Un-Conference - Tomorrow! - London

2012-10-26 Thread Ian Norton
Manuel,

On 26 October 2012 10:58, Manuel Corpas m...@manuelcorpas.com wrote:
 Is there a mail list to know about these event more in advance in the
 future?

Indeed there is!  Cunningly hidden near the bottom of the forwarded message:

Announce mailing list
annou...@lists.ukuug.org
http://lists.ukuug.org/mailman/listinfo/announce

Ian.
-- 
Ian Norton
Co-Leader North West England Perl Mongers (http://northwestengland.pm.org/)
Member of The Perl Foundation Marketing Committee
(http://www.perlfoundation.org/)
Member of FLOSS UK Council (http://www.flossuk.org/)


Re: Hotels for the LPW

2012-10-26 Thread Peter Corlett
On 25 Oct 2012, at 09:00, Mark Keating wrote:
 I have been asked by a couple of people for hotel recommendations in and 
 around the LPW for this year. Traditionally we have always left people to 
 their own devices and the sites like TripAdvisor and Booking.com, but since I 
 have been asked and i know there is a vast wealth of knowledge and experience 
 on this list i thought I might throw the question to the masses.

As noted elsethread, people living in London tend not to need hotels in London 
so are the least-qualified to say which are good.

 I await, with anticipation, your gracious responses.

I have a spare double bed and a sofa available in Shepherd's Bush, which 
obviates the need for two hotel rooms.





Re: Hotels for the LPW

2012-10-26 Thread Piers Cawley
On 26 October 2012 12:20, Peter Corlett ab...@cabal.org.uk wrote:

 On 25 Oct 2012, at 09:00, Mark Keating wrote:
  I have been asked by a couple of people for hotel recommendations in and
 around the LPW for this year. Traditionally we have always left people to
 their own devices and the sites like TripAdvisor and Booking.com, but since
 I have been asked and i know there is a vast wealth of knowledge and
 experience on this list i thought I might throw the question to the masses.

 As noted elsethread, people living in London tend not to need hotels in
 London so are the least-qualified to say which are good.

  I await, with anticipation, your gracious responses.

 I have a spare double bed and a sofa available in Shepherd's Bush, which
 obviates the need for two hotel rooms.


Or maybe even three.


Re: Hotels for the LPW

2012-10-26 Thread Avi Greenbury
Peter Corlett wrote:
 As noted elsethread, people living in London tend not to need hotels
 in London so are the least-qualified to say which are good.

I'm tempted to suggest that we're generally likely to have a high
concentration of people who know other people who have come to London
and stayed in hotels, and can perhaps therefore pass on grumbles or
praise about them.

But a quick ask around reveals that I don't know anybody who would
recommend a hotel in London so perhaps that's not such a
solidly-founded suggestion after all.

-- 
Avi
 


Re: Hotels for the LPW

2012-10-26 Thread DAVID HODGKINSON

On 25 Oct 2012, at 09:00, Mark Keating m.keat...@shadowcat.co.uk wrote:

 Hi all,
 
 I have been asked by a couple of people for hotel recommendations in and 
 around the LPW for this year. Traditionally we have always left people to 
 their own devices and the sites like TripAdvisor and Booking.com, but since I 
 have been asked and i know there is a vast wealth of knowledge and experience 
 on this list i thought I might throw the question to the masses.
 
 I await, with anticipation, your gracious responses.

As a data point, $daughter said the Travelodge near Tower Bridge was skanky.





Re: Perl syntax highlighting

2012-10-26 Thread Randy J. Ray

I built a web-based tool around Perl::Critic for my employer, and for
syntax-coloring I used PPI::HTML. I have yet to see it get confused by
anything, and it has had to chew through some pretty atrocious Perl code...

https://metacpan.org/module/PPI::HTML

I don't remember all the details off-hand, and I can't share the code
unfortunately. But tomorrow when I'm back in my office I might look it
over and see if I can relate a few helpful hints.


I can get away with posting this small snippet:

my $document = PPI::Document-new($sourcefile);
my $ppi_html = PPI::HTML-new(line_numbers = 1);
my @lines = split /br\n/, $ppi_html-html($document);
# Now strip the line-numbers PPI provided, and force-close the span on
# each line. This seems wasteful, but it was the only way to get PPI::HTML
# to markup the code on a line-by-line basis, as opposed to leaving spans
# open across whole blocks of lines.
for my $lineno (0 .. $#lines) {
if ($lines[$lineno] =~ s{^/span}{}) {
$lines[$lineno - 1] .= '/span';
}
$lines[$lineno] =~ s{span\s+class=line_number\s*\d+:\s+/span}{}x;
}

Basically, I needed individual lines as opposed to just a big chunk of 
HTML (each line goes into a table row, with some other information in 
other td's of that same row). Calling PPI::HTML-new() with 
line_numbers = 1 prevents PPI::HTML from spanning mark-up across 
lines. For example, a 5-line comments would have the starting span on 
the first line, but the closing /span on the 5th line. I needed each 
line to be marked up individually. line_numbers does this as a 
side-effect of having to insert a span for each line number.


But I didn't want their line numbers :-). Plus, they close whatever 
currently-open span there is at the start of the next line instead of 
on the line they opened it. So in the for-loop, I first excise the 
leading /span, and if there was one to excise (there isn't on the 
first line, of course) I append it to the previous line. Now each line 
is truly self-contained. I then delete the leading span that matches 
'span\s+class=line_number\s*\d+:\s+/span', which drops their line 
numbering.


And I now have @lines, which are my marked-up, syntax-highlighted 
(highlit?) lines.


Of course, if you don't need individual lines, you can skip all of the 
extra work:


my $document = PPI::Document-new($sourcefile);
my $ppi_html = PPI::HTML-new();
my $html = $ppi_html-html($document);

And you can decide for yourself if you need line numbers or not...

Randy
--

Randy J. Ray  Sunnyvale, CA  http://www.rjray.org 
rj...@blackperl.com


Silicon Valley Scale Modelers: http://www.svsm.org


Re: Perl syntax highlighting

2012-10-26 Thread David Cantrell
On Fri, Oct 26, 2012 at 08:43:59AM +0100, William Blunn wrote:

 What do people reckon to use when wanting to do Perl syntax highlighting 
 (Perl ? HTML), such as one might want to use in one's source code 
 repository browser.
 
 There is an existing repository browser installation at $employer which 
 does Perl syntax highlighting, but I've found the existing highlighter 
 to be a bit mediocre in as much as it doesn't handle some rather common 
 cases. The people who look after the repository browser have been 
 working on improving the syntax highlighter, and have so far managed to fix:

Back when I used cgit, I wrote a little script that wrapped around
perltidy for syntax highlighting.  These days I just let github do all
that.

-- 
David Cantrell | even more awesome than a panda-fur coat

Anyone who cannot cope with mathematics is not fully human.
At best he is a tolerable subhuman who has learned to wear
shoes, bathe and not make messes in the house.
   -- Robert A Heinlein


Re: UKUUG: [UKUUG-Announce] UKUUG - FLOSS UK - Un-Conference - Tomorrow! - London

2012-10-26 Thread David Cantrell
On Fri, Oct 26, 2012 at 10:58:15AM +0100, Manuel Corpas wrote:

 Is there a mail list to know about these event more in advance in the
 future?

I sent something out about it a coupla weeks ago.  So yes, this one!.

-- 
David Cantrell | Hero of the Information Age

Erudite is when you make a classical allusion to a
feather.  Kinky is when you use the whole chicken.