Skip to content

Commit

Permalink
Merge pull request #1 from staffanm/feature/transformer
Browse files Browse the repository at this point in the history
Transformation from XHTML + config + anntations to browser-ready HTML5 now done through separate class
  • Loading branch information
staffanm committed Sep 15, 2013
2 parents 7c686d4 + 41ddce3 commit 6b4f24e
Show file tree
Hide file tree
Showing 60 changed files with 884 additions and 539 deletions.
8 changes: 8 additions & 0 deletions doc/api/transformer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The ``Transformer`` class
============================

.. autoclass:: ferenda.Transformer
:members:
:undoc-members:
:inherited-members:
:member-order: bysource
20 changes: 10 additions & 10 deletions doc/createdocrepos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ The default implementation does this in two steps. In the first,
:meth:`~ferenda.DocumentRepository.prep_annotation_file`
fetches metadata about other documents that relates to the document to
be generated into an *annotation file*. In the second,
:meth:`~ferenda.DocumentRepository.transform_html` runs an
:class:`~ferenda.Transformer` runs an
XSLT transformation on the source file (which sources the annotation
file and a configuration file created by
:func:`~ferenda.manager.makeresources`) in order to create the
Expand Down Expand Up @@ -493,15 +493,15 @@ obsoletes the same document (RFC 6991).
Transforming to HTML
^^^^^^^^^^^^^^^^^^^^^

The :meth:`~ferenda.DocumentRepository.transform_html` step is driven
by a XSLT stylesheet. The default stylesheet uses a site-wide
configuration file (created by :func:`~ferenda.manager.makeresources`)
for things like site name and top-level navigation, and lists the
document content, section by section, alongside of other documents
that contains references (in the form of ``dct:references``) for each
section. The SPARQL query and the XSLT stylesheet often goes hand in
hand -- if your stylesheet needs a certain piece of data, the query
must be adjusted to fetch it. By setting he class variable
The :class:`~ferenda.Transformer` step is driven by a XSLT
stylesheet. The default stylesheet uses a site-wide configuration file
(created by :func:`~ferenda.manager.makeresources`) for things like
site name and top-level navigation, and lists the document content,
section by section, alongside of other documents that contains
references (in the form of ``dct:references``) for each section. The
SPARQL query and the XSLT stylesheet often goes hand in hand -- if
your stylesheet needs a certain piece of data, the query must be
adjusted to fetch it. By setting he class variable
:data:`~ferenda.DocumentRepository.xslt_template` in the same way as
you did for the SPARQL query, you can override the default.

Expand Down
4 changes: 4 additions & 0 deletions doc/docrepo/keyword.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
``ferenda.sources.general.Keyword`` -- generate documents for keywords used by document in other docrepos
=========================================================================================================

.. autoclass:: ferenda.sources.general.Keyword
12 changes: 12 additions & 0 deletions doc/docrepo/legal-eu.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
``ferenda.sources.legal.eu`` -- repositories for EU law
=======================================================

``EurlexTreaties``
-------------------------------------------

.. autoclass:: ferenda.sources.legal.eu.EurlexTreaties

``EurlexCaselaw``
------------------------------------------

.. autoclass:: ferenda.sources.legal.eu.EurlexTreaties
125 changes: 125 additions & 0 deletions doc/docrepo/legal-se.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
``ferenda.sources.legal.se`` -- repositories for Swedish law
============================================================


``ARN``
-------

.. autoclass:: ferenda.sources.legal.se.ARN

``Direktiv``
------------

.. autoclass:: ferenda.sources.legal.se.Direktiv


``direktiv.DirTrips``
^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: ferenda.sources.legal.se.direktiv.DirTrips

``direktiv.DirAsp``
^^^^^^^^^^^^^^^^^^^

.. autoclass:: ferenda.sources.legal.se.direktiv.DirAsp

``direktiv.DirPolopoly``
^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: ferenda.sources.legal.se.direktiv.DirPolopoly

``Ds``
------

.. autoclass:: ferenda.sources.legal.se.Ds

``DV``
------

.. autoclass:: ferenda.sources.legal.se.DV

``JK``
------

.. autoclass:: ferenda.sources.legal.se.JK

``JO``
------

.. autoclass:: ferenda.sources.legal.se.JO

``Kommitte``
------------

.. autoclass:: ferenda.sources.legal.se.Kommitte

``MyndFskr``
------------

.. autoclass:: ferenda.sources.legal.se.MyndFskr

``myndfskr.SJVFS``
^^^^^^^^^^^^^^^^^^

.. autoclass:: ferenda.sources.legal.se.myndfskr.SJVFS

``myndfskr.DVFS``
^^^^^^^^^^^^^^^^^

.. autoclass:: ferenda.sources.legal.se.myndfskr.DVFS

``myndfskr.FFFS``
^^^^^^^^^^^^^^^^^

.. autoclass:: ferenda.sources.legal.se.myndfskr.FFFS

``myndfskr.ELSAKFS``
^^^^^^^^^^^^^^^^^^^^

.. autoclass:: ferenda.sources.legal.se.myndfskr.ELSAKFS

``myndfskr.NFS``
^^^^^^^^^^^^^^^^^^

.. autoclass:: ferenda.sources.legal.se.myndfskr.NFS

