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

FilterLabels: off for unlabeled includes #345

Merged
merged 3 commits into from
Aug 15, 2019
Merged

Conversation

ennru
Copy link
Member

@ennru ennru commented Aug 12, 2019

Purpose

Disable label filtering for snippets/includes/fiddles which include a complete file.
Document the filterLabels flag and property.

Background

Especially for snippets including whole HOCON files, label filtering often hides important lines with important information as # is used for comments.

One example is the reference.conf snippet in https://doc.akka.io/docs/alpakka/1.1.1/dynamodb.html#setup

Copy link
Contributor

@2m 2m left a comment

Choose a reason for hiding this comment

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

LGTM.

@@ -393,7 +393,7 @@ case class SnipDirective(page: Page, variables: Map[String, String])
try {
val labels = node.attributes.values("identifier").asScala
val source = resolvedSource(node, page)
val filterLabels = node.attributes.booleanValue("filterLabels", variables.get("snip.filterLabels").forall(_ == "true"))
val filterLabels = labels.nonEmpty && node.attributes.booleanValue("filterLabels", variables.get("snip.filterLabels").forall(_ == "true"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we allow filtering out the labels when including a full file? Like:

  • if a filterLabels attribute is present, use it
  • if not, and a snip.filterLabels default it set, use it
  • else, labels.nonEmpty
    ?

(do you have a use for snip.filterLabels? might be simpler without that option)

Copy link
Member Author

Choose a reason for hiding this comment

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

I made the local attribute take precedence and if nothing is defined labels.nonEmpty and the attribute control it.
(The global setting was there before, I didn't want to drop it.)

@ennru ennru merged commit 85d3a87 into lightbend:master Aug 15, 2019
@ennru ennru deleted the filterLabels branch August 15, 2019 05:05
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.

3 participants