Skip to content
Snippets Groups Projects
Select Git revision
  • ea5a453042b6e15cf333c520f7763cfc294eccff
  • master default protected
  • dev
  • gh-pages
4 results

identifier.md

Blame
  • Simple.pm 14.41 KiB
    #!/usr/bin/perl
    
    package Tomboy::Note::Simple;
    
    =head1 NAME
    
      Tomboy::Note::Simple
    
    =head1 SYNOPSIS
    
      my $note= new Tomboy::Note::Simple (options => values);
    
    =head2 parsing
    
      # version 1
      my $n1= parse Tomboy::Note::Simple ($note_fnm);
    
      # version 2
      my $n2= new Tomboy::Note::Simple; $n->parse ($note_fnm);
    
    =head1 DESCRIPTION
    
    Simple abstraction for notes written with Gnome's Tomboy.
    
    The script uses XML::Parser in Tree style and uses it's parse
    tree as the note's content datastructure (stored in "text").
    
    =head1 NOTES
    
    This module consists of originally two different ones, they are not
    completely consistent.  The difference is how the content is stored.
    
    In a .note file, contents looks like this:
    
     <text xml:space="preserve"><note-content version="0.1">title line
     content line2
     ...
     last content last</note-content></text>
    
     * Parser: based on XML::Parser, stores contents in
       @nc= @{$note->{'text'}->[2]} which represents the the <note-content>
       element, the first text-part starts at $nc[2]
    
     * Generator: contents (the stuff *in* the "note-content" element)
       is put into "lines" the first line, however, is stored in 'title'.
    
    That should be further unified.
    
    =cut
    
    use strict;
    
    use XML::Parser;
    use JSON;
    use Data::Dumper;
    $Data::Dumper::Indent= 1;
    
    use Tomboy;
    use Util::XML_Parser_Tree;
    
    my $VERSION= 0.004;
    
    my %fields=
    (
      'title' => {},
      'last-change-date' => {},
      'last-metadata-change-date' => {},
      'create-date' => {},
      'cursor-position'          => { 'default' => 0 },
      'selection-bound-position' => { 'default' => -1, 'supress' => 1 },