Convenience function to create a full-fledged comment for a
    given tag, for example it is convenient to assign a Comment
    to a ReturnValueSymbol.
437719
def comment_from_tag(tag):
    
    if not tag:
        return None
    comment = Comment(name=tag.name,
                      meta={'description': tag.description},
                      annotations=tag.annotations)
    return comment
787648
function(tag) {
		if (!tag) {
			// create a document fragment to hold multiple-root elements
			if (document.createDocumentFragment) {
				return document.createDocumentFragment();
			}

			tag = '';

		} else if (tag.charAt(0) === '!') {
			return document.createComment(tag === '!' ? '' : tag.substr(1)+' ');
		}

		if (tag.toLowerCase() === 'style' && document.createStyleSheet) {
			// IE requires this interface for styles
			return document.createStyleSheet();
		}

		return document.createElement(tag);
	}
1316756
function (commentObj, code, filepath, context, emitter) {
        var tagRegexp = tags.getTagRegexp();
        var sym = new Symbol({file:filepath});
        var comment = commentObj.comment,
            match = tagRegexp.exec(comment), description,
            l = comment.length, i;
        if (match && match[1]) {
            parseCode(code, commentObj.end, sym, context);
            i = match.index;
            sym.description = comment.substr(0, i);
            comment = comment.substr(i);
            i = 0;
            while (i < l) {
                var subComment = comment.substr(i), nextIndex;
                match = tagRegexp.exec(comment.substr(i + 2));
                if (match && match[1]) {
                    nextIndex = match.index;
                    nextIndex += i + 1;
                    parseTag(comment.substr(i, nextIndex - i), sym, context);
                    i = nextIndex;
                } else {
                    parseTag(subComment, sym, context);
                    i = l;
                }
            }
        } else {
            parseCode(code, commentObj.end, sym, context);
            sym.description = comment;
        }
        sym.fullName = sym.memberof ? [sym.memberof, sym.name].join(".") : sym.name;
        return {symbol:sym, comment:comment};
    }
897821
def optional_assignment_tag(func=None, takes_context=None, name=None):
    
    def dec(func):
        params, varargs, varkw, defaults = getargspec(func)

        class AssignmentNode(TagHelperNode):
            def __init__(self, takes_context, args, kwargs, target_var=None):
                super(AssignmentNode, self).__init__(takes_context, args, kwargs)
                self.target_var = target_var

            def render(self, context):
                resolved_args, resolved_kwargs = self.get_resolved_arguments(context)
                output = func(*resolved_args, **resolved_kwargs)
                if self.target_var is None:
                    return output
                else:
                    context[self.target_var] = output
                return ''

        function_name = (name or
                         getattr(func, '_decorated_function', func).__name__)

        def compile_func(parser, token):
            bits = token.split_contents()[1:]
            if len(bits) < 2 or bits[-2] != 'as':
                target_var = None
            else:
                target_var = bits[-1]
                bits = bits[:-2]
            args, kwargs = parse_bits(parser, bits, params,
                varargs, varkw, defaults, takes_context, function_name)
            return AssignmentNode(takes_context, args, kwargs, target_var)

        compile_func.__doc__ = func.__doc__
        register.tag(function_name, compile_func)
        return func
    if func is None:
        # @register.assignment_tag(...)
        return dec
    elif callable(func):
        # @register.assignment_tag
        return dec(func)
    else:
        raise TemplateSyntaxError("Invalid arguments provided to assignment_tag")
725750
public void setComments(String tag, List<String> comments) {
        String nt = normaliseTag(tag);
        if(this.comments.containsKey(nt)) {
            this.comments.remove(nt);
        }
        this.comments.put(nt, comments);
    }
373892
def create(self, tag, **kwds):
        
        return self._client.post("/tag/create.json", tag=tag, **kwds)["result"]
898533
def translate_comment(self, comment, link_resolver):
        
        out = u''

        self.translate_tags(comment, link_resolver)
        ast = self.comment_to_ast(comment, link_resolver)
        out += self.ast_to_html(ast, link_resolver)
        return out
329153
public void addInlineDeprecatedComment(Element e, DocTree tag, Content htmltree) {
        CommentHelper ch = utils.getCommentHelper(e);
        addCommentTags(e, ch.getBody(configuration, tag), true, false, htmltree);
    }
742498
def create(context, name):
    

    result = tag.create(context, name=name)
    utils.format_output(result, context.format)
1249428
def _CreateEventTag(self, event, comment, labels):
    
    event_identifier = event.GetIdentifier()

    event_tag = events.EventTag(comment=comment)
    event_tag.SetEventIdentifier(event_identifier)
    event_tag.AddLabels(labels)

    event_identifier_string = event_identifier.CopyToString()
    logger.debug('Created event tag: {0:s} for event: {1:s}'.format(
        comment, event_identifier_string))

    return event_tag
