Commits

Gabriele Lanaro  committed 25fe9d1 Merge

Merged with dcolish

  • Participants
  • Parent commits 0885523, 754db1f

Comments (0)

Files changed (9)

File articles/notes.rst

-==============================
-Notes about Google Blogger API
-==============================
-
-List of Entry attributes::
-    'author',
-    'category',
-    'content',
-    'contributor',
-    'control',
-    'extension_attributes',
-    'extension_elements',
-    'id',
-    'link',
-    'published',
-    'rights',
-    'source',
-    'summary',
-    'text',
-    'title',
-    'updated'

File articles/post.rst

-Editing Blogger_ posts directly in emacs seems a natural choice. I've seen some Blogger clients for linux, such as BloGTK, though the editing features are not so good.
-
-A quick, but great idea would be using some sort of markup language to edit posts, ideal choices would be RestructuredText, Markdown and OrgMode. The only problem is that in this way the blog entry is no more editable since the html isn't importable without loosing some information, but to some extent this is possible (there are very good importers).
-
-Apart from editing that can be done on a separate stage a good set of feature would include a sort of "post browser" with the ability of deleting, renaming etc each entry of the blog.
-
-And how about images? Another feature would be to automatically (or easily) uploading images to picasa and include the hyperlink in the post, from emacs.
-
-About sourcecode? Pygments highlighter
-
-Well, I've done a little set of requirements and a "test post" to try out the rst2html exporter and the GoogleCL utility to post articles on the blog.
-
-Bye, Nobody!
- 
-.. _Blogger: http://www.blogger.com

File articles/testarticle.rst

-This is an article in restructured text
-=======================================
-
-Byez! Now I will take you a little script:
-
-.. sourcecode:: python
-
-    def function(abc):
-        print "Hello, baby"
-        if a = b:
-            print c
-        return abc
-
-Bene, ora riprendiamo il testo normale.
-

File articles/update01.rst

-Emacs blogger client seems to proceed quite well, I've introduces some interesting features:
-
-- ``blogger-show`` will show the current list of blogs and entries, pressing ``d`` on an entry will delete it.
-- ``blogger-post`` from a rst-mode buffer you can directly upload the post, you will be prompted for the title
-
-I've also updated the source @ bitbucket_, check the project at http://bitbucket.org/gabriele/emacs-blogger
-
-.. _bitbucket: http://bitbucket.org

File articles/writing_blogger.rst

-.. title: Writing an emacs mode for blogger
-
-On the lines of the last post, I'm trying to implement this new package for blog editing in emacs. Let's look at the commands I'm trying to implement.
-
-Blogger Major Mode
-------------------
-This is a mode for browsing posts and articles in emacs, it would be nice to spawn a buffer for example with ``(blogger-show)`` in this ``blogger-major-mode``. Here's what I imagine the buffer::
-   
-   + Riding Python
-     - Emacs and python toghether  06/07/2010  :emacs:python:
-     - I love cats                 02/11/2009  :loving:cat:
-     - I drink coffee              23/04/2009  :fluff:coffee:python:
-
-It should be evident that there's a blog name (maybe collapsible, how many blogs do you own?) and under each blog a list of entries sorted by date, and with tags.
-I'm designing this mode to be dired like, with the following actions:
-
-    - ``click on an entry`` -> prompt for something to do, or open the entry
-    - ``u`` -> update the blog post (prompting for a buffer or a file name containing the content)
-    - ``r`` -> rename entry (wdired like?)
-    - ``d`` -> remove the entry
-    - ``t`` -> add a new tag
-    - ``c`` -> clean tags
-    - ``r`` -> remove tag
-    - ``+`` -> promtping for editing a new entry, asking for example which markup language to use etc..
-
-An interface like that should be quite nice for such tasks, but for example the "new entry" make not much sense, imho a good workflow for posting *new* stuff would be:
-   - Fire up emacs on a new file in some markup language
-   - type ``M-x blogger-publish``
-   - answer to various prompt, like title, tags
-   - confirm and you're done
-
-Utilities for Images
---------------------
-A simple function like ``M-x upload-to-picasa-and-insert-link`` seems a pretty good choice, at least it is a throw away solution for fast uploading photos and inserting links in the blog.
-
-Currently I'm developing this stuff in home, I'll put the code soon on bitbucket_. Unfortunately I'm not comfortable with writing the complete API in elisp, in fact I need a thin layer with python (using pymacs) to have the good apis provided by python-gdata. Unfortunately pymacs is not easy installable, though at least in linux it's pacakaged for most distributions.
-
-I think nobody is reading this post, but comments are welcomed.
-
-.. _bitbucket: http://www.bitbucket.org
 '''Filter collection to handle the various text manipulation between formats
 '''
 import re
