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


Java HtmlEscape.escapeHtml5方法代码示例

本文整理汇总了Java中org.unbescape.html.HtmlEscape.escapeHtml5方法的典型用法代码示例。如果您正苦于以下问题:Java HtmlEscape.escapeHtml5方法的具体用法?Java HtmlEscape.escapeHtml5怎么用?Java HtmlEscape.escapeHtml5使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.unbescape.html.HtmlEscape的用法示例。


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

示例1: CommitMessageLabel

import org.unbescape.html.HtmlEscape; //导入方法依赖的package包/类
public CommitMessageLabel(String id, IModel<Project> projectModel, IModel<String> messageModel) {
	super(id, new LoadableDetachableModel<String>() {

		@Override
		protected String load() {
			String message = HtmlEscape.escapeHtml5(messageModel.getObject());
			for (CommitMessageTransformer transformer: GitPlex.getExtensions(CommitMessageTransformer.class)) {
				message = transformer.transform(projectModel.getObject(), message);
			}
			return message;
		}

		@Override
		protected void onDetach() {
			projectModel.detach();
			messageModel.detach();
			super.onDetach();
		}
		
	});
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:22,代码来源:CommitMessageLabel.java

示例2: getJsonOfBlameInfos

import org.unbescape.html.HtmlEscape; //导入方法依赖的package包/类
private String getJsonOfBlameInfos(boolean blamed) {
	String jsonOfBlameInfos;
	if (blamed) {
		List<BlameInfo> blameInfos = new ArrayList<>();
		
		String commitHash = context.getCommit().name();
		
		BlameCommand cmd = new BlameCommand(context.getProject().getGitDir());
		cmd.commitHash(commitHash).file(context.getBlobIdent().path);
		for (Blame blame: cmd.call().values()) {
			BlameInfo blameInfo = new BlameInfo();
			blameInfo.commitDate = DateUtils.formatDate(blame.getCommit().getCommitter().getWhen());
			blameInfo.authorName = HtmlEscape.escapeHtml5(blame.getCommit().getAuthor().getName());
			blameInfo.hash = blame.getCommit().getHash();
			blameInfo.abbreviatedHash = GitUtils.abbreviateSHA(blame.getCommit().getHash(), 7);
			CommitDetailPage.State state = new CommitDetailPage.State();
			state.revision = blame.getCommit().getHash();
			state.pathFilter = context.getBlobIdent().path;
			PageParameters params = CommitDetailPage.paramsOf(context.getProject(), state);
			blameInfo.url = RequestCycle.get().urlFor(CommitDetailPage.class, params).toString();
			blameInfo.ranges = blame.getRanges();
			blameInfos.add(blameInfo);
		}
		try {
			jsonOfBlameInfos = GitPlex.getInstance(ObjectMapper.class).writeValueAsString(blameInfos);
		} catch (JsonProcessingException e) {
			throw new RuntimeException(e);
		}
	} else {
		jsonOfBlameInfos = "undefined";
	}
	return jsonOfBlameInfos;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:34,代码来源:SourceViewPanel.java

示例3: newItem

import org.unbescape.html.HtmlEscape; //导入方法依赖的package包/类
private Component newItem(String itemId, String itemValue) {
	String ref;
	if (itemValue.startsWith(COMMIT_FLAG))
		ref = itemValue.substring(COMMIT_FLAG.length());
	else if (itemValue.startsWith(ADD_FLAG))
		ref = itemValue.substring(ADD_FLAG.length());
	else
		ref = itemValue;
	
	AjaxLink<Void> link = new ViewStateAwareAjaxLink<Void>("link") {

		@Override
		protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
			super.updateAjaxAttributes(attributes);
			attributes.getAjaxCallListeners().add(new ConfirmLeaveListener());
		}
		
		@Override
		public void onClick(AjaxRequestTarget target) {
			if (itemValue.startsWith(ADD_FLAG)) {
				onCreateRef(target, ref);
			} else {
				selectRevision(target, ref);
			}
		}

		@Override
		protected void onComponentTag(ComponentTag tag) {
			super.onComponentTag(tag);
			
			if (!itemValue.startsWith(ADD_FLAG)) {
				String url = getRevisionUrl(ref);
				if (url != null)
					tag.put("href", url);
			}
		}
		
	};
	if (itemValue.startsWith(COMMIT_FLAG)) {
		link.add(new Label("label", ref));
		link.add(AttributeAppender.append("class", "icon commit"));
	} else if (itemValue.startsWith(ADD_FLAG)) {
		String label;
		if (branchesActive)
			label = "<div class='name'>Create branch <b>" + HtmlEscape.escapeHtml5(ref) + "</b></div>";
		else
			label = "<div class='name'>Create tag <b>" + HtmlEscape.escapeHtml5(ref) + "</b></div>";
		label += "<div class='revision'>from " + HtmlEscape.escapeHtml5(revision) + "</div>";
		link.add(new Label("label", label).setEscapeModelStrings(false));
		link.add(AttributeAppender.append("class", "icon add"));
	} else if (ref.equals(revision)) {
		link.add(new Label("label", ref));
		link.add(AttributeAppender.append("class", "icon current"));
	} else {
		link.add(new Label("label", ref));
	}
	WebMarkupContainer item = new WebMarkupContainer(itemId);
	item.setOutputMarkupId(true);
	item.add(AttributeAppender.append("data-value", HtmlEscape.escapeHtml5(itemValue)));
	item.add(link);
	
	return item;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:64,代码来源:RevisionSelector.java

示例4: toJson

import org.unbescape.html.HtmlEscape; //导入方法依赖的package包/类
@Override
public void toJson(String choice, JSONWriter writer) throws JSONException {
	String escapedName = HtmlEscape.escapeHtml5(choice);
	writer.key("id").value(escapedName).key("name").value(escapedName);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:6,代码来源:VerificationChoiceProvider.java


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