本文整理汇总了Java中com.github.slugify.Slugify类的典型用法代码示例。如果您正苦于以下问题:Java Slugify类的具体用法?Java Slugify怎么用?Java Slugify使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Slugify类属于com.github.slugify包,在下文中一共展示了Slugify类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: replace
import com.github.slugify.Slugify; //导入依赖的package包/类
private String replace(String variableString, Object data) {
String result;
// 1. process proxy
StringWriter writer = new StringWriter();
try {
freemarker.template.Template t = new freemarker.template.Template(variableString, variableString, new Configuration(Configuration.VERSION_2_3_25));
t.process(data, writer);
} catch (TemplateException | IOException e) {
log.error("Could not replace proxy pattern");
}
result = writer.toString();
// 2. slugify
Slugify slg = new Slugify();
result = slg.slugify(result);
return result;
}
示例2: onPublishUnpublishClicked
import com.github.slugify.Slugify; //导入依赖的package包/类
public void onPublishUnpublishClicked() {
int msg = R.string.alert_publish;
String targetStatus = Post.PUBLISHED;
if (mPost.isPublished()) {
msg = R.string.alert_unpublish;
targetStatus = Post.DRAFT;
}
@Post.Status final String finalTargetStatus = targetStatus;
new AlertDialog.Builder(mActivity)
.setMessage(msg)
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
if (finalTargetStatus.equals(mPost.getStatus())) {
Log.exception(new IllegalStateException("UI is messed up, " +
"desired post status is same as current status!"));
}
// This will not be triggered when updating a published post, that goes through
// onSaveClicked(). It is assumed the user will ALWAYS want to synchronize the
// slug with the title as long as it's being published now (even if it was
// published and then unpublished earlier).
if (Post.PUBLISHED.equals(finalTargetStatus)) {
// update the title in memory first, from the latest value in UI
mPost.setTitleFromPostEditor(mPostTitleEditView.getText().toString());
mPost.setSlug(new Slugify().slugify(mPost.getTitle()));
}
saveToServerExplicitly(finalTargetStatus);
})
.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.dismiss())
.create().show();
}
示例3: IndexController
import com.github.slugify.Slugify; //导入依赖的package包/类
@Autowired
IndexController(ServicosEmDestaque servicosEmDestaque, AreasDeInteresseEmDestaque areasDestaque, OrgaoRepositoryUtil orgaos, Slugify slugify) {
this.destaques = servicosEmDestaque;
this.areasDestaque = areasDestaque;
this.orgaos = orgaos;
this.slugify = slugify;
}
示例4: fromServico
import com.github.slugify.Slugify; //导入依赖的package包/类
@SneakyThrows
public static PaginaTematica fromServico(ServicoXML servico) {
return new PaginaTematica()
.withId(new Slugify().slugify(servico.getNome()))
.withTipoConteudo(SERVICO.getNome())
.withNome(servico.getNome())
.withConteudo(servico.getDescricao());
}
示例5: fromServico
import com.github.slugify.Slugify; //导入依赖的package包/类
@SneakyThrows
public static PaginaEstatica fromServico(ServicoXML servico) {
return new PaginaEstatica()
.withId(new Slugify().slugify(servico.getNome()))
.withTipoConteudo(SERVICO.getNome())
.withNome(servico.getNome())
.withConteudo(servico.getDescricao());
}
示例6: ImportadorParaPaginasDeOrgao
import com.github.slugify.Slugify; //导入依赖的package包/类
@Autowired
public ImportadorParaPaginasDeOrgao(Slugify slugify, ConteudoParser parser, OrgaoRepository orgaoRepository, LeitorDeArquivos leitorDeArquivos) {
this.slugify = slugify;
this.parser = parser;
this.orgaoRepository = orgaoRepository;
this.leitorDeArquivos = leitorDeArquivos;
}
示例7: ImportadorServicos
import com.github.slugify.Slugify; //导入依赖的package包/类
@Autowired
ImportadorServicos(PortalDeServicosIndex indices,
ServicoRepository servicoRepository,
Siorg siorg,
Slugify slugify,
LeitorDeArquivos leitorDeArquivos) {
this.indices = indices;
this.servicoRepository = servicoRepository;
this.siorg = siorg;
this.slugify = slugify;
this.leitorDeArquivos = leitorDeArquivos;
}
示例8: setUp
import com.github.slugify.Slugify; //导入依赖的package包/类
@Before
@SneakyThrows
public void setUp() {
slugify = new Slugify();
destaquesManuais = new ServicosEmDestaque(servicos, destaques, piwikClient, false);
destaquesAutomaticos = new ServicosEmDestaque(servicos, destaques, piwikClient, true);
given(servicos.findAll(any(PageRequest.class)))
.willReturn(new PageImpl<>(singletonList(SERVICO)));
}
示例9: setUp
import com.github.slugify.Slugify; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
given(servicos.findBySegmentoDaSociedade(CIDADAOS)).willReturn(asList(
SERVICO.withNome("XXXX").withSegmentosDaSociedade(asList(CIDADAOS, EMPRESAS)),
SERVICO.withNome("AAAA").withSegmentosDaSociedade(asList(CIDADAOS, EMPRESAS))));
given(servicos.findBySegmentoDaSociedade(EMPRESAS)).willReturn(asList(
SERVICO.withNome("FFFF").withSegmentosDaSociedade(asList(CIDADAOS, EMPRESAS)),
SERVICO.withNome("AAAA").withSegmentosDaSociedade(asList(CIDADAOS, EMPRESAS))));
publicosAlvo = new PublicoAlvoController(servicos, new Slugify());
}
示例10: onPublishUnpublishClicked
import com.github.slugify.Slugify; //导入依赖的package包/类
public void onPublishUnpublishClicked() {
int msg = R.string.alert_publish;
String targetStatus = Post.PUBLISHED;
if (mPost.isPublished()) {
msg = R.string.alert_unpublish;
targetStatus = Post.DRAFT;
}
@Post.Status final String finalTargetStatus = targetStatus;
new AlertDialog.Builder(mActivity)
.setMessage(msg)
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
if (finalTargetStatus.equals(mPost.getStatus())) {
Crashlytics.logException(new IllegalStateException("UI is messed up, " +
"desired post status is same as current status!"));
}
// This will not be triggered when updating a published post, that goes through
// onSaveClicked(). It is assumed the user will ALWAYS want to synchronize the
// slug with the title as long as it's being published now (even if it was
// published and then unpublished earlier).
if (Post.PUBLISHED.equals(finalTargetStatus)) {
// update the title in memory first, from the latest value in UI
mPost.setTitle(mPostTitleEditView.getText().toString());
mPost.setSlug(new Slugify().slugify(mPost.getTitle()));
}
saveToServerExplicitly(finalTargetStatus);
})
.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.dismiss())
.create().show();
}
示例11: getNodeKey
import com.github.slugify.Slugify; //导入依赖的package包/类
@Override
public String getNodeKey() {
if (StringUtils.isBlank(nodeKey)) {
nodeKey = Slugify.slugify(getName());
}
return nodeKey;
}
示例12: addFilter
import com.github.slugify.Slugify; //导入依赖的package包/类
@PreAuthorize("hasRole('ROLE_ADMIN') or principal.username == #username")
@RequestMapping(value = "/{username:[.a-zA-Z0-9_-]{2,}}", method = RequestMethod.POST)
public void addFilter(@PathVariable("username") String username,
@RequestBody FilterView filterView) throws IOException {
Slugify slugify = new Slugify();
filterView.setSlug(slugify.slugify(filterView.getName()));
filtersDao.addFilter(username, filterView);
}
示例13: toTechnology
import com.github.slugify.Slugify; //导入依赖的package包/类
public static Technology toTechnology(User user, String title) {
Technology technology = new Technology();
Slugify slugger = new Slugify();
technology.setCode(slugger.slugify(title));
technology.setTitle(title);
technology.setUser(user);
return technology;
}
示例14: slugify
import com.github.slugify.Slugify; //导入依赖的package包/类
@PrePersist
public void slugify(){
this.slug = new Slugify().slugify(this.title);
}
示例15: slugify
import com.github.slugify.Slugify; //导入依赖的package包/类
public static String slugify(Collection<String> pathComponents) {
Slugify slg = new Slugify();
return slg.slugify(constructFullPath(pathComponents));
}