Package org.opoo.press.source

Examples of org.opoo.press.source.SourceEntry


 
  private File prepareTempFile(String content, Date date, String title) throws Exception{
    File file = File.createTempFile("opoopress.mail.", ".post");
    FileUtils.write(file, content, "UTF-8");
   
    SourceEntry sourceEntry = new SourceEntry(file);
    List<String> metaLines = new ArrayList<String>();
    boolean hasFrontMatter = true;
    try {
      Source source = sourceParser.parse(sourceEntry);
      Map<String, Object> meta = source.getMeta();
View Full Code Here


        log.info("Copy static file: " + file);
        copyStaticFile(site.getAssets(), file);
        return;
      }
      if(isSourceFile(file)){
        SourceEntry sourceEntry = loadSourceEntry(site.getSource(), file);
        try {
          Source source = Application.getContext().getSourceParser().parse(sourceEntry);
          if(! showDrafts && isDraft(source.getMeta())){     
            log.info("showDrafts = false: Draft post file '" + file + "' changed, skip regenerate.");
            return;
View Full Code Here

  /**
   * @since 1.0.2
   * @param file - other source directory
   */
  private void otherSourceFileChanged(File file){
    SourceEntry sourceEntry =  new SourceEntry(null, file);
    try {
      Source source = Application.getContext().getSourceParser().parse(sourceEntry);
      if(! showDrafts && isDraft(source.getMeta())){     
        log.info("showDrafts = false: Draft post file '" + file + "' changed, skip regenerate.");
        return;
View Full Code Here

    while(!parent.equals(dir)){
      files.add(parent);
      parent = parent.getParentFile();
    }
   
    SourceEntry parentEntry = null;
    if(!files.isEmpty()){
      Collections.reverse(files);
      Iterator<File> iterator = files.iterator();
      parentEntry = new SourceEntry(iterator.next());
      while(iterator.hasNext()){
        parentEntry = new SourceEntry(parentEntry, iterator.next());
      }
    }
   
    return new SourceEntry(parentEntry, file);
  }
View Full Code Here

  /**
   * @param assets
   * @param file
   */
  private void copyStaticFile(File assets, File file) {
    SourceEntry sourceEntry = loadSourceEntry(assets, file);
    copyStaticFile(sourceEntry);
  }
View Full Code Here

    initTags(stringTags);
   
    String url = (String)frontMatter.get("url");
    if(url == null){
      String permalinkStyle = getPossiblePermalink();
      SourceEntry sourceEntry = getSource().getSourceEntry();
      url = buildPostUrl(permalinkStyle, getDate(), sourceEntry.getPath(), sourceEntry.getName(), getSource().getMeta());
    }
    setUrl(url);
    this.id = url;
   
    Boolean bool = (Boolean) frontMatter.get("published");
View Full Code Here

  public static boolean isPaginationEnabled(Site site, Page page){
    return isPaginationEnabled(site.getConfig().toMap(), page);
  }

  public static boolean isPaginationEnabled(Map<String, Object> config, Page page) {
    SourceEntry entry = page.getSource().getSourceEntry();
    String name = entry.getName();
    String path = entry.getPath();
    // (isIndexPaginationEnabled || isNormalPagePaginationEnabled) && containsPaginatorInContent
    return (config.containsKey("paginate") && "".equals(path) && "index.html".equals(name)
        || page.get("paginate") != null)
        && page.getContent().contains("paginator.");
  }
View Full Code Here

  private void listFileEntries(List<SourceEntry> results, File parent, SourceEntry parentEntry, FileFilter fileFilter){
    File[] files = parent.listFiles(fileFilter);
    SourceEntry[] children = new SourceEntry[files.length];
    for(int i = 0 ; i < files.length ; i++){
      File file = files[i];
      SourceEntry child = new SourceEntry(parentEntry, file);
      children[i] = child;
     
      if(file.isFile()){
        results.add(child);
      }else if(file.isDirectory()){
View Full Code Here

  @Override
  public SourceEntry buildEntry(File sourceDir, String path) {
    path = FilenameUtils.separatorsToUnix(path);
    String[] arr = StringUtils.split(path, "/");
   
    SourceEntry entry = null;
    for(String s: arr){
      sourceDir = new File(sourceDir, s);
      entry = new SourceEntry(entry, sourceDir);
    }
   
    return entry;
  }
View Full Code Here

  /* (non-Javadoc)
   * @see org.opoo.press.source.SourceManager#buildSource(java.io.File, java.lang.String, java.util.Map, java.lang.String)
   */
  @Override
  public Source buildSource(File sourceDir, String path, Map<String, Object> meta, String content) {
    SourceEntry entry = buildEntry(sourceDir, path);
    return new SimpleSource(entry, meta, content);
  }
View Full Code Here

TOP

Related Classes of org.opoo.press.source.SourceEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.