Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Txtble subclasses with default values configured for various common table styles #24

Open
jwodder opened this issue Dec 2, 2021 · 0 comments
Labels
c:borders-rules enhancement New feature or request therefor library API Relating to the public library API

Comments

@jwodder
Copy link
Owner

jwodder commented Dec 2, 2021

  • Settings for a reStructuredText "simple table":

    RST_BORDER = BorderStyle(
        hline    = "=",
        vline    = "  ",
        ulcorner = "  ",
        urcorner = "  ",
        llcorner = "  ",
        lrcorner = "  ",
        vrtee    = "  ",
        vltee    = "  ",
        dhtee    = "  ",
        uhtee    = "  ",
        plus     = "  ",
    )
    
    border_style = RST_BORDER
    left_border  = False
    right_border = False

    Note that this does not support indicating column spans with hyphen rules. It also can result in multiline or blank cells in the first column, which rST will misinterpret.

  • Settings for a reStructuredText "grid table":

    padding = 1  # Optional
    row_border = True
    header_border = ASCII_EQ_BORDERS
  • Settings for a GitHub-Flavored Markdown table, sans alignment-indicating colons:

    GFM_LEFT_BORDER_STYLE = BorderStyle(
        hline = None,
        vline = "| ",
        ulcorner = "| ",
        urcorner = "| ",
        llcorner = "| ",
        lrcorner = "| ",
        vrtee = "| ",
        vltee = "| ",
        dhtee = "| ",
        uhtee = "| ",
        plus = "| ",
    )
    
    GFM_RIGHT_BORDER_STYLE = BorderStyle(
        hline = None,
        vline = " |",
        ulcorner = " |",
        urcorner = " |",
        llcorner = " |",
        lrcorner = " |",
        vrtee = " |",
        vltee = " |",
        dhtee = " |",
        uhtee = " |",
        plus = " |",
    )
    
    GFM_COLUMN_BORDER_STYLE = BorderStyle(
        hline = None,
        vline = " | ",
        ulcorner = " | ",
        urcorner = " | ",
        llcorner = " | ",
        lrcorner = " | ",
        vrtee = " | ",
        vltee = " | ",
        dhtee = " | ",
        uhtee = " | ",
        plus = " | ",
    )
    
    GFM_HEADER_BORDER_STYLE = BorderStyle(
        hline = "-",
        vline = None,
        ulcorner = None,
        urcorner = None,
        llcorner = None,
        lrcorner = None,
        vrtee = "| ",
        vltee = " |",
        dhtee = None,
        uhtee = None,
        plus = " | ",
    )
    
    top_border = False
    bottom_border = False
    left_border = GFM_LEFT_BORDER_STYLE
    right_border = GFM_RIGHT_BORDER_STYLE
    column_border = GFM_COLUMN_BORDER_STYLE
    header_border = GFM_HEADER_BORDER_STYLE
  • Settings for a Pandoc Markdown table (requires colsep from Add a VRule class #4 or Add easier ways to configure the column separator #22):

    border = False
    bottom_border = True
    colsep = "  "
  • Cf. tabulate's tablefmt

@jwodder jwodder added enhancement New feature or request therefor c:borders-rules library API Relating to the public library API labels Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c:borders-rules enhancement New feature or request therefor library API Relating to the public library API
Projects
None yet
Development

No branches or pull requests

1 participant