com.vladsch.flexmark.util.html.Attributes.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中com.vladsch.flexmark.util.html.Attributes.<init>()方法的一些代码示例,展示了Attributes.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attributes.<init>()方法的具体详情如下:
包路径:com.vladsch.flexmark.util.html.Attributes
类名称:Attributes
方法名:<init>

Attributes.<init>介绍

暂无

代码示例

代码示例来源:origin: vsch/flexmark-java

public Attributes getNonNullAttributes() {
  if (myAttributes == null) {
    myAttributes = new Attributes();
  }
  return myAttributes;
}

代码示例来源:origin: vsch/flexmark-java

State(final Node parent) {
  myParent = parent;
  myElements = parent.childNodes();
  myIndex = 0;
  myAttributes = new Attributes();
  myPrePopActions = null;
}

代码示例来源:origin: vsch/flexmark-java

@Override
public Attributes extendRenderingNodeAttributes(Node node, AttributablePart part, Attributes attributes) {
  Attributes attr = attributes != null ? attributes : new Attributes();
  for (AttributeProvider attributeProvider : myAttributeProviders) {
    attributeProvider.setAttributes(node, part, attr);
  }
  return attr;
}

代码示例来源:origin: vsch/flexmark-java

@Override
public Attributes extendRenderingNodeAttributes(AttributablePart part, Attributes attributes) {
  Attributes attr = attributes != null ? attributes : new Attributes();
  for (AttributeProvider attributeProvider : attributeProviders) {
    attributeProvider.setAttributes(this.renderingNode, part, attr);
  }
  return attr;
}

代码示例来源:origin: vsch/flexmark-java

@Override
public Attributes extendRenderingNodeAttributes(Node node, AttributablePart part, Attributes attributes) {
  Attributes attr = attributes != null ? attributes : new Attributes();
  for (AttributeProvider attributeProvider : attributeProviders) {
    attributeProvider.setAttributes(node, part, attr);
  }
  return attr;
}

代码示例来源:origin: vsch/flexmark-java

@Override
public Attributes extendRenderingNodeAttributes(AttributablePart part, Attributes attributes) {
  Attributes attr = attributes != null ? attributes : new Attributes();
  for (AttributeProvider attributeProvider : myAttributeProviders) {
    attributeProvider.setAttributes(this.renderingNode, part, attr);
  }
  return attr;
}

代码示例来源:origin: vsch/flexmark-java

@Override
public T attr(CharSequence attrName, CharSequence value) {
  if (currentAttributes == null) {
    currentAttributes = new Attributes();
  }
  currentAttributes.addValue(attrName, value);
  return (T) this;
}

代码示例来源:origin: vsch/flexmark-java

@Override
public T attr(Attributes attributes) {
  if (attributes != null && !attributes.isEmpty()) {
    if (currentAttributes == null) {
      currentAttributes = new Attributes(attributes);
    } else {
      currentAttributes.addValues(attributes);
    }
  }
  return (T) this;
}

代码示例来源:origin: vsch/flexmark-java

@Override
public T attr(Attribute... attribute) {
  if (currentAttributes == null) {
    currentAttributes = new Attributes();
  }
  for (Attribute attr : attribute) {
    currentAttributes.addValue(attr.getName(), attr.getValue());
  }
  return (T) this;
}

代码示例来源:origin: vsch/flexmark-java

@Override
public String getNodeId(Node node) {
  String id = htmlIdGenerator.getId(node);
  if (attributeProviderFactories.size() != 0) {
    Attributes attributes = new Attributes();
    if (id != null) attributes.replaceValue("id", id);
    for (AttributeProvider attributeProvider : attributeProviders) {
      attributeProvider.setAttributes(this.renderingNode, AttributablePart.ID, attributes);
    }
    id = attributes.getValue("id");
  }
  return id;
}

代码示例来源:origin: vsch/flexmark-java

String calculateNodeId(Node node) {
  String id = htmlIdGenerator.getId(node);
  if (attributeProviderFactories.size() != 0) {
    Attributes attributes = new Attributes();
    if (id != null) attributes.replaceValue("id", id);
    for (AttributeProvider attributeProvider : myAttributeProviders) {
      attributeProvider.setAttributes(node, AttributablePart.ID, attributes);
    }
    id = attributes.getValue("id");
  }
  return id == null ? "" : id;
}

代码示例来源:origin: vsch/flexmark-java

public ResolvedLink withTitle(CharSequence title) {
  String haveTitle = myAttributes == null ? null : myAttributes.getValue(Attribute.TITLE_ATTR);
  if (title == haveTitle || haveTitle != null && haveTitle.equals(title)) return this;
  Attributes attributes = new Attributes(myAttributes);
  if (title == null) {
    attributes.remove(Attribute.TITLE_ATTR);
    if (attributes.isEmpty()) attributes = null;
  } else {
    attributes.replaceValue(Attribute.TITLE_ATTR, title);
  }
  return new ResolvedLink(myLinkType, myUrl, attributes, myStatus);
}

代码示例来源:origin: vsch/flexmark-java

