gopandoc

package module
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// https://pandoc.org/MANUAL.html#creating-a-pdf
	CLICommand     = "pandoc"
	FormatDOCX     = "docx"
	FormatMarkdown = "markdown"
	FormatPDF      = "pdf"
	ExampleMargin  = "margin=0.5in"

	MarginCentimeter = "cm"
	MarginInch       = "in"
)

Variables

View Source
var ErrOptsNil = errors.New("opts is nil")

Functions

func Exec

func Exec(opts *PandocOpts, stdout io.Writer, stderr io.Writer) error

func MarginHeaderLines

func MarginHeaderLines(geo Geometry) []string

func MarkdownLines

func MarkdownLines(marginUnit string, marginScalar int, lines []string) string

func WriteFiles

func WriteFiles(basename string, data []byte, writeDOCX, writePDF bool, stdout io.Writer, stderr io.Writer) error

func WriteFilesLines

func WriteFilesLines(basename string, data []string, marginUnit string, marginScalar int, writeDOCX, writePDF bool, stdout io.Writer, stderr io.Writer) error

Types

type Geometry

type Geometry struct {
	Unit   string
	Margin int
	Left   int
	Right  int
	Top    int
	Bottom int
}

func NewGeometry

func NewGeometry(unit string, width int) Geometry

func (Geometry) String

func (g Geometry) String() string

type PandocOpts

type PandocOpts struct {
	FromFormat string
	OutputFile string
	ToFormat   string
	InputFiles []string
	Geometry   string
	Margin     string
}

func PandocOptsExmample

func PandocOptsExmample() PandocOpts

func (*PandocOpts) CLIArgs

func (p *PandocOpts) CLIArgs() []string

func (*PandocOpts) TrimSpace

func (p *PandocOpts) TrimSpace()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL