Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(parser/renderer): support role attributes, refactor attributes and image type #171

Merged
merged 1 commit into from
Aug 23, 2018

Conversation

xcoulon
Copy link
Member

@xcoulon xcoulon commented Aug 22, 2018

While improving support for role, id and title in the lists, this patch
also introduces changes in the attributes which get their own type
instead of map[string]interface{}, which allows for utility method(s).

Also, pursuing on images, the Macro type that is common to BlockImage
and InlineImage is behind removed, to avoid having to deal with 2 levels
of attributes for the same element.

Fixes #151

Signed-off-by: Xavier Coulon [email protected]

@@ -225,6 +225,21 @@ func getID(attributes map[string]interface{}) string {
return id
}

// hasRole checks if the given map has an entry with key `types.AttrRole`
func hasRole(attributes map[string]interface{}) bool {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hasRole is unused

}

// getRole returns the value for the entry with key `types.AttrRole` in the given map
func getRole(attributes map[string]interface{}) string {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getRole is unused

// log.Debugf("initializing a new AttributeGroup with %v", attributes)
result := make(map[string]interface{}, 0)
result := make(ElementAttributes, 0)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use make(ElementAttributes) instead

@xcoulon xcoulon force-pushed the Issue151_support_attributes branch from f8a2c21 to 6446ca9 Compare August 22, 2018 21:05
…nd image type

While improving support for role, id and title in the lists, this patch
also introduces changes in the attributes which get their own type
instead of `map[string]interface{}`, which allows for utility method(s).

Also, pursuing on images, the `Macro` type that is common to `BlockImage`
and `InlineImage` is behind removed, to avoid having to deal with 2 levels
of attributes for the same element.

Fixes bytesparadise#151

Signed-off-by: Xavier Coulon <[email protected]>
@xcoulon xcoulon force-pushed the Issue151_support_attributes branch from 6446ca9 to 0a02da5 Compare August 22, 2018 21:08
@xcoulon xcoulon merged commit d2b6e95 into bytesparadise:master Aug 23, 2018
@xcoulon xcoulon deleted the Issue151_support_attributes branch February 25, 2019 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants