git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] revisions.txt: expand tabs to spaces in diagram

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
May 4, 2018, 01:52 UTC
Message-ID
<20180504015202.GP13217@genre.crustytoothpaste.net>
In-Reply-To
<CAN0heSqeMFq4yVHX=8Ug3wOTEzrLXwE=PcF7UFWTRg_AbZEWWg@mail.gmail.com>
On Wed, May 02, 2018 at 08:20:54AM +0200, Martin Ågren wrote:
Show 33 quoted lines
> On 2 May 2018 at 06:50, Junio C Hamano <gitster@pobox.com> wrote:
> > Martin Ågren <martin.agren@gmail.com> writes:
> >
> >> The diagram renders fine in AsciiDoc before and after this patch.
> >> Asciidoctor, on the other hand, ignores the tabs entirely, which results
> >> in different indentation for different lines. The graph illustration
> >> earlier in the document already uses spaces instead of a tab.
> >
> > Ouch.  We might want to teach Documentation/.gitattributes that
> > indent-with-tab is unwelcome in that directory, after making this
> > fix (and possibly similar ones to other files).
> 
> I actually grepped around a little for a leading tab, to see if I could
> immediately spot any similar issues. But there are tons of tabs here
> (about 13000). Most of them work out just fine, e.g., in the OPTIONS,
> where we tab-indent the descriptions.
> 
> So while we could try to move away from leading tabs in Documentation/,
> it would be a huge undertaking. Any kind of "do it while we're nearby"
> approach would take a long time to complete. And a one-off conversion
> would probably be a horrible idea. ;-)
> 
> I just noticed another difference in how the tabs are handled. In
> git-add.txt, which I just picked at random, the three continuation lines
> in the synopsis indent differently in AsciiDoc (which indents them more
> than in the .txt) and Asciidoctor (which indents them less than in the
> .txt). To me, this is more of a "if I didn't sit down and compare the
> two outputs, I would never think about these indentations -- they're
> both fine".
> 
> So it might be that the only places where leading tabs really matter is
> this kind of diagrams. Maybe we have a handful such bugs lingering among
> the 13000 tab-indented lines...

I took a look at this. Asciidoctor does seem to have some weird ideas about tabs, but I think how it's handling this is converting them to spaces, which makes sense if you're working with HTML or XML (which do some bizarre things with tabs).

However, it's not converting them to 8 spaces, which is really what we want here. We can help both AsciiDoc and Asciidoctor do the right thing here (and keep our 8-space tabs) by enclosing the diagram in a block like so:

[literal]
--
   Args   Expanded arguments    Selected commits
   D                            G H D
   D F                          G H I J D F
   ^G D                         H D
   ^D B                         E I J F B
   ^D B C                       E I J F B C
   C                            I J F C
   B..C   = ^B C                C
   B...C  = B ^F C              G H D E B C
   B^-    = B^..B
	  = ^B^1 B              E I J F B
   C^@    = C^1
	  = F                   I J F
   B^@    = B^1 B^2 B^3
	  = D E F               D G H E F I J
   C^!    = C ^C^@
	  = C ^C^1
	  = C ^F                C
   B^!    = B ^B^@
	  = B ^B^1 ^B^2 ^B^3
	  = B ^D ^E ^F          B
   F^! D  = F ^I ^J D           G H D F
--

and using the tabsize=8 attribute when invoking Asciidoctor. I can send a patch tomorrow which does this, which I think may be a bit nicer than having to give up tabs.

Thoughts?
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
Previous: Martin ÅgrenNext: Junio C Hamano
Message 4 of 12 in “revisions.txt: expand tabs to spaces in diagram”
  1. revisions.txt: expand tabs to spaces in diagramMartin Ågren, Apr 30, 2018
  2. Junio C HamanoMay 2, 2018
  3. Martin ÅgrenMay 2, 2018
  4. brian m. carlsonMay 4, 2018
  5. Junio C HamanoMay 4, 2018
  6. 1/2 Documentation: use 8-space tabs with Asciidoctorbrian m. carlson, May 6, 2018
  7. 2/2 Documentation: render revisions correctly under Asciidoctorbrian m. carlson, May 6, 2018
  8. Martin ÅgrenMay 7, 2018
  9. brian m. carlsonMay 8, 2018
  10. Martin ÅgrenMay 8, 2018
  11. brian m. carlsonMay 9, 2018
  12. Junio C HamanoMay 7, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.