summaryrefslogtreecommitdiffstats
path: root/help-install/fr
diff options
context:
space:
mode:
authorYuri Chornoivan <yurchor@ukr.net>2022-06-01 13:29:26 +0300
committerYuri Chornoivan <yurchor@ukr.net>2022-06-01 13:29:26 +0300
commita5121eec1d301d0d26f11fcc91ace2c08663cfa2 (patch)
treebcd5d814df703c973a783ce267d1f057d510816f /help-install/fr
parentc9382996dd8e92bf379c1e29c41f97cf714ee4a0 (diff)
downloadbootloader-theme-a5121eec1d301d0d26f11fcc91ace2c08663cfa2.tar
bootloader-theme-a5121eec1d301d0d26f11fcc91ace2c08663cfa2.tar.gz
bootloader-theme-a5121eec1d301d0d26f11fcc91ace2c08663cfa2.tar.bz2
bootloader-theme-a5121eec1d301d0d26f11fcc91ace2c08663cfa2.tar.xz
bootloader-theme-a5121eec1d301d0d26f11fcc91ace2c08663cfa2.zip
Update German translation from Tx
Diffstat (limited to 'help-install/fr')
0 files changed, 0 insertions, 0 deletions
3 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
package printer::common;

use strict;
use vars qw(@ISA @EXPORT);

@ISA = qw(Exporter);
@EXPORT = qw(addentry addsection removeentry  removesection);


sub addentry {
    my ($section, $entry, $filecontent) = @_;
    my $sectionfound = 0;
    my $entryinserted = 0;
    my @lines = split("\n", $filecontent);
    foreach (@lines) {
	if (!$sectionfound) {
	    $sectionfound = 1 if /^\s*\[\s*$section\s*\]\s*$/;
	} else {
	    if (!/^\s*$/ && !/^\s*;/) { #-#
		$_ = "$entry\n$_";
		$entryinserted = 1;
		last;
	    }
	}
    }
    push(@lines, $entry) if $sectionfound && !$entryinserted;
    return join "\n", @lines;
}

sub addsection {
    my ($section, $filecontent) = @_;
    my @lines = split("\n", $filecontent);
    foreach (@lines) {
     # section already there, nothing to be done
     return $filecontent if /^\s*\[\s*$section\s*\]\s*$/;
    }
    return $filecontent . "\n[$section]";
}

sub removeentry {
    my ($section, $entry, $filecontent) = @_;
    my $sectionfound = 0;
    my $done = 0;
    my @lines = split("\n", $filecontent);
    foreach (@lines) {
	$_ = "$_\n";
	next if $done;
	if (!$sectionfound) {
	    $sectionfound = 1 if /^\s*\[\s*$section\s*\]\s*$/;
	} else {
	    if (/^\s*\[.*\]\s*$/) { # Next section
		$done = 1;
	    } elsif (/^\s*$entry/) {
		$_ = "";
		$done = 1;
	    }
	}
    }
    return join "", @lines;
}

sub removesection {
    my ($section, $filecontent) = @_;
    my $sectionfound = 0;
    my $done = 0;
    my @lines = split("\n", $filecontent);
    foreach (@lines) {
	$_ = "$_\n";
	next if $done;
	if (!$sectionfound) {
	    if (/^\s*\[\s*$section\s*\]\s*$/) {
		$_ = "";
		$sectionfound = 1;
	    }
	} else {
	    if (/^\s*\[.*\]\s*$/) { # Next section
		$done = 1;
	    } else {
		$_ = "";
	    }
	}
    }
    return join "", @lines;
}

1;