~ubuntu-branches/ubuntu/karmic/zim/karmic

« back to all changes in this revision

Viewing changes to TRepository.PL

  • Committer: Bazaar Package Importer
  • Author(s): Raphael Hertzog
  • Date: 2007-12-01 20:50:34 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20071201205034-bpweecgj7wtt9ze2
Tags: 0.23-1
* New upstream version. Closes: #452999
  * Now handles symlinks properly. Closes: #446870
* Add myself to Uploaders.
* Updated dependencies to match new requirements: libfile-basedir-perl 
  (>= 0.03), libfile-desktopentry-perl (>= 0.04)
* Add Vcs-Svn and Vcs-Browser fields to document the SVN repository now used
  to co-maintain the package.
* Add an Homepage field pointing to the upstream website.
* Moved libmodule-build-perl to Build-Depends-Indep as it's needed for the
  clean target.
* Fix some bad permissions detected by lintian.
* Updated debian/menu file to conform to the new menu policy and added an
  icon.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
 
3
 
use strict;
4
 
use lib './lib';
5
 
use File::Path;
6
 
use Zim::File;
7
 
 
8
 
print "Creating test repository\n";
9
 
 
10
 
$SIG{__WARN__} = sub { print STDERR @_ unless $_[0] =~ /^#/ };
11
 
 
12
 
if (-e 't/repository') {
13
 
        print "Deleting old files\n";
14
 
        File::Path::rmtree('t/repository', 0, 0);
15
 
        die "Couldn't remove 't/repository': $!\n" if -e 't/repository';
16
 
}
17
 
 
18
 
my ($file, $fh);
19
 
binmode DATA, ':utf8' if not $] < 5.008;
20
 
while (<DATA>) {
21
 
        if (/^%%\t(\S+)\t%%$/) {
22
 
                $fh->close if $fh;
23
 
                $file = Zim::File->new($1);
24
 
                $file->make_dir;
25
 
                $fh = $file->open('w');
26
 
        }
27
 
        elsif ($fh) {
28
 
                print $fh $_;
29
 
        }
30
 
        else { die "oops" }
31
 
}
32
 
$fh->close if $fh;
33
 
 
34
 
__DATA__
35
 
%%      t/repository/Test/wiki.txt      %%
36
 
====== Foo Bar ======
37
 
 
38
 
This is a **test page** to see how parsing goes
39
 
when ''we'' ''loop'',
40
 
arbitrary //content// through our __parser__
41
 
 
42
 
($ROOT, $PAGE, @BACK, @FORW, $UNDO, $REDO);
43
 
                my (%tree_iter, $tree_loaded, $pane_visible);
44
 
                my (@undo_chars, $undo_lock, $save_lock, $overwrite_toggle);
45
 
                my %undo_steps = (
46
 
               delete => 'insert', insert => 'delete',
47
 
               apply_tag => 'remove_tag', remove_tag => 'apply_tag' );
48
 
                my $link_icon = Gtk2->CHECK_VERSION(2, 6, 0) ? 'gtk-connect' : 'gtk-convert';
49
 
               # gtk-connect stock item was introduced in 2.6.0
50
 
                my $DATA_DIR  = find_data_dir();
51
 
                my $ICON_FILE = File::Spec->catfile($DATA_DIR, qw/images zim64.png/);
52
 
 
53
 
my %opts = ( 'read_only' => 0 );
54
 
        for (@ARGV) {
55
 
                next unless /^-/;
56
 
                if (/^(--version|-v)$/) {
57
 
                        print version();
58
 
                        exit;
59
 
                }
60
 
                elsif (/^--read-?o
61
 
                     my $iter = $buffer->get_iter_at_mark($buffer->get_insert());
62
 
                        return parse_backspace($iter);
63
 
                }
64
 
                elsif ($val == $k_tab or $val == ord(' ')) { # Other WhiteSpace
65
 
                        my $buffer = $self->get_buffer;
66
 
                        my $iter = $buffer->get_iter_at_mark($buffer->get_insert());
67
 
                        my $string = ($val == $k_tab) ? "\t" : ' ';
68
 
                        return parse_word($iter, $string);
69
 
                }
70
 
                #else { printf "key %x pressed\n", $val } # perldoc -m Gtk2::Gdk::Keysyms
71
 
 
72
 
return 0; } )
73
 
unless $opts{read_only};
74
 
 
75
 
Glib::Timeout->add(5000, \&save_page)
76
 
                unless $opts{read_only}; # TODO also use this timer for maintaining an undo stack
77
 
 
78
 
        # ################# # 
79
 
 
80
 
 
81
 
        some pre format
82
 
        dsfdf
83
 
                        dfssdf
84
 
                        sdfsdf
85
 
 
86
 
        sdf
87
 
        sdf
88
 
                *&^*&%*&
89
 
 
90
 
===== So =====
91
 
what do we need to type
92
 
* to make
93
 
        * the parser
94
 
        * vomit
95
 
                * ???
96
 
 
97
 
OK, maybe a heading
98
 
==== Hmmm ====
99
 
sandwhich might do that ?
100
 
 
101
 
dfsfds
102
 
sdfd
103
 
fdsfdsfdsfds
104
 
 
105
 
 
106
 
{{foo.png}}{{bar.png}}
107
 
 
108
 
{{foo.tex|foo.png}}
109
 
 
110
 
fsdfds
111
 
 
112
 
=== fdsfds ===
113
 
 
114
 
123 test
115
 
 
116
 
sdffdsfds
117
 
%%      t/repository/Test/foo/bar.txt   %%
118
 
= FOO =
119
 
 
120
 
[[wIKi]]
121
 
 
122
 
•• Search Me ••
123
 
 
124
 
%%      t/repository/Test/foo.txt       %%
125
 
====== Foo ======
126
 
 
127
 
bar baz
128