diff options
author | Přemysl Janouch <p@janouch.name> | 2018-09-29 21:42:23 +0200 |
---|---|---|
committer | Přemysl Janouch <p@janouch.name> | 2018-09-30 17:34:26 +0200 |
commit | 3e9ed4eac6a953b2616bcf129b515a857271acdc (patch) | |
tree | b7e674aa21fe3044eec6071e0d990c3933ba5f0d /nexgb/xgbgen/context.go | |
parent | 0056720d05d72d7b3a1b3cbdae5b5c5d80e167d3 (diff) | |
download | haven-3e9ed4eac6a953b2616bcf129b515a857271acdc.tar.gz haven-3e9ed4eac6a953b2616bcf129b515a857271acdc.tar.xz haven-3e9ed4eac6a953b2616bcf129b515a857271acdc.zip |
xgbgen: process <doc> elements
Most of XCB documentation now ends up in Go sources,
although the end result is of mixed quality.
Diffstat (limited to 'nexgb/xgbgen/context.go')
-rw-r--r-- | nexgb/xgbgen/context.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/nexgb/xgbgen/context.go b/nexgb/xgbgen/context.go index 32dee58..b35bc5a 100644 --- a/nexgb/xgbgen/context.go +++ b/nexgb/xgbgen/context.go @@ -6,6 +6,7 @@ import ( "fmt" "log" "sort" + "strings" ) // Context represents the protocol we're converting to Go, and a writer @@ -34,6 +35,13 @@ func (c *Context) Put(format string, v ...interface{}) { } } +// PutComment writes each line of comment commented out to 'out'. +func (c *Context) PutComment(comment string) { + for _, line := range strings.Split(comment, "\n") { + c.Putln("// %s", line) + } +} + // Morph is the big daddy of them all. It takes in an XML byte slice, // parse it, transforms the XML types into more usable types, // and writes Go code to the 'out' buffer. |