Skip to contentSkip to conversation

possible marker cleanup: ": ::$" -> "::"

DISCUSSION Robert P. J. Day 4 participants 7 messages Oct 30, 2020

lore
Share & tools
lore
#0 lore raw

in the midst of messing with "::" markers, i just noticed that there
is a *ton* of literal code block markers of the form:

... blah blah: ::

code stuff

this seems clearly overkill as the trailing "::" obviously starts a literal block, while the definition of the marker includes the explanation:

If it is preceded by whitespace, the marker is removed.

in short, this appears to be *exactly* equivalent as if you had simply written:

... blah blah::

code stuff

the apparent effect in the original being to start a literal block while leaving the preceding colon there -- just what ending with "::" provides. does that seem about right? one suspects there is a pile of marker simplification could be done.

rday

#1 lore raw
Quoted 18 lines · Robert P. J. Day

in the midst of messing with "::" markers, i just noticed that there
is a *ton* of literal code block markers of the form:

... blah blah: ::

code stuff

this seems clearly overkill as the trailing "::" obviously starts a literal block, while the definition of the marker includes the explanation:

If it is preceded by whitespace, the marker is removed.

in short, this appears to be *exactly* equivalent as if you had simply written:

Quoted 8 lines

... blah blah::

code stuff

the apparent effect in the original being to start a literal block while leaving the preceding colon there -- just what ending with "::" provides. does that seem about right? one suspects there is a pile of marker simplification could be done.

You are correct. all instances of ": ::" can be replaced with "::". If you make the change, you will notice that the generated HTML is not changing.
So it's a style question. I would prefer the short "::" form, let's check with RP and Quentin first as they have been the main contributors so far!

Quoted 7 lines

rday

#2 lore raw
Quoted 32 lines · Nicolas Dechesne
Quoted 21 lines · Robert P. J. Day

in the midst of messing with "::" markers, i just noticed that
there
is a *ton* of literal code block markers of the form:

... blah blah: ::

code stuff

this seems clearly overkill as the trailing "::" obviously starts a literal block, while the definition of the marker includes the explanation:

If it is preceded by whitespace, the marker is removed.

in short, this appears to be *exactly* equivalent as if you had simply
written:

... blah blah::

Quoted 8 lines

code stuff

the apparent effect in the original being to start a literal block while leaving the preceding colon there -- just what ending with "::"
provides. does that seem about right? one suspects there is a pile of
marker simplification could be done.

Quoted 7 lines

You are correct. all instances of ": ::" can be replaced with "::". If
you make the change, you will notice that the generated HTML is not changing.
So it's a style question. I would prefer the short "::" form, let's check with RP and Quentin first as they have been the main contributors so far!

:: is probably neater so I'm fine with that. Its a learning curve for us all.

Cheers,

Richard

#3 lore raw
In reply to Nicolas Dechesne

Hi all,

Quoted 31 lines · Nicolas Dechesne
Quoted 3 lines · Robert P. J. Day

in the midst of messing with "::" markers, i just noticed that

there

Quoted 6 lines

is a *ton* of literal code block markers of the form:

... blah blah: ::

code stuff

Quoted 7 lines

this seems clearly overkill as the trailing "::" obviously starts a literal block, while the definition of the marker includes the explanation:

If it is preceded by whitespace, the marker is removed.

in short, this appears to be *exactly* equivalent as if you had

simply

Quoted 10 lines

written:

... blah blah::

code stuff

the apparent effect in the original being to start a literal block while leaving the preceding colon there -- just what ending with "::" provides. does that seem about right? one suspects there is a pile of marker simplification could be done.

Quoted 7 lines

You are correct. all instances of ": ::" can be replaced with "::". If you make the change, you will notice that the generated HTML is not changing.
So it's a style question. I would prefer the short "::" form, let's check with RP and Quentin first as they have been the main contributors so far!

To be honest, I don't know much about reST. I learned the very basics of it while doing the clean ups.

Anyway, I don't really like it because it's not that explicit (though it is documented) that :: without a space actually is identical to : ::. At the same time, it's a "programming language" thing/quirk/implementation so I'm sure we can teach/document/enforce it as much as we would for Python or any other language one uses.

The nice outcome out of this is consistency and I'm a sucker for that kind of improvement, so all good for me.

By the way, if we are starting to fix that kind of thing, I'd like to request some kind of guidelines, formatting rules, etc.. so that we have consistency and make it easier both to contribute and to review? And put those into a README or something?

