# Project idea: Ruby Press

**URL:** <https://www.ruby-forum.com/t/project-idea-ruby-press/106302>\
**Category:** Ruby\
**Created:** [June 8, 2007, 9:23am UTC](https://www.ruby-forum.com/t/project-idea-ruby-press/106302 "2007-06-08T09:23:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Victor\_SZverokSS\_Sh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f04885/32.png) [@Victor\_SZverokSS\_Sh](https://www.ruby-forum.com/u/Victor_SZverokSS_Sh)\
**Post date:** [June 8, 2007, 9:23am UTC](https://www.ruby-forum.com/t/project-idea-ruby-press/106302/1 "2007-06-08T09:23:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Victor\_SZverokSS\_Sh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f04885/32.png) [@Victor\_SZverokSS\_Sh](https://www.ruby-forum.com/u/Victor_SZverokSS_Sh)\
**Post date:** [June 8, 2007, 1:08pm UTC](https://www.ruby-forum.com/t/project-idea-ruby-press/106302/2 "2007-06-08T13:08:10Z")

</div>

On Fri, Jun 08, 2007 at 04:22:37PM +0900, Victor Zverok S. 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/projects/rtex](http://rubyforge.org/projects/rtex).  
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

---

<div class="post-metadata">

**Author:** ![Victor\_SZverokSS\_Sh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f04885/32.png) [@Victor\_SZverokSS\_Sh](https://www.ruby-forum.com/u/Victor_SZverokSS_Sh)\
**Post date:** [June 8, 2007, 1:13pm UTC](https://www.ruby-forum.com/t/project-idea-ruby-press/106302/3 "2007-06-08T13:13:10Z")

</div>

On 08/06/07, Gregory S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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/projects/rtex](http://rubyforge.org/projects/rtex).  
> 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

---

<div class="post-metadata">

**Author:** ![Victor\_SZverokSS\_Sh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f04885/32.png) [@Victor\_SZverokSS\_Sh](https://www.ruby-forum.com/u/Victor_SZverokSS_Sh)\
**Post date:** [June 9, 2007, 2:50pm UTC](https://www.ruby-forum.com/t/project-idea-ruby-press/106302/4 "2007-06-09T14:50:57Z")

</div>

> > On Fri, Jun 08, 2007 at 04:22:37PM +0900, Victor Zverok S. 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.dancingbison.com/products.html

```

The ReportLab toolkit is here:

```
http://www.reportlab.org

```

Vasudev Ram

> **[dancingbison.com](http://ww38.dancingbison.com/)**
>
> Learn Python Programming

---

<div class="post-metadata">

**Author:** ![Victor\_SZverokSS\_Sh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f04885/32.png) [@Victor\_SZverokSS\_Sh](https://www.ruby-forum.com/u/Victor_SZverokSS_Sh)\
**Post date:** [June 9, 2007, 10:43pm UTC](https://www.ruby-forum.com/t/project-idea-ruby-press/106302/5 "2007-06-09T22:43:51Z")

</div>

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 S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> section "Author" do
> columns 2, :space => 0.5
> 
> ```
> 
> “Title Page” =\> {  
> The main idea is:

–  
[http://www.jeremymcanally.com/](http://www.jeremymcanally.com/)

My free Ruby e-book:  
[http://www.humblelittlerubybook.com/book/](http://www.humblelittlerubybook.com/book/)

My blogs:

> **[Site not found · DreamHost](http://www.mrneighborly.com/)**
>
> The owner of this domain has not yet uploaded their website.

[http://www.rubyinpractice.com/](http://www.rubyinpractice.com/)

---

<div class="post-metadata">

**Author:** ![Victor\_SZverokSS\_Sh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f04885/32.png) [@Victor\_SZverokSS\_Sh](https://www.ruby-forum.com/u/Victor_SZverokSS_Sh)\
**Post date:** [June 8, 2007, 1:21pm UTC](https://www.ruby-forum.com/t/project-idea-ruby-press/106302/6 "2007-06-08T13:21:11Z")

</div>

Hi –

On Fri, 8 Jun 2007, Gregory S. wrote:

> 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 once toyed with the idea of a Ruby DVI writer. I didn’t get  
anywhere with it, but it might still be a good idea.

David

---

<div class="post-metadata">

**Author:** ![Victor\_SZverokSS\_Sh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f04885/32.png) [@Victor\_SZverokSS\_Sh](https://www.ruby-forum.com/u/Victor_SZverokSS_Sh)\
**Post date:** [June 9, 2007, 11:30pm UTC](https://www.ruby-forum.com/t/project-idea-ruby-press/106302/7 "2007-06-09T23:30:57Z")

</div>

On 6/8/07, Gregory S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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
