Metadata-Version: 1.0
Name: transmogrify.siteanalyser
Version: 1.3
Summary: transmogrifier source blueprints for crawling html
Home-page: http://github.com/collective/transmogrify.siteanalyser
Author: Dylan Jay
Author-email: software@pretaweb.com
License: GPL
Description: .. contents :: :local:
        
        
        Introduction
        ============
        
        Transmogrifier blueprints that look at how html items are linked to gather metadata
        about items. They can help you restructure your content.
        
        
        
        
        
        transmogrify.siteanalyser.sitemapper
        ====================================
        Take navigation html such as a whole sitemap, breadcrumbs or navigation menus using nested links
        and buildup a site structure and titles
        for pages. This can then be used to cleanup urls and titles for items as well as hide content that shouldn't be
        displayed in menus. This is useful for cleaning up sites with a flat url scheme such 'display?id=xxx' type sites.
        
        
        Options:
        
        :field:
          Name of a field from item which contains a sitemap or nested links
        
        :field_expr:
          Expression to determine the field which contains a sitemap
        
        :breadcrumb_field:
          Key of the field which contains breadcrumb style html. e.g. <a href="..">Folder</a> &gt; Item.
        
        :folder-type:
          If set will ensure all parents in sitemap are of this Type, moving item to defaultpage if needed
        
        :exclude-from-navigation-key:
          Will set this key to 'True' if this item is not found in the sitemap. Defaults to 'exclude-from-navigation'
        
        :title-key:
          Update this field with the title taken from the sitemap if no title already exists
        
        :path_sub:
          Newline seperated regular expressions and substitions to adjust paths so change where content is moved to
        
        :condition:
          TAL expression which if false, don't move this item
        
        
        
        transmogrify.siteanalyser.urltidy
        =================================
        Will  normalize ids in urls to be suitable for adding to plone.
        
        The following will tidy up the URLs based on a TALES expression ::
        
         $> bin/funnelweb --urltidy:link_expr="python:item['_path'].endswith('.html') and item['_path'][:-5] or item['_path']"
        
        If you'd like to move content around before it's uploaded you can use the urltidy step as well e.g. ::
        
         $> bin/funnelweb --urltidy:link_expr=python:item['_path'].startswith('/news') and '/otn/news'+item['path'][5:] or item['_path']
        
        
        Options:
        
        :condition:
          TAL Expression to apply transform
        
        :locale:
          TAL Expression to return the locale used for id normalisation. e.g. 'string:en'
        
        :link_expr:
          TAL Expression to alter the items '_path'
        
        :use_title:
          Condition TAL Expression to change the end path element to a normalised version of item['_title']
        
        
        
        
        
        
        
        transmogrify.siteanalyser.attach
        ================================
        
        Find items and move them if they are tightly linked to a single page. For example if an image
        is located in an images folder, but is only referenced from a single img element on a page in
        /page then the image will be 'merged' with the page.
        How the merge occurs depends on the 'fields' setting. Merging can either be moving the content
        of the subitem into a field of the parent item, or it can be via containment.
        
        
        
        or the following will only move attachments that are images and use ``index-html`` as the new
        name for the default page of the newly created folder ::
        
          [funnelweb]
          recipe = funnelweb
          attachmentguess-condition = python: subitem.get('_type') in ['Image']
          attachmentguess-defaultpage = index-html
        
        Options
        
        :fields:
          TAL Expression to return the a dictionary of changes to ``item``. It will use ``item``, ``subitem`` and ``i`` variables.
          e.g. python:{'attachment':subitem['text']}. This will be called for all subitems. The subitems will be deleted.
        
        :condition:
          TAL Expression to apply transform
          (default='python:True')
        
        :defaultpage:
          (default='index-html')
        
        
        
        transmogrify.siteanalyser.title
        ===============================
        
        This blueprint will take the _backlinks from the item generated by webcrawler
        and if no Title field has been given to the item it will attempt to guess
        it from the link names that linked to this document.
        You can specify an option 'ignore' option to specify titles never to use
        
        If it can't guess it from the backlinks it will default to using the file name after
        cleaning it up somewhat
        
        Options:
        
        :condition:
          TAL Expression to apply transform
        
        :ignore:
          New line seperated list of strings which won't be use as titles. Defaults to 'next','previous'
        
        
        transmogrify.siteanalyser.hidefromnav
        =====================================
        
        This blueprint will guess which folders should be hidden from the navigation tree.
        It does this by one of three rules
        
        1. Gather all links in the _template html left over after content extraction
        and assume anything linked from outside the content should have their folders shown and
        anything else should be hidden. #TODO
        2. Any folders with content found only via img links will also be hidden. #TODO
        3. The condition to set to tree for the item to hide
        
        Options
        
        :key:
          Default is '_exclude-from-navigation'.
        
        :condition:
          Default is 'python:False'
        
        :template_key:
          #TODO
          Default is '_template'
        
        :hide_img_folders:
          #TODO
          Default is 'True'
        
        
        transmogrify.siteanalyser.defaultpage
        =====================================
        To determine if an item is a default page for a container (it has many links
        to items in that container, even if not contained in that folder), and then move
        it to that folder.
        
        Options:
        
        :mode:
          'links' or 'path' (default=links).
          'links' mode uses links
          to determine if a item is a defaultpage of a subtree by looking at it's links.
          'path' mode uses parent_path expression to
          determine if an item is a defaultpage of that parent.
        
        :min_links:
          If a page has as at least this number of links that point to content in a folder
          then move it there and make it the defaultpage. (default=2)
        
        :max_uplinks:
          If a page has more than max_uplinks it won't be moved. (default=2)
        
        :parent_path:
                Rule is defined by entered
                parent_path option which is expression with access to item,
                transmogrifier, name, options and modules variables.
                Returned value is used to find possible parent item by path. If found,
                item is moved to that parent item, parent item _defaultpage key is set
                appropriately, and we turn to processing another item in a pipeline. So
                the first item in pipeline will take precedence in case parent_path rule
                returns more than one item for the same parent.
        
        :condition:
          default=python:True
        
        
        transmogrify.siteanalyser.relinker
        ==================================
        Help restructure your content.
        If you'd like to move content from one path to another then in a
        previous blueprints adjust the '_path' to the new path. Create a new field
        called '_origin' and put the old path into that. Once you pass it through
        the relinker all href, img tags etc will be changed in any html content where they
        pointed to content that has since moved. All '_origin' fields will be removed
        after relinking.
        
        Options:
        
        :ignore_duplicates:
          If 'True' there won't be an error raised when two items were redirected from the same place. This can occur with
          some CMS's where content can be in different urls in the site
        =======
        #import urllib
        from external.relative_url import relative_url
        #from sys import stderr
        #from collective.transmogrifier.utils import Expression
        import logging
        #from external.normalize import urlnormalizer as normalizer
        import urlparse
        #from sys import stderr
        #from plone.i18n.normalizer import urlnormalizer as normalizer
        >>>>>>> 99c848b08ab582b860086322b5419436c7163d49
        
        :broken_link_normalise:
          TAL expressions, each on a new line, which take 'url' from inside the html and returns a link that will match one of
          the existing links in the site. Must return the full url, not the path. This is useful when many different links
          could go to the same content.
        
        
        transmogrify.pathsorter
        ==================================
        
        If items are at the same level in a folder then they will be sorted based on a
        '_sortorder' key as given by transmogrify.webcrawler.
        
        In addition
        
        
        - if a container has a 'text' key then a default page will be created.
        
        - if item's name is in 'default_pages' and it's parent doesn't already have a defaultpage
          then the item will be set as the parents default page.
        
        Options:
        
        :default_pages:
          Set item as to be set as the default page of it's parent if it matches one of these names.
          Default is 'index.html'
        
        :default_containers:
          if an item doesn't exist for a given items parent it will be created. The _type key will
          be set to the first item in 'default_containers'. Default is 'Folder'.
        
        Changelog
        =========
        
        1.3 (Unreleased)
        ---------------------
        
        - added sitemapper blueprint
        - converted text to unicode baseNormalize because decomposition needs unicode valute to works properly [gborelli]
        - add ignore_re attribute in Backlinks title for ignore regular expression condition [ivanteoh]
        - add 'ignore_duplicates' and 'broken_link_normalise' to relinker [djay]
        - added invalid_ids option [ivanteoh]
        - relinker relinks any field which contains '<' and additional specififed fields [djay]
        - cleaned up logging [djay]
        - fixed relinking of defaultpages [djay]
        - titles from backlinks must be unique to be used [djay]
        
        1.2 (2012-04-28)
        ----------------
        
        - moved transmogrify.pathsorter into transmogrify.siteanalyser.pathsorter [djay]
        
        1.1 (2012-04-18)
        ----------------
        
        - added transmogrify.siteanalyser.sitemapper [djay]
        - split transmogrify.siteanalyser.urltidy out of relinker [djay]
        - ensure urltidy always create unique urls [djay]
        - Added ability to take id from title to urltidy [djay]
        - improved logging [djay]
        - fixed bug in attach where two items can end up with same path [djay]
        
        
        1.0 (2011-06-29)
        ----------------
        
        - 1.0 release
        
        1.0b8 (2011-02-12)
        ------------------
        - more robust parsing of html
        
        1.0b7 (2011-02-06)
        ------------------
        
        - show error if text is None
        - fix bug with bad chars in rewritten links
        - fix bug in losing items
        - add hidefromnav blueprint. does manual hiding
        
        
        1.0b6 (2010-12-15)
        ------------------
        
        - remove nulls from links which cause lxml errors
        - summarise info in log to single entry
        
        1.0b5 (2010-12-13)
        ------------------
        
        - condition was in the wrong place. resulted in dropping items
        - improve logging
        - handle default pages that don't exist
        
        1.0b4 (2010-11-11)
        ------------------
        
        - fix bug where _defaultpage wasn't being relinked
        
        1.0b3 (2010-11-09)
        ------------------
        
        - fix bug in quoting links in relinker
        
        
        1.0b2 (2010-11-08)
        ------------------
        
        - Add conditions to site analyser blueprints
        
Keywords: transmogrifier blueprint funnelweb source plone import conversion microsoft office
Platform: UNKNOWN
Classifier: Programming Language :: Python
Classifier: Topic :: Software Development :: Libraries :: Python Modules
