Skip to content

Commit b180269

Browse files
committed
Feat: Mainframe tables + deprecate bootstrap-table
1 parent 9fc3a63 commit b180269

File tree

5 files changed

+31
-39
lines changed

5 files changed

+31
-39
lines changed

assets/css/v2/style.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,6 +1497,11 @@ table {
14971497
}
14981498
}
14991499

1500+
.md-table-scroll-x {
1501+
overflow-x: auto;
1502+
width: 100%;
1503+
}
1504+
15001505
.narrow table {
15011506
min-width: 100%;
15021507
margin: var(--table-top-bottom-spacing) 0;

exampleSite/content/test-product/tables/examples/config-sharing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ EXCLUDE="default.conf"
1818
Use a space or newline character to separate the items in each list:
1919

2020

21-
{{<bootstrap-table "table table-striped table-bordered">}}
21+
{{<table variant="narrow">}}
2222

2323
| Parameter | Description |
2424
| ------------------------ | -------------------------------------------------------------------------------------|
2525
| `NODES` | List of peers that receive the configuration from the primary. |
2626
| `CONFPATHS` | List of files and directories to distribute from the primary to the peers. |
2727
| `EXCLUDE` | (Optional) List of configuration files on the primary not to distribute to the peers.|
2828

29-
{{</bootstrap-table>}}
29+
{{</table>}}
3030

3131
### Advanced Parameters
3232

33-
{{<bootstrap-table "table table-striped table-bordered">}}
33+
{{<table variant="wide">}}
3434

3535
| Parameter | Description | Default |
3636
| ------------------------ | ---------------------------------------------------------------------------------------|-------------------------|
@@ -42,4 +42,4 @@ Use a space or newline character to separate the items in each list:
4242
| `RSYNC` | Location of the `rsync` binary | **/usr/bin/rsync** |
4343
| `SSH` | Location of the `ssh` binary | **/usr/bin/ssh** |
4444

45-
{{</bootstrap-table>}}
45+
{{</table>}}

layouts/partials/table.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{ if and (not (eq .variant "narrow")) (not (eq .variant "wide")) }}
2+
{{ errorf "Invalid variant supplied to <table> shortcode: Received %s. Wanted: 'narrow', 'wide'" .variant }}
3+
{{ end }}
4+
5+
<div class="md-table-scroll-x {{ .variant }}">
6+
{{ .content | markdownify}}
7+
</div>
Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
1-
{{ $htmlTable := .Inner | markdownify }}
2-
{{ $class := .Get 0 }}
3-
{{ $oldTable := "<table>" }}
4-
{{ $newTable := printf "<table class=\"%s %s\">" $class "table-v1" }}
5-
{{ $oldP := "<p>" }}
6-
{{ $newP := printf "<p class=\"%s\">" "table-v1"}}
7-
{{ $htmlTable := replace $htmlTable $oldTable $newTable }}
8-
{{ $htmlTable := replace $htmlTable $oldP $newP }}
9-
{{ $htmlTable | safeHTML }}
1+
{{ $defaultVariant := "narrow" }}
102

11-
<!-- Add default option for table of "narrow" if one is not provided -->
12-
{{ $narrowOption := "narrow" }}
13-
{{ $wideOption := "wide" }}
14-
{{ if and (not (strings.Contains $class $narrowOption)) (not (strings.Contains $class $wideOption)) }}
15-
{{ $class = printf "%s %s" $class $narrowOption }}
16-
{{ end }}
3+
{{ partial "table.html" (dict
4+
"variant" $defaultVariant
5+
"content" .Inner
6+
)}}
177

18-
<div class="table-v2 {{ $class }}">
19-
{{ .Inner | markdownify }}
20-
</div>
8+
{{ warnf "'<bootstrap-table></bootstrap-table>' is being deprecated. Use the '<table>' shortcode instead." }}

layouts/shortcodes/table.html

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
{{/* Use this shortcode to wrap big tables that you want to have scrollbars when being shown in smaller screens */}}
2-
<style>
3-
table, th, td {
4-
border: 1px solid #CCC;
5-
border-collapse: collapse;
6-
list-style-position: inside;
7-
}
8-
th, td {
9-
padding: 5px;
10-
}
11-
th {
12-
text-align: center;
13-
}
14-
</style>
15-
<div class="override-table">
16-
{{.Inner}}
17-
</div>
1+
<!-- Use this shortcode to allow tables to be scrollable across the x-axis -->
2+
<!-- Params: variant=['narrow' | 'wide'] (defaults to "narrow") -->
3+
4+
{{ $variant := default "narrow" (.Get "variant") }}
5+
6+
{{ partial "table.html" (dict
7+
"variant" $variant
8+
"content" .Inner
9+
)}}

0 commit comments

Comments
 (0)