Menu

#13 tab width of source code in html output

closed-accepted
nobody
None
5
2008-01-29
2007-03-11
No

Tried my best to brew a patch to
add a new commandline and config setting
"src_code_tab_width" that lets the user
specify the number of spaces that replace a
tab in source code listings.

cli.py --src-code-tab-width 4

[epydoc]
src-code-tab-width=4

Default tab width is 8.

I'm Pretty new to patching, so any comments on
the patch?

Discussion

  • Jürgen Urner

    Jürgen Urner - 2007-03-11
     
  • Edward Loper

    Edward Loper - 2008-01-29

    Logged In: YES
    user_id=195958
    Originator: NO

    The Python Language Reference explicitly describes how tabs are expanded to spaces:

    http://docs.python.org/ref/indentation.html

    Given that, I feel a little uneasy about adding this option. But I do know that some people use one-tab-per-indent, and that gets very wide if those tabs get expanded to 8 characters, so I guess I'll go ahead and add the option anyway.

    Added in svn revision 1674.

    (comments on the patch -- it was relatively clean & well-formatted. It had a minor bug -- you named the command-line option with underscores, even though all of epydoc's other command-line options (and your example) use dashes -- but that was easy enough to catch & fix. Thanks for contributing!)

     
  • Edward Loper

    Edward Loper - 2008-01-29
    • status: open --> closed-accepted
     
  • Jürgen Urner

    Jürgen Urner - 2008-01-29

    Logged In: YES
    user_id=1660798
    Originator: YES

    >> Given that, I feel a little uneasy about adding this option

    o need to feel uneasy.

    http://docs.python.org/ref/indentation.html only describes
    how whitespace is evaluated.

    Encouraged is 4 spaces per indentation level. 8 is just
    some default for string.expandtabs().

    http://www.python.org/doc/essays/styleguide.html#layout

     

Log in to post a comment.