[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Project idea: Ruby Press

Victor 'Zverok' Shepelev

6/8/2007 7:23:00 AM

It seems to be cool idea if somebody with strong experience of printing and
press would code his experience in Ruby, to have pretty DSL for making
"book-like" and "newspaper-like" printing.

I have in mind something like

my_book = book "My Book" do
page_size 'A4'
units 'cm'
type :brochure

section "Title Page" do
margin 0
columns 1

section "Title" do
padding :top => 20
font "Lucida", "36pt"
align :center
end

section "Author" do
font "Times New Roman", "20pt"
align :right
end
end

section "Plain Pages" do
margin [1, 1, 0.5, 0.5]

font 'Georgia', '12pt'

columns 2, :space => 0.5

header do
text_template self.number
text_align :right
end
#hm... lots of other cool stuff?
end
end

my_book.render_pdf "mybook.pdf" {
"Title Page" => {
"Title" => "It's my book!",
"Author" => "It's me"
},

"Plain Pages" => File.read("mybook.txt")
}


It can all look strange (as well as my English)...

The main idea is:
* DSL, which would be natural for press (headers and footers, columns, and
other things, if you know...)
* Under it, press-print experience coded accurately.
* Special efforts for correct images and tables printing...

What do you think? Am I reinventing TeX?

V.


6 Answers

Gregory Seidman

6/8/2007 11:07:00 AM

0

On Fri, Jun 08, 2007 at 04:22:37PM +0900, Victor Zverok Shepelev wrote:
> It seems to be cool idea if somebody with strong experience of printing and
> press would code his experience in Ruby, to have pretty DSL for making
> "book-like" and "newspaper-like" printing.
[...]
> What do you think? Am I reinventing TeX?

Yes, that's what I think :-)

That said, it's plausible that a Ruby DSL frontend to TeX (or, more likely,
LaTeX) would be useful to someone, in much the same way that RJS is a
frontend to (Prototype-/Scriptaculous-backed) JavaScript. I think it would
be a terrible waste to reimplement all the well-tuned, well-tested, and
pretty much bug-free typesetting/flowing/layout TeX/LaTeX provides.

You might also want to look into rtex <http://rubyforge.org/project....
It isn't quite what you're talking about, but a layer of helper methods on
top of it might suit your needs.

> V.
--Greg


Farrel Lifson

6/8/2007 11:12:00 AM

0

On 08/06/07, Gregory Seidman <gsslist+ruby@anthropohedron.net> wrote:
> On Fri, Jun 08, 2007 at 04:22:37PM +0900, Victor Zverok Shepelev wrote:
> > It seems to be cool idea if somebody with strong experience of printing and
> > press would code his experience in Ruby, to have pretty DSL for making
> > "book-like" and "newspaper-like" printing.
> [...]
> > What do you think? Am I reinventing TeX?
>
> Yes, that's what I think :-)
>
> That said, it's plausible that a Ruby DSL frontend to TeX (or, more likely,
> LaTeX) would be useful to someone, in much the same way that RJS is a
> frontend to (Prototype-/Scriptaculous-backed) JavaScript. I think it would
> be a terrible waste to reimplement all the well-tuned, well-tested, and
> pretty much bug-free typesetting/flowing/layout TeX/LaTeX provides.
>
> You might also want to look into rtex <http://rubyforge.org/project....
> It isn't quite what you're talking about, but a layer of helper methods on
> top of it might suit your needs.
>
> > V.
> --Greg

You could build something on PDF::Writer. There already is a simple
markup language with the Ruby based parser that generates all it's
documentation.

Farrle

dblack

6/8/2007 11:20:00 AM

0

vasudevram

6/9/2007 12:50:00 PM

0

> > On Fri, Jun 08, 2007 at 04:22:37PM +0900, Victor Zverok Shepelev wrote:
> >> It seems to be cool idea if somebody with strong experience of printing and
> >> press would code his experience in Ruby, to have pretty DSL for making
> >> "book-like" and "newspaper-like" printing.
> > [...]

Sounds like it might be a good idea ...

I wrote a very simple book-generating program (in Python) using my
xtopdf toolkit. Its called
PDFBook.py and is part of the xtopdf package. xtopdf in turn uses the
open source ReportLab toolkit, which is pretty good, IMO. So is
PDF::Writer.

xtopdf info and software is here:

http://www.dancin.../pro...

The ReportLab toolkit is here:

http://www.rep...

Vasudev Ram
http://www.dancin...


Jeremy McAnally

6/9/2007 8:44:00 PM

0

I started something like that that was basically a Ruby DSL to Docbook
using Builder + convenience methods. I called it Rockbook...

I think I still have the code around somewhere.

--Jeremy

On 6/8/07, Victor Zverok Shepelev <vshepelev@imho.com.ua> wrote:
> It seems to be cool idea if somebody with strong experience of printing and
> press would code his experience in Ruby, to have pretty DSL for making
> "book-like" and "newspaper-like" printing.
>
> I have in mind something like
>
> my_book = book "My Book" do
> page_size 'A4'
> units 'cm'
> type :brochure
>
> section "Title Page" do
> margin 0
> columns 1
>
> section "Title" do
> padding :top => 20
> font "Lucida", "36pt"
> align :center
> end
>
> section "Author" do
> font "Times New Roman", "20pt"
> align :right
> end
> end
>
> section "Plain Pages" do
> margin [1, 1, 0.5, 0.5]
>
> font 'Georgia', '12pt'
>
> columns 2, :space => 0.5
>
> header do
> text_template self.number
> text_align :right
> end
> #hm... lots of other cool stuff?
> end
> end
>
> my_book.render_pdf "mybook.pdf" {
> "Title Page" => {
> "Title" => "It's my book!",
> "Author" => "It's me"
> },
>
> "Plain Pages" => File.read("mybook.txt")
> }
>
>
> It can all look strange (as well as my English)...
>
> The main idea is:
> * DSL, which would be natural for press (headers and footers, columns, and
> other things, if you know...)
> * Under it, press-print experience coded accurately.
> * Special efforts for correct images and tables printing...
>
> What do you think? Am I reinventing TeX?
>
> V.
>
>
>


--
http://www.jeremymca...

My free Ruby e-book:
http://www.humblelittlerubybook...

My blogs:
http://www.mrneigh...
http://www.rubyinpra...

Martin DeMello

6/9/2007 9:30:00 PM

0

On 6/8/07, Gregory Seidman <gsslist+ruby@anthropohedron.net> wrote:
>
> That said, it's plausible that a Ruby DSL frontend to TeX (or, more likely,
> LaTeX) would be useful to someone, in much the same way that RJS is a
> frontend to (Prototype-/Scriptaculous-backed) JavaScript. I think it would
> be a terrible waste to reimplement all the well-tuned, well-tested, and
> pretty much bug-free typesetting/flowing/layout TeX/LaTeX provides.

I've had good experiences using ruby to generate lout - it's more
pleasant to work with than {la,}tex since machine generation was one
of its design goals.

martin