2017-03-21 10:59 GMT+01:00 Jan Michálek <godzilalal...@gmail.com>: > > > 2017-03-21 9:59 GMT+01:00 Ideriha, Takeshi <ideriha.take...@jp.fujitsu.com > >: > >> Hi, >> >> I like your suggestion and took a look at your patch though I’m not the >> expert about psql. >> >> >> >> I like the idea taking advantage of linestyle utilities >> >> to implement rst and markdown format efficiently instead of newly >> developing pset format things. >> >> But I'm thinking two comments below needs change to something about not >> focusing only linestyle. >> >> That's because they really take care of both '\pset linestyle and \pset >> format' and it may lead to misunderstanding to readers. >> >> >> >> --- >> >> /* Line style control structures */ >> >> const printTextFormat pg_markdown = >> >> >> >> /* get selected or default line style */ >> >> const printTextFormat * >> >> get_line_style(const printTableOpt *opt) >> >> --- >> > > It is in command.c? > > I have it done that \pset format changes linestyle > > psql (9.6.2, server 9.6.1) > Type "help" for help. > > jelen=# \pset linestyle ascii > Line style is ascii. > jelen=# \pset format rst > Output format is rst. > jelen=# \pset linestyle > Line style is rst. > jelen=# > > Peter wrote that this is not right, but i don`t know how it should like, > because most of this is done on linestyle, format is used only for switch > from console. > > > >> >> >> The rest things are about code style convention. >> >> - there are some indents with white spaces around >> skip_leading_spaces_print() >> >> but Postgresql conventions says indents should be with 4 column tab. >> >> https://www.postgresql.org/docs/devel/static/source-format.html >> > > Thanks, i often using 4 whitespaces (i have it in vim) but in other code i > found mostly used 8 whitespaces. > I will look on this. I use code from another functions (fputnbytes, > print_html_escaped) as template. > > >> >> >> - On the other hand, in docs there are some tab indent >> >> but white space indenet is preferable. Looking around sgml files, white >> space is used. >> >> >> >> - some multi-line comment style also needs fix according to the above >> documentation (link) >> > > I will look on the comments, this is only work version, coding style > issues will be corrected (i have some comments only my orientation in code). > > >> >> >> - And I also found patch cannot be applied to current master. >> > > I have 9.6.2 source code. It is not correct? Where i find source code i > should use? >
Please use git master https://wiki.postgresql.org/wiki/Working_with_Git Regards Pavel > > Have nice day > Jan > > >> >> >> Regards, >> >> Ideriha, Takeshi >> >> >> >> *From:* pgsql-hackers-ow...@postgresql.org [mailto:pgsql-hackers-owner@po >> stgresql.org] *On Behalf Of *Jan Michalek >> *Sent:* Sunday, March 19, 2017 5:10 AM >> *To:* Peter Eisentraut <peter.eisentr...@2ndquadrant.com> >> *Cc:* Pavel Stehule <pavel.steh...@gmail.com>; PostgreSQL mailing lists < >> pgsql-hackers@postgresql.org> >> *Subject:* Re: [HACKERS] Other formats in pset like markdown, rst, >> mediawiki >> >> >> >> >> >> >> >> 2017-03-12 19:21 GMT+01:00 Jan Michálek <godzilalal...@gmail.com>: >> >> >> >> >> >> 2017-03-10 9:43 GMT+01:00 Jan Michálek <godzilalal...@gmail.com>: >> >> >> >> >> >> 2017-03-09 20:10 GMT+01:00 Peter Eisentraut < >> peter.eisentr...@2ndquadrant.com>: >> >> This is looking pretty neat. I played around with it a bit. There are >> a couple of edge cases that you need to address, I think. >> >> >> >> Thanks, original code is very synoptical and and well prepared for adding >> new formats. >> >> >> >> >> - Does not support \x >> >> >> >> I know, i dnot`t know, if \x make sense in this case. I will look, how it >> is done in other formats like html. I think, that it should work in sense, >> that table generated to rst should give similar output after processing >> like output of html format. >> >> >> >> I prepared something like this (i have no prepared diff, i need do some >> another changes) >> >> There a few things I need to do. First problem is bold column names, i >> should do it in sme fashin as "RECORD", but i need to do some research >> about length of column. >> >> Bigger problem is with tab indent, rst processor doesn`t work with this >> in this case. >> >> >> In new diff is added \x for rst and skipping leading spaces in rst in >> both. make check passed >> >> >> >> Jan >> >> >> >> >> >> jelen=# execute q \g | xclip >> +---------+------------------------------------------------- >> -----------------------+ >> | **RECORD 1** >> | >> +---------+------------------------------------------------- >> -----------------------+ >> | column1 | Elephant, kangaroo, >> | >> | | squirrel, gorilla >> | >> +---------+------------------------------------------------- >> -----------------------+ >> | column2 | 121 >> | >> +---------+------------------------------------------------- >> -----------------------+ >> | column3 | 1.0035971223021583 >> | >> +---------+------------------------------------------------- >> -----------------------+ >> | column4 | 0.1111 >> | >> +---------+------------------------------------------------- >> -----------------------+ >> | column5 | Hello Hello Hello Hello Hello Hello Hello Hello Hello >> Hello | >> +---------+------------------------------------------------- >> -----------------------+ >> | **RECORD 2** >> | >> +---------+------------------------------------------------- >> -----------------------+ >> | column1 | goat, rhinoceros, >> | >> | | monkey, ape >> | >> +---------+------------------------------------------------- >> -----------------------+ >> | column2 | 11121 >> | >> +---------+------------------------------------------------- >> -----------------------+ >> | column3 | 1.0007824726134585 >> | >> +---------+------------------------------------------------- >> -----------------------+ >> | column4 | 5.1111 >> | >> +---------+------------------------------------------------- >> -----------------------+ >> | column5 | xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx >> xxxxxx xxxxxx | >> +---------+------------------------------------------------- >> -----------------------+ >> | **RECORD 3** >> | >> +---------+------------------------------------------------- >> -----------------------+ >> | column1 | donkey, cow, horse, tit, >> | >> | | eagle, whale, >> | >> | | aligator, >> | >> | | pelican, >> | >> | | grasshoper >> | >> | | pig >> | >> | | bat >> | >> +---------+------------------------------------------------- >> -----------------------+ >> | column2 | 14351 >> | >> +---------+------------------------------------------------- >> -----------------------+ >> | column3 | 50.3877551020408163 >> | >> +---------+------------------------------------------------- >> -----------------------+ >> | column4 | 345.11 >> | >> +---------+------------------------------------------------- >> -----------------------+ >> | column5 | yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy >> yyyyyy yyyyyy | >> +---------+------------------------------------------------- >> -----------------------+ >> >> >> >> >> >> >> - When \pset format is rst, then \pset linestyle also shows up as >> "rst". That is wrong. Same for markdown. >> >> >> >> I will look on this. >> >> >> >> >> - Broken output in tuples_only (\t) mode. (rst and markdown) >> >> >> >> Similar to \x, im not certain, what it should return. I will look, what >> returns html format. Or i can use it in markdown for nice vs expanded >> format. >> >> >> >> >> - rst: Do something about \pset title; the way it currently shows up >> appears to be invalid; could use ".. table:: title" directive >> >> >> >> OK, it shouldn`t be problem alter this. >> >> >> >> >> - markdown: Extra blank line between table and footer. >> >> >> >> It is because markdown needs empty line after table, if is row count >> presented. >> >> >> >> >> - markdown: We should document or comment somewhere exactly which of the >> various markdown table formats this is supposed to produce. (Pandoc >> pipe_tables?) >> >> >> >> I use format that was similar to aligned format and ascii linestyle, >> because it allows me to use existing features. I should look over more >> table styles in markdown. >> >> >> >> >> - markdown: Table title needs to be after the table, like >> >> Table: title >> >> I will change this. >> >> >> >> - markdown: Needs to escape | characters in cell contents. (Not >> needed for rst.) More escaping might be needed. >> >> >> >> This can be problem because of aligning, i will look on this, this same >> problem as replace newline with </br> for markdown. >> >> >> >> Have Nice day >> >> Jan >> >> >> >> >> -- >> 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 >> >> >> >> >> -- >> >> Jelen >> >> Starší čeledín datovýho chlíva >> > > > > -- > Jelen > Starší čeledín datovýho chlíva >