-
-
Notifications
You must be signed in to change notification settings - Fork 12
Bump github.com/olekukonko/tablewriter from 0.0.5 to 1.0.4 #874
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
Bump github.com/olekukonko/tablewriter from 0.0.5 to 1.0.4 #874
Conversation
Bumps [github.com/olekukonko/tablewriter](https://github.com/olekukonko/tablewriter) from 0.0.5 to 1.0.4. - [Commits](olekukonko/tablewriter@v0.0.5...v1.0.4) --- updated-dependencies: - dependency-name: github.com/olekukonko/tablewriter dependency-version: 1.0.4 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately it is impossible to produce the output that is required for the arduino-lint
result output using the new version of the module.
This simple demonstration program using 0.0.5:
package main
import (
"regexp"
"strings"
"github.com/olekukonko/tablewriter"
)
func main() {
width := 120 // Wrap text to this width
prefix := "INFO: "
message := "The original machine had a base-plate of prefabulated aluminite, surmounted by a malleable logarithmic casing in such a way that the two main spurving bearings were in a direct line with the pentametric fan. The latter consisted simply of six hydrocoptic marzlevanes, so fitted to the ambifacient lunar waneshaft that side fumbling was effectively prevented.\nContent after explicit line break."
formattedOutput := &strings.Builder{}
table := tablewriter.NewWriter(formattedOutput)
table.SetBorder(false)
table.SetColumnSeparator("")
table.SetNoWhiteSpace(true) // Do not pad cell margins.
table.SetColWidth(width - len(prefix))
table.SetReflowDuringAutoWrap(false) // Reflow removes explicit line breaks.
table.Append([]string{prefix, message})
table.Render()
// Remove blank lines on explicit line breaks caused by tablewriter bug.
blankLineRegexp := regexp.MustCompile("\n[[:space:]]*\n")
cleanedOutput := blankLineRegexp.ReplaceAllLiteralString(formattedOutput.String(), "\n")
print(cleanedOutput)
}
produces the expected output:
INFO: The original machine had a base-plate of prefabulated aluminite, surmounted by a malleable logarithmic casing
in such a way that the two main spurving bearings were in a direct line with the pentametric fan. The latter
consisted simply of six hydrocoptic marzlevanes, so fitted to the ambifacient lunar waneshaft that side fumbling
was effectively prevented.
Content after explicit line break.
The equivalent program using 1.0.4:
package main
import (
"strings"
"github.com/olekukonko/tablewriter"
"github.com/olekukonko/tablewriter/renderer"
"github.com/olekukonko/tablewriter/tw"
)
func main() {
width := 120 // Wrap text to this width
prefix := "INFO: "
message := "The original machine had a base-plate of prefabulated aluminite, surmounted by a malleable logarithmic casing in such a way that the two main spurving bearings were in a direct line with the pentametric fan. The latter consisted simply of six hydrocoptic marzlevanes, so fitted to the ambifacient lunar waneshaft that side fumbling was effectively prevented.\nContent after break."
formattedOutput := &strings.Builder{}
tableConfigBuilder := tablewriter.NewConfigBuilder()
tableConfigBuilder.ForColumn(0).WithMaxWidth(len(prefix))
tableConfigBuilder.ForColumn(1).WithMaxWidth(width - len(prefix))
tableConfig := tableConfigBuilder.Build()
tableBorders := tw.Border{
Left: tw.Off,
Right: tw.Off,
Top: tw.Off,
Bottom: tw.Off,
}
tableSettings := tw.Settings{
Separators: tw.Separators{
BetweenColumns: tw.Off,
},
}
tableRendition := tw.Rendition{
// We would expect to be able to do this via the high level tablewriter.WithBorders, but it has no effect.
Borders: tableBorders,
// We would expect to be able to do this via the high level tablewriter.WithRendererSettings, but it has no effect.
Settings: tableSettings,
}
tableRenderer := renderer.NewBlueprint(tableRendition)
table := tablewriter.NewTable(
formattedOutput,
tablewriter.WithConfig(tableConfig),
tablewriter.WithRenderer(tableRenderer),
)
table.Append([]string{prefix, message})
if err := table.Render(); err != nil {
panic(err)
}
print(formattedOutput.String())
}
Produces this output:
INFO: The original machine had a base-plate of prefabulated aluminite, surmounted by a malleable logarithmic casing
in such a way that the two main spurving bearings were in a direct line with the pentametric fan. The latter
consisted simply of six hydrocoptic marzlevanes, so fitted to the ambifacient lunar waneshaft that side fumbling
was effectively prevented.
Content after break.
This output has two separate problems, which confusingly consist of both the presence of unexpected spaces, and the absence of an expected space:
Unwanted Padding
The module forces one unit of padding at the left and right sides of the cell content.
This is the source of the leading space on the output, and the two spaces between the columns.
This has been reported at olekukonko/tablewriter#244 (comment).
Unwanted trimming
The module forces the trimming of whitespace from cells in width constrained tables, even when there is sufficient space for the untrimmed content.
This results in the loss of the intentional trailing space from the result type prefix. The need for that trailing space is not obvious due to the unwanted padding, but will be essential once the padding problem is fixed.
This has been reported at olekukonko/tablewriter#254
OK, I won't notify you again about this release, but will get in touch when a new version is available. If you'd rather skip all updates until the next major or minor version, let me know by commenting If you change your mind, just re-open this PR and I'll resolve any conflicts on it. |
Bumps github.com/olekukonko/tablewriter from 0.0.5 to 1.0.4.
Commits
4876204
added caption support #97, clarify max width #2479374103
Merge pull request #246 from olekukonko/experimente9aa807
improve readme3f8a175
Pushing the fix for #245c7f3322
trying to fix artifact & unicode symbols8f1fa98
improve conversionca4dd04
Fix Markdown Alignment Update #2448596f56
remove all debug information736f849
fix error in readme update #244e642815
improve documentationDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditions
will show all of the ignore conditions of the specified dependency@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)