From a342aa7e9080bfec7553564ec5e936c01e2d9c64 Mon Sep 17 00:00:00 2001 From: Craig Peterson Date: Thu, 14 Sep 2017 16:25:39 -0400 Subject: [PATCH] add ability to linkify provider matrix --- build/generate/featureMatrix.go | 4 ++-- docs/_includes/matrix.html | 8 +++---- providers/capabilities.go | 25 ++++++++++++++++------ providers/namedotcom/namedotcomProvider.go | 2 +- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/build/generate/featureMatrix.go b/build/generate/featureMatrix.go index d0e16b04f..e7e1edd13 100644 --- a/build/generate/featureMatrix.go +++ b/build/generate/featureMatrix.go @@ -125,8 +125,8 @@ var tmpl = template.Must(template.New("").Funcs(template.FuncMap{ {{range $pname, $features := $providers}}{{$f := index $features $name}}{{if $f -}} - + {{if $f.Link}}{{end}}{{if $f.Link}}{{end}} {{- else}}{{end}} {{end -}} diff --git a/docs/_includes/matrix.html b/docs/_includes/matrix.html index 243c39e21..facd6e942 100644 --- a/docs/_includes/matrix.html +++ b/docs/_includes/matrix.html @@ -21,7 +21,7 @@ - Official Support + Official Support @@ -129,7 +129,7 @@ - ALIAS + ALIAS @@ -198,8 +198,8 @@ - - + + diff --git a/providers/capabilities.go b/providers/capabilities.go index 5aaafa7b6..36f09ef34 100644 --- a/providers/capabilities.go +++ b/providers/capabilities.go @@ -2,7 +2,6 @@ package providers import ( "log" - "strings" ) //Capability is a bitmasked set of "features" that a provider supports. Only use constants from this package. @@ -45,6 +44,7 @@ func ProviderHasCabability(pType string, cap Capability) bool { type DocumentationNote struct { HasFeature bool Comment string + Link string } // DocumentationNotes is a full list of notes for a single provider @@ -79,19 +79,30 @@ func unwrapProviderCapabilities(pName string, meta []ProviderMetadata) { } // Can is a small helper for concisely creating Documentation Notes -// comments are variadic for easy ommission, so you generally should pass 0 or 1 only. +// comments are variadic for easy ommission. First is comment, second is link, the rest are ignored. func Can(comments ...string) *DocumentationNote { - return &DocumentationNote{ + n := &DocumentationNote{ HasFeature: true, - Comment: strings.Join(comments, " "), } + n.addStrings(comments) + return n } // Cannot is a small helper for concisely creating Documentation Notes -// comments are variadic for easy ommission, so you generally should pass 0 or 1 only. +// comments are variadic for easy ommission. First is comment, second is link, the rest are ignored. func Cannot(comments ...string) *DocumentationNote { - return &DocumentationNote{ + n := &DocumentationNote{ HasFeature: false, - Comment: strings.Join(comments, " "), + } + n.addStrings(comments) + return n +} + +func (n *DocumentationNote) addStrings(comments []string) { + if len(comments) > 0 { + n.Comment = comments[0] + } + if len(comments) > 1 { + n.Link = comments[1] } } diff --git a/providers/namedotcom/namedotcomProvider.go b/providers/namedotcom/namedotcomProvider.go index 7447b658c..88facc8b7 100644 --- a/providers/namedotcom/namedotcomProvider.go +++ b/providers/namedotcom/namedotcomProvider.go @@ -23,7 +23,7 @@ var docNotes = providers.DocumentationNotes{ providers.DocDualHost: providers.Cannot("Apex NS records not editable"), providers.DocCreateDomains: providers.Cannot("New domains require registration"), providers.DocOfficiallySupported: providers.Can(), - providers.CanUsePTR: providers.Cannot("PTR records are not supported https://www.name.com/support/articles/205188508-Reverse-DNS-records (2017-05-08)"), + providers.CanUsePTR: providers.Cannot("PTR records are not supported (See Link)", "https://www.name.com/support/articles/205188508-Reverse-DNS-records"), } func newReg(conf map[string]string) (providers.Registrar, error) {