text: function process_block_macro_extension(obj) {
  
      var attrs = obj["attrs"];
      var parent = obj["parent"];
      var self = obj["self"];
      var nil = obj["nil"];
      var name = obj["name"];
      var target = obj["target"];
  
      var title = (attrs['$[]']("title")),
          alt = (attrs['$[]']("alt")),
          caption = (attrs['$[]']("caption")),
          width = (attrs['$[]']("width")),
          height = (attrs['$[]']("height")),
          scale = (attrs['$[]']("scale")),
          align = (attrs['$[]']("align")),
          type = (attrs['$[]']("type")),
          cache = (attrs['$[]']("cache")),
          role = (attrs['$[]']("role")),
          link = (attrs['$[]']("link")),
          float = (attrs['$[]']("float")),
          imagesdir = parent.$document().$attr('imagesdir', '');
  
      var filename = "";
  
      if (!attrs['$[]']("file")["$nil?"]()) {
          var extension = attrs['$[]']("extension")["$nil?"]() ? "" : "." + attrs['$[]']("extension");
          filename = "" + attrs['$[]']("file") + extension;
      }
  
      var content = "" + Ajax.getFile(target);
      var command = name;
  
      if (filename != "") {
          target = parent.$image_uri(filename);
      }
      else {
          target = cachedImageUri(content);
          var host = ((typeof location) != "undefined") ? "http://" + location.host : "";
          filename = host + target;
      }
  
      var stems = ["stem", "asciimath", "latexmath", "mathml"];
      if (stems.indexOf(name) != -1) {
          content = parseStems(parent, content, name);
          command = "math";
      }
  
      var parameters = [content, type, imagesdir, target, name].map(function (e) {
          return e + "";
      });
  
      //afx[command].apply(afx,parameters);
  
      postMessage(JSON.stringify({
          type: "afx",
          func: command,
          parameters: parameters
      }));
  
      var attributes = {
          "target": filename,
          "title": title,
          "alt": alt,
          "caption": caption,
          "width": width,
          "height": height,
          "scale": scale,
          "align": align,
          "role": role,
          "link": link,
          "float": float
      };
  
      var keys = Object.keys(attributes);
  
      keys.forEach(function (key) {
          if (attributes[key]["$nil?"]()) {
              delete attributes[key];
          }
      });
  
      return self.$create_image_block(parent, Opal.hash(attributes));
  
  };
  
  function registerBlockMacroExtensions(name) {
      /* Generated by Opal 0.11.99.dev */
      (function (Opal) {
          var TMP_1, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified,
              $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $send = Opal.send;
  
          Opal.add_stubs(['$register', '$block_macro', '$use_dsl', '$named', '$process', '$create_image_block']);
          return $send($$$($$($nesting, 'Asciidoctor'), 'Extensions'), 'register', [], (TMP_1 = function () {
              var self = TMP_1.$$s || this, TMP_2;
  
              return $send(self, 'block_macro', [], (TMP_2 = function () {
                  var self = TMP_2.$$s || this, TMP_3;
  
                  //self.$use_dsl();
                  self.$named(name);
                  self.$name_positional_attributes("file", "extension");
                  return $send(self, 'process', [], (TMP_3 = function (parent, target, attrs) {
                      var self = TMP_3.$$s || this;
  
                      if (parent == null) {
                          parent = nil;
                      }
  
                      if (target == null) {
                          target = nil;
                      }
  
                      if (attrs == null) {
                          attrs = nil;
                      }
  
                      return process_block_macro_extension({
                          parent: parent,
                          attrs: attrs,
                          self: self,
                          nil: nil,
                          name: name,
                          target: target
                      });
  
                  }, TMP_3.$$s = self, TMP_3.$$arity = 3, TMP_3));
              }, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2))
          }, TMP_1.$$s = self, TMP_1.$$arity = 0, TMP_1))
      })(Opal);
  }
  
  ["uml", "plantuml", "ditaa", "graphviz", "tree", "math", "stem", "asciimath", "a_s_c_i_i_m_a_t_h", "latexmath", "mathml"].forEach(function (name) {
      registerBlockMacroExtensions(name);
  });