googledoc

package
v0.0.0-...-ca2a86b Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMonospace

func IsMonospace(font *docs.WeightedFontFamily) bool

determine whether a font is monospace (used for detecting code blocks)

func MatchObjectIDsToImages

func MatchObjectIDsToImages(d *Archive, imageURLs []string) (map[string]string, error)

MatchOBjectIDsToImages creates a map from Google Doc object IDs to the URL of the corresponding image

func WriteFile

func WriteFile(d *Archive, path string) error

WriteFile writes a google doc to a .googledoc file

Types

type Archive

type Archive struct {
	Doc    *docs.Document
	HTML   []byte   // html export of the google doc
	Images []*Image // images from the html-exported google doc
}

Archive represents a google that has been exported, including images This is the struct that is serialized to make .googledoc files

func Fetch

func Fetch(ctx context.Context, docID string, docsClient *docs.Service, driveClient *drive.Service) (*Archive, error)

Fetch fetches a google doc using Google's REST API

func ReadFile

func ReadFile(path string) (*Archive, error)

ReadFile reads a .googledoc file

type Image

type Image struct {
	Filename string
	Content  []byte
}

Image represents an image in the HTML export of a google doc

Jump to

Keyboard shortcuts

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