Merge pull request #13 from jbussdieker/jbb-fix-heredoc-description

Fix heredoc descriptions
This commit is contained in:
Amir Abu Shareb
2016-08-29 15:59:53 +03:00
committed by GitHub
2 changed files with 7 additions and 3 deletions

View File

@@ -77,7 +77,7 @@ func inputs(list *ast.ObjectList) []Input {
if is(item, "variable") {
name, _ := strconv.Unquote(item.Keys[1].Token.Text)
items := item.Val.(*ast.ObjectType).List.Items
desc, _ := strconv.Unquote(description(items))
desc := description(items)
def := get(items, "default")
ret = append(ret, Input{
Name: name,
@@ -120,7 +120,11 @@ func get(items []*ast.ObjectItem, key string) *Value {
v := new(Value)
if lit, ok := item.Val.(*ast.LiteralType); ok {
v.Literal = lit.Token.Text
if value, ok := lit.Token.Value().(string); ok {
v.Literal = value
} else {
v.Literal = lit.Token.Text
}
v.Type = "string"
return v
}

View File

@@ -74,7 +74,7 @@ func Markdown(d *doc.Doc) (string, error) {
buf.WriteString(fmt.Sprintf("| %s | %s | %s | %v |\n",
v.Name,
v.Description,
strings.TrimSpace(v.Description),
def,
humanize(v.Default)))
}