Compare commits

...

12 Commits
2.0 ... 2.0.1

Author SHA1 Message Date
Alex Schroeder
fdde88c98f Provide a default class for the RecentChanges form
The XHTML is invalid because the tag ends with ... class> -- this is
caused by an assignment without value. Fix: Provide a class attribute
to the form in RcHtml. Provide a default class attribute to the form
in GetFormStart.
2012-05-21 17:32:36 +02:00
Alex Schroeder
f6c18b2ccd no borders for a img 2012-05-21 11:43:53 +02:00
Alex Schroeder
a7d9995db9 Google +1 link without border 2012-05-20 01:43:48 +02:00
Alex Schroeder
8d39c095ff Google +1 button uses id, not class 2012-05-18 10:32:05 +02:00
Alex Schroeder
cdecbef49a Merge branch 'master' of git.sv.gnu.org:/srv/git/oddmuse 2012-05-18 10:29:25 +02:00
Alex Schroeder
8fa4eed63d Google +1 button style 2012-05-18 10:27:28 +02:00
Alex Schroeder
41ef3cb386 added imap2wiki script 2012-05-17 02:25:19 +02:00
Alex Schroeder
c11a196f8f Ignore #bla# files created by Emacs and test-data directory 2012-04-27 01:10:27 +02:00
Alex Schroeder
de4ef6451f Merge branch 'master' of git.sv.gnu.org:/srv/git/oddmuse 2012-04-27 01:09:54 +02:00
Alex Schroeder
8ed24a11f8 Remove unused local variables
in GetPageFile, InitLinkPatterns
2012-04-27 00:45:23 +02:00
Alex Schroeder
f73c8f66ce beige.css with changes from campaignwiki.org
Mostly the introduction of more classes such as
.aside and other classes to be used in divs.

I also added a .gitignore file for the Emacs backup
files and the current.pl that is created by the
Makefile.
2012-04-25 04:19:46 -04:00
Alex Schroeder
348f4bcf3b rule to create current.pl from wiki.pl
The file current.pl is the same as wiki.pl but it's
$WikiDescription now contains the git description --tags
output and links to the appropriate entry in
http://git.savannah.gnu.org/cgit/oddmuse.git/refs/
2012-04-24 00:49:27 +02:00
8 changed files with 244 additions and 8137 deletions

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
*~
/current.pl
\#*\#
/test-data