public ResolvedLink withTarget(CharSequence target) {
  String haveTarget = myAttributes == null ? null : myAttributes.getValue(Attribute.TARGET_ATTR);
  if (target == haveTarget || haveTarget != null && haveTarget.equals(target)) return this;
  Attributes attributes = new Attributes(myAttributes);
  if (target == null) {
    attributes.remove(Attribute.TARGET_ATTR);
    if (attributes.isEmpty()) attributes = null;
  } else {
    attributes.replaceValue(Attribute.TARGET_ATTR, target);
  }
  return new ResolvedLink(myLinkType, myUrl, attributes, myStatus);
}

代码示例来源:origin: vsch/flexmark-java

private void transferToParentOnly(String... includes) {
  if (myStateStack.isEmpty())
    throw new IllegalStateException("transferIdToParent with an empty stack");
  final Attributes attributes = new Attributes();
  for (String include : includes) {
    Attribute attribute = myState.myAttributes.get(include);
    if (attribute != null) {
      myState.myAttributes.remove(include);
      attributes.addValue(attribute);
    }
  }
  if (!attributes.isEmpty()) {
    final State parentState = myStateStack.peek();
    for (String attrName : attributes.keySet()) {
      parentState.myAttributes.addValue(attributes.get(attrName));
    }
  }
}

代码示例来源:origin: vsch/flexmark-java

private void transferToParentExcept(String... excludes) {
  if (myStateStack.isEmpty())
    throw new IllegalStateException("transferIdToParent with an empty stack");
  final Attributes attributes = new Attributes(myState.myAttributes);
  myState.myAttributes.clear();
  for (String exclude : excludes) {
    myState.myAttributes.addValue(attributes.get(exclude));
    attributes.remove(exclude);
  }
  if (!attributes.isEmpty()) {
    final State parentState = myStateStack.peek();
    for (String attrName : attributes.keySet()) {
      parentState.myAttributes.addValue(attributes.get(attrName));
    }
  }
}

代码示例来源:origin: vsch/flexmark-java

private void render(EnumeratedReferenceLink node, final DocxRendererContext docx) {
  final String text = node.getText().toString();
  if (text.isEmpty()) {
    // placeholder for ordinal
    docx.text(String.valueOf(ordinal));
  } else {
    final Node referenceFormat = enumeratedOrdinals.getFormatNode(text);
    int wasOrdinal = ordinal;
    ordinal = enumeratedOrdinals.getOrdinal(text);
    final String defaultText = String.format("%s %d", EnumeratedReferenceRepository.getType(text), ordinal);
    String title = referenceFormat != null ? new EnumRefTextCollectingVisitor(ordinal).collectAndGetText(referenceFormat) : defaultText;
    Attributes attributes = new Attributes();
    if (title != null) {
      attributes.replaceValue(Attribute.TITLE_ATTR, title);
    }
    attributes = docx.extendRenderingNodeAttributes(AttributablePart.NODE, attributes);
    renderURL(node.getText(), docx, "#" + text, attributes, new EnumeratedReferenceRenderer(docx, referenceFormat, defaultText));
    ordinal = wasOrdinal;
  }
}

代码示例来源:origin: com.vladsch.flexmark/flexmark

@Override
public Attributes extendRenderingNodeAttributes(Node node, AttributablePart part, Attributes attributes) {
  Attributes attr = attributes != null ? attributes : new Attributes();
  for (AttributeProvider attributeProvider : attributeProviders) {
    attributeProvider.setAttributes(node, part, attr);
  }
  return attr;
}

代码示例来源:origin: com.vladsch.flexmark/flexmark-util

@Override
public T attr(Attribute... attribute) {
  if (currentAttributes == null) {
    currentAttributes = new Attributes();
  }
  for (Attribute attr : attribute) {
    currentAttributes.addValue(attr.getName(), attr.getValue());
  }
  return (T) this;
}

代码示例来源:origin: com.vladsch.flexmark/flexmark

public ResolvedLink withTitle(CharSequence title) {
  String haveTitle = myAttributes == null ? null : myAttributes.getValue(Attribute.TITLE_ATTR);
  if (title == haveTitle || haveTitle != null && haveTitle.equals(title)) return this;
  Attributes attributes = new Attributes(myAttributes);
  if (title == null) {
    attributes.remove(Attribute.TITLE_ATTR);
    if (attributes.isEmpty()) attributes = null;
  } else {
    attributes.replaceValue(Attribute.TITLE_ATTR, title);
  }
  return new ResolvedLink(myLinkType, myUrl, attributes, myStatus);
}

代码示例来源:origin: com.vladsch.flexmark/flexmark

public ResolvedLink withTarget(CharSequence target) {
  String haveTarget = myAttributes == null ? null : myAttributes.getValue(Attribute.TARGET_ATTR);
  if (target == haveTarget || haveTarget != null && haveTarget.equals(target)) return this;
  Attributes attributes = new Attributes(myAttributes);
  if (target == null) {
    attributes.remove(Attribute.TARGET_ATTR);
    if (attributes.isEmpty()) attributes = null;
  } else {
    attributes.replaceValue(Attribute.TARGET_ATTR, target);
  }
  return new ResolvedLink(myLinkType, myUrl, attributes, myStatus);
}

相关文章