Hi Felipe,
It's good to hear you are working on the self-documenting examples.
Those will be very helpful to aid in our documentation.
The example you posted looks like a great start. I'd work on cleaning
up the look of the code -- set it in a monospace font and turn spaces
in the input text into non-breaking spaces so line indentation is
properly preserved.
One major issue with your Snippet module: I believe
Proc#source_location is 1.9-only. Since we support Ruby 1.8.7 as well,
you'll have to find some other way to extract the source text.
Thanks and keep up the good work!
Brad
The example you posted looks like a great start. I'd work on cleaning
up the look of the code -- set it in a monospace font and turn spaces
in the input text into non-breaking spaces so line indentation is
properly preserved.
One major issue with your Snippet module: I believe
Proc#source_location is 1.9-only. Since we support Ruby 1.8.7 as well,
you'll have to find some other way to extract the source text.
This stuff looks great. I really like the direction this is going.
One note on Ruby 1.9.2 compatibility: The current directory (.) has
been removed from $LOAD_PATH. So requiring a file relative to the
current directory won't work. This can bite you in weird ways -- one
of which is that the previous require statements:
require File.join(File.dirname(__FILE__), '..', 'example_helper.rb'))
should be changed to use File.expand_path:
require File.expand_path(File.join(File.dirname(__FILE__),
'..', 'example_helper.rb'))
in order to be able to run the examples via a relative path (ruby
new_examples/graphics/hexagon.rb).
Similarly, try running your examples from outside of that directory --
for example, in Prawn's root directory:
ruby new_examples/graphics/graphics.rb
and fix any LoadErrors that pop there.
As for the text introducing the examples: It would be nice if you
could flow the text naturally instead of forcing linebreaks where they
appear in the source file. For example, in origin.rb, we probably
don't need a linebreak before "page".
> 2) Should I use some well defined comments to ease the code parsing? like:
>
> # BEGIN_EXAMPLE
> do_stuff
> # END_EXAMPLE
I think that this would probably be a good thing to do. I would prefer
if we could find a way around it, but I can't immediately think of a
way to avoid it if we're trying to pull the exact source text.
Eventually I can see something like this becoming Prawn's reference
manual. You could add in higher-level functions to create a chapter
for each directory (graphics being one). I'm sure you have thought of
these ideas already... I think this is off to a great start and I'm
excited to see where this can go.
Brad
Eventually I can see something like this becoming Prawn's reference
manual. You could add in higher-level functions to create a chapter
for each directory (graphics being one). I'm sure you have thought of
these ideas already... I think this is off to a great start and I'm
excited to see where this can go.
--
Tom Dyer
Thank you so much Felipe. This looks excellent.
You've really set a high bar for what sort of great things can be
started through RMU projects.
-greg
This is fantastic! As Greg said, you have truly set the bar high for
RMU projects, as well as for Prawn contributions. These examples are
incredibly clear and self-explanatory; excellent work.
I'll read over your code and post comments I may have, but I just
wanted to say that I'm very impressed with the result here.
-be
I think it's fine if those examples aren't strictly self-executing.
But it would be good to have some information in the manual about how
Prawn::Document.generate behaves.
> 2. The first examples on the manual will be those about creating and
> generating Prawn::Document. After that what should be the order for examples
> or example packages?
Start with the simple stuff: basic graphics and text. Then you could
move on to page layout, more complex text formatting (like inline
formatting), tables, outlines, document security, and everything else.
-be
I can't see the any of the examples in the examples dir? For example,
basic_concepts/creation.rb ?
thanks
--
Tom Dyer
--
Tom Dyer
Ok, needed to clone https://github.com/aguids/prawn.git and switch to
the examples branch, got it.