refactor(blogo,plugin): move plugin definitions to their own file

This commit is contained in:
Guz
2025-01-22 19:20:21 -03:00
parent 3e17b2339d
commit f12d0cc66b
2 changed files with 17 additions and 15 deletions

View File

@@ -13,9 +13,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package blogo
package plugin
const pluginGroupPluginName = "blogo-plugingroup-group"
const pluginGroupName = "blogo-plugingroup-group"
type PluginGroup interface {
Plugin
WithPlugins
Plugins() []Plugin
}
type pluginGroup struct {
plugins []Plugin
@@ -26,7 +32,7 @@ func NewPluginGroup(plugins ...Plugin) PluginGroup {
}
func (p *pluginGroup) Name() string {
return pluginGroupPluginName
return pluginGroupName
}
func (p *pluginGroup) Use(plugin Plugin) {

View File

@@ -13,33 +13,29 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package blogo
package plugin
import (
"io"
"forge.capytal.company/loreddev/x/blogo/fs"
)
type Plugin interface {
Name() string
}
type PluginWithPlugins interface {
type WithPlugins interface {
Plugin
Use(Plugin)
}
type PluginGroup interface {
type Renderer interface {
Plugin
PluginWithPlugins
Plugins() []Plugin
Render(src fs.File, out io.Writer) error
}
type RendererPlugin interface {
type Sourcer interface {
Plugin
Render(src File, out io.Writer) error
}
type SourcerPlugin interface {
Plugin
Source() (FS, error)
Source() (fs.FS, error)
}