[rfc-i] tabs [was: sourcecode indentation]

Joe Hildebrand (jhildebr) jhildebr at cisco.com
Mon Feb 15 10:03:38 PST 2016


On 2/14/16, 3:34 PM, "rfc-interest on behalf of HANSEN, TONY L" <rfc-interest-bounces at rfc-editor.org on behalf of tony at att.com> wrote:



>I actually mis-spoke earlier. Tabs are not allowed anywhere within figures and source code. Elsewhere within the XML, tabs have always been considered fine (unless a change got slipped in that I missed).

We should add a preptool step to remove non-semantic tabs, replace them with a single space, which will be fixed up in pretty-printing in a later step.  After thinking about it for a few minutes, I think any tab character outside <artwork> or <sourcecode> are non-semantic.

I think a warning on tab characters that are inside artwork or sourcecode is likely to be a good thing as well.  Because of reasons below, tabs in <artwork> might even be an error.

These steps need to be after any x:include, DTD, or @src processing.

>If there were demand for tab to be allowed within figures and source code, the obvious choice is to let the user specify what that amount of whitespace was.

That's a can of worms, but might be possible in HTML.

I'd much rather urge people to de-tabify their input files where possible.  If tabs are left in (generating warnings), the HTML output formatter might be able to do something interesting with "␉" (U+2409: SYMBOL FOR HORIZONTAL TABULATION) and the CSS "user-select: none" property.  That will be a good amount of fiddly work to get perfect.  For tab size, we'd need an XML attribute like sourcecode/@tabsize, and hope that the CSS "tab-size" property works in all browsers.  It doesn't work in any version of IE yet, and Firefox may need a -moz- prefix.  

Finally, this would have to be applied with an HTML pre/@style attribute. Since the tab stop may be different for each block, it can't go in the CSS file.

Because of all of that, I'd like to discourage heading down this path.

>I note that python allows tabs (and assumes it's equal to 8 spaces when used), but a number of Python style guides recommend only allowing spaces.
>
>Makefiles insist on tab characters.
>
>The XML files I send to xml2rfc today often have a mixture of tabs and spaces, because that's what my editor generates on indenting and re-indenting. It's only within figures and now source code blocks that tabs become troublesome.

Nod.  Almost all of those will fall into the non-semantic cases, and would be silently fixed up by the preptool rules above.

-- 
Joe Hildebrand


More information about the rfc-interest mailing list