X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=pve-docs-mediawiki-import.in;h=14dffa09d9e7556f1c13c72145f303f7497b308f;hb=a550860d7283366ad52513a4c0435cb90376cdfe;hp=851cbf9bdc6f031cafc7d7412e8ecbfc44fcf9d5;hpb=3f4666b4563dcaad47ecb29cd247746502d4c6aa;p=pve-docs.git diff --git a/pve-docs-mediawiki-import.in b/pve-docs-mediawiki-import.in index 851cbf9..14dffa0 100755 --- a/pve-docs-mediawiki-import.in +++ b/pve-docs-mediawiki-import.in @@ -21,7 +21,7 @@ my $config_fn = "/root/.pve-docs"; # format 'username:pw' my $fh = IO::File->new("$config_fn") || die "Please configure the mediawiki user/passswd in '$config_fn'\n"; -my $api_url = "http://localhost/mediawiki/api.php"; +my $api_url = "https://pve.proxmox.com/mediawiki/api.php"; my $config = <$fh>; chomp $config; @@ -55,9 +55,10 @@ sub update_page { my $parser_opts = { api_version => 3, - text_h => [ sub { $pve_content .= shift }, "dtext" ], + text_h => [ sub { $pve_content .= shift }, "text" ], }; my $parser = HTML::Parser->new(%$parser_opts); + $parser->ignore_elements(qw(script style)); my $fh = IO::File->new("/usr/share/pve-docs/$filename", "r") or die "unable to open file '$filename' - $!\n"; @@ -70,10 +71,8 @@ sub update_page { chomp $pve_content; - if ($page =~ m/^(.*)$starttag\n.*\n$endtag(.*)$/s) { + if ($page =~ m/^(.*)$starttag\n.*\n$endtag\n?(.*)$/s) { my ($top_content, $bottom_content) = ($1, $2); - chomp $top_content; - chomp $bottom_content; $page = $top_content; $page .= "$starttag\n"; $page .= $pve_content;