New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sbinet.org/x/odf

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sbinet.org/x/odf

  • v0.1.0
  • Go
  • Socket score

Version published
Created
Source

odf

Build status GoDoc godocs.io

odf is a set of Go-based tools to deal with the OpenDocument file format.

Installation

$> go install sbinet.org/x/odf

Examples

func main() {
	doc, err := odf.Open("testdata/simple.odt")
	if err != nil {
		panic(err)
	}
	defer doc.Close()

	var depth int
	indent := func() string {
		return strings.Repeat("  ", depth)
	}

	err = odf.Walk(doc.Node(), func(n odf.Node, entering bool) (odf.WalkStatus, error) {
		switch {
		case entering:
			ii := indent()
			fmt.Printf("%s<%s> {\n", ii, n.Name())
			depth++
		default:
			switch n := n.(type) {
			case *odf.Text:
				if n.Value != "" {
					fmt.Printf("%stext: %q\n", indent(), n.Value)
				}
			}
			depth--
			ii := indent()
			fmt.Printf("%s}\n", ii)
		}
		return odf.WalkContinue, nil
	})
	if err != nil {
		panic(err)
	}
}

odt2md

odt2md tries its best at converting an ODT document to a CommonMark one:

$> go install sbinet.org/x/odf/cmd/odt2md@latest
$> odt2md -h
odt2md converts an ODT document into a CommonMark one.

Usage: odt2md [OPTIONS] [INPUT.odt]

Example:

 $> odt2md input.odt
 $> odt2md input.odt > out.md
 $> odt2md -o out.md input.odt
 $> odt2md < input.odt > out.md
 $> odt2md -o out.md < input.odt

Options:
  -o string
    	path to output CommonMark file

$> odt2md ./testdata/simple.odt

# Title

Hello World!

FAQs

Package last updated on 04 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc