コード例 #1
0
ファイル: __init__.py プロジェクト: ssbr/jules
import os
import tempfile
import shutil
import posixpath

import genshi
import jinja2

import jules
from jules.query import cache, unwrapping_kwargs, method_registrar
from jules import writer, utils

from .postprocessing import MutatingPostProcessingPlugin

jules.add_namespace(__package__)

class CanonConflictError(Exception): pass

class Renderer(jules.plugins.EnginePlugin):
    """Query operatings for rendering results to disk.
    
    A basic problem is that posts need to know canonical URLs, but canonical
    URLs are generated after posts. To solve this, we look at the URLs first,
    and only then do we render the templates and write out the actual data.
    
    Steps:
     * Collect URL information
       This is done during the pipeline/query phase. To be precise, we collect:
        
        - what URLs get rendered with what templates, data.
        - what URLs are canonical for what names.
コード例 #2
0
ファイル: __init__.py プロジェクト: ssbr/jules
from jules.plugins import BaseJulesPlugin
from jules import add_namespace
add_namespace(__name__)

class MutatingPostProcessingPlugin(BaseJulesPlugin):
    processing_dependencies = ()
    # TODO: support MIME types?
    input_extension = None
    output_extension = None
    
    def process_data(self, data):
        """Process data and return replacement data.
        
        If the extension of the replacement data is different, then the class
        attribute output_extension must be different. A plugin can't currently
        return multiple different extensions depending on the input.
        """
        return data

# TODO:
##BEGINNING = 0
##END = -1
##ANYWHERE = None
##class NonmutatingPostProcessingPlugin(jules.plugins.BaseJulesPlugin):