mirror of https://github.com/mickael-menu/zk
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
432 B
Go
19 lines
432 B
Go
4 years ago
|
package core
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
// stylerMock implements core.Styler by doing the transformation:
|
||
|
// "hello", "red" -> "red(hello)"
|
||
|
type stylerMock struct{}
|
||
|
|
||
|
func (s *stylerMock) Style(text string, rules ...Style) (string, error) {
|
||
|
return s.MustStyle(text, rules...), nil
|
||
|
}
|
||
|
|
||
|
func (s *stylerMock) MustStyle(text string, rules ...Style) string {
|
||
|
for _, rule := range rules {
|
||
|
text = fmt.Sprintf("%s(%s)", rule, text)
|
||
|
}
|
||
|
return text
|
||
|
}
|