Fix für neue HTML-Struktur für FuturamaHitAndRunBridge
This commit is contained in:
@@ -23,17 +23,19 @@ class FuturamaHitAndRunBridge extends BridgeAbstract {
|
|||||||
$versionText = trim($versionHeader->find('div.text', 0)->plaintext ?? '');
|
$versionText = trim($versionHeader->find('div.text', 0)->plaintext ?? '');
|
||||||
if (empty($versionText)) continue;
|
if (empty($versionText)) continue;
|
||||||
|
|
||||||
// Skip branch names - only process actual version numbers (e.g., 0.1.0, 1.2.3)
|
// Skip branch names - only process actual version numbers (e.g., Version 0.1.0, Version 1.2.3)
|
||||||
// Version numbers typically contain dots or start with numbers
|
if (!preg_match('/^Version\s+\d+\./', $versionText)) continue;
|
||||||
if (!preg_match('/^\d+\./', $versionText)) continue;
|
|
||||||
|
// Remove "Version " prefix to get clean version number
|
||||||
|
$versionNumber = preg_replace('/^Version\s+/', '', $versionText);
|
||||||
|
|
||||||
// Get the parent block containing all version information
|
// Get the parent block containing all version information
|
||||||
$versionBlock = $versionHeader->parent();
|
$versionBlock = $versionHeader->parent();
|
||||||
if (!$versionBlock) continue;
|
if (!$versionBlock) continue;
|
||||||
|
|
||||||
$item = [];
|
$item = [];
|
||||||
$item['title'] = 'Futurama: Hit & Run - Version ' . $versionText;
|
$item['title'] = 'Futurama: Hit & Run - Version ' . $versionNumber;
|
||||||
$item['uid'] = 'futurama-har-' . $versionText;
|
$item['uid'] = 'futurama-har-' . $versionNumber;
|
||||||
|
|
||||||
// Find version ID from badges
|
// Find version ID from badges
|
||||||
$badges = $versionBlock->find('div.component-badge');
|
$badges = $versionBlock->find('div.component-badge');
|
||||||
@@ -73,28 +75,20 @@ class FuturamaHitAndRunBridge extends BridgeAbstract {
|
|||||||
$content .= '<img src="https://nyc3.digitaloceanspaces.com/donut-team/files/2025/10/18/19-46-32/399a6671-8cf9-4aa0-b3d5-6cd8656f8a09/banner.webp" alt="Futurama: Hit & Run Banner" style="max-width: 100%;">';
|
$content .= '<img src="https://nyc3.digitaloceanspaces.com/donut-team/files/2025/10/18/19-46-32/399a6671-8cf9-4aa0-b3d5-6cd8656f8a09/banner.webp" alt="Futurama: Hit & Run Banner" style="max-width: 100%;">';
|
||||||
$content .= '</div><br>';
|
$content .= '</div><br>';
|
||||||
|
|
||||||
$content .= '<h2>Version ' . htmlspecialchars($versionText) . '</h2>';
|
|
||||||
|
|
||||||
// Add changelog if available
|
// Add changelog if available
|
||||||
$changelogDetails = $versionBlock->find('details.component-details', 0);
|
$changelogDetails = $versionBlock->find('details.component-details', 0);
|
||||||
if ($changelogDetails) {
|
if ($changelogDetails) {
|
||||||
$changelogContent = $changelogDetails->find('p.component-paragraph', 0);
|
// Get the entire changelog content (includes h2, h3, ul, p elements)
|
||||||
if ($changelogContent) {
|
$changelogHTML = $changelogDetails->innertext;
|
||||||
$content .= '<h3>Changelog:</h3>';
|
// Remove the <summary> tag from the output
|
||||||
$content .= '<p>' . $changelogContent->innertext . '</p>';
|
$changelogHTML = preg_replace('/<summary>.*?<\/summary>/is', '', $changelogHTML);
|
||||||
|
// Remove redundant version header from changelog (e.g., <h2>Version 0.1.2</h2>)
|
||||||
|
$changelogHTML = preg_replace('/<h2[^>]*>Version\s+' . preg_quote($versionNumber, '/') . '<\/h2>/is', '', $changelogHTML);
|
||||||
|
if (!empty(trim(strip_tags($changelogHTML)))) {
|
||||||
|
$content .= $changelogHTML;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add download button
|
|
||||||
if ($downloadLink) {
|
|
||||||
$content .= '<br><p><strong><a href="' . htmlspecialchars($downloadLink) . '">Download Version ' . htmlspecialchars($versionText) . '</a></strong></p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add project info
|
|
||||||
$content .= '<br><hr>';
|
|
||||||
$content .= '<p><em>Futurama: Hit & Run is a total conversion mod for The Simpsons: Hit & Run aiming to replicate the gameplay of Hit & Run in the world of Futurama.</em></p>';
|
|
||||||
$content .= '<p><strong>Developer:</strong> Slurm Team</p>';
|
|
||||||
|
|
||||||
$item['content'] = $content;
|
$item['content'] = $content;
|
||||||
$item['author'] = 'Slurm Team';
|
$item['author'] = 'Slurm Team';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user