# \[ANN\] erbook 4.0.0 (was previously named Gerbil)

**URL:** <https://www.ruby-forum.com/t/ann-erbook-4-0-0-was-previously-named-gerbil/153389>\
**Category:** Ruby\
**Created:** [November 16, 2008, 4:35am UTC](https://www.ruby-forum.com/t/ann-erbook-4-0-0-was-previously-named-gerbil/153389 "2008-11-16T04:35:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![snk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@snk](https://www.ruby-forum.com/u/snk)\
**Post date:** [November 16, 2008, 4:35am UTC](https://www.ruby-forum.com/t/ann-erbook-4-0-0-was-previously-named-gerbil/153389/1 "2008-11-16T04:35:21Z")

</div>

# erbook : write books and documents in eRuby

erbook is an extensible document processor that emits HTML  
(web page), LaTeX (PDF), man (UNIX manual page), plain text,  
and any document format you can imagine from eRuby templates  
that allow scripting and dynamic content generation.

erbook is a light (200 source lines of code), extensible  
(create your own document formats), and flexible (your content  
is scriptable) alternative to DocBook, Deplate, and SiSU.

Visit [ERBook 9.2.1 — Write books, manuals, and documents in eRuby](http://snk.tuxfamily.org/lib/erbook/) for more information.

```
            * * * RELEASE NOTES * * *

```

erbook 4.0.0

This release renames the project, changes the project  
license, the source repository, and the default  
text-to-HTML formatting system, refactors the HTML format,  
and revises the documentation.

1 Caution

â€¢ The â€œGerbilâ€ project has been renamed to â€œerbookâ€ to  
better reflect its purpose: it allows you to write  
books and documents using eRuby.

â€¢ The project license has been changed from a custom MIT/  
copyleft license to the more permissive ISC license to  
make the world a better place! 🙂

â€¢ The project source code repository is now hosted on  
GitHub (and therefore we now use Git instead of Darcs)  
to ease collaboration.

â€¢ Markdown is now the default text-to-HTML formatting  
system for the HTML format.

2 Thanks

the new project logo

â€¢ Jens Vierbuchen contributed the the cartoon owl sitting  
on a book drawing that is used in the new project logo.

â€¢ Maunika Gosike provided usability feedback to help  
improve the HTML format.

3 Improvements

â€¢ Renameed Node#url to Node#here\_frag. Also, speak of  
â€œfragsâ€ rather than â€œanchorsâ€ or â€œurlsâ€ from now on.

â€¢ Refactored common logic from node output templates into  
Node class.

â€¢ Added admonition icon for HTML

> element.
> 
> â€¢ Revised the user manual and added new content.
> 
> 3.1 Usability
> 
> â€¢ A visual marker is shown on outgoing (external)  
> hyperlinks.
> 
> â€¢ Tooltips are shown upon mouse hover for section index  
> and title links which instruct new users how to  
> navigate the web page more efficiently.

---

<div class="post-metadata">

**Author:** ![snk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@snk](https://www.ruby-forum.com/u/snk)\
**Post date:** [November 17, 2008, 4:41am UTC](https://www.ruby-forum.com/t/ann-erbook-4-0-0-was-previously-named-gerbil/153389/2 "2008-11-17T04:41:48Z")

</div>

Hi Suraj,

- Suraj K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [2008-11-16 12:32:07 +0900]:

> # erbook : write books and documents in eRuby
> 
> erbook is an extensible document processor that emits HTML  
> (web page), LaTeX (PDF), man (UNIX manual page), plain text,  
> and any document format you can imagine from eRuby templates  
> that allow scripting and dynamic content generation.

Nice software - hope to see the LaTex formatter coming out soon.  
I was wondering if the markup could be made simpler. Is the eruby  
template the best for this - For example, there are so many extra  
things to type in the following

\<% chapter “Introduction” do %\>  
\<% end %\>

compared to say \chapter{Introduction} in TeX, for example

## saji

> ??? The ???Gerbil??? project has been renamed to ???erbook??? to
> 
> ## ??? Maunika Gosike provided usability feedback to help ??? Added admonition icon for HTML > element. > navigate the web page more efficiently.
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

–  
Saji N. Hameed

APEC Climate Center +82 51 668 7470  
National Pension Corporation Busan Building 12F  
Yeonsan 2-dong, Yeonje-gu, BUSAN 611705 removed\_email\_address@domain.invalid  
KOREA

---

<div class="post-metadata">

**Author:** ![snk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@snk](https://www.ruby-forum.com/u/snk)\
**Post date:** [November 17, 2008, 5:46am UTC](https://www.ruby-forum.com/t/ann-erbook-4-0-0-was-previously-named-gerbil/153389/3 "2008-11-17T05:46:03Z")

</div>

Hi,

Saji N. Hameed wrote:

> Nice software - hope to see the LaTex formatter coming out soon.

Thanks. I’m planning to use Maruku’s Markdown-to-LaTeX conversion  
ability to achieve this. This was one of the reasons I switched from  
RedCloth (Textile) to Maruku (Markdown).

> I was wondering if the markup could be made simpler. Is the eruby  
> template the best for this - For example, there are so many extra  
> things to type in the following
> 
> \<% chapter “Introduction” do %\>  
> \<% end %\>
> 
> compared to say \chapter{Introduction} in TeX, for example

Good suggestion, the TeX equivalent is indeed shorter. Unfortunately,  
the \<% eRuby syntax %\> is what it is and I don’t wish to reinvent eRuby.  
☹

You could try turning the document inside-out:

\<%  
chapter “Introduction” do  
“some content here” +

```
  section "Something" do
    "and in here"
  end +

  "more content here"
end

```

%\>

This kind of usage is currently supported by erbook.

I also suggest using the abbreviation and auto-complete features of your  
text editor to reduce most of the typing. In my case, I just type  
[p][r][TAB] to get \<% this %\> and my cursor is placed inside. And  
[p][r][c][TAB] gives me:

\<% chapter “CURSOR\_1” do %\>  
CURSOR\_2  
\<% end %\>

where CURSOR\_1 denotes the inital cursor position and CURSOR\_2 is where  
the cursor goes when I press TAB from CURSOR\_1.

Cheers.

---

<div class="post-metadata">

**Author:** ![snk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@snk](https://www.ruby-forum.com/u/snk)\
**Post date:** [November 17, 2008, 7:43am UTC](https://www.ruby-forum.com/t/ann-erbook-4-0-0-was-previously-named-gerbil/153389/4 "2008-11-17T07:43:34Z")

</div>

- Suraj K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [2008-11-17 13:42:39 +0900]:

> ```
> "more content here"
> end
> 
> ```
> 
> %\>

hmmm…i have to use double quotes to delimit the text - not very  
convenient.

According to eruby entry in Wikipedia [http://en.wikipedia.org/wiki/ERuby](http://en.wikipedia.org/wiki/ERuby)  
,  
the following are equivalent, however the output from erbook is  
different  
for each.

\<% chapter “Introduction” do %\>  
This is a chapter  
\<% end %\>

% chapter “Introduction” do  
This is a chapter  
% end

Compilation is ok, in case of the second way - however output is  
something  
like

```
<div id="content">% chapter "Introduction" do
This is a chapter

```

% end

For the first one, the correct html is returned as below:

# Chapter&nbsp;[1](#rev:Introduction "Return to table of contents") [Introduction](#Introduction "Permanent link to this section")

```
This is a chapter
```

saji

---

<div class="post-metadata">

**Author:** ![snk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@snk](https://www.ruby-forum.com/u/snk)\
**Post date:** [November 23, 2008, 8:26am UTC](https://www.ruby-forum.com/t/ann-erbook-4-0-0-was-previously-named-gerbil/153389/5 "2008-11-23T08:26:38Z")

</div>

Suraj K. wrote:

> Saji N. Hameed wrote:
> 
> > \<% chapter “Introduction” do %\>  
> > This is a chapter  
> > \<% end %\>
> > 
> > % chapter “Introduction” do  
> > This is a chapter  
> > % end
> 
> They were treated differently because the latter  
> was not enabled in erbook’s usage of eRuby.

This has been fixed in erbook 5.0.0.  
Indented usage is also supported now:

% chapter “Introduction” do  
This is a chapter

```
% section "Hello" do
  This is a section
% end

The time is:
%= Time.now

```

% end

Cheers.

---

<div class="post-metadata">

**Author:** ![snk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@snk](https://www.ruby-forum.com/u/snk)\
**Post date:** [November 17, 2008, 8:37am UTC](https://www.ruby-forum.com/t/ann-erbook-4-0-0-was-previously-named-gerbil/153389/6 "2008-11-17T08:37:08Z")

</div>

Hi,

Saji N. Hameed wrote:

> - Suraj K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [2008-11-17 13:42:39 +0900]:
> 
> > ```
> > "more content here"
> > end
> > 
> > ```
> > 
> > %\>
> 
> hmmm…i have to use double quotes to delimit the text - not very  
> convenient.

Well, you could also use Ruby’s %Q{} or %q{} or \<\<EOS syntax for writing  
multi-line strings. But I agree, it is ugly.

> According to eruby entry in Wikipedia [eRuby - Wikipedia](http://en.wikipedia.org/wiki/ERuby)  
> the following are equivalent, however the output from erbook is  
> different for each.

Excellent find! I completely forgot about that eRuby capability. It is  
definitely more readable with a single % at the beginning of a line.  
🙂

> \<% chapter “Introduction” do %\>  
> This is a chapter  
> \<% end %\>
> 
> % chapter “Introduction” do  
> This is a chapter  
> % end

They were treated differently because the latter was not enabled in  
erbook’s usage of eRuby. If you apply the following patch, then the  
latter will work:

diff --git a/bin/erbook b/bin/erbook  
index c5bf5bd…568c7d8 100755  
— a/bin/erbook  
+++ b/bin/erbook  
@@ -47,6 +47,9 @@ class Template \< ERB  
# silence the code-only \<% … %\> directive, just like PHP does  
args[0].gsub!( /^[\t]_(\<%^%=_?[^%]%\>)[\t]\*\r?\n/m ) {  
$1 }

- 
# enable Ruby code processing for lines beginning with %
- (args[2] ||= ‘’) \<\< ‘%’
- 
# use @buffer to store the result of the ERB template
args[3] = :@buffer  
super(\*args)

I’m currently refactoring the code to be more object-oriented, and I  
will include the above patch in the next release.

Thanks for your help!
