当前位置: 首页>>代码示例>>Java>>正文


Java DataHolder类代码示例

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


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

示例1: extend

import com.vladsch.flexmark.util.options.DataHolder; //导入依赖的package包/类
@Override
public void extend(HtmlRenderer.Builder rendererBuilder, String rendererType) {
    switch (rendererType) {
        case "HTML":
            rendererBuilder.nodeRendererFactory(new NodeRendererFactory() {
                @Override
                public NodeRenderer create(DataHolder options) {
                    return new MarkNodeRenderer(options);
                }
            });
            break;
    }
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:14,代码来源:MarkExtension.java

示例2: extend

import com.vladsch.flexmark.util.options.DataHolder; //导入依赖的package包/类
@Override
public void extend(HtmlRenderer.Builder rendererBuilder, String rendererType) {
    switch (rendererType) {
        case "HTML":
            rendererBuilder.nodeRendererFactory(new NodeRendererFactory() {
                @Override
                public NodeRenderer create(DataHolder options) {
                    return new MathJaxNodeRenderer(options);
                }
            });
            break;
    }
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:14,代码来源:MathJaxExtension.java

示例3: MarkdownAssetsServlet

import com.vladsch.flexmark.util.options.DataHolder; //导入依赖的package包/类
/**
 * Construct a {@link MarkdownAssetsServlet} configured with provided parameters, having a wrapped default
 * {@link AssetServlet} for fulfilling non-markdown asset requests.
 * <p>
 * {@code MarkdownAssetsServlet} and {@link AssetServlet} serve static assets loaded from {@code resourceURL}
 * (typically a file: or jar: URL). The assets are served at URIs rooted at {@code uriPath}. For
 * example, given a {@code resourceURL} of {@code "file:/data/assets"} and a {@code uriPath} of
 * {@code "/js"}, an {@code AssetServlet} would serve the contents of {@code
 * /data/assets/example.js} in response to a request for {@code /js/example.js}. If a directory
 * is requested and {@code indexFile} is defined, then {@code AssetServlet} will attempt to
 * serve a file with that name in that directory.
 *  @param resourcePath      the base URL from which assets are loaded
 * @param uriPath            the URI path fragment in which all requests are rooted
 * @param indexFile          the filename to use when directories are requested
 * @param defaultCharset     the default character set
 * @param configuration      environment-specific configuration properties
 * @param extensions         Flexmark-Java markdown rendering extensions to use
 * @param options            Flexmark-Java markdown rendering options
 * @param cacheBuilderSpec   {@link CacheBuilderSpec} for rendered pages
 */
public MarkdownAssetsServlet(@NotNull String resourcePath,
                             @NotNull String uriPath,
                             @NotNull String indexFile,
                             @NotNull Charset defaultCharset,
                             @NotNull MarkdownAssetsConfiguration configuration,
                             @NotNull List<Extension> extensions,
                             @NotNull DataHolder options,
                             @NotNull CacheBuilderSpec cacheBuilderSpec) {

    this.resourcePath = resourcePath;
    this.uriPath = uriPath;
    this.indexFile = indexFile;
    this.defaultCharset = defaultCharset;
    this.configuration = configuration;

    parser = Parser.builder(options).extensions(extensions).build();
    renderer = HtmlRenderer.builder(options).extensions(extensions).build();

    assetServlet = new AssetServlet(resourcePath, uriPath, indexFile, defaultCharset);
    pageCache = CacheBuilder.from(cacheBuilderSpec)
            .build(new CacheLoader<URL, CachedPage>() {
                @Override
                public CachedPage load(@NotNull URL key) throws Exception {
                    return renderPage(key);
                }
            });
    try {
        URL resource = this.getClass().getResource(resourcePath);
        Preconditions.checkNotNull(resource, "Resource root URL (" + resourcePath + ") was not found");

        resourceRootURL = resource.toURI();
    } catch (URISyntaxException e) {
        throw new IllegalArgumentException("Resource root URL (" + resourcePath + ") was ind", e);
    }
}
 
开发者ID:rnorth,项目名称:dropwizard-markdown-assets-bundle,代码行数:56,代码来源:MarkdownAssetsServlet.java

示例4: processBody

import com.vladsch.flexmark.util.options.DataHolder; //导入依赖的package包/类
@Override
public void processBody(final ParserContext context) {
    String[] mdExts = context.getConfig().getStringArray("markdown.extensions");

    int extensions = Extensions.NONE;
    if (mdExts.length > 0) {
        for (int index = 0; index < mdExts.length; index++) {
            String ext = mdExts[index];
            if (ext.startsWith("-")) {
  ext = ext.substring(1);
                extensions=removeExtension(extensions, extensionFor(ext));
            } else {
                if (ext.startsWith("+")) {
    ext = ext.substring(1);
                }
                extensions=addExtension(extensions, extensionFor(ext));
            }
        }
    }

    DataHolder options = PegdownOptionsAdapter.flexmarkOptions(
            extensions
    );

    Parser parser = Parser.builder(options).build();
    HtmlRenderer renderer = HtmlRenderer.builder(options).build();

    Node document = parser.parse(context.getBody());
    context.setBody(renderer.render(document));
}
 
开发者ID:jbake-org,项目名称:jbake,代码行数:31,代码来源:MarkdownEngine.java

示例5: create

import com.vladsch.flexmark.util.options.DataHolder; //导入依赖的package包/类
@Override
public NodeRenderer create(DataHolder options) {
    return new NodeRenderer() {
        @Override
        public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
            HashSet<NodeRenderingHandler<?>> set = new HashSet<>();
            set.add(new NodeRenderingHandler<>(Image.class, new CustomNodeRenderer<Image>() {
                @Override
                public void render(Image node, NodeRendererContext context, HtmlWriter html) {
                    if (!context.isDoNotRenderLinks()) {
                        String altText = new TextCollectingVisitor().collectAndGetText(node);

                        ResolvedLink resolvedLink = context.resolveLink(LinkType.IMAGE, node.getUrl().unescape(), null);
                        String url = resolvedLink.getUrl();

                        if (!node.getUrlContent().isEmpty()) {
                            // reverse URL encoding of =, &
                            String content = Escaping.percentEncodeUrl(node.getUrlContent()).replace("+", "%2B").replace("%3D", "=").replace("%26", "&amp;");
                            url += content;
                        }

                        final int index = url.indexOf('@');

                        if (index >= 0) {
                            String[] dimensions = url.substring(index + 1, url.length()).split("\\|");
                            url = url.substring(0, index);

                            if (dimensions.length == 2) {
                                String width = TextUtils.isEmpty(dimensions[0]) ? "auto" : dimensions[0];
                                String height = TextUtils.isEmpty(dimensions[1]) ? "auto" : dimensions[1];
                                html.attr("style", "width: " + width + "; height: " + height);
                            }
                        }

                        html.attr("src", url);
                        html.attr("alt", altText);

                        if (node.getTitle().isNotNull()) {
                            html.attr("title", node.getTitle().unescape());
                        }

                        html.srcPos(node.getChars()).withAttr(resolvedLink).tagVoid("img");
                    }
                }
            }));
            return set;
        }
    };
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:50,代码来源:MarkdownView.java

示例6: LocalizationNodeRenderer

import com.vladsch.flexmark.util.options.DataHolder; //导入依赖的package包/类
public LocalizationNodeRenderer(DataHolder options) {
    mContext = options.get(LocalizationExtension.LOCALIZATION_CONTEXT);
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:4,代码来源:LocalizationNodeRenderer.java

示例7: create

import com.vladsch.flexmark.util.options.DataHolder; //导入依赖的package包/类
@Override
public NodeRenderer create(final DataHolder options) {
    return new LocalizationNodeRenderer(options);
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:5,代码来源:LocalizationNodeRenderer.java

示例8: TwitterNodeRenderer

import com.vladsch.flexmark.util.options.DataHolder; //导入依赖的package包/类
public TwitterNodeRenderer(DataHolder options) {
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:3,代码来源:TwitterNodeRenderer.java

示例9: create

import com.vladsch.flexmark.util.options.DataHolder; //导入依赖的package包/类
@Override
public NodeRenderer create(final DataHolder options) {
    return new TwitterNodeRenderer(options);
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:5,代码来源:TwitterNodeRenderer.java

示例10: TwitterNodePostProcessor

import com.vladsch.flexmark.util.options.DataHolder; //导入依赖的package包/类
public TwitterNodePostProcessor(DataHolder options) {
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:3,代码来源:TwitterNodePostProcessor.java

示例11: Factory

import com.vladsch.flexmark.util.options.DataHolder; //导入依赖的package包/类
public Factory(DataHolder options) {
    super(false);

    addNodes(Link.class);
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:6,代码来源:TwitterNodePostProcessor.java

示例12: KeystrokeNodeRenderer

import com.vladsch.flexmark.util.options.DataHolder; //导入依赖的package包/类
public KeystrokeNodeRenderer(DataHolder options) {
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:3,代码来源:KeystrokeNodeRenderer.java

示例13: create

import com.vladsch.flexmark.util.options.DataHolder; //导入依赖的package包/类
@Override
public NodeRenderer create(final DataHolder options) {
    return new KeystrokeNodeRenderer(options);
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:5,代码来源:KeystrokeNodeRenderer.java

示例14: MarkNodeRenderer

import com.vladsch.flexmark.util.options.DataHolder; //导入依赖的package包/类
public MarkNodeRenderer(DataHolder options) {
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:3,代码来源:MarkNodeRenderer.java

示例15: create

import com.vladsch.flexmark.util.options.DataHolder; //导入依赖的package包/类
@Override
public NodeRenderer create(final DataHolder options) {
    return new MarkNodeRenderer(options);
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:5,代码来源:MarkNodeRenderer.java


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