Simon Wistow (deflatermouse) wrote,
Simon Wistow
deflatermouse

A splash of hubris and a slight turd polishing

I finally got round to doing something I've been threatening to do for ages - which is automatically generating my CV in multiple formats from one source.

It actually turned out to be quite easy and I wish I'd done it before. Of course it was helped by the awesome and new PDF::API2::Simple which basically did exactly what I was thinking of doing without me having to do it. for t3h w1N!!1111.

Currently it can output Text, HTML, PDF and Doc (technically RTF with a .doc file extension) which should be enough for anyone.

Over the weekend I abstracted out the stuff that controls look and feel (sort of) so that each someone else can make everything look different by writing an .ini style file. There's a default file contained within the CV::Style module which looks something like

    [title]
    font        = Helvetica
    font-size   = 20
    font-colour = #c0c0c0
    font-weight = bold
    font-style  = italic
    align       = left

or something. That's a slightly contrived example but it borrows heavily from CSS.

There's still some hard coding for the order of things, padding in a couple (RTF, PDF) filters and how urls look and titles. Also, most output filters don't understand font-styles other than italic or font-decoration like underline.

I'm pondering allowing each section to have call backs for transforming the object so that instead of the current system wherby the name of the CV is always prefixed with '::' (because I think it look arty like) and titles always look like '[ title ]' and urls look like '< url >' you'll be able to do

    [name]
    callback = sub { my $name = shift; return ":: $name"; }
    [title]
    callback = sub { my $title = shift; return "[ $title ]"; }
    [url]
    callback = sub { my $url = shift; return "< $url >"; }

or something.

Tags: 1111, arty, call backs, current system, doc file, file extension, font, hard coding, html pdf, ini, italic, look and feel, output filters, padding, rtf pdf, urls
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments