From 9237920cf352cb549e4ff59bee51a90ee14ac6ce Mon Sep 17 00:00:00 2001 From: Todd Date: Tue, 29 Aug 2017 23:07:54 -0500 Subject: [PATCH] meta: add more documentation --- common/doc.go | 14 ++++++++++++++ creator.go | 3 ++- doc.go | 26 ++++++++++++++++++++++++++ optional.go | 10 ++++++++++ update-godoc.sh | 7 +++++++ 5 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 common/doc.go create mode 100644 doc.go create mode 100755 update-godoc.sh diff --git a/common/doc.go b/common/doc.go new file mode 100644 index 00000000..3e7f80fa --- /dev/null +++ b/common/doc.go @@ -0,0 +1,14 @@ +// Copyright 2017 Baliance. All rights reserved. +// +// Use of this source code is governed by the terms of the Affero GNU General +// Public License version 3.0 as published by the Free Software Foundation and +// appearing in the file LICENSE included in the packaging of this file. A +// commercial license can be purchased by contacting sales@baliance.com. + +/* + +Package common contains wrapper types and utilities common to all of the OOXML +document formats. +*/ + +package common diff --git a/creator.go b/creator.go index 0767ee52..c877fb48 100644 --- a/creator.go +++ b/creator.go @@ -28,7 +28,8 @@ func RegisterConstructor(ns, name string, fn interface{}) { creatorFns[ns+"/"+name] = fn } -// CreateElement creates an element with the given namespace and name. +// CreateElement creates an element with the given namespace and name. It is +// used to unmarshal some xsd:any elements to the appropriate concrete type. func CreateElement(start xml.StartElement) (Any, error) { fn, ok := creatorFns[start.Name.Space+"/"+start.Name.Local] if !ok { diff --git a/doc.go b/doc.go new file mode 100644 index 00000000..b7bf993f --- /dev/null +++ b/doc.go @@ -0,0 +1,26 @@ +// Copyright 2017 Baliance. All rights reserved. +// +// Use of this source code is governed by the terms of the Affero GNU General +// Public License version 3.0 as published by the Free Software Foundation and +// appearing in the file LICENSE included in the packaging of this file. A +// commercial license can be purchased by contacting sales@baliance.com. + +/* + +Package gooxml provides creation, reading, and writing of ECMA 376 Open Office +XML documents, spreadsheets and presentations. It is still early in +development, but is progressing quickly. This library takes a slightly +different approach from others, in that it starts by trying to support all of +the ECMA-376 standard when marshaling/unmarshaling XML documents. From there it +adds wrappers around the ECMA-376 derived types that provide a more convenient +interface. + +The raw XML based types reside in the ```schema/``` directory. These types are +always accessible from the wrapper types via a ```X()``` method that returns the +raw type. Except for the base documents (document.Document, +spreadsheet.Workbook and presentation.Presentation), the other wrapper types are +value types with non-pointer methods. They exist solely to modify and return +data from one or more XML types. + +*/ +package gooxml diff --git a/optional.go b/optional.go index 230834d0..2ac47b3b 100644 --- a/optional.go +++ b/optional.go @@ -7,39 +7,49 @@ package gooxml +// Float64 returns a copy of v as a pointer. func Float64(v float64) *float64 { x := v return &x } +// Uint32 returns a copy of v as a pointer. func Uint32(v uint32) *uint32 { x := v return &x } +// Int32 returns a copy of v as a pointer. func Int32(v int32) *int32 { x := v return &x } + +// Int64 returns a copy of v as a pointer. func Int64(v int64) *int64 { x := v return &x } + +// Bool returns a copy of v as a pointer. func Bool(v bool) *bool { x := v return &x } +// String returns a copy of v as a pointer. func String(v string) *string { x := v return &x } +// Int returns a copy of v as a pointer. func Int(v int) *int { x := v return &x } +// Uint64 returns a copy of v as a pointer. func Uint64(v uint64) *uint64 { x := v return &x diff --git a/update-godoc.sh b/update-godoc.sh new file mode 100755 index 00000000..a311fb8e --- /dev/null +++ b/update-godoc.sh @@ -0,0 +1,7 @@ +#!/bin/bash +for file in `find . -type d -not -ipath "*git*" -print`; do + url=`echo $file | sed 's#^.#https://godoc.org/baliance.com/gooxml#'` + echo $url + curl -s $url -o /dev/null + sleep 10 +done \ No newline at end of file