Skip to content

Commit

Permalink
Add basename function to sgml FuncMap
Browse files Browse the repository at this point in the history
This function is necessary to allow custom backends to only use the
basename of an image in cases where images are stored as attachments.

blockImageTmpl = `<image ><attachment filename="{{ basename .Src }}" /></image>`
  • Loading branch information
DavidGamba committed Feb 28, 2023
1 parent 8eb93f9 commit 3deb666
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/renderer/sgml/sgml.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sgml
import (
"fmt"
"io"
"path/filepath"
"strings"
texttemplate "text/template"

Expand All @@ -19,6 +20,7 @@ func Render(doc *types.Document, config *configuration.Configuration, output io.
templates: tmpls,
// Establish some default function handlers.
functions: texttemplate.FuncMap{
"basename": filepath.Base,
"escape": escapeString,
"halign": halign,
"lastInStrings": lastInStrings,
Expand Down

0 comments on commit 3deb666

Please sign in to comment.