login
Header Space

 
 

Re: WIP: asciidoc replacement

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Johannes Schindelin <Johannes.Schindelin@...>
Cc: <git@...>, <msysgit@...>
Date: Tuesday, October 2, 2007 - 9:56 pm

Johannes Schindelin wrote:

It's pretty good, I certainly wouldn't have trouble reading or
maintaining it, but I'll give you suggestions anyway.

nice work, replacing a massive XML/XSL/etc stack with a small Perl
script ;-)

Sam.


Add -w for warnings, also use strict;


this function acts on globals; make them explicit arguments to the function.


uncuddle your elsif's; also consider making this a "tabular ternary"
with the actions in separate functions.

ie

$result = ( $par =~ /^\. /s      ? $conv->do_enum($par)    :
            $par =~ /^\[verse\]/ ? $conv->do_verse($par)  :
            ... )

However I have a suspicion that your script is doing line-based parsing
instead of recursive descent; I don't know whether that's the right
thing for asciidoc.  It's actually fairly easy to convert a grammar to
code blocks using tricks from MJD's _Higher Order Perl_.  Is it
necessary for the asciidoc grammar?


These REs suffer from LTS (Leaning Toothpick Syndrome).  Consider using
s{foo}{bar} and adding the 'x' modifier to space out groups.


I'd consider a HERE-doc, or multi-line qq{ } more readable than this.


Use qq{} when making strings with lots of embedded double quotes and
interpolation.


Using commas rather than "." will safe you a concat when printing to
filehandles, but that's a very small nit to pick :)


Hmm, that regex would not match for <<foo > bar>>, if you care you'd
need to write something like <<((?:[^>]+|>[^>])*)>>


"." is the same as [^\n] (without the 's' modifier).


just use if (@$links) and while (@$links)


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
WIP: asciidoc replacement, Johannes Schindelin, (Tue Oct 2, 8:42 pm)
Re: WIP: asciidoc replacement, Junio C Hamano, (Wed Oct 3, 12:48 am)
Re: [msysGit] Re: WIP: asciidoc replacement, Johannes Schindelin, (Wed Oct 3, 7:50 am)
Re: [msysGit] Re: WIP: asciidoc replacement, David Kastrup, (Wed Oct 3, 8:02 am)
Re: WIP: asciidoc replacement, Wincent Colaiuta, (Wed Oct 3, 2:34 am)
Re: WIP: asciidoc replacement, David Kastrup, (Wed Oct 3, 4:12 am)
Re: WIP: asciidoc replacement, Wincent Colaiuta, (Wed Oct 3, 6:05 am)
Re: WIP: asciidoc replacement, Junio C Hamano, (Wed Oct 3, 6:57 am)
Re: WIP: asciidoc replacement, Martin Langhoff, (Thu Oct 4, 2:55 am)
Re: WIP: asciidoc replacement, David Kastrup, (Thu Oct 4, 4:58 pm)
Re: WIP: asciidoc replacement, Martin Langhoff, (Thu Oct 4, 6:49 pm)
Re: WIP: asciidoc replacement, Sam Ravnborg, (Wed Oct 3, 1:46 pm)
Re: WIP: asciidoc replacement, Johannes Schindelin, (Wed Oct 3, 2:57 pm)
Re: WIP: asciidoc replacement, Sam Ravnborg, (Wed Oct 3, 3:21 pm)
Re: WIP: asciidoc replacement, David Kastrup, (Wed Oct 3, 6:25 am)
Re: WIP: asciidoc replacement, J. Bruce Fields, (Wed Oct 3, 9:47 am)
Re: WIP: asciidoc replacement, David Kastrup, (Wed Oct 3, 10:01 am)
Re: WIP: asciidoc replacement, Sam Ravnborg, (Wed Oct 3, 6:52 am)
Re: WIP: asciidoc replacement, Sam Vilain, (Tue Oct 2, 9:56 pm)
Re: WIP: asciidoc replacement, Wincent Colaiuta, (Wed Oct 3, 2:40 am)
Re: WIP: asciidoc replacement, Johannes Schindelin, (Wed Oct 3, 12:23 am)
Re: WIP: asciidoc replacement, Sam Vilain, (Thu Oct 4, 12:13 am)
Re: WIP: asciidoc replacement, Johannes Schindelin, (Thu Oct 4, 8:41 am)
Re: WIP: asciidoc replacement, J. Bruce Fields, (Wed Oct 3, 9:55 am)
Re: WIP: asciidoc replacement, Jeff King, (Wed Oct 3, 12:51 am)
speck-geostationary