class_docstr: This publisher adds a slack attachment with fields from the rule's description
  
  It can include such fields as "reference" or "playbook" but will NOT include the description
  or the author.
class_docstr_tok: ["This","publisher","adds","a","slack","attachment","with","fields","from","the","rule","'s","description","It","can","include","such","fields","as","``","reference","''","or","``","playbook","''","but","will","NOT","include","the","description","or","the","author","."]
code: def publish(self, alert, publication):
      publication["@slack.attachments"] = publication.get(
          "@slack.attachments", []
      )
  
      rule_description = alert.rule_description
      rule_presentation = RuleDescriptionParser.present(
          rule_description
      )
  
      publication["@slack.attachments"].append(
          {
              "color": self._color(),
              "fields": [
                  {
                      "title": key.capitalize(),
                      "value": rule_presentation["fields"][key],
                  }
                  for key in rule_presentation["fields"].keys()
              ],
          }
      )
  
      return publication
  
imports: import calendar
  import cgi
  import json
  import urllib.request, urllib.parse, urllib.error
  from streamalert.shared.publisher import AlertPublisher, Register
  from streamalert.shared.description import RuleDescriptionParser
label_desc: Use image node_id 1 for calling the AttachRuleInfo obj's underlying member method code with example usage: obj.publish(alert, publication) and returns: publication