GithubHelp home page GithubHelp logo

enigmacurry / blogofile_blog Goto Github PK

View Code? Open in Web Editor NEW
26.0 7.0 28.0 1.08 MB

A Blogofile blog plugin

Home Page: http://www.blogofile.com

Python 57.37% CSS 20.17% JavaScript 8.34% HTML 1.24% Mako 12.88%

blogofile_blog's Introduction

This is a Blogofile plugin that implements a basic blog engine.

It provides a collection of Mako template files along with CSS and ancillary files, all derived from the HTML5Boilerplate project. It also provided Blogofile configuration, controllers, filters, and commands to allow you to create a simple blog engine that requires no database and no special hosting environment.

The templates include features like:

Use them or remove them as you wish.

There's also a few sample posts to show off:

  • Syntax highlighting for code snippets
  • Unicode support
  • Basic Markdown syntax

Customize the Mako templates, create posts in reStructuredText, Markdown, or Textile, (or even plain HTML) and blogofile generates your entire blog as plain HTML, CSS, Javascript, images, and Atom/RSS feeds which you can then upload to any old web server you like. No database. No CGI or scripting environment on the server. Just fast, secure static content!

Take a look at the blogofile project docs for a quick-start guide, and detailed usage instructions.

Or create a virtualenv and dive right in with:

pip install -U blogofile
pip install -U blogofile_blog

blogofile_blog's People

Contributors

bparsons avatar douglatornell avatar enigmacurry avatar jamur2 avatar ncw avatar szelga avatar tg-- avatar zsoldosp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

blogofile_blog's Issues

Tags don't do anything.

The brief description of tags in the documentation seem to indicate that they should behave similarly to categories. However, while categories behave as expected, there isn't any code in blogofile_blog sucking up and processing tags.

Reading UTF-8 posts broken on Windows

When building posts in UTF-8 encoded files, there's a UnicodeDecodeError in _controllers//blog/post.py line 395:
src = open(post_path, "r").read()
File "C:\Programme\Python\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 210: char
acter maps to

The problem is that the encoding of the read string is platform dependet. You can either open the file in binary mode and then decode it, or set the decoding in the call to open:

src = open(post_path, "r", encoding = 'utf8').read()
OR
src = open(post_path, "br").read().decode('utf-8')
See the Python docs for more info:
http://docs.python.org/release/3.0.1/library/functions.html#open

Improve image inclusion in rst posts

Not sure if this is a real issue, or how to solve it's bugging me in a post I'm working on, so I'm flagging it here for future consideration.

Working with the rst .. image:: file.png role in a post is brittle.

  • Putting file.png in the _posts directory doesn't work because file.png doesn't get copied to the _site subdirectory where the post's index.html ends up.
  • Putting file.png in a top level directory like images that gets copied to _site means that the image markup ends up something like .. image:: ../../../../../images/file.png. I haven't dug deeply enough to know if the number of ../ in that relative file spec is constant.

There has to be a better way...

Adding rel="prev" and rel="next" to chronological blog template

(First, I want to say thank you for making this engine. I love using it to generate our blog as static pages.)

I have a suggestion that I've added to my own chronological blog template, that should be helpful to most site developers.

site_src/_templates/blog/chronological.mako

10c10
<  <a href="${prev_link}">« Previous Page</a>

---
>  <a href="${prev_link}/" rel="prev">« Previous Page</a>
16c16
<  <a href="${next_link}">Next Page »</a>

---
>  <a href="${next_link}/" rel="next">Next Page »</a>

Adding rel="prev" and rel="next" to all of the paginated chronological index pages will help search-engine crawlers consolidate index properties. Indexing systems should probably be able to figure it out, but it's always good to be sure.

I also add the trailing slash to the page link folders in that diff, but there may be a more elegant way to do that than what I have done, so I'm just suggesting the rel="prev" and rel="next" here!

blog template nav_class does not work on windows (header.mako)

Environment:

$ python --version
Python 2.7.1
$ blogofile --version
Blogofile 0.8b1 -- http://www.blogofile.com -- CPython 2.7.1
$ blogofile plugins list
blog (0.8b1) - A simple blog engine - Ryan McGuire, Doug Latornell, and the Blogofile Contributors

Symptom

In the navigation, the current menu item does not get the "selected" css class

Quickfix/root cause

in blogofile_blog/_templates/header.mako (nav_class method):

- render_path = bf.template_context.render_path.rsplit("/index.html")[0]
+ render_path = bf.template_context.render_path.rsplit("/index.html")[0].rsplit('\\index.html')[0]

though likely this kind of path separation would be better handled centrally and via http://docs.python.org/2/library/os.html#os.sep

site_path_helper() produces URLs without trailing slashes

Blogofile templates tend to use site_path_helper() to build URLs, like this:

<link rel="alternate" type="application/rss+xml" title="RSS 2.0"
 href="${bf.util.site_path_helper(bf.config.blog.path,'/feed')}" />

But the function, as shown in its own docstring, fails to end URLs with a terminal slash — even if the string provided as its second argument ends with a terminal slash. Since Blogofile is designed to produce sites that make heavy use of index.html files, and thus of URLs ending with "/" that avoid the ugly use of file extensions, this creates a mismatch.

The symptom is web servers that experience extra traffic because of all of the 301's ("moved permanent") as the terminal-slash-less URLs are invoked, hit a 301, and then finally load the page they are looking for.

Unicode characters not handled by syntax highlighter

Quick patch:

--- a/blogofile_blog/site_src/_filters/syntax_highlight.py
+++ b/blogofile_blog/site_src/_filters/syntax_highlight.py
@@ -108,7 +108,7 @@ def highlight_code(code, language, formatter):
#But get rid of the last
which throws off line numbers:
highlighted = "".join(highlighted.rsplit("
"))
#Surround the text with newlines so markdown etc parse properly:

  • highlighted = "\n\n{0}\n\n".format(highlighted)
  • highlighted = u"\n\n{0}\n\n".format(highlighted)
    return highlighted

def parse_args(args):

md vs. markdown extension & filter chains

when gathering posts, both md and markdown files are recognized. However, when processing the filters, only markdown files are recognized, because the default filters are based on the file extension, and for markdown only the "markdown" is defined

a workaround is the following entry in the config file

blog.post.default_filters['md'] = blog.post.default_filters['markdown']

but probably it would be better consolidated into the core somehow

Release 0.8

This is mostly a placeholder to prevent the 0.8 milestone from being closed before the release actually happens.

Add command line option to `post create` specify markup type

Add a command line option to blogofile blog post create to specify the markup type to use for the post being created.

This is basically adding a command line interface for the functionality added in #8. It would simplify the user experience in blogs like the one at blogofile.com where posts are written (in that case, by different authors) using different markup systems.

Extra space in pygments CSS file path

35034a1 adds an extra space in the pygments CSS file path. The generated file contains path like '/css/ /pygments_murphy.css', and the syntax highlight is not working.
The fix is trivial:

--- a/blogofile_blog/site_src/_templates/head.mako
+++ b/blogofile_blog/site_src/_templates/head.mako
@@ -21,7 +21,7 @@
         href="${bf.util.site_path_helper('/css/handheld.css?v=1')}">
   <link rel="stylesheet"
         href="${bf.util.site_path_helper(
-                  bf.config.filters.syntax_highlight.css_dir,' /pygments_'
+                  bf.config.filters.syntax_highlight.css_dir,'/pygments_'
                   + bf.config.filters.syntax_highlight.style+'.css')}">

   <script

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.