8126
ChangeLog

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
# The Makefile is only for developpers wanting to prepare the tarball.
# Make sure the CVS keywords for the sed command on the next line are not expanded.
VERSION_NO=$(shell sed -n -e 's/^.*\$$Id: wiki\.pl,v \(1\.[0-9]*\).*$$/\1/p' wiki.pl | head -n 1)
VERSION_NO=$(shell git describe --tags)
VERSION=oddmuse-$(VERSION_NO)
UPLOADVERSION=oddmuse-inkscape-$(shell sed -n -e 's/^.*\$$Id: wikiupload,v \([0-9.]*\).*$$/\1/p' wikiupload)
UPLOADVERSION=oddmuse-inkscape-$(VERSION_NO)
TRANSLATIONS=$(wildcard modules/translations/[a-z]*-utf8.pl$)
MODULES=$(wildcard modules/*.pl)
INKSCAPE=GPL $(wildcard inkscape/*.py inkscape/*.inx inkscape/*.sh)
@@ -21,6 +21,9 @@ OLDDIST=$(VERSION).dmg $(VERSION).dmg.sig \
dist: $(DIST)
current.pl: wiki.pl
sed "s/\\\$$q->a({-href=>'http:\/\/www.oddmuse.org\/'}, 'Oddmuse')/\\\$$q->a({-href=>'http:\/\/git.savannah.gnu.org\/cgit\/oddmuse.git\/tag\/?id=$(VERSION_NO)'}, 'wiki.pl') . ', see ' . &/" < $< > $@
upload: $(DIST)
for f in $^; do \
scp $$f as@dl.sv.nongnu.org:/releases/oddmuse/; \
@@ -32,7 +35,7 @@ upload-text: new-utf8.pl
contrib/simple-install/$(VERSION)-simple.tar.gz:
cd contrib/simple-install && make $(VERSION)-simple.tar.gz
$(VERSION).tar.gz: README FDL GPL ChangeLog wiki.pl $(TRANSLATIONS) $(MODULES)
$(VERSION).tar.gz: README FDL GPL ChangeLog wiki.pl $(TRANSLATIONS) $(MODULES) current.pl
rm -rf $(VERSION)
mkdir $(VERSION)
cp $^ $(VERSION)

View File

@@ -83,6 +83,10 @@ span.bar a {
margin-right: 1ex;
}
a img {
border: none;
}
/* search box in the top bar */
form.tiny, form.tiny p {

View File

@@ -16,6 +16,23 @@ body {
font-size:12pt;
}
}
/* iPhone */
@media only screen and (max-device-width: 480px) {
body { font-size: 200%; }
}
/* iPad */
@media only screen and (min-device-width: 481px) and (max-device-width: 900px) {
body { font-size: 150%; }
textarea,input { font-size: 100%; }
img { max-width: 550px !important; }
}
div.browse {
min-height: 3em;
}
@@ -41,6 +58,14 @@ div.commentshown {
}
div.commenthidden { display:none; }
div.commentshown { display:block; }
/* comment pages with username, homepage, and email subscription */
.comment span { display: block; }
.comment span label {
display: inline-block; width: 10em;
}
input#mail, input#homepage, input#username {
display: inline-block; width: 20em;
}
h1 {
font-weight: bold;
@@ -63,9 +88,10 @@ h2 {
font-weight: bold;
color: white;
background-color: #000;
width: 98%;
/* width: 98%; */
font-size: 110%;
padding: 0.2em;
clear: both;
}
a:link {
font-weight: bold;
@@ -89,21 +115,47 @@ div.image { display: inline; margin: 1em; font-size: 90%; text-align: center; }
.right { float: right; margin-left: 1em; }
div.right .right { float: none; }
div.left .left { float: none; }
.caption { padding: 0 1em; }
.license { font-size: small; }
.aside {
font-size: small;
width: 30%;
float: right;
margin-left: 1em;
margin-bottom: 1em;
padding-left: 1em;
}
.aside img.smiley { height: 1em; }
.narrow {
width: 70%;
}
a img { border: 1px solid #333; }
.fit img { width: 80%; text-align: center; margin: 2em 8%; }
.half img { width: 50%; height: 50%; text-align: center; margin: 2em 8%; }
.noborder img { border: none; }
.twenty img { max-width: 20em; }
em.underline { font-weight: bold; }
.bar a { padding-right: 1em; }
textarea { width:100%; }
div.edit { padding-right: 1em; }
img.logo { float: right; clear: right; border-style:none; }
img.logo {
float: right;
clear: right;
border-style:none;
margin-left: 1em;
margin-bottom: 1ex;
border: 1px solid black;
}
div.diff { padding-left:5%; padding-right:5%; }
div.old { background-color:#FFFFAF; }
div.new { background-color:#CFFFCF; }
div.message { background-color:#FEE; }
/* div.message { background-color:#FEE; } */
div.message {
background-color: inherit;
font-size: smaller;
}
table.history { border-style:none; }
td.history { border-style:none; }
span.result { font-size:larger; }
@@ -132,6 +184,10 @@ table.user {
border-top: 1px solid black;
border-bottom: 1px solid black;
}
div.aside table.user {
margin: 1em 0;
padding: 0;
}
table.user td, table.user th {
border-style: none;
padding:5px 10px;
@@ -153,6 +209,12 @@ table.user td.mark { background-color:yellow; }
}
}
/* Help */
.edit table {
font-size: small;
}
/* Calendar */
div.month { margin:0; padding:0; font-size:x-small; float:right; }
div.content div.month { float:none; }
@@ -164,7 +226,7 @@ div.month span.title a { font: inherit; }
div.month a.local { font-weight: bold; }
div.month a.local:link { color: #562; }
div.month a.local:visited { color: #542; }
div.month a.today { font-weight: bold; color: #fff; }
div.month a.today { background-color: #faa; }
div.month span.title a.local { font-weight: normal; color: #842; }
@media print {
div.month { display: none; }

View File

@@ -38,6 +38,13 @@ li img, img.smiley, .noborder img {
background:#fff;
color:#000;
}
/* Google +1 */
a#plus1 img {
background-color: #fff;
padding: 0;
margin: 0;
border: none;
}
div.header img, div.footer img { border:0; padding:0; margin:0; }

152
imap2wiki Executable file
View File

@@ -0,0 +1,152 @@
#!/usr/bin/perl -w
#
# Copyright (C) 2012 Alex Schroeder <alex@gnu.org>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
use strict;
use Getopt::Std;
use LWP::UserAgent;
use Net::IMAP::Simple;
use Email::Simple;
use Email::MIME;
use IO::Socket::SSL; # fail unless this is available
my $usage = "Usage:\n"
. " imap2wiki TARGET SERVER PORT FROM TO MAIL_USER MAIL_PASSWORD \\\n"
. " MAIL_USER MAIL_PASSWORD WIKI_USER [WIKI_PASSWORD]\n\n"
. "TARGET is the base URL for the wiki.\n"
. "SERVER is the IMAP server you are checking.\n"
. "PORT is the port you are using.\n"
. " (We assume that you must use SSL.)\n"
. "FROM is sender you are looking for.\n"
. "TO is recipient you are looking for.\n"
. "MAIL_USER is the username to connect to the mail server.\n"
. "MAIL_PASSWORD is the password to use for the mail server.\n"
. "WIKI_USER is the username to use for the edit.\n"
. "WIKI_PASSWORD is the password to use if required.\n"
. "Example:\n"
. " imap2wiki http://www.emacswiki.org/cgi-bin/test imap.gmail.com 993 \\\n"
. " kensanata\@gmail.com kensanata+post\@gmail.com \\\n"
. " kensanata\@gmail.com '*secret*' \\\n"
. " Alex test\n\n";
sub UrlEncode {
my $str = shift;
return '' unless $str;
my @letters = split(//, $str);
my @safe = ('a' .. 'z', 'A' .. 'Z', '0' .. '9', '-', '_', '.', '!',
'~', '*', "'", '(', ')', '#');
foreach my $letter (@letters) {
my $pattern = quotemeta($letter);
if (not grep(/$pattern/, @safe)) {
$letter = sprintf("%%%02x", ord($letter));
}
}
return join('', @letters);
}
sub GetRaw {
my ($uri) = @_;
my $ua = LWP::UserAgent->new;
my $response = $ua->get($uri);
return $response->content if $response->is_success;
}
sub PostRaw {
my ($uri, $id, $data, $user, $pwd) = @_;
my $ua = LWP::UserAgent->new;
my $summary;
if ($data =~ /^#FILE (\S+) ?(\S+)?\n/) {
$summary = 'file upload';
}
my $response = $ua->post($uri, {title=>$id, text=>$data, raw=>1,
summary=>$summary,
username=>$user, pwd=>$pwd});
warn "POST $id failed: " . $response->status_line . "\n"
unless $response->is_success;
return $response->is_success;
}
sub post {
my ($target, $page, $data, $user, $pwd) = @_;
$page =~ s/ /_/g;
$page = UrlEncode ($page);
return PostRaw($target, $page, $data, $user, $pwd);
}
sub main {
my ($target, $server, $port, $from, $to,
$mail_user, $mail_pwd, $wiki_user, $wiki_pwd) = @ARGV;
# all parameters except the wiki password are mandatory
for my $arg ($target, $server, $port, $from, $to,
$mail_user, $mail_pwd, $wiki_user) {
die $usage unless $arg;
}
my $imap = Net::IMAP::Simple->new($server, port=>$port, use_ssl=>1 )
or die "Unable to connect to IMAP: $Net::IMAP::Simple::errstr\n";
if (not $imap->login($mail_user, $mail_pwd)) {
print STDERR "Login failed: " . $imap->errstr . "\n";
exit(64);
}
my %result;
my $rfrom = quotemeta($from);
my $rto = quotemeta($to);
# go through the inbox and look for appropriate mails
my $num = $imap->select('INBOX');
for (my $i = 1; $i <= $num; $i++) {
# looking at headers only
my $email = Email::Simple->new(join '', @{ $imap->top($i) } );
if ($email->header("From") =~ /$rfrom/io
and $email->header("To") =~ /$rto/io) {
my $subject = $email->header('Subject');
my $n = 1;
# fetch the body and parse the MIME stuff
$email = Email::MIME->new(join '', @{ $imap->get($i) } );
$email->walk_parts(sub {
my ($part) = @_;
return if $part->subparts; # multipart
my ($pagename, $data);
warn $part->content_type;
if ($part->content_type =~ m[text/plain]i) {
($pagename, $data) = ($subject, $part->body);
} elsif ($part->content_type =~ m!(image/[a-z]+)!i) {
($pagename, $data) = ($subject . " " . $n++,
"#FILE " . $1 . "\n" . $part->body_raw);
}
if ($pagename and $data) {
warn "Posting $pagename\n";
post($target, $pagename, $data, $wiki_user, $wiki_pwd)
|| die "Posting aborted, INBOX not expunged\n";
}
} );
# mark as deleted
$imap->delete($i);
}
}
# expunge messages that are marked for deletion
$imap->quit;
}
main();

View File

@@ -381,7 +381,7 @@ sub SetParam {
}
sub InitLinkPatterns {
my ($UpperLetter, $LowerLetter, $AnyLetter, $WikiWord, $QDelim);
my ($WikiWord, $QDelim);
$QDelim = '(?:"")?'; # Optional quote delimiter (removed from the output)
$WikiWord = '[A-Z]+[a-z\x80-\xff]+[A-Z][A-Za-z\x80-\xff]*';
$LinkPattern = "($WikiWord)$QDelim";
@@ -1815,7 +1815,7 @@ sub RcHtml {
$more .= ";$_=$val" if $val;
}
$html .= $q->p({-class=>'more'}, ScriptLink($more, T('More...'), 'more'));
return GetFormStart() . $html . $q->endform;
return GetFormStart(undef, 'get', 'rc') . $html . $q->endform;
}
sub PrintRcHtml { # to append RC to existing page, or action=rc directly
@@ -2452,7 +2452,8 @@ sub GetCommentForm {
sub GetFormStart {
my ($ignore, $method, $class) = @_;
$method ||= 'post';
return $q->start_multipart_form(-method=>$method, -action=>$FullUrl, -class=>$class);
return $q->start_multipart_form(-method=>$method, -action=>$FullUrl,
-class=>$class||'form');
}
sub GetSearchForm {
@@ -2717,7 +2718,7 @@ sub GetKeptRevision { # Call after OpenPage
}
sub GetPageFile {
my ($id, $revision) = @_;
my ($id) = @_;
return $PageDir . '/' . GetPageDirectory($id) . "/$id.pg";
}