| | |
| | | package com.gitblit.wicket.pages;
|
| | |
|
| | | import java.text.MessageFormat;
|
| | | import java.text.ParseException;
|
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | |
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.MarkdownUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.CacheControl;
|
| | | import com.gitblit.wicket.CacheControl.LastModified;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | |
|
| | | @CacheControl(LastModified.BOOT)
|
| | | public class MarkdownPage extends RepositoryPage {
|
| | |
|
| | | public MarkdownPage(PageParameters params) {
|
| | |
| | | Repository r = getRepository();
|
| | | RevCommit commit = JGitUtils.getCommit(r, objectId);
|
| | | String [] encodings = GitBlit.getEncodings();
|
| | | |
| | |
|
| | | // markdown page links
|
| | | add(new BookmarkablePageLink<Void>("blameLink", BlamePage.class,
|
| | | WicketUtils.newPathParameter(repositoryName, objectId, markdownPath)));
|
| | |
| | | String htmlText;
|
| | | try {
|
| | | htmlText = MarkdownUtils.transformMarkdown(markdownText);
|
| | | } catch (ParseException p) {
|
| | | } catch (Exception e) {
|
| | | logger.error("failed to transform markdown", e);
|
| | | markdownText = MessageFormat.format("<div class=\"alert alert-error\"><strong>{0}:</strong> {1}</div>{2}", getString("gb.error"), getString("gb.markdownFailure"), markdownText);
|
| | | htmlText = StringUtils.breakLinesForHtml(markdownText);
|
| | | }
|
| | |
| | | protected String getPageName() {
|
| | | return getString("gb.markdown");
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | protected Class<? extends BasePage> getRepoNavPageClass() {
|
| | | return DocsPage.class;
|