Browse Source

No empty lines in svg

merge-requests/1/head
JamesRezo 4 years ago
parent
commit
84736595d3
  1. 6
      lang/supportedversions_fr.php
  2. 32
      modeles/legend.html
  3. 160
      modeles/supported-versions.html
  4. 14
      modeles/table.html
  5. 40
      supportedversions_fonctions.php

6
lang/supportedversions_fr.php

@ -8,13 +8,15 @@ $GLOBALS[$GLOBALS['idx_lang']] = [
et des mises à jour régulières sont effectuées.',
'active_support_until' => 'Prise en charge jusqu\'au',
'security_fix' => 'Correctifs de sécurité seulement',
'security_fix_definition' => 'Une version prise en charge uniquement pour les problèmes de sécurité critiques.
'security_fix_definition' => 'Une version prise en charge uniquement pour les problèmes
de sécurité critiques.
Les publications ne sont effectuées qu\'au besoin.',
'security_support_until' => 'Faille de sécurité jusqu\'au',
'end_of_life' => 'Fin de vie',
'end_of_life_definition' => 'Une version qui n\'est plus prise en charge.
Les utilisateurs de cette version doivent mettre à jour dès que possible,
car ils peuvent être exposés à des vulnérabilités de sécurité non corrigées.',
car ils peuvent être exposés à des vulnérabilités de sécurité
non corrigées.',
'initial_release' => 'Première publication',
'unreleased' => 'Non publiée',
'unreleased_definition' => 'Une version qui n\'a pas encore été publiée.',

32
modeles/legend.html

@ -1,18 +1,18 @@
<table class="spip standard">
<tr class="future">
<td><:supportedversions:unreleased:></td>
<td><:supportedversions:unreleased_definition:></td>
</tr>
<tr class="stable">
<td><:supportedversions:active_support:></td>
<td><:supportedversions:active_support_definition:></td>
</tr>
<tr class="security">
<td><:supportedversions:security_fix:></td>
<td><:supportedversions:security_fix_definition:></td>
</tr>
<tr class="eol">
<td><:supportedversions:end_of_life:></td>
<td><:supportedversions:end_of_life_definition:></td>
</tr>
<tr class="future">
<td><:supportedversions:unreleased:></td>
<td><:supportedversions:unreleased_definition:></td>
</tr>
<tr class="stable">
<td><:supportedversions:active_support:></td>
<td><:supportedversions:active_support_definition:></td>
</tr>
<tr class="security">
<td><:supportedversions:security_fix:></td>
<td><:supportedversions:security_fix_definition:></td>
</tr>
<tr class="eol">
<td><:supportedversions:end_of_life:></td>
<td><:supportedversions:end_of_life_definition:></td>
</tr>
</table>

160
modeles/supported-versions.html

@ -3,98 +3,122 @@
width="[(#SVG{margin_left}|width)]"
height="[(#SVG{header_height}|height)]"
>
<style type="text/css">
<![CDATA[
text {
fill: #333;
[font-size: (#SVG{header_height}|mult{2}|div{3})px;]
}
<style type="text/css">
<![CDATA[
text {
fill: #333;
[font-size: (#SVG{header_height}|mult{2}|div{3})px;]
}
g.eol rect,
.branches rect.eol {
fill: #e29ea2;
}
g.eol rect,
.branches rect.eol {
fill: #e29ea2;
}
g.eol text {
fill: white;
}
g.eol text {
fill: white;
}
g.security rect,
.branches rect.security {
fill: #fceaae;
}
g.security rect,
.branches rect.security {
fill: #fceaae;
}
g.stable rect,
.branches rect.stable {
fill: #c3e2c5;
}
g.stable rect,
.branches rect.stable {
fill: #c3e2c5;
}
g.future rect,
.branches rect.future {
fill: #edcbdc;
}
g.future rect,
.branches rect.future {
fill: #edcbdc;
}
.branch-labels text {
dominant-baseline: central;
text-anchor: middle;
}
.branch-labels text {
dominant-baseline: central;
text-anchor: middle;
}
.today line {
stroke: #f33;
stroke-dasharray: 7,7;
stroke-width: 3px;
}
.today line {
stroke: #f33;
stroke-dasharray: 7,7;
stroke-width: 3px;
}
.today text {
fill: #f33;
text-anchor: middle;
}
.today text {
fill: #f33;
text-anchor: middle;
}
.years line {
stroke: black;
}
.years line {
stroke: black;
}
.years text {
text-anchor: middle;
}
]]>
</style>
.years text {
text-anchor: middle;
}
]]>
</style>
<!-- Branch labels -->
<g class="branch-labels">
<BOUCLE_active_branches(DATA){source json, #CHEMIN{data/releases.json}}>[(#EOL|>={#DATE}|ou{#EOL|intval|non})
<BOUCLE_active_branches(DATA){source table, #NULL|branches_to_show}>
<g[ class="(#VALEUR|state)"]>
<rect x="0" y="[(#BRANCH|top)]" width="[(#SVG{margin_left}|mult{0.5})]" height="#SVG{branch_height}" />
<text x="[(#SVG{margin_left}|mult{0.25})]" y="[(#BRANCH|top|top_for_text)]">
#BRANCH
</text>
</g>]
</g>
</BOUCLE_active_branches>
</g>
<!-- Branch blocks -->
<g class="branches">
<BOUCLE_active_branches_2(DATA){source json, #CHEMIN{data/releases.json}}>[(#EOL|>={#DATE}|ou{#EOL|intval|non})
<rect class="stable" x="[(#INITIAL_RELEASE|horiz_coord)]" y="[(#BRANCH|top)]" width="[(#ACTIVE_SUPPORT|horiz_coord|strmoins{#INITIAL_RELEASE|horiz_coord})]" height="#SVG{branch_height}" />
<rect class="security" x="[(#ACTIVE_SUPPORT|horiz_coord)]" y="[(#BRANCH|top)]" width="[(#EOL|horiz_coord|strmoins{#ACTIVE_SUPPORT|horiz_coord})]" height="#SVG{branch_height}" />]
</BOUCLE_active_branches_2>
</g>
<!-- Branch blocks -->
<g class="branches">
<BOUCLE_active_branches_2(DATA){source table, #NULL|branches_to_show}>
<rect
class="stable"
x="[(#INITIAL_RELEASE|horiz_coord)]"
y="[(#BRANCH|top)]"
width="[(#ACTIVE_SUPPORT|horiz_coord|strmoins{#INITIAL_RELEASE|horiz_coord})]"
height="#SVG{branch_height}"
/>
<rect
class="security"
x="[(#ACTIVE_SUPPORT|horiz_coord)]"
y="[(#BRANCH|top)]"
width="[(#EOL|horiz_coord|strmoins{#ACTIVE_SUPPORT|horiz_coord})]"
height="#SVG{branch_height}"
/>
</BOUCLE_active_branches_2>
</g>
<!-- Year lines -->
<g class="years">
<BOUCLE_years(DATA){source table, #NULL|years}>
<line x1="[(#VALEUR|horiz_coord)]" y1="#SVG{header_height}" x2="[(#VALEUR|horiz_coord)]" y2="[(#SVG{header_height}|height)]" />
<text x="[(#VALEUR|horiz_coord)]" y="[(#SVG{header_height}|mult{0.8})]">
[(#VALEUR|affdate{M Y})]
</text>
</BOUCLE_years>
</g>
<!-- Year lines -->
<g class="years">
<BOUCLE_years(DATA){source table, #NULL|years}>
<line
x1="[(#VALEUR|horiz_coord)]"
y1="#SVG{header_height}"
x2="[(#VALEUR|horiz_coord)]"
y2="[(#SVG{header_height}|height|strmoins{#SVG{footer_height}})]"
/>
<text x="[(#VALEUR|horiz_coord)]" y="[(#SVG{header_height}|mult{0.8})]">[
(#VALEUR|affdate{M Y})
]</text>
</BOUCLE_years>
</g>
<!-- Today -->
<g class="today">
<line x1="[(#DATE|affdate{Y-m-d}|horiz_coord)]" y1="#SVG{header}" x2="[(#DATE|affdate{Y-m-d}|horiz_coord)]" y2="[(#SVG{header_height}|height)]" />
<text x="[(#DATE|affdate{Y-m-d}|horiz_coord)]" y="[(#SVG{header_height}|height|strplus{#SVG{footer_height}|mult{0.8}})]">
[<:info_aujourdhui:> (#DATE|affdate)]
</text>
<line
x1="[(#DATE|affdate{Y-m-d}|horiz_coord)]"
y1="#SVG{header_height}"
x2="[(#DATE|affdate{Y-m-d}|horiz_coord)]"
y2="[(#SVG{header_height}|height|strmoins{#SVG{footer_height}})]"
/>
<text
x="[(#DATE|affdate{Y-m-d}|horiz_coord)]"
y="[(#SVG{header_height}|height)]">[
<:info_aujourdhui:> (#DATE|affdate)
]</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

14
modeles/table.html

@ -2,22 +2,22 @@
<table class="spip standard">
<thead>
<tr>
<th><:supportedversions:branch:></th>
<th><:supportedversions:php_compatibility:></th>
<th><:supportedversions:initial_release:></th>
<th><:supportedversions:active_support_until:></th>
<th><:supportedversions:security_support_until:></th>
<th><:supportedversions:branch:></th>
<th><:supportedversions:php_compatibility:></th>
<th><:supportedversions:initial_release:></th>
<th><:supportedversions:active_support_until:></th>
<th><:supportedversions:security_support_until:></th>
</tr>
</thead>
<tbody>
<BOUCLE_active_branches(DATA){source json, #CHEMIN{data/releases.json}}>[(#EOL|>={#DATE}|ou{#EOL|intval|non})
<BOUCLE_active_branches(DATA){source table, #NULL|branches_to_show}>
<tr[ class="(#VALEUR|state)"]>
<td>#BRANCH</td>
<td>[(#PHP|join{', '})]</td>
<td>[(#INITIAL_RELEASE|affdate)]</td>
<td>[(#ACTIVE_SUPPORT|affdate)]</td>
<td>[(#EOL|affdate)]</td>
</tr>]
</tr>
</BOUCLE_active_branches>
</tbody>
</table>

40
supportedversions_fonctions.php

@ -82,25 +82,41 @@ function years() {
return $years;
}
function branches() {
static $branches = [];
function releases() {
static $releases = [];
if (empty($branches)) {
$branches = array_map(
function ($branch) {
return $branch['branch'];
},
json_decode(file_get_contents(find_in_path('data/releases.json')), true)
);
if (empty($releases)) {
$releases = json_decode(file_get_contents(find_in_path('data/releases.json')), true);
}
return $branches;
return $releases;
}
function branches_to_show() {
$now = date('Y-m-d');
return array_reduce(
releases(),
function ($branches, $release) use ($now) {
if ($release['eol'] == '' || $release['eol'] > $now) {
$branches[] = $release;
}
return $branches;
},
[]
);
}
function top($branch) {
global $svg;
$i = array_search($branch, branches(), true);
$branches = array_map(
function ($branch) {
return $branch['branch'];
},
branches_to_show()
);
$i = array_search($branch, $branches, true);
return $svg['header_height'] + ($svg['branch_height'] * $i++);
}
@ -122,5 +138,5 @@ function width($margin_left) {
function height($header_height) {
global $svg;
return $header_height + $svg['footer_height'] + (count(branches()) * $svg['branch_height']);
return $header_height + $svg['footer_height'] + (count(branches_to_show()) * $svg['branch_height']);
}

Loading…
Cancel
Save