we want to insert custom content inside the directive
551897
function($scope, element, attrs, ctrl) {
                $scope.popoverClass = attrs.popoverClass;
                $scope.dropDirection = attrs.direction || 'bottom';
                var left, top;
                var trigger = document.querySelector('#'+$scope.trigger);
                var target = document.querySelector('.ng-popover[trigger="'+$scope.trigger+'"]');

                // Add click event listener to trigger
                trigger.addEventListener('click', function(ev){
                    var left, top;
                    var trigger = this; //get trigger element 
                    var target =  document.querySelector('.ng-popover[trigger="'+$scope.trigger+'"]'); //get triger's target popover
                    ev.preventDefault();
                    calcPopoverPosition(trigger, target); //calculate the position of the popover
                   hideAllPopovers(trigger);
                    target.classList.toggle('hide'); //toggle display of target popover
                    // if target popover is visible then add click listener to body and call the open popover callback
                    if(!target.classList.contains('hide')){
                        ctrl.registerBodyListener();
                        $scope.onOpen();
                        $scope.$apply();
                    }
                    //else remove click listener from body and call close popover callback
                    else{
                        ctrl.unregisterBodyListener();
                        $scope.onClose();
                        $scope.$apply();
                    }
                });

                var getTriggerOffset = function(){
                    var triggerRect = trigger.getBoundingClientRect();
                    var bodyRect = document.body.getBoundingClientRect();
                    return {
                        top: triggerRect.top + document.body.scrollTop,
                        left: triggerRect.left + document.body.scrollLeft
                    }
                };

                // calculates the position of the popover
                var calcPopoverPosition = function(trigger, target){
                    target.classList.toggle('hide');
                    var targetWidth = target.offsetWidth;
                    var targetHeight = target.offsetHeight;
                    target.classList.toggle('hide');
                    var triggerWidth = trigger.offsetWidth;
                    var triggerHeight = trigger.offsetHeight;
                    switch($scope.dropDirection){
                        case 'left': {
                            left = getTriggerOffset().left - targetWidth - 10 + 'px';
                            top = getTriggerOffset().top + 'px';
                            break;
                        }

                        case 'right':{
                            left = getTriggerOffset().left + triggerWidth + 10 + 'px';
                            top = getTriggerOffset().top + 'px';
                            break;
                        } 

                        case'top':{
                            left = getTriggerOffset().left + 'px';
                            top = getTriggerOffset().top - targetHeight - 10 + 'px';
                            break;
                        }

                        default:{
                            left = getTriggerOffset().left +'px';
                            top = getTriggerOffset().top + triggerHeight + 10 + 'px'
                        }
                    }
                    target.style.position = 'absolute';
                    target.style.left = left;
                    target.style.top = top;
                }
                calcPopoverPosition(trigger, target);
            }
1213701
function injectTemplate(template, id, newContent) {
	walkRecursive(template.t, function (item) {
		if (item.t === 7 && item.a && item.a.id === id) {
			item.f = newContent.t;

			// break;
			return false;
		}
	});

	return template;
}
133861
function(raw_directive, view_config) {

		if (Lava.schema.DEBUG && view_config.type == 'widget') Lava.t("Wrong usage of x:refresher directive. May be applied only to views.");
		if (Lava.schema.DEBUG && ('refresher' in view_config)) Lava.t("Refresher is already defined");
		if (Lava.schema.DEBUG && (!raw_directive.content || raw_directive.content.length != 1)) Lava.t("Malformed refresher config: no content");
		view_config.refresher = Lava.parseOptions(raw_directive.content[0]);

	}
1279167
function addDirectivesToJangular(directives) {
    _.each(directives, function (directive, directiveName) {
        jangular.addDirective(directiveName, directive);
    });
}
12107
function(content){
			if (typeof content === 'string') {  //$NON-NLS-0$
				this._contentParent.innerHTML = content;
			} else {
				this._contentParent.innerHTML = ""; //NON-NLS-0$
				this._contentParent.appendChild(content);
			}
		}
1303911
function Embeds(el, options) {
        this.el = el;
        this.$el = $(el);
        this.templates = window.MediumInsert.Templates;
        this.core = this.$el.data('plugin_' + pluginName);

        this.options = $.extend(true, {}, defaults, options);

        this._defaults = defaults;
        this._name = pluginName;

        // Extend editor's functions
        if (this.core.getEditor()) {
            this.core.getEditor()._serializePreEmbeds = this.core.getEditor().serialize;
            this.core.getEditor().serialize = this.editorSerialize;
        }

        this.init();
    }
