-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(renderer): move context and switch/call to backends (#1064)
move `Context` from `pkg/renderer` into `pkg/renderer/sgml` and make it unexported, and refactor the way to run the renderer on the doc: ``` html5.Render(doc, config, out) ``` Signed-off-by: Xavier Coulon <[email protected]>
- Loading branch information
Showing
46 changed files
with
456 additions
and
483 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package renderer | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
|
||
"github.com/bytesparadise/libasciidoc/pkg/configuration" | ||
"github.com/bytesparadise/libasciidoc/pkg/renderer/sgml/html5" | ||
"github.com/bytesparadise/libasciidoc/pkg/renderer/sgml/xhtml5" | ||
"github.com/bytesparadise/libasciidoc/pkg/types" | ||
) | ||
|
||
func Render(doc *types.Document, config *configuration.Configuration, output io.Writer) (types.Metadata, error) { | ||
switch config.BackEnd { | ||
case "html", "html5": | ||
return html5.Render(doc, config, output) | ||
case "xhtml", "xhtml5": | ||
return xhtml5.Render(doc, config, output) | ||
default: | ||
return types.Metadata{}, fmt.Errorf("backend '%s' not supported", config.BackEnd) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.