本文整理汇总了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";
}
示例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;
}
示例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;
}
示例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
}
}
示例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("<","<");
html = html.replace(">",">");
html="<pre>"+html+"<pre>";
}
} catch (IOException e) {
e.printStackTrace();
}
return html;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
}
示例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;
}
}