Re: printing table in asciidoc with psql

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Szymon Guz <mabewlun(at)gmail(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: printing table in asciidoc with psql
Date: 2014-10-17 07:01:05
Message-ID: CAFj8pRChyBO7c5CXZxvw+vs+MULnXXi_CRj3J-Y9eXd+xL+rWA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Szymon

I found a small bug - it doesn't escape "|" well

postgres=# select * from mytab ;
a | numeric_b | c
----------+-----------+------------
Ahoj | 10 | 2014-10-17
Hello | 20 | 2014-10-18
Hi | 30 | 2014-10-19
aaa|aaaa | 2222 | 2014-10-17
(4 rows)

result

[options="header",cols="<literal,>literal,<literal",frame="all",grid="all"]
|====
^| +++a+++ ^| +++numeric_b+++ ^| +++c+++
| Ahoj | 10 | 2014-10-17
| Hello | 20 | 2014-10-18
| Hi | 30 | 2014-10-19
| aaa|aaaa | 2222 | 2014-10-17
|====

Next, I tested it with asciidoc and asciidoctor and I have a problem with
asciidoctor - it doesn't respect aligning .. so numbers are aligned to left
instead to right.

When you use a option "header" then a formatting "+++xxxx++++" is useless.

Regards

Pavel

2014-09-17 21:26 GMT+02:00 Szymon Guz <mabewlun(at)gmail(dot)com>:

>
>
> On 17 September 2014 19:55, Szymon Guz <mabewlun(at)gmail(dot)com> wrote:
>
>>
>>
>> On 17 September 2014 19:30, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
>>
>>> On 9/16/14 3:52 PM, Szymon Guz wrote:
>>> > It's not finished yet, I'm not sure it there is any sense in supporting
>>> > border types etc.
>>>
>>> AFAICT, Asciidoc doesn't support border types, so (if so) you should
>>> just ignore that setting.
>>>
>>
>> Too late, I've done something like this:
>>
>> border=0
>> [frame="none",grid="none"]
>>
>> border=1
>> [frame="all",grid="none"]
>>
>> border=2
>> [frame="all",grid="all"]
>>
>> thanks,
>> Szymon
>>
>
>
> Hi,
> thanks for all the remarks.
>
> I've attached another version of this patch.
>
> I think it's done.
>
> - This works: `\pset format asciidoc`
>
> - Output is formatted as asciidoc tables.
>
> - There is support for borders {0,1,2}. The attached html file was made by
> running tests for psql, taking the asciidoc tables from it, converting to
> html with `asciidoc file`.
> -- border = 0 -> [frame="none",grid="none"]
> -- border = 1 -> [frame="none",grid="all"]
> -- border = 2 -> [frame="all",grid="all"]
>
> - There are also tests.
> -- For normal and extended mode combined with each of the border values.
> -- With column names made of characters which need escaping
> -- With values: (with escape needed characters, string '11' and integer 11
> - they should have different right-left alignment).
>
> - Documentation for psql is updated.
>
> - According to Emanuel's advice: help.c is updated.
>
> The attached html file contains tables from the test in this order:
>
> normal, border 0
> normal, border 1
> normal, border 2
> expanded, border 0
> expanded, border 1
> expanded, border 2
>
> regards,
> Szymon
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Petr Jelinek 2014-10-17 07:14:08 Re: proposal: plpgsql - Assert statement
Previous Message Craig Ringer 2014-10-17 06:57:03 Re: CREATE POLICY and RETURNING