• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Heading类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.vladsch.flexmark.ast.Heading的典型用法代码示例。如果您正苦于以下问题:Java Heading类的具体用法?Java Heading怎么用?Java Heading使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Heading类属于com.vladsch.flexmark.ast包,在下文中一共展示了Heading类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: renderHeading

import com.vladsch.flexmark.ast.Heading; //导入依赖的package包/类
private void renderHeading(final Heading node, final NodeRendererContext context, final HtmlWriter html) {
    if (context.getHtmlOptions().renderHeaderId) {
        String id = context.getNodeId(node);
        if (id != null) {
            html.attr("id", id);
        }
    }

    if (context.getHtmlOptions().sourcePositionParagraphLines) {
        html.srcPos(node.getChars()).withAttr().tagLine("h" + (node.getLevel()+renderContext.incrementHeading()), new Runnable() {
            @Override
            public void run() {
                html.srcPos(node.getText()).withAttr().tag("span");
                context.renderChildren(node);
                html.tag("/span");
            }
        });
    } else {
        html.srcPos(node.getText()).withAttr().tagLine("h" + (node.getLevel()+renderContext.incrementHeading()), new Runnable() {
            @Override
            public void run() {
                context.renderChildren(node);
            }
        });
    }
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:27,代码来源:Markdown2Html.java


示例2: parse

import com.vladsch.flexmark.ast.Heading; //导入依赖的package包/类
@SneakyThrows
public HashMap<String, Node> parse(final String fileContents) {
  final Node document = parser.parse(fileContents);
  final ReversiblePeekingIterable<Node> children = document.getChildren();
  final Stack<String> headingStack = new Stack<>();
  final HashMap<String, Node> documentTree = new HashMap<>();
  Paragraph subDocument = new Paragraph();
  documentTree.put("#", subDocument);
  for (final Node next : children) {
    final Optional<Paragraph> newSubDocument = resolveHeading(next)
      .map((Heading heading) -> {
        pushHeading(headingStack, heading);
        final String headingTitle = getHeadingTitle(headingStack);
        final Paragraph subDoc = new Paragraph();
        documentTree.put(headingTitle, subDoc);
        return subDoc;
      });
    if (newSubDocument.isPresent()) {
      subDocument = newSubDocument.get();
    }
    else {
      subDocument.appendChild(next);
    }
  }
  return documentTree;
}
 
开发者ID:camunda,项目名称:camunda-bpm-swagger,代码行数:27,代码来源:DocumentParser.java


示例3: setAttributes

import com.vladsch.flexmark.ast.Heading; //导入依赖的package包/类
@Override
public void setAttributes(final Node node, final AttributablePart part, final Attributes attributes) {
    if (node instanceof FencedCodeBlock) {
        if (part.getName().equals("NODE")) {
            String language = ((FencedCodeBlock) node).getInfo().toString();
            if (!TextUtils.isEmpty(language) &&
                    !language.equals("nohighlight")) {
                addJavascript(HIGHLIGHTJS);
                addJavascript(HIGHLIGHT_INIT);

                attributes.addValue("language", language);
                attributes.addValue("onclick", String.format("javascript:android.onCodeTap('%s', this.textContent);",
                        language));
            }
        }
    } else if (node instanceof MathJax) {
        addJavascript(MATHJAX);
        addJavascript(MATHJAX_CONFIG);
    } else if (node instanceof Abbreviation) {
        addJavascript(TOOLTIPSTER_JS);
        addStyleSheet(TOOLTIPSTER_CSS);
        addJavascript(TOOLTIPSTER_INIT);
        attributes.addValue("class", "tooltip");
    } else if (node instanceof Heading) {
        attributes.addValue("onclick", String.format("javascript:android.onHeadingTap(%d, '%s');",
                ((Heading) node).getLevel(), ((Heading) node).getText()));
    } else if (node instanceof Image) {
        attributes.addValue("onclick", String.format("javascript: android.onImageTap(this.src, this.clientWidth, this.clientHeight);"));
    } else if (node instanceof Mark) {
        attributes.addValue("onclick", String.format("javascript: android.onMarkTap(this.textContent)"));
    } else if (node instanceof Keystroke) {
        attributes.addValue("onclick", String.format("javascript: android.onKeystrokeTap(this.textContent)"));
    } else if (node instanceof Link ||
            node instanceof AutoLink) {
        attributes.addValue("onclick", String.format("javascript: android.onLinkTap(this.href, this.textContent)"));
    }
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:38,代码来源:MarkdownView.java


示例4: pushHeading

import com.vladsch.flexmark.ast.Heading; //导入依赖的package包/类
private void pushHeading(final Stack<String> headingStack, final Heading heading) {
  clearHeadingStack(headingStack, heading.getLevel());
  headingStack.push(heading.getText().toString());
}
 
开发者ID:camunda,项目名称:camunda-bpm-swagger,代码行数:5,代码来源:DocumentParser.java


示例5: resolveHeading

import com.vladsch.flexmark.ast.Heading; //导入依赖的package包/类
private Optional<Heading> resolveHeading(final Node next) {
  if (!(next instanceof Heading))
    return Optional.empty();
  return Optional.of((Heading) next);
}
 
开发者ID:camunda,项目名称:camunda-bpm-swagger,代码行数:6,代码来源:DocumentParser.java


示例6: setAttributes

import com.vladsch.flexmark.ast.Heading; //导入依赖的package包/类
public void setAttributes(Node node, AttributablePart part, Attributes attributes) {
    if (node instanceof FencedCodeBlock) {
        if (part.getName().equals("NODE")) {
            String language = ((FencedCodeBlock) node).getInfo().toString();
            if (!TextUtils.isEmpty(language) && !language.equals("nohighlight")) {
                addJavascript(
                        MarkdownView.HIGHLIGHTJS);
                addJavascript(
                        MarkdownView.HIGHLIGHT_INIT);
                attributes.addValue("language", language);
                attributes.addValue("onclick", String.format(
                        "javascript:android.onCodeTap(\'%s\', this.textContent);",
                        language));
            }
        }
    } else if (node instanceof MathJax) {
        addJavascript(MarkdownView.MATHJAX);
        addJavascript(
                MarkdownView.MATHJAX_CONFIG);
    } else if (node instanceof Abbreviation) {
        addJavascript(
                MarkdownView.TOOLTIPSTER_JS);
        addStyleSheet(
                MarkdownView.TOOLTIPSTER_CSS);
        addJavascript(
                MarkdownView.TOOLTIPSTER_INIT);
        attributes.addValue("class", "tooltip");
    } else if (node instanceof Heading) {
        attributes.addValue("onclick",
                String.format(Locale.getDefault(),
                        "javascript:android.onHeadingTap(%d, \'%s\');",
                        ((Heading) node).getLevel(),
                        ((Heading) node).getText()));
    } else if (node instanceof Image) {
        attributes.addValue("onclick",
                "javascript: android.onImageTap(this.src, this.clientWidth, this.clientHeight);");
    } else if (node instanceof Mark) {
        attributes.addValue("onclick", "javascript: android.onMarkTap(this.textContent)");
    } else if (node instanceof Keystroke) {
        attributes.addValue("onclick",
                "javascript: android.onKeystrokeTap(this.textContent)");
    } else if (node instanceof Link || node instanceof AutoLink) {
        attributes.addValue("onclick",
                "javascript: android.onLinkTap(this.href, this.textContent)");
    }

}
 
开发者ID:sorcererXW,项目名称:SorceryIconPack,代码行数:48,代码来源:AsynMarkdownView.java


示例7: printAttributes

import com.vladsch.flexmark.ast.Heading; //导入依赖的package包/类
private void printAttributes(StringBuilder buf, Node node) {
	if (node instanceof Heading)
		printAttribute(buf, "level", ((Heading)node).getLevel());
}
 
开发者ID:JFormDesigner,项目名称:markdown-writer-fx,代码行数:5,代码来源:FlexmarkPreviewRenderer.java


示例8: updateStateProperties

import com.vladsch.flexmark.ast.Heading; //导入依赖的package包/类
private void updateStateProperties() {
	// avoid too many (and useless) runLater() invocations
	if (updateStatePropertiesRunLaterPending)
		return;
	updateStatePropertiesRunLaterPending = true;

	Platform.runLater(() -> {
		updateStatePropertiesRunLaterPending = false;

		List<Node> nodesAtSelection = findNodesAtSelection((s, e, n) -> true, true, false);

		boolean bold = false;
			boolean italic = false;
			boolean code = false;
			boolean link = false;
			boolean image = false;
			boolean unorderedList = false;
			boolean orderedList = false;
			boolean blockquote = false;
			boolean fencedCode = false;
			boolean header = false;
		for (Node node : nodesAtSelection) {
			if (!bold && node instanceof StrongEmphasis)
				bold = true;
			else if (!italic && node instanceof Emphasis)
				italic = true;
			else if (!code && node instanceof Code)
				code = true;
			else if (!link && (node instanceof Link || node instanceof LinkRef))
				link = true;
			else if (!image && (node instanceof Image || node instanceof ImageRef))
				image = true;
			else if (!unorderedList && node instanceof BulletListItem)
				unorderedList = true;
			else if (!orderedList && node instanceof OrderedListItem)
				orderedList = true;
			else if (!blockquote && node instanceof BlockQuote)
				blockquote = true;
			else if (!fencedCode && node instanceof FencedCodeBlock)
				fencedCode = true;
			else if (!header && node instanceof Heading)
				header = true;
		}
		this.bold.set(bold);
		this.italic.set(italic);
		this.code.set(code);
		this.link.set(link);
		this.image.set(image);
		this.unorderedList.set(unorderedList);
		this.orderedList.set(orderedList);
		this.blockquote.set(blockquote);
		this.fencedCode.set(fencedCode);
		this.header.set(header);
	});
}
 
开发者ID:JFormDesigner,项目名称:markdown-writer-fx,代码行数:56,代码来源:SmartEdit.java



注:本文中的com.vladsch.flexmark.ast.Heading类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BaseApi类代码示例发布时间:2022-05-22
下一篇:
Java IGridCache类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap