[RFC PATCH wayland 3/3] contributing: reformat code examples
Pekka Paalanen
ppaalanen at gmail.com
Thu Jun 14 07:51:26 UTC 2018
On Thu, 14 Jun 2018 08:53:19 +1000
Peter Hutterer <peter.hutterer at who-t.net> wrote:
> On Wed, Jun 13, 2018 at 04:32:24PM +0300, Pekka Paalanen wrote:
> > From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> >
> > Before, the code examples looked good in the file, but a hard tab was
> > rendered as 4 spaces by Gitlab.
> >
> > Now, Gitlab renders the code examples like they should look, with 8-wide
> > tabs, but the file looks awful.
> >
> > Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> > ---
> >
> > Is it better with or without this patch?
>
> IMO it's worse, it makes the source file unreadable.
>
> Depends who you consider the main reference, the .md file itself or the
> online rendered one. I don't know if there's a clear preference for either.
> fwiw, I opted for replacing all tabs with spaces in the libinput
> CODING_STYLE document (i.e. make the rendered one look correct), with this
> warning at the top:
>
> **Note: this file uses spaces due to markdown rendering issues for tabs.
> Code must be implemented using tabs.**
Hi Peter,
I like that idea, I'll go for it.
Also, I used the <pre> tags because at least worked with them. I
didn't try with ``` if it'd work, but I do like ``` more than
<pre>.
Thanks,
pq
>
> Cheers,
> Peter
>
> >
> > You can see the result in:
> > https://gitlab.freedesktop.org/pq/wayland/blob/61f169d24af699643708d22f728890151994d05e/CONTRIBUTING.md
> >
> > CONTRIBUTING.md | 36 ++++++++++++++++++------------------
> > 1 file changed, 18 insertions(+), 18 deletions(-)
> >
> > diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
> > index b22fdef..0c2990e 100644
> > --- a/CONTRIBUTING.md
> > +++ b/CONTRIBUTING.md
> > @@ -134,19 +134,19 @@ try to follow the rules below.
> > static int
> > my_function(void)
> > {
> > - int a = 0;
> > -
> > - if (a)
> > - b();
> > - else
> > - c();
> > -
> > - if (a) {
> > - b();
> > - c();
> > - } else {
> > - d();
> > - }
> > + int a = 0;
> > +
> > + if (a)
> > + b();
> > + else
> > + c();
> > +
> > + if (a) {
> > + b();
> > + c();
> > + } else {
> > + d();
> > + }
> > }
> > </pre>
> >
> > @@ -158,12 +158,12 @@ my_function(void)
> > sense;
> >
> > <pre>
> > - long_variable_name =
> > - function_with_a_really_long_name(parameter1, parameter2,
> > - parameter3, parameter4);
> > + long_variable_name =
> > + function_with_a_really_long_name(parameter1, parameter2,
> > + parameter3, parameter4);
> >
> > - x = function_with_a_really_long_name(parameter1, parameter2,
> > - parameter3, parameter4);
> > + x = function_with_a_really_long_name(parameter1, parameter2,
> > + parameter3, parameter4);
> > </pre>
> >
> > Conduct
> > --
> > 2.16.4
> >
> > _______________________________________________
> > wayland-devel mailing list
> > wayland-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/wayland-devel
> >
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20180614/fce46437/attachment.sig>
More information about the wayland-devel
mailing list