E.g. I still have no clue on the max characters in a line. We also discussed adding :term:`` for each variable in the glossary (probably same for tasks/classes?). Still on my to-do list to not use <#blablbla> for internal links as sphinx does not detect broken links at build time when this is used. Basically anything that isn't specific to Sphinx but YP's documentation.

Anyway, that's off topic.

Thanks Robert for sharing your knowledge and improving the docs :)

Quentin

Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
#4 lore raw
Quoted 47 lines · Quentin Schulz

Hi all,

Quoted 31 lines · Nicolas Dechesne
Quoted 3 lines · Robert P. J. Day

in the midst of messing with "::" markers, i just noticed that

there

Quoted 6 lines

is a *ton* of literal code block markers of the form:

... blah blah: ::

code stuff

Quoted 7 lines

this seems clearly overkill as the trailing "::" obviously starts a literal block, while the definition of the marker includes the explanation:

If it is preceded by whitespace, the marker is removed.

in short, this appears to be *exactly* equivalent as if you had

simply

Quoted 10 lines

written:

... blah blah::

code stuff

the apparent effect in the original being to start a literal block while leaving the preceding colon there -- just what ending with "::" provides. does that seem about right? one suspects there is a pile of marker simplification could be done.

Quoted 7 lines

You are correct. all instances of ": ::" can be replaced with "::". If you make the change, you will notice that the generated HTML is not changing.
So it's a style question. I would prefer the short "::" form, let's check with RP and Quentin first as they have been the main contributors so far!

To be honest, I don't know much about reST. I learned the very basics of it while doing the clean ups.

Anyway, I don't really like it because it's not that explicit (though it is documented) that :: without a space actually is identical to : ::. At the same time, it's a "programming language" thing/quirk/implementation so I'm sure we can teach/document/enforce it as much as we would for Python or any other language one uses.

Quoted 7 lines

The nice outcome out of this is consistency and I'm a sucker for that kind of improvement, so all good for me.

By the way, if we are starting to fix that kind of thing, I'd like to request some kind of guidelines, formatting rules, etc.. so that we have consistency and make it easier both to contribute and to review? And put those into a README or something?

E.g. I still have no clue on the max characters in a line. We also discussed adding :term:`` for each variable in the glossary (probably same for tasks/classes?). Still on my to-do list to not use <#blablbla> for internal links as sphinx does not detect broken links at build time when this is used. Basically anything that isn't specific to Sphinx but YP's documentation.

We should start a CODINGSTYLE document, I added a few things in the README, but if we really want to add , perhaps a separate file is better. But I agree we should do it. Like we could create an extension that checks the syntax.. so many things to do!

Quoted 8 lines

Anyway, that's off topic.

Thanks Robert for sharing your knowledge and improving the docs :)

Quentin
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

#5 lore raw
In reply to Quentin Schulz

On Fri, 30 Oct 2020, Quentin Schulz wrote:

... snip ...

Quoted 2 lines

To be honest, I don't know much about reST. I learned the very basics of it while doing the clean ups.

... snip ...

i didn't appreciate that syntax either, until i tripped over it
searching on the earlier stuff, saw ": ::" at the end of a line, and thought, "what in the name of mutt is *that*?" and then read and figured it out.

i'll submit another patch and, for the sake of consistency and
predictability, i'll combine the two types of cleanup based on running simple perl commands, to do:

1) change

...:
::

stuff

to

...::

stuff [like in my first patch]

2) change the above ": ::" to its simpler form.

the end result being the single consistent usage of "::" at the end of the line before the literal block.

the commit msg will be clear what commands were run to get that
effect. i'm sure this will miss the occasional corner case that doesn't *precisely* match the two patterns above, but i can live with that.

stay tuned ...

rday

#6 lore raw
In reply to Quentin Schulz

On Fri, 30 Oct 2020, Quentin Schulz wrote:

...

Quoted 5 lines

Anyway, I don't really like it because it's not that explicit (though it is documented) that :: without a space actually is identical to : ::. At the same time, it's a "programming language" thing/quirk/implementation so I'm sure we can teach/document/enforce it as much as we would for Python or any other language one uses.

...

i know exactly what you mean; it seems arbitrary but, in fact, the
reST docs stress that this *is* the way to do it:

Literal blocks

Literal code blocks (ref) are introduced by ending a paragraph with the special marker ::.

i'm currently poring over the reST and sphinx docs ... i should be an expert by the time donald trump is re-elected.

kidding. i'm kidding.

jesus, i *better* be kidding.

rday