John Culleton wrote: > How about a stripper? An .sla file is pretty unreadable as is. But > with a simple Gvim command I took a book cover template and revealed > its sexy inner secrets. The Gvim command: > :%s/" /" \r/g > > This yields a file that looks like this (extract): > --------------------------------------------------------- > PAGEHEIGHT="666" > PAGEWIDTH="918" > PAGEYPOS="20" > HorizontalGuides="441 477 663 " > MNAM="Normal" > PAGEXPOS="100" > NumHGuides="3" > VerticalGuides="" > BORDERLEFT="27" > /> > </DOCUMENT> > </SCRIBUSUTF8NEW> > --------------------------------------- > Now this can be edited pretty easily by hand or by program (think sed) > to change page dimensions, guide locations and so on. Of course > dimensions need to be expressed in points. This example is 1.3.3.12 > based as I recall so it is readable by both 1.3.3.x and 1.3.5 etc. > > Why is this useful? Well dimensions of a book spine are calculated > based on number of pages and pages per inch plus a factor for the > thickness of the cover itself. Hand calculation can be error prone. > A program which takes in the raw data (pages, pages per inch, page > size etc.) can spit out a template with the correct dimensions and > spine guides, similar to what LSI template maker provides but without > the LSI-specific trimming around the edges. >
Here is a perl program that does a similar thing: (what I've done is strip out the #! /usr/bin/env perl and pasted the rest here. When I have tried to attach perl scripts in the past, they get scrubbed away) **** use XML::Parser; $parser = new XML::Parser( Style => 'Tree' ); my $tree = $parser->parsefile( shift @ARGV ); use Data::Dumper; print Dumper( $tree ); **** This creates an output similar to what you've done. Since it's a perl program, it could be modified to further parse out details. This output is typically many lines long. Greg
