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


Java Slugify类代码示例

本文整理汇总了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;
}
 
开发者ID:marcobehler,项目名称:saito,代码行数:20,代码来源:TemplateProcessor.java

示例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();
}
 
开发者ID:TryGhost,项目名称:Ghost-Android,代码行数:30,代码来源:PostEditFragment.java

示例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;
}
 
开发者ID:servicosgovbr,项目名称:portal-de-servicos,代码行数:8,代码来源:IndexController.java

示例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());
}
 
开发者ID:servicosgovbr,项目名称:portal-de-servicos,代码行数:9,代码来源:PaginaTematica.java

示例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());
}
 
开发者ID:servicosgovbr,项目名称:portal-de-servicos,代码行数:9,代码来源:PaginaEstatica.java

示例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;
}
 
开发者ID:servicosgovbr,项目名称:portal-de-servicos,代码行数:8,代码来源:ImportadorParaPaginasDeOrgao.java

示例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;
}
 
开发者ID:servicosgovbr,项目名称:portal-de-servicos,代码行数:13,代码来源:ImportadorServicos.java

示例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)));
}
 
开发者ID:servicosgovbr,项目名称:portal-de-servicos,代码行数:11,代码来源:IndexControllerTest.java

示例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());
}
 
开发者ID:servicosgovbr,项目名称:portal-de-servicos,代码行数:13,代码来源:PublicoAlvoControllerTest.java

示例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();
}
 
开发者ID:vickychijwani,项目名称:quill,代码行数:30,代码来源:PostEditFragment.java

示例11: getNodeKey

import com.github.slugify.Slugify; //导入依赖的package包/类
@Override
public String getNodeKey() {
	if (StringUtils.isBlank(nodeKey)) {
		nodeKey = Slugify.slugify(getName());
	}
	return nodeKey;
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:8,代码来源:TreeNode.java

示例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);
}
 
开发者ID:kTT,项目名称:adjule,代码行数:9,代码来源:FiltersEndpoint.java

示例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;
}
 
开发者ID:padc,项目名称:DevConSummit,代码行数:9,代码来源:Technology.java

示例14: slugify

import com.github.slugify.Slugify; //导入依赖的package包/类
@PrePersist
public void slugify(){
    this.slug = new Slugify().slugify(this.title);
}
 
开发者ID:hantsy,项目名称:spring-microservice-sample,代码行数:5,代码来源:Post.java

示例15: slugify

import com.github.slugify.Slugify; //导入依赖的package包/类
public static String slugify(Collection<String> pathComponents) {
  Slugify slg = new Slugify();
  return slg.slugify(constructFullPath(pathComponents));
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:5,代码来源:PathUtils.java


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