80126
function(directive) {

		    		var filename = directive.path 
		    			? directive.path.currentFileInfo.filename
		    			: directive.currentFileInfo.filename;
		    		var val, node, nodeTmp = buildNodeObject(filename, directive.index);

		    		if(!directive.path) {
			    		if(directive.features) {
			    			val = getObject(directive.features, true).stringValue;
			    		}
			    		else {
							val = getObject(directive.value, true).stringValue;
			    		}
			    	}
			    	else {
			    		val = directive.path.quote + directive.path.value + directive.path.quote;
			    	}

		    		node = {
		    			type: ""
		    		};

		    		if(directive.type === 'Media') {
		    			node.name = 'media';
		    		}
		    		else if(directive.type === 'Import') {
		    			node.name = 'import';
		    		}
		    		else {
		    			// Remove "@" for PostCSS
		    			node.name = directive.name.replace('@','');
		    		}

		    		node.source = nodeTmp.source;
		    		node.params = val;
		    		
		    		var atrule = postcss.atRule(node);

		    		if(directive.rules) {
		    			atrule.nodes = [];
		    			processRules(atrule, directive.rules);
		    		}
		    		return atrule;
		    	}
584173
function $directiveAddEventListener(event, directive, scope) {
        // Binds directive's css
        if (scope && directive.hasOwnProperty('css')) {
          $css.bind(directive.css, scope);
        }
      }
998961
function() {
		//this.el.content_item = document.getElementById(this._el.content_item.id);
		this._el.content_item.style.height = TL.Util.ratio.r16_9({w:this.options.width}) + "px";
		this._el.content_item.style.width = this.options.width + "px";
	}
1360484
def p_directive(self, p):
        
        arguments = p[3] if len(p) == 4 else None
        p[0] = Directive(name=p[2], arguments=arguments)
432069
function insertAnchors(content) {
    var $ = cheerio.load(content);
    $(':header').each(function(i, elem) {
        var header = $(elem);
        var id = header.attr("id");
        if (!id) {
            id = slug(header.text());
            header.attr("id", id);
        }
        header.prepend('<a name="' + id + '" class="plugin-anchor" '
                   + 'href="#' + id + '">'
                   + '<i class="fa fa-link" aria-hidden="true"></i>'
                   + '</a>');
    });
    return $.html();
}
1087898
function applyTemplateContent(inst, node, nodeInfo) {
  if (nodeInfo.templateInfo) {
    node._templateInfo = nodeInfo.templateInfo;
  }
}
246214
function insertTemplate( html ) {
			var dialog = CKEDITOR.dialog.getCurrent(),
				isReplace = dialog.getValueOf( 'selectTpl', 'chkInsertOpt' );

			if ( isReplace ) {
				editor.fire( 'saveSnapshot' );
				// Everything should happen after the document is loaded (#4073).
				editor.setData( html, function() {
					dialog.hide();

					// Place the cursor at the first editable place.
					var range = editor.createRange();
					range.moveToElementEditStart( editor.editable() );
					range.select();
					setTimeout( function() {
						editor.fire( 'saveSnapshot' );
					}, 0 );

				} );
			} else {
				editor.insertHtml( html );
				dialog.hide();
			}
		}
218002
protected function prepareRules()
    {
        $contentLength = mb_strlen($this->content);
        while ($this->char_index <= $contentLength) {
            $this->step();
        }

        foreach ($this->rules as $userAgent => $directive) {
            foreach ($directive as $directiveName => $directiveValue) {
                if (is_array($directiveValue)) {
                    $this->rules[$userAgent][$directiveName] = array_values(array_unique($directiveValue));
                }
            }
        }
    }
27028
public function addDirective($directive)
    {
        if (isset($this->directives[$i = $directive->id->toString()])) {
            throw new HTMLPurifier_ConfigSchema_Exception("Cannot redefine directive '$i'");
        }
        $this->directives[$i] = $directive;
    }
1044595
function(content) {
      if(typeof content == "string") {
         this.bodyEl.innerHTML = content;
      }
      else {
         this.bodyEl.innerHTML = "";
         this.bodyEl.appendChild(content);
      }
   }
756275
function(content) {
            this.content = content;
            if (this.content != null) this.generate = Q.fbind(_.template(this.content));
            return this;
        }