public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/php] private-php86: add help to create mardown version of the NEWS file
@ 2026-11-27  7:27 Remi Collet
  0 siblings, 0 replies; only message in thread
From: Remi Collet @ 2026-11-27  7:27 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/php
Branch : private-php86
Commit : a34b2835e1d355ad3b9b59cf73af6231628aa095
Author : Remi Collet <remi@fedoraproject.org>
Date   : 2016-09-14T09:12:22+02:00
Stats  : +36/-0 in 1 file(s)
URL    : https://src.fedoraproject.org/rpms/php/c/a34b2835e1d355ad3b9b59cf73af6231628aa095?branch=private-php86

Log:
add help to create mardown version of the NEWS file

---
diff --git a/news2markdown.php b/news2markdown.php
new file mode 100755
index 0000000..f14b5fa
--- /dev/null
+++ b/news2markdown.php
@@ -0,0 +1,36 @@
+#!/usr/bin/env php
+<?php
+if ($_SERVER['argc'] < 2) {
+	die("Usage {$_SERVER['argv'][0]} /path/to/NEWS\n");
+}
+
+$text = file_get_contents($_SERVER['argv'][1]);
+if (!$text) {
+	die("Can't read {$_SERVER['argv'][1]}\n");
+}
+
+$text = explode("\n", $text);
+$in=false;
+foreach ($text as $line) {
+	if (preg_match('/(^[0-9][0-9] ... 20[0-9][0-9]) PHP (.*)$/', $line, $reg)) {
+		if ($in) {
+			break;
+		}
+		printf("%s **PHP version %s**", $reg[1], $reg[2]);
+		$in = true;
+		continue;
+	} else if (!$in) {
+		continue;
+	}
+	$line = preg_replace('/(#[0-9])+/', 'php\1', $line);
+	if (empty($line)) {
+		echo "\n\n";
+	} else if (substr($line, 0, 2) == '- ') {
+		echo "**" . substr($line, 2) . "**\n";
+	} else if (substr($line, 0, 4) == '  . ') {
+		echo "\n* " . substr($line, 4);
+	} else {
+		echo " ".trim($line);
+	}
+}
+

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-27  7:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27  7:27 [rpms/php] private-php86: add help to create mardown version of the NEWS file Remi Collet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox