@@ -255,7 +255,7 @@ func goDoc(v interface{}, indentLvl int, opts []Option) string {
255
255
256
256
synopsize := searchOptsBool (opts , synopsize {})
257
257
258
- docStr := preprocessMarkdown (self , docBuilder .String (), append (opts , originalTypeName (orig )))
258
+ docStr := FixGrammar (self , docBuilder .String (), append (opts , originalTypeName (orig ))... )
259
259
if synopsize && docStr == "" {
260
260
return ""
261
261
}
@@ -335,9 +335,7 @@ func writeParamDocs(tail *strings.Builder, label string, params []ParamDoc) {
335
335
336
336
var doc string
337
337
if param .InfoElements .Doc != nil {
338
- doc = preprocessMarkdown (name , param .InfoElements .Doc .String , []Option {
339
- originalTypeName (param .Name ),
340
- })
338
+ doc = FixGrammar (name , param .InfoElements .Doc .String , originalTypeName (param .Name ))
341
339
// Insert a dash space into the lines.
342
340
doc = transformLines (doc , func (i , _ int , line string ) string {
343
341
if i == 0 {
@@ -387,10 +385,9 @@ func trimFirstWord(paragraph string) string {
387
385
return parts [1 ]
388
386
}
389
387
390
- // preprocessMarkdown takes a (GTK-Doc-flavored / GI-DocGen-flavored)
391
- // markdown string makes some stylistic changes to it. The return
392
- // value is still markdown.
393
- func preprocessMarkdown (self , cmt string , opts []Option ) string {
388
+ // FixGrammar takes a comment and fixes its grammar by adding the [self] name
389
+ // where appropriate to make it more idiomatic.
390
+ func FixGrammar (self , cmt string , opts ... Option ) string {
394
391
if cmt == "" {
395
392
return ""
396
393
}
0 commit comments