-import rst_directive
+import utils.rst_directive
 from BeautifulSoup import BeautifulSoup
 from docutils.core import publish_string
 

File rst_directive.py

-# -*- coding: utf-8 -*-
-"""
-    The Pygments reStructuredText directive
-    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-    This fragment is a Docutils_ 0.4 directive that renders source code
-    (to HTML only, currently) via Pygments.
-
-    To use it, adjust the options below and copy the code into a module
-    that you import on initialization.  The code then automatically
-    registers a ``sourcecode`` directive that you can use instead of
-    normal code blocks like this::
-
-        .. sourcecode:: python
-
-            My code goes here.
-
-    If you want to have different code styles, e.g. one with line numbers
-    and one without, add formatters with their names in the VARIANTS dict
-    below.  You can invoke them instead of the DEFAULT one by using a
-    directive option::
-
-        .. sourcecode:: python
-            :linenos:
-
-            My code goes here.
-
-    Look at the `directive documentation`_ to get all the gory details.
-
-    .. _Docutils: http://docutils.sf.net/
-    .. _directive documentation:
-       http://docutils.sourceforge.net/docs/howto/rst-directives.html
-
-    :copyright: 2007 by Georg Brandl.
-    :license: BSD, see LICENSE for more details.
-"""
-
-# Options
-# ~~~~~~~
-
-# Set to True if you want inline CSS styles instead of classes
-INLINESTYLES = True
-
-from pygments.formatters import HtmlFormatter
-
-# The default formatter
-DEFAULT = HtmlFormatter(noclasses=INLINESTYLES)
-
-# Add name -> formatter pairs for every variant you want to use
-VARIANTS = {
-    # 'linenos': HtmlFormatter(noclasses=INLINESTYLES, linenos=True),
-}
-
-
-from docutils import nodes
-from docutils.parsers.rst import directives
-
-from pygments import highlight
-from pygments.lexers import get_lexer_by_name, TextLexer
-
-def pygments_directive(name, arguments, options, content, lineno,
-                       content_offset, block_text, state, state_machine):
-    try:
-        lexer = get_lexer_by_name(arguments[0])
-    except ValueError:
-        # no lexer found - use the text one instead of an exception
-        lexer = TextLexer()
-    # take an arbitrary option if more than one is given
-    formatter = options and VARIANTS[options.keys()[0]] or DEFAULT
-    parsed = highlight(u'\n'.join(content), lexer, formatter)
-    return [nodes.raw('', parsed, format='html')]
-
-pygments_directive.arguments = (1, 0, 1)
-pygments_directive.content = 1
-pygments_directive.options = dict([(key, directives.flag) for key in VARIANTS])
-
-directives.register_directive('sourcecode', pygments_directive)
-
-#import docutils.core
-#docutils.core.publish_cmdline(writer_name='html')
+from setuptools import setup, find_packages
+
+
+setup(name='emacs-blogger',
+      version='0.1',
+      description='An emacs mode for using Blogger',
+      long_description=__doc__,
+      packages=find_packages(),
+      author='',
+      author_email='',
+      url='',
+      license='',
+      classifiers='',
+
+      install_requires=[
+        'gdata',
+        'python-dateutil'
+        'rst_directive',
+        'beautifulsoup',
+        'pygments',
+        'docutils',
+        ],
+
+      )

File utils/__init__.py

+#