``myndfskr.STAFS``
^^^^^^^^^^^^^^^^^^

.. autoclass:: ferenda.sources.legal.se.myndfskr.STAFS

``myndfskr.SKVFS``
^^^^^^^^^^^^^^^^^^

.. autoclass:: ferenda.sources.legal.se.myndfskr.SKVFS


``Propositioner``
-----------------

.. autoclass:: ferenda.sources.legal.se.Propositioner

``propositioner.PropPolo``
^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: ferenda.sources.legal.se.propositioner.PropPolo

``propositioner.PropTrips``
^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: ferenda.sources.legal.se.propositioner.PropTrips

``propositioner.PropRiksdagen``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: ferenda.sources.legal.se.propositioner.PropRiksdagen



.. We don't include Regeringen, Riksdagen, SwedishLegalSource or Trips since they're abstract base classes
``SFS``
-------

.. autoclass:: ferenda.sources.legal.se.SFS
4 changes: 4 additions & 0 deletions doc/docrepo/mediawiki.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
``ferenda.sources.general.MediaWiki`` -- pull in commentary on documents and keywords from a MediaWiki instance
===============================================================================================================

.. autoclass:: ferenda.sources.general.MediaWiki
6 changes: 0 additions & 6 deletions doc/docrepo/rfc.rst

This file was deleted.

4 changes: 4 additions & 0 deletions doc/docrepo/skeleton.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
``ferenda.sources.general.Skeleton`` -- generate skeleton documents for references from other documents
=======================================================================================================

.. autoclass:: ferenda.sources.general.Skeleton
6 changes: 2 additions & 4 deletions doc/docrepo/static.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
The ``Static`` document repository
==================================
``ferenda.sources.general.Static`` -- generate documents from your own ``.rst`` files
=====================================================================================

.. autoclass:: ferenda.sources.general.Static
:members:
:member-order: bysource
12 changes: 12 additions & 0 deletions doc/docrepo/tech.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
``ferenda.sources.tech`` -- repositories for technical standards
================================================================

``W3Standards``
------------------------------------

.. autoclass:: ferenda.sources.tech.W3Standards

``RFC``
----------------------------

.. autoclass:: ferenda.sources.tech.RFC
6 changes: 0 additions & 6 deletions doc/docrepo/w3c.rst

This file was deleted.

9 changes: 7 additions & 2 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Classes
api/elements
api/elements-html
api/describer
api/transformer
api/fsmparser
api/citationparser
api/uriformatter
Expand Down Expand Up @@ -96,9 +97,13 @@ Document repositories
.. toctree::
:maxdepth: 2

docrepo/rfc
docrepo/w3c
docrepo/static
docrepo/keyword
docrepo/mediawiki
docrepo/skeleton
docrepo/tech
docrepo/legal-eu
docrepo/legal-se
api/devel


Expand Down
4 changes: 2 additions & 2 deletions doc/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ Alternately, using the command line tools and the project framework:
7000 RFC documents takes several hours. In order to process all
documents, remove the ``downloadmax`` configuration
parameter/command line option, and be prepared to wait. You should
also set up an external triple store (see :doc:`triplestore`) and
an external fulltext search engine (see :doc:`fulltextsearch`).
also set up an external triple store (see :ref:`external-triplestore`) and
an external fulltext search engine (see :ref:`external-fulltext`).

Features
--------
Expand Down
1 change: 1 addition & 0 deletions ferenda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from .tocpage import TocPage
from .toccriteria import TocCriteria
from .newscriteria import NewsCriteria
from .transformer import Transformer
from .document import Document
from .documententry import DocumentEntry
from .documentstore import DocumentStore
Expand Down
1 change: 0 additions & 1 deletion ferenda/citationparser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

Expand Down
16 changes: 8 additions & 8 deletions ferenda/compat.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""kind of like six.moves but primarily for py26 support.
Client code uses this like::
from ferenda.compat import OrderedDict
from ferenda.compat import unittest
from ferenda.compat import Mock, patch
"""
from __future__ import unicode_literals
# ferenda/compat.py -- kind of like six.moves but primarily for py26 support
#
# client code uses this like:
#
# from ferenda.compat import OrderedDict
# from ferenda.compat import unittest
# from ferenda.compat import Mock, patch
import sys
try:
from collections import OrderedDict
Expand Down
1 change: 0 additions & 1 deletion ferenda/compositerepository.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

Expand Down
1 change: 0 additions & 1 deletion ferenda/decorators.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Most of these decorators are intended to handle various aspects of
a complete :py:meth:`~ferenda.DocumentRepository.parse`
Expand Down
2 changes: 2 additions & 0 deletions ferenda/devel.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class Devel(object):
class DummyStore(object):
def __init__(self, path, **kwargs):
pass
def list_basefiles_for(self, action, basedir=None):
return []
downloaded_suffix = ".html"
storage_policy = "file"
documentstore_class = DummyStore
Expand Down
2 changes: 1 addition & 1 deletion ferenda/document.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from rdflib import Graph


Expand Down
2 changes: 1 addition & 1 deletion ferenda/documententry.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import os
import hashlib
import json
Expand Down

0 comments on commit 6b4f24e

Please sign in to comment.