Re: Other formats in pset like markdown, rst, mediawiki

From: Jan Michálek <godzilalalala(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Other formats in pset like markdown, rst, mediawiki
Date: 2017-03-05 12:08:04
Message-ID: CAAYBy8ZN9GXTxQmynSwsxbqdF9iCO6RaLiAoHx30nA+QPLauPw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

It is question if it is really new format, because formating is the same as
aligned/wrapped format, changed is only style of lines.

2017-03-05 12:36 GMT+01:00 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:

>
>
> 2017-03-05 11:40 GMT+01:00 Jan Michálek <godzilalalala(at)gmail(dot)com>:
>
>> I know, but, both new linestyles are created literally by cloning ascii
>> linestyle and few lines in print_aligned_text. Both works with "aligned"
>> and "wrapped" format. In rst is wrapped format useful, in my opinion, in
>> markdown i can`t find how I can get newline in record (maybe it is not
>> posiible in main markdown types). So it is why i add markdown and rst as
>> new linestyles. But it is not problem to change it in command to use "\pset
>> format", but i mean, that this is cleaner.
>>
>
> Using a special linestyle for new format is possible probably. But new
> format should be switched with \pset format command.
>
> Not sure if wrapped or aligned behave is correct for markdown - it is task
> for markdown processing, not for psql.
>
> Regards
>
> Pavel
>
>
>
>>
>> Je;
>>
>>
>> jelen=# \pset linestyle rst
>> Line style is rst.
>> jelen=# \pset format wrapped
>> Output format is wrapped.
>> jelen=# SELECT repeat('Goodnight Irene ', 30);
>> +-----------------------------------------------------------
>> ------------------+
>> | repeat
>> |
>> +===========================================================
>> ==================+
>> | Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene
>> Goodnight I.|
>> |.rene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene
>> Goodni.|
>> |.ght Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight
>> Irene G.|
>> |.oodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene
>> Goodnight Ir.|
>> |.ene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight Irene
>> Goodnig.|
>> |.ht Irene Goodnight Irene Goodnight Irene Goodnight Irene Goodnight
>> Irene Go.|
>> |.odnight Irene Goodnight Irene
>> |
>> +-----------------------------------------------------------
>> ------------------+
>>
>> (1 row)
>>
>> jelen=#
>>
>>
>> 2017-03-01 15:00 GMT+01:00 Peter Eisentraut <
>> peter(dot)eisentraut(at)2ndquadrant(dot)com>:
>>
>>> If you want to implement a new table format, you should be looking at
>>> \pset format, not \pset linestyle. \pset format sets different table
>>> formats, such as html, latex, and asciidoc. \pset linestyle just
>>> chooses between different styles for the plain-text table format.
>>>
>>> On 3/1/17 06:31, Jan Michálek wrote:
>>> > Regression test corrected.
>>> >
>>> > 2017-03-01 11:43 GMT+01:00 Jan Michálek <godzilalalala(at)gmail(dot)com
>>> > <mailto:godzilalalala(at)gmail(dot)com>>:
>>> >
>>> > Sorry, I have some errors in my diff, i had copy something from bad
>>> > folder. I will fix it.
>>> >
>>> > 2017-03-01 0:27 GMT+01:00 Jan Michálek <godzilalalala(at)gmail(dot)com
>>> > <mailto:godzilalalala(at)gmail(dot)com>>:
>>> >
>>> > There it is, what i have.
>>> > I need i small help with psql.out, because \pset format
>>> wrapped.
>>> > I don`t know, how to have it in fixed width.
>>> >
>>> > 2017-02-28 14:23 GMT+01:00 Jan Michálek <
>>> godzilalalala(at)gmail(dot)com
>>> > <mailto:godzilalalala(at)gmail(dot)com>>:
>>> >
>>> > Current state is something like this (diff is attached).
>>> > I currently haven`t regression test, tab completion etc., I
>>> > will add this thing following structure of asciidoc commit.
>>> >
>>> > Output is tested using retext, rst is OK, md have problem
>>> > with cells with newline (i must find out, how it is
>>> possible
>>> > create table with this in markdown).
>>> >
>>> > [jelen(at)laptak patch_postgre_rst]$
>>> > [jelen(at)laptak psql]$ ./psql
>>> > psql (9.6.2, server 9.6.1)
>>> > Type "help" for help.
>>> >
>>> > jelen=# \pset linestyle markdown
>>> > Line style is markdown.
>>> > jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký
>>> > kobyly'), ('''',E'a\tb') \g | xclip
>>> > jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký
>>> > kobyly'), ('''',E'a\tb') \g
>>> >
>>> > | column1 | column2 |
>>> > |---------------|------------------|
>>> > | nasral Franta | Žluťoučký kobyly |
>>> > | na trabanta | |
>>> > | ' | a b |
>>> >
>>> >
>>> > (2 rows)
>>> >
>>> > jelen=# \pset linestyle rst
>>> > Line style is rst.
>>> > jelen=# values(E'nasral Franta\nna trabanta','Žluťoučký
>>> > kobyly'), ('''',E'a\tb') \g
>>> > +---------------+------------------+
>>> > | column1 | column2 |
>>> > +===============+==================+
>>> > | nasral Franta+| Žluťoučký kobyly |
>>> > | na trabanta | |
>>> > +---------------+------------------+
>>> > | ' | a b |
>>> > +---------------+------------------+
>>> >
>>> > (2 rows)
>>> >
>>> > jelen=#
>>> >
>>> > 2017-02-24 0:46 GMT+01:00 Michael Paquier
>>> > <michael(dot)paquier(at)gmail(dot)com <mailto:michael(dot)paquier(at)gmail(dot)
>>> com>>:
>>> >
>>> > On Fri, Feb 24, 2017 at 3:09 AM, Jan Michálek
>>> > <godzilalalala(at)gmail(dot)com
>>> > <mailto:godzilalalala(at)gmail(dot)com>> wrote:
>>> > > I can try it, doesn`t look dificult, but I`m worry,
>>> that I`m not able to
>>> > > write clean, pretty code.
>>> >
>>> > If you want to have something available in Postgres 10,
>>> > you had better
>>> > be quick. The last commit fest of the development cycle
>>> > of Postgres 10
>>> > begins on the 1st of March, you need to to register
>>> your
>>> > patch here:
>>> > https://commitfest.postgresql.org/13/
>>> > <https://commitfest.postgresql.org/13/>
>>> > Here are also some rough guidelines about submitting a
>>> > patch:
>>> > https://wiki.postgresql.org/wiki/Submitting_a_Patch
>>> > <https://wiki.postgresql.org/wiki/Submitting_a_Patch>
>>> > --
>>> > Michael
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > Jelen
>>> > Starší čeledín datovýho chlíva
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > Jelen
>>> > Starší čeledín datovýho chlíva
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > Jelen
>>> > Starší čeledín datovýho chlíva
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > Jelen
>>> > Starší čeledín datovýho chlíva
>>> >
>>> >
>>> >
>>>
>>>
>>> --
>>> Peter Eisentraut http://www.2ndQuadrant.com/
>>> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>>>
>>
>>
>>
>> --
>> Jelen
>> Starší čeledín datovýho chlíva
>>
>
>

--
Jelen
Starší čeledín datovýho chlíva

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2017-03-05 12:22:13 Re: Other formats in pset like markdown, rst, mediawiki
Previous Message Pavel Stehule 2017-03-05 11:36:48 Re: Other formats in pset like markdown, rst, mediawiki