(PR#10284) [Request]Docs: distribute FAQ into freeciv/docs/

"Egor Vyscrebentsov" <[email protected]> Mon, 24 Oct 2005 00:31:25 -0700
Newsgroups gmane.games.freeciv.devel,gmane.games.freeciv.data
Message-ID <[email protected]>
This is a multi-part message in MIME format...

------------=_1130139084-19607-2
Content-Type: text/plain; charset="utf-8"


<URL: http://bugs.freeciv.org/Ticket/Display.html?id=10284 >

> [evyscr - Sep 23 20:12:58 2004]:
> 
> Good daytime!
> 
> It would be nice to see FAQ file in freeciv distribution, wouldn't it?

Pre-alpha version of simple script that generates text FAQ file from
http://www.freeciv.org/index.php/FAQ is attached.

TODO:
1. Write numbers at answers.
2. Support other languages (we have at least 'pl' at www.freeciv.org)
3. Other improvements :)

--
Thanks, evyscr.

------------=_1130139084-19607-2
Content-Type: text/x-perl; charset="ascii"; name="fcgetfaq.pl"
Content-Disposition: inline; filename="fcgetfaq.pl"
Content-Transfer-Encoding: 7bit

#!/usr/bin/perl

$faq_url = "http://www.freeciv.org/index.php/FAQ";
$faq_file = "FAQ";

open(FILE, ">$faq_file") || die ("Cannot open file $faq_file for writing.\n");

@content = `links -dump "$faq_url"`;

my $i = 0;
foreach my $line(@content) {
  $line =~ s/^\s*\[edit\]/\-\-\-\-\-\-\-/;
  $line =~ s/\s+$//;
  $line =~ s/^\s*FAQ$/                  Freeciv Frequently Asked Questions \(FAQ\)/;
  $line =~ s/^\s*From Freeciv$/                 (from $faq_url)/;
  if ($line =~ m/^\s*(\-){15,}$/) {
    last;
  }
  if ($i++ > 1) {
    print FILE "$line\n";
  }
}
close(FILE);

print "File $faq_file has written successfully\n";

------------=_1130139084-19607-2--