mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-02 23:17:34 -04:00
Follow upstream reflow API changes
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"io"
|
||||
|
||||
"github.com/muesli/reflow"
|
||||
"github.com/muesli/reflow/wordwrap"
|
||||
)
|
||||
|
||||
type BlockElement struct {
|
||||
@@ -29,7 +29,7 @@ func (e *BlockElement) Finish(w io.Writer, ctx RenderContext) error {
|
||||
if e.Margin {
|
||||
mw := NewMarginWriter(ctx, w, bs.Current().Style)
|
||||
_, err := mw.Write(
|
||||
reflow.Bytes(bs.Current().Block.Bytes(), int(bs.Width(ctx))))
|
||||
wordwrap.Bytes(bs.Current().Block.Bytes(), int(bs.Width(ctx))))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"io"
|
||||
|
||||
"github.com/muesli/reflow"
|
||||
"github.com/muesli/reflow/wordwrap"
|
||||
)
|
||||
|
||||
type HeadingElement struct {
|
||||
@@ -69,7 +69,7 @@ func (e *HeadingElement) Finish(w io.Writer, ctx RenderContext) error {
|
||||
},
|
||||
}
|
||||
|
||||
flow := reflow.NewReflow(int(bs.Width(ctx) - indent - margin*2))
|
||||
flow := wordwrap.NewWriter(int(bs.Width(ctx) - indent - margin*2))
|
||||
_, err := flow.Write(bs.Current().Block.Bytes())
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ import (
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"github.com/muesli/reflow"
|
||||
"github.com/muesli/reflow/wordwrap"
|
||||
)
|
||||
|
||||
type ParagraphElement struct {
|
||||
@@ -33,7 +33,7 @@ func (e *ParagraphElement) Finish(w io.Writer, ctx RenderContext) error {
|
||||
|
||||
mw := NewMarginWriter(ctx, w, rules)
|
||||
if len(strings.TrimSpace(bs.Current().Block.String())) > 0 {
|
||||
flow := reflow.NewReflow(int(bs.Width(ctx)))
|
||||
flow := wordwrap.NewWriter(int(bs.Width(ctx)))
|
||||
flow.KeepNewlines = false
|
||||
_, _ = flow.Write(bs.Current().Block.Bytes())
|
||||
flow.Close()
|
||||
|
||||
@@ -9,7 +9,7 @@ require (
|
||||
github.com/mattn/go-isatty v0.0.10
|
||||
github.com/mattn/go-runewidth v0.0.7
|
||||
github.com/microcosm-cc/bluemonday v1.0.2
|
||||
github.com/muesli/reflow v0.0.0-20191205210016-363f169defe8
|
||||
github.com/muesli/reflow v0.0.0-20191215022747-2d83db2ad290
|
||||
github.com/olekukonko/tablewriter v0.0.3
|
||||
github.com/rakyll/statik v0.1.6
|
||||
github.com/spf13/cobra v0.0.5
|
||||
|
||||
@@ -54,8 +54,8 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk
|
||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/muesli/reflow v0.0.0-20191205210016-363f169defe8 h1:oxAi+9SI2+btEmUX6WttiY4n5wjH79Jy88SgVrcnlCw=
|
||||
github.com/muesli/reflow v0.0.0-20191205210016-363f169defe8/go.mod h1:I9bWAt7QTg/que/qmUCJBGlj7wEq8OAFBjPNjc6xK4I=
|
||||
github.com/muesli/reflow v0.0.0-20191215022747-2d83db2ad290 h1:efDGgE60hqLHC7iOwagZe9RrNz/TdFKW74iCD/qylbs=
|
||||
github.com/muesli/reflow v0.0.0-20191215022747-2d83db2ad290/go.mod h1:I9bWAt7QTg/que/qmUCJBGlj7wEq8OAFBjPNjc6xK4I=
|
||||
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E=
|
||||
github.com/olekukonko/tablewriter v0.0.3 h1:i0LBnzgiChAWHJYTQAZJDOgf8MNxAVYZJ2m63SIDimI=
|
||||
github.com/olekukonko/tablewriter v0.0.3/go.mod h1:YZeBtGzYYEsCHp2LST/u/0NDwGkRoBtmn1cIWCJiS6M=
|
||||
|
||||
Reference in New Issue
Block a user