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


Java Markdown4jProcessor类代码示例

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


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

示例1: bbsDetailRegist

import org.markdown4j.Markdown4jProcessor; //导入依赖的package包/类
@Execute(validator = true,input = "viewinput")
public String bbsDetailRegist() {
   	
   	//MarkDownに変換する
   	String markDown = new String();
   	Markdown4jProcessor pross = new Markdown4jProcessor();
	try {
		markDown = pross.process(bbsForm.detail);
	} catch (IOException e) {
		e.printStackTrace();
	}
   	
   	//DBに書き込み
   	TBbsDetail tBbsDetail = new TBbsDetail();
   	tBbsDetail.subjectId = bbsForm.id;
   	tBbsDetail.detail = markDown;
   	tBbsDetail.memberId = loginMemberDto.memberId;
   	tBbsDetailService.insert(tBbsDetail);
   	bbsForm.detail = null;
   	
   return "/" + getDirectory() + "/bbsDetailList/?redirect=true";
}
 
开发者ID:kagucho,项目名称:tsubonesystem2,代码行数:23,代码来源:BbsDetailListAction.java

示例2: onCreateView

import org.markdown4j.Markdown4jProcessor; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_changelog, container, false);

    HtmlTextView changelogText = (HtmlTextView) view.findViewById(R.id.changelogText);
    try {
        String html = new Markdown4jProcessor().process(
                getActivity().getResources().openRawResource(R.raw.changelog));
        changelogText.setHtml(html, new HtmlResImageGetter(changelogText));
    } catch (IOException e) {
        Log.e("UniPatcher", "IOException", e);
    }

    return view;
}
 
开发者ID:btimofeev,项目名称:UniPatcher,代码行数:17,代码来源:ChangelogFragment.java

示例3: onCreateView

import org.markdown4j.Markdown4jProcessor; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_about, container, false);

    TextView versionText = (TextView) view.findViewById(R.id.versionText);
    versionText.setText(getString(R.string.help_activity_about_tab_version, Utils.getAppVersion(getActivity())));
    HtmlTextView aboutText = (HtmlTextView) view.findViewById(R.id.aboutText);
    try {
        String html = new Markdown4jProcessor().process(
                getActivity().getResources().openRawResource(R.raw.about));
        aboutText.setHtml(html, new HtmlResImageGetter(aboutText));
    } catch (IOException e) {
        Log.e("UniPatcher", "IOException", e);
    }

    return view;
}
 
开发者ID:btimofeev,项目名称:UniPatcher,代码行数:19,代码来源:AboutFragment.java

示例4: execute

import org.markdown4j.Markdown4jProcessor; //导入依赖的package包/类
public cfData execute( cfSession _session, cfArgStructData argStruct ) throws cfmRunTimeException {

		String str = getNamedStringParam( argStruct, "markdown", null );
		if ( str == null )
			throwException( _session, "missing markdown parameter" );

		if ( getNamedBooleanParam( argStruct, "escapehtml", true ) )
			str = xmlFormat.formatXML( str );

		try {
			return new cfStringData( new Markdown4jProcessor().process( str ) );
		} catch ( IOException e ) {
			throwException( _session, "Failed to convert markdown due to error: " + e.getMessage() );
			return null; // keep the compiler happy
		}

	}
 
开发者ID:OpenBD,项目名称:openbd-core,代码行数:18,代码来源:markdown.java

示例5: parseMarkDown