741601
public static TagScript createTagScript() {
        return new TagScript() {
            /**
             * If all the attributes are constant, as is often the case with literal tags,
             * then we can skip the attribute expression evaluation altogether.
             */
            private boolean allAttributesAreConstant = true;

            @Override
            public void addAttribute(String name, Expression expression) {
                allAttributesAreConstant &= expression instanceof ConstantExpression;
                super.addAttribute(name, expression);
            }

            @Override
            public void addAttribute(String name, String prefix, String nsURI, Expression expression) {
                allAttributesAreConstant &= expression instanceof ConstantExpression;
                super.addAttribute(name, prefix, nsURI, expression);
            }

            public void run(JellyContext context, XMLOutput output) throws JellyTagException {
                Attributes actual = (allAttributesAreConstant && !EMIT_LOCATION) ? getSaxAttributes() : buildAttributes(context);

                try {
                    output.startElement(getNsUri(),getLocalName(),getElementName(),actual);
                    getTagBody().run(context,output);
                    output.endElement(getNsUri(),getLocalName(),getElementName());
                } catch (SAXException x) {
                    throw new JellyTagException(x);
                }
            }

            private AttributesImpl buildAttributes(JellyContext context) {
                AttributesImpl actual = new AttributesImpl();

                for (ExpressionAttribute att : attributes.values()) {
                    Expression expression = att.exp;
                    String v = expression.evaluateAsString(context);
                    if (v==null)    continue; // treat null as no attribute
                    actual.addAttribute(att.nsURI, att.name, att.qname(),"CDATA", v);
                }

                if (EMIT_LOCATION) {
                    actual.addAttribute("","file","file","CDATA",String.valueOf(getFileName()));
                    actual.addAttribute("","line","line","CDATA",String.valueOf(getLineNumber()));

                    // try to obtain the meaningful part of the script and put it in CSS with a
                    // class name like "jelly-foo-bar-xyz" given "file://path/to/src/tree/src/main/resources/foo/bar/xyz.jelly"
                    String form = getFileName().replace('\\','/');
                    for (String suffix : SUFFIX) {
                        int idx = form.lastIndexOf(suffix);
                        if (idx>0)  form=form.substring(idx+suffix.length());
                    }

                    int c = actual.getIndex("class");
                    if (c>=0)   actual.setValue(c, actual.getValue(c)+" "+form);
                    else        actual.addAttribute("","class","class","CDATA",form);
                }

                return actual;
            }
        };
    }
186381
function formatComment(comment) {
  if (!comment) {
    return undefined;
  }
  const parts = comment.trim().split('\n');
  if (parts.length === 1 && parts[0].indexOf('*') !== 0) {
    return parts[0];
  }
  return parts.reduce((previousValue, currentValue) => {
    // newlines in the middle of the comment should stay to achieve:
    // multiline comments entered by user drive unchanged from JDL
    // studio to generated domain class
    let delimiter = '';
    if (previousValue !== '') {
      delimiter = '\n';
    }
    return previousValue.concat(delimiter, currentValue.trim().replace(/[*]*\s*/, ''));
  }, '');
}
107692
function createElement(tagName) {
  return function (...args) {
    const element  = document.createElement(tagName);
    const attrs    = isObject(args[0]) ? args[0] : {};
    const children = args.length === 2 ? args[1] : args[0];

    Object
      .keys(attrs)
      .forEach(name => element.setAttribute(name, attrs[name]));

    if (Array.isArray(children)) {
      children.forEach(node => append(element, node));
    }

    if (isString(children) && !isVoidElement(tagName.toLowerCase())) {
      append(element, children);
    }

    return element;
  };
}
762716
@Override @DefinedBy(Api.COMPILER_TREE)
    public DCDocComment newDocCommentTree(List<? extends DocTree> fullBody, List<? extends DocTree> tags) {
        ListBuffer<DCTree> lb = new ListBuffer<>();
        lb.addAll(cast(fullBody));
        List<DCTree> fBody = lb.toList();

        // A dummy comment to keep the diagnostics logic happy.
        Comment c = new Comment() {
            @Override
            public String getText() {
                return null;
            }

            @Override
            public int getSourcePos(int index) {
                return Position.NOPOS;
            }

            @Override
            public CommentStyle getStyle() {
                return CommentStyle.JAVADOC;
            }

            @Override
            public boolean isDeprecated() {
                return false;
            }
        };
        Pair<List<DCTree>, List<DCTree>> pair = splitBody(fullBody);
        DCDocComment tree = new DCDocComment(c, fBody, pair.fst, pair.snd, cast(tags));
        return tree;
    }
427729
def create(self, **kwargs):
        
        Statement = self.get_model('statement')

        if 'tags' in kwargs:
            kwargs['tags'] = list(set(kwargs['tags']))

        if 'search_text' not in kwargs:
            kwargs['search_text'] = self.tagger.get_bigram_pair_string(kwargs['text'])

        if 'search_in_response_to' not in kwargs:
            if kwargs.get('in_response_to'):
                kwargs['search_in_response_to'] = self.tagger.get_bigram_pair_string(kwargs['in_response_to'])

        inserted = self.statements.insert_one(kwargs)

        kwargs['id'] = inserted.inserted_id

        return Statement(**kwargs)
507350
function Tag(tagDict){
  if(!(this instanceof Tag))
    return new Tag(tagDict)

  // Check tagDict has the required fields
  checkType('String', 'tagDict.key', tagDict.key, {required: true});
  checkType('String', 'tagDict.value', tagDict.value, {required: true});

  // Init parent class
  Tag.super_.call(this, tagDict)

  // Set object properties
  Object.defineProperties(this, {
    key: {
      writable: true,
      enumerable: true,
      value: tagDict.key
    },
    value: {
      writable: true,
      enumerable: true,
      value: tagDict.value
    }
  })
}
203860
def get_comments_content_object(parser, token):
    
    keywords = token.contents.split()
    if len(keywords) != 5:
        raise template.TemplateSyntaxError(
            "'%s' tag takes exactly 2 arguments" % (keywords[0],))
    if keywords[1] != 'for':
        raise template.TemplateSyntaxError(
            "first argument to '%s' tag must be 'for'" % (keywords[0],))
    if keywords[3] != 'as':
        raise template.TemplateSyntaxError(
            "first argument to '%s' tag must be 'as'" % (keywords[0],))
    return GetCommentsContentObject(keywords[2], keywords[4])