#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Scour
#
# Copyright 2009 Jeff Schiller
#
# This file is part of Scour, http://www.codedread.com/scour/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Notes:
# rubys' path-crunching ideas here: http://intertwingly.net/code/svgtidy/spec.rb
# (and implemented here: http://intertwingly.net/code/svgtidy/svgtidy.rb )
# Yet more ideas here: http://wiki.inkscape.org/wiki/index.php/Save_Cleaned_SVG
#
# * Process Transformations
# * Collapse all group based transformations
# Even more ideas here: http://esw.w3.org/topic/SvgTidy
# * analysis of path elements to see if rect can be used instead? (must also need to look
# at rounded corners)
# * removal of unused attributes in groups:
#
#
#
#
#
# in this case, fill="blue" should be removed
# * Move common attributes up to a parent group:
#
#
#
#
#
# becomes:
#
#
#
#
#
# Next Up:
# - analyze all children of a group, if they have common attributes, then move them to the group
# - analyze a group and its children, if a group's attribute is not being used by any children
# (or descendants?) then remove it
# - crunch *opacity, offset values (remove trailing zeros, reduce prec, integerize)
# - add an option to remove ids if they match the Inkscape-style of IDs
# - investigate point-reducing algorithms
# - parse transform attribute
# - if a has only one element in it, collapse the (ensure transform, etc are carried down)
# - option to remove metadata
# - prevent elements from being stripped if they are referenced in a