import org.markdown4j.Markdown4jProcessor; //导入依赖的package包/类
public String parseMarkDown(String path,String fileName){
    String absolutePath = path+ File.separator +fileName;
    String html="";
    try {
        if (absolutePath.endsWith(".md")) {
            html = new Markdown4jProcessor().process(Helper.readFromFile(context, absolutePath));
        } else if (absolutePath.endsWith(".html")){
            html = Helper.readFromFile(context, absolutePath);
        }else {
            html = Helper.readFromFile(context, absolutePath);
            html = html.replace("&","&");
            html = html.replace("<","&lt;");
            html = html.replace(">","&gt;");
            html="<pre>"+html+"<pre>";
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return html;
}
 
开发者ID:Amabyte,项目名称:vtu-cs-lab-manual,代码行数:21,代码来源:ToHtml.java

示例6: enter

import org.markdown4j.Markdown4jProcessor; //导入依赖的package包/类
@Override
public void enter() {
    final EntityManager entityManager = Site.getCurrent().getSiteContext().getObject(EntityManager.class);
    final String html;
    try {
        html = new Markdown4jProcessor().process(escapeHtml(content.getMarkup()));
    } catch (IOException e) {
        throw new SiteException("Error processing markdown.", e);
    }

    ((AbstractFlowViewlet) getFlow()).getTopRightLayout().removeComponent(topEditButton);
    ((AbstractFlowViewlet) getFlow()).getTopRightLayout().addComponent(topEditButton);
    ((AbstractFlowViewlet) getFlow()).refreshPathLabels();

    final CssLayout layout = new CssLayout();
    //layout.addComponent(topEditButton);
    layout.setStyleName("wiki-content");
    layout.addComponent(new Label(html, ContentMode.HTML));

    setCompositionRoot(layout);
}
 
开发者ID:bubblecloud,项目名称:ilves,代码行数:22,代码来源:RenderFlowlet.java

示例7: attach

import org.markdown4j.Markdown4jProcessor; //导入依赖的package包/类
@Override
public void attach() {
    super.attach();
    final String markup = (String) getViewletDescriptor().getConfiguration();

    try {
        if (!markupHtmlMap.containsKey(markup)) {
            final long startTimeMillis = System.currentTimeMillis();
            final String html = new Markdown4jProcessor().process(RenderFlowlet.escapeHtml(markup));
            markupHtmlMap.put(markup, html);
            LOGGER.debug("Markup processing took: " + (System.currentTimeMillis() -  startTimeMillis) + " ms.");
        }
    } catch (IOException e) {
        throw new SiteException("Error processing markdown.", e);
    }

    setStyleName("wiki-content");
    final Label label = new Label(markupHtmlMap.get(markup), ContentMode.HTML);
    setCompositionRoot(label);
}
 
开发者ID:bubblecloud,项目名称:ilves,代码行数:21,代码来源:RenderViewlet.java

示例8: chargeAide

import org.markdown4j.Markdown4jProcessor; //导入依赖的package包/类
/**
 * Charge un fichier d'aide dans la fen�tre
 * @param chemin
 */
private void chargeAide(String chemin){
	String text = "";
	try {
		text = lisFichier(chemin);
		text = new Markdown4jProcessor().process(text);
		
	} catch (IOException e) {
		// TODO Auto-generated catch block
		//e.printStackTrace();
		//System.out.println("Probl�me d'acc�s au fichier du menu aide!");
	}

	text = text.replaceAll("src=\"","src=\"" + getClass().getResource("/doc/"));
	//System.out.println(text);
	p.setText(text);
	p.setCaretPosition(0);
}
 
开发者ID:lamatypus,项目名称:Simulateur,代码行数:22,代码来源:JAide.java

示例9: print

import org.markdown4j.Markdown4jProcessor; //导入依赖的package包/类
private void print(Callable function, StringBuilder out) {
	out.append("<h4>");
	out.append(function.getDescription());
	out.append("</h4>\r\n");
	if (function.getAliases().size() > 1) {
		out.append("</p>Aliases: ");
		out.append(function.getAliases().get(1));
		for (int i = 2; i < function.getAliases().size(); i++) {
			out.append(", ");
			out.append(function.getAliases().get(i));
		}
		out.append("</p>\r\n");
	}
	try {
		out.append(new Markdown4jProcessor().process(function
				.getMarkdownHelp()));
	} catch (IOException e) {
		throw new AssertionError(e);
	}
}
 
开发者ID:henrikor2,项目名称:bridlensis,代码行数:21,代码来源:FunctionsPlugin.java

示例10: linkVarExpandTest

import org.markdown4j.Markdown4jProcessor; //导入依赖的package包/类
@Test
public void linkVarExpandTest() throws IOException {
    Markdown4jProcessor p = new Markdown4jProcessor();
    Map<String, String> m = ImmutableMap.<String, String>builder().put("FOO", "bar!").build();
    p.addLinkRefTransformer(new VarInLinkExpandLinkRefTransformer(m));
    String s = p.process("[foo](${FOO}spam)!");
    LOG.debug(s);
}
 
开发者ID:ageldama,项目名称:glados-wiki,代码行数:9,代码来源:Markdown4jTests.java

示例11: onCreateView

import org.markdown4j.Markdown4jProcessor; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_faq, container, false);
    HtmlTextView faqText = (HtmlTextView) view.findViewById(R.id.faqText);
    try {
        String html = new Markdown4jProcessor().process(
                getActivity().getResources().openRawResource(R.raw.faq));
        faqText.setHtml(html, new HtmlResImageGetter(faqText));
    } catch (IOException e) {
        Log.e("UniPatcher", "IOException", e);
    }

    return view;
}
 
开发者ID:btimofeev,项目名称:UniPatcher,代码行数:16,代码来源:FaqFragment.java

示例12: setMarkdown

import org.markdown4j.Markdown4jProcessor; //导入依赖的package包/类
public static void setMarkdown(String markdown, TextView view) {
    Log.d(Config.TAG, "md: " + markdown);
    try {
        String html = new Markdown4jProcessor().process(markdown);
        Log.d(Config.TAG, "html: " + html);
        CharSequence trimmed = convertToSpanned(html);
        view.setText(trimmed);
    } catch (IOException e) {
        Log.e(Config.TAG, "error: " + e.getMessage());
    }
    view.setMovementMethod(LocalLinkMovementMethod.getInstance());

}
 
开发者ID:Stocard,项目名称:markdown-to-spanned,代码行数:14,代码来源:Markdown.java

示例13: fromMarkdown

import org.markdown4j.Markdown4jProcessor; //导入依赖的package包/类
public static Spanned fromMarkdown(String markdown) {
    Log.d(Config.TAG, "md: " + markdown);
    try {
        String html = new Markdown4jProcessor().process(markdown);
        html = workaroundCodeBlocks(html);
        Log.d(Config.TAG, "html: " + html);
        CharSequence trimmed = convertToSpanned(html);
        return (Spanned) trimmed;
    } catch (IOException e) {
        Log.e(Config.TAG, "error: " + e.getMessage());
    }
    return null;
}
 
开发者ID:Stocard,项目名称:markdown-to-spanned,代码行数:14,代码来源:Markdown.java

示例14: convert

import org.markdown4j.Markdown4jProcessor; //导入依赖的package包/类
@Override
public String convert(String input) throws ConversionException {
    try {
        return new Markdown4jProcessor().process(input).trim();
    } catch (IOException e) {
        throw ConversionException.HTML_TO_PDF_EXCEPTION;
    }
}
 
开发者ID:eamonfoy,项目名称:trello-to-markdown,代码行数:9,代码来源:Markdown2HtmlConverter.java

示例15: markdown

import org.markdown4j.Markdown4jProcessor; //导入依赖的package包/类
public static String markdown(String input) {
    if (input == null) {
        return "";
    }
    try {
        return new Markdown4jProcessor().process(input);
    } catch (IOException e) {
        return e.toString() + "<br><br>" + input;
    }
}
 
开发者ID:schmave,项目名称:demschooltools,代码行数:11,代码来源:Application.java


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