Exemple #1
0
 def index(self):
     content = Component(
         markdown("""
     Parts
     ====
     * <div class="component-pink">component styles makes this pink</div>
     * <div class="component-green">component css makes this green</div>
     * <div class="component-chocolate">component libs makes this chocolate</div>
     * <div class="component-magenta">component js makes this magenta</div>
     * <div class="component-coral">component head makes this coral</div>
     * <div class="component-tomato">component tail makes this tomato</div>
     * <div class="page-slategray">page styles makes this slategray</div>
     * <div class="page-red">page css makes this red</div>
     * <div class="page-purple">page libs makes this purple</div>
     * <div class="page-cyan">page js makes this cyan</div>
     * <div class="page-navy">page head makes this navy</div>
     * <div class="page-olive">page tail makes this olive</div>
     """),
         styles=['/sample/parts/mystyle'],
         css=".component-green {color: green}",
         libs=['/sample/parts/mylib'],
         js='$(".component-magenta").css("color", "magenta")',
         head='<style>.component-coral {color: coral}</style>',
         tail=
         '<script>$(".component-tomato").css("color", "tomato")</script>',
     )
     return page(
         content,
         styles=['/sample/parts/pagestyle'],
         css='.page-red {color: red}',
         libs=['/sample/parts/pagelib'],
         js='$(".page-cyan").css("color", "cyan")',
         head='<style>.page-navy {color: navy}</style>',
         tail='<script>$(".page-olive").css("color", "olive")</script>',
     )
Exemple #2
0
def load_page(path):

    page = get_pages().first(path=path)
    if page:
        return markdown(render(page.body))

    filename = os.path.splitext(path or 'index.html')[0] + '.md'
    if os.path.exists(filename):
        return load_content(filename)

    logger = logging.getLogger(__name__)
    logger.debug('file not found %r', path + '.md')
Exemple #3
0
    def index(self):
        content = markdown("""
        Alerts
        ====
        * [Success](alerts/success)
        * [Warning](alerts/warning)
        * [Error](alerts/error)
        * [Random](alerts/random)

        Developer
        ====
        * [Stdout](alerts/stdout)
        """)
        return page(content)
Exemple #4
0
def make_message(token):
    """create a message to send to the user"""
    reset_link = redirect_to('/forgot/reset?token=%s' % token).render(context.request).headers['Location']
    filler = dict(
        site_name=context.site.title,
        reset_link=reset_link,
    ).get
    message = markdown(
        dzfill(
            load('activate.md'),
            filler,
        )
    )
    logger = logging.getLogger(__name__)
    logger.debug('password reset link: %s', reset_link)
    return message
Exemple #5
0
 def success(self):
     success('that was great!')
     return page(markdown('return to [index](/sample/alerts)'),
                 title='Alerts')