Actions

Talk

Fanfic

From Betamountain.org

Adding Fanfic

Try this (We'll use "Starfarers Journey" as a title)

Starting A Page

  • Be logged into the wiki
  • Search for Starfarers Journey via the search bar
  • You should get a result that the page does not exist and a link to create one. Click that
  • New page appears: Creating Starfarers Journey
  • Near the top you should see Select Boilerplate and Character BP in the box, drop that down and select Fanfic BP, then load

Boilerplate (Part 1)

If the fanfic does not exist anywhere online currently, delete the first line.
If it does exist:
  • Change NAME to the author (case sensitive + consistency is good)
  • If it exists on Archive of Our Own, replace Ao3# OR DELETE with the number of the Ao3 article (found in the Ao3 URL)
  • If it doesn't exist there, remove OR DELETE Archive of Our Own/Ao3# OR DELETE entirely
  • If it exists elsewhere, use the available slots (three) to put in the URL. If you don't use all of the spots, delete the wording for the spot.

Example:
{{FanFicExists|Somebody|{{AOOO|Ao3# OR DELETE}}|SPOT2|SPOT3}}
Ann's story The Glitch exists on Ao3 and her website, so I used two slots:
{{FanFicExists|AKK|{{AOOO|13232220}}|https://annkniggendorf.de/page134.html|}}

Boilerplate (Part 2)

Edit the next part in place as follows


{{HideTitle}}
<center>
<h1>{{PAGENAME}}</h1>
<h2>Rabbi Bob</h2>
<h3>Leave blank unless there's more to put.  You can play with the size and arrangement as needed </h3></center><br>
'''Summary:''' 



Main Body

Paste the main text here. Wiki will take some level of formatting but isn't overly friendly. I do this usually: 
  1. Get the text in html
  2. Copy the html to the clipboard
  3. Go to https://htmltidy.net/">https://htmltidy.net/ and paste the clipboard on the left side
  4. Click Tidy (upper right)
  5. Grab the code from the right
  6. Paste into wiki
8 times out of 10 that helps get me where I need to be.

Bottom of the page

At the bottom I put all the categories in and for Fanfic, that's driven from the spreadsheets.
If possible, Email me about the fanfic and include any characters (split them up by series characters and author original characters). The same with any prominent locations and vehicles. I'm not looking for BETA Mountain cafeteria, locker room, etc, but if the story goes to BETA Mountain, that one mention is fine. From that, I update the spreadsheet and then transfer the category info to the page.

How This Page Works

Due to the large number of elements on the Fanfic page, the page is built on information from this Google spreadsheet. Content adds\edits\etc are made to the spreadsheet and then downloaded as a CSV. The CSV is pulled through a Perl script and formatted for the page information, then posted.

There should be no direct edits to the page itself, only exports from the Perl output.

Mindnet 192000000.jpg



Known Issues

Unicode\Encoding issues cause Raumjäger to become Raumjäger on export and at the current time, my Perl-Fu isn't what it was.

Code

Directories

  • root
    • html\
    • fanfic\

all.bat

perl "download.pl"
perl "Master fanfic.pl" "Galaxy Rangers - The Spreadsheet - FanFic - Master List.csv"
perl "Appearances fanfic.pl" "Galaxy Rangers - The Spreadsheet - Fanfic - Appearances.csv"
move /Y fanfic\*COMPLETE.txt fanfic\done

Master fanfic.pl

#!/usr/bin/perl
use strict;
use warnings;
no warnings 'uninitialized';
use Data::Dumper;
use Text::CSV;
use feature 'unicode_strings';
use utf8;
use open ':encoding(utf8)';
binmode(STDOUT, ":utf8");
use open IN => ":encoding(utf8)", OUT => ":utf8";



my $filename='temp.txt';
my $NAME_CHECK="";
my $COUNTER=0;
my $INPUT_FILE = $ARGV[0] or die "Need to get CSV file on the command line\n";

my $CSV = Text::CSV->new ({
                                              binary    => 1,
                                              auto_diag => 1,
                                              sep_char  => ','    # not really needed as this is the default
                                              }
                                            );

open(my $DATA_IN, '<:encoding(utf8)', $INPUT_FILE) or die "Could not open '$INPUT_FILE' $! - exiting\n";

open(my $DATA_OUT, '>:encoding(utf8)', "output.txt") or die "Could not open: $! -exiting\n";






SETUP ();  #create page setup

while (my $fields = $CSV->getline( $DATA_IN )) 
  {
  ##1	#2	Title	Author	PERM	Done?	BM	FF		AO3	.	Other1	.	RATING	LANGUAGE	STYLE	Chapter #	Length	Published	Updated	Description	
  my $BMSTATUS;            
  my $SORT;
  my $TITLE;
  my $TITLE_FILE;
  my $AUTHOR;
  my $PERMISSION;
  my $DONE;
  my $BM;
  my $FANFIC;
  my $AO3;
  my $OTHER;
  my $RATING = "[[Category:Fanfic-Unrated]]";
  my $TIMELINE;
  my $AUTHOR_ORDER;
  my $SERIES;
  my $SERIES_ORDER;
  my $MASTER_ORDER;
  my $LANGUAGE;
  my $STYLE;
  my $CHAPTERS;
  my $LENGTH;
  my $PUBLISHED;
  my $UPDATED;
  my $DESC;
  my $NOTES;
  my $SHADE;
  
  ####
      $BMSTATUS = $fields->[0];        
      $SORT = $fields->[1];          
      $TITLE = $fields->[2];
       # if($TITLE=~m/(Raumj).*/){$TITLE="Raumjager"}
      $TITLE_FILE=$TITLE;
      $AUTHOR = $fields->[3];
      $PERMISSION = $fields->[4];
      $DONE = $fields->[5];
      $BM = $fields->[6];
      $FANFIC = $fields->[7];
      $AO3 = $fields->[9];
      $OTHER = $fields->[11];
      $RATING = $fields->[13];
      $TIMELINE = $fields->[14];
      $AUTHOR_ORDER = $fields->[15];
      $SERIES = $fields->[16];
      $SERIES_ORDER = $fields->[17];
      $MASTER_ORDER = $fields->[18];
      $LANGUAGE = $fields->[19];
      $STYLE = $fields->[20];
      $CHAPTERS = $fields->[21];
      $LENGTH = $fields->[22];
      $PUBLISHED = $fields->[23];
      $UPDATED = $fields->[24];
      $DESC = $fields->[25];
      $NOTES = $fields->[26];
#######################################


#############
  ################################################################
  ## check to see if html\$TITLE.html exists and if so, open it, read it in and add it to $TITLE_OUT
my $htmlfilename = "html/$TITLE.html";
$htmlfilename =~ s/(\?|\:)//g;
if (-e $htmlfilename) 
  {
    #print "$htmlfilename"; 
  }
else {
  
  print "No $htmlfilename, creating blank\n";
  open my $fh, '>', "$htmlfilename" or die "Can't open file $!";
  close $fh;
  }
  
  
  ##
  ################################################################

  
#############

  if ($BMSTATUS=~ "X")
    {
    #IGNORE ANYTHING WITH AN X IN THE FIRST COLUMN
    }
    
else
  {
	  
$TITLE_FILE =~ s/\?|\'|  |\:|\!//g;

my $TITLE_OUT;

if ($BMSTATUS =~ "COMPLETE")
  {
  open($TITLE_OUT, '>:encoding(utf8)', "fanfic/$TITLE_FILE-$AUTHOR-COMPLETE.txt") or die "Could not open $TITLE_FILE: $!\n";
  }
else
  {
  open($TITLE_OUT, '>:encoding(utf8)', "fanfic/$TITLE_FILE-$AUTHOR.txt") or die "Could not open $TITLE_FILE: $!\n";  
    }
	  
  $COUNTER++;
  if (0 == $COUNTER % 2) 
    {
    $SHADE="style=\"background:#D3D3D3\"";
    } 
  else
    {
    $SHADE="";
    }
      
#print $DATA_OUT "| $SORT\n";
#print $DATA_OUT "| {{#ifexist: $TITLE | [[$TITLE]] | $TITLE }} \n";  #Too intensive for Mediawiki

  print $DATA_OUT "|$SHADE|$SORT\n";

# N - not done
# O - offsite only, but categorized
# Y - done
if ($DONE =~ "N")
  {
    print $DATA_OUT "|$SHADE|<i>$TITLE</i>";
  }
elsif ($DONE =~ "O")
  {
    print $DATA_OUT "|$SHADE|$TITLE";
  }
else
  {
  print $DATA_OUT "|$SHADE|[[$TITLE]]";
  #print $DATA_OUT "|\n";
  }

#############
## DESC for Summary Hover ##
#############

if (length $DESC > 0)
  {
    #$DESC=~ s/(\:|\")//g;  #COLONS ARE WIKI BAD
    #print $DATA_OUT "    {{HoverSynopsis|$DESC|$TITLE}}";
  }
else
{}

print $DATA_OUT "\n";
print $DATA_OUT "|$SHADE|$AUTHOR\n";

#print "PERMISSION: $PERMISSION\n";
#print "DONE: $DONE\n";
#print $DATA_OUT "|[[$TITLE]]\n";


if ($FANFIC=~ "^http(.*)")
  {
    print $DATA_OUT "|$SHADE|[[File:Logo FanFiction.jpg|25px|link=$FANFIC]]\n";
      #print $DATA_OUT "|$SHADE|[$FANFIC FF]\n";
      #Logo FanFiction.jpg
  }
else
  {
  print $DATA_OUT "|$SHADE|\n";
  }
  
if ($AO3=~ "^http(.*)")
  {
    #[[Image:Wiki.png|50px|link=MediaWiki]]
      #print $DATA_OUT "|$SHADE|[$AO3 Ao3 ]\n";
      print $DATA_OUT "|$SHADE|[[File:Logo Ao3.jpg|25px|link=$AO3]]\n";
  }
else
  {
  print $DATA_OUT "|$SHADE|\n";
  }

if ($OTHER=~ "^http(.*)")
  {
    #Logo Site.jpg
    print $DATA_OUT "|$SHADE|[[File:Logo Site.jpg|25px|link=$OTHER]]\n";
      #print $DATA_OUT "|$SHADE|[$OTHER Site]\n";
  }
else
  {
  print $DATA_OUT "|$SHADE|\n";
  }
  print $DATA_OUT "|$SHADE|$RATING\n";
 #print $DATA_OUT "| $LANGUAGE\n";
  #print $DATA_OUT "| $STYLE\n";
  #print $DATA_OUT "| $CHAPTERS\n";
  print $DATA_OUT "|$SHADE|$LENGTH\n";
  print $DATA_OUT "|$SHADE|<p style=\"font-size:11px\">$PUBLISHED</p>\n";
  print $DATA_OUT "|$SHADE|$DONE\n";
   #print "UPDATED: $UPDATED\n";
  #print "DESC: $DESC\n";
  #print "NOTES: $NOTES\n";
  print $DATA_OUT "|-\n";
  #print $TITLE_OUT "$BM";
  #####
  
  #$FANFIC = $fields->[7];
  #$AO3 = $fields->[9];
  #$OTHER = $fields->[11];


if ($AO3=~ "^http(.*)" || $FANFIC=~ "^http(.*)" || $OTHER=~ "^http(.*)")
	{
	if ($AO3=~ "^http(.*)://archiveofourown.org/works/(.*)")
	  {
		$AO3 = $2;
		print $TITLE_OUT "{{FanFicExists|$AUTHOR|{{AOOO|$AO3}}|$OTHER|$FANFIC}}\n\n";
	  }
	  else
		{
	  print $TITLE_OUT "{{FanFicExists|$AUTHOR|$OTHER|$FANFIC||}}\n\n";
		}
	}
  
  print $TITLE_OUT "<!-- HEADER START -->\n"; 
  print $TITLE_OUT "__NOTOC__\n";  
  print $TITLE_OUT "{{HideTitle}}\n";
  print $TITLE_OUT "<center>\n";
  print $TITLE_OUT "<h1>{{PAGENAME}}</h1>\n";
  print $TITLE_OUT "<h2></h2>\n";
  print $TITLE_OUT "<h3>by $AUTHOR</h3><br>\n";
  print $TITLE_OUT "<h4>Rated: $RATING</h4></center><br>\n";
  if (length $DESC > 0)
  {
    print $TITLE_OUT "'''Summary:'''  $DESC";
  }
else
{print $TITLE_OUT "<!-- '''Summary:''' -->\n";}
  
  print $TITLE_OUT "\n";
  print $TITLE_OUT "\n";
  print $TITLE_OUT "<hr><br><br>\n";
  print $TITLE_OUT "<!-- HEADER END -->\n"; 
  
  
  ################################################################
  ## check to see if html\$TITLE.html exists and if so, open it, read it in and add it to $TITLE_OUT
  #$filename = "html/$TITLE.html";
if (-e $htmlfilename) 
  {
  #print "$filename Exists!!!!!!!!!";
  
  open my $fh, '<', "$htmlfilename" or die "Can't open file $!";
  my @lines = readline $fh;
  
  
  if ($PERMISSION =~ "(NEED|UNFINISHED)")
    {
    print $TITLE_OUT "<!--  PERMISSION: $PERMISSION\n";
    print $TITLE_OUT "      Material collected however not made available for display.\n";
    print {$TITLE_OUT} @lines;
    print $TITLE_OUT "-->\n";
    print $TITLE_OUT "[[Category:FanFic-NeedsPermission]]\n";
    print $TITLE_OUT "[[Category:FanFic-NeedsPermission-$AUTHOR]]\n";
  
  
    }
else
    {
    print $TITLE_OUT "<!--  PERMISSION DERIVED FROM: $PERMISSION \n";
    print $TITLE_OUT "      YES or PERM comes from messaging and\\or email.  RB has attempted to keep track of this.\n";
    print $TITLE_OUT "      GRCD1 or RANGER-L derives from posting or inclusion within the fan community.\n";
    print $TITLE_OUT "      Archive.org, OoOCities.org, etc derived from rescuing material that was publically available and has fallen to the archives as the original website has gone away.  BetaMountain is attempting to provide a collective archive of material.\n";
    print $TITLE_OUT "      *********** IF THERE ARE ANY DISPUTES ON THE ABOVE OR CHANGES REQUESTED PLEASE CONTACT RB DIRECTLY WITH DETAILS ********\n";
    print $TITLE_OUT "-->\n";
    print {$TITLE_OUT} @lines;
    print $TITLE_OUT "\n";
    }

  
  close $fh;
  }
else {
  
  #print "No $filename\n";
  # create a blank file for later 
  }
  
  
  ##
  ################################################################
  
  
  print $TITLE_OUT "\n";
  print $TITLE_OUT "<!-- FOOTER START -->\n"; 
  print $TITLE_OUT "[[Category:Fanfic]]\n";
  print $TITLE_OUT "[[Category:Fanfic-$RATING]]\n";
  print $TITLE_OUT "[[Category:Fanfic-$AUTHOR]]\n";  
  if ($PERMISSION =~ "GRCD")
    {
      print $TITLE_OUT "[[Category:GRCD1]]\n";  
      }
  
  print $TITLE_OUT "\n\n<!-- ********************************************************************************************************** -->\n";      
  print $TITLE_OUT "<!-- Review items for clean up -->\n";      
  print $TITLE_OUT "<!-- Does the page look good (and can it be helped?) -->\n";      
  print $TITLE_OUT "<!-- If fanfic exists elsewhere, is the new template in place? Did we include all the links? -->\n";      
  print $TITLE_OUT "<!-- If additional links are found, send to RB to put in the master spreadsheet as well as add them here -->\n";      
  print $TITLE_OUT "<!-- If everything looks good, remove the next lines and set the Finished marker. -->\n";      
  print $TITLE_OUT "<!-- ********************************************************************************************************** -->\n";      
  #print $TITLE_OUT "[[Category:FanFic-CheckFormat]]\n\n";   
  #print "$BMSTATUS\n";
  
  
  ## Consider check earlier on to see if Permission has been granted and include the .html file or not
  
  # B = needs both + needs permission
  # FI = COMPLETE
  # FU = needs index
  # UU needs both
  # UI = needs formatting
  # EI = needs permission to import
  
  if ($BMSTATUS =~ "B")
    {
     print $TITLE_OUT "[[Category:FanFic-CheckFormat]]\n";
     print $TITLE_OUT "[[Category:FanFic-NeedsIndex]]\n";
     print $TITLE_OUT "[[Category:FanFic-NeedsImporting]]\n";
    }
  elsif  ($BMSTATUS =~ "COMPLETE")
    {
     print $TITLE_OUT "[[Category:FanFic-Finished]]\n";
    }
  elsif  ($BMSTATUS =~ "FI")
    {
     print $TITLE_OUT "[[Category:FanFic-Finished]]\n";
    }
  elsif  ($BMSTATUS =~ "FU")
    {
     print $TITLE_OUT "[[Category:FanFic-NeedsIndex]]\n";
    }
  elsif ($BMSTATUS =~ "UU")
    {
     print $TITLE_OUT "[[Category:FanFic-CheckFormat]]\n";
     print $TITLE_OUT "[[Category:FanFic-NeedsIndex]]\n";
    }
  elsif ($BMSTATUS =~ "UI")
    {
     print $TITLE_OUT "[[Category:FanFic-CheckFormat]]\n";
    }
  elsif ($BMSTATUS =~ "EI")
    {
    print $TITLE_OUT "[[Category:FanFic-NeedsImporting]]\n";
    }
   else
    {
      print $TITLE_OUT "[[Category:FanFic-CheckFormat]]\n";
      print $TITLE_OUT "[[Category:FanFic-NeedsIndex]]\n";
      print $TITLE_OUT "[[Category:FanFic-NeedsImporting]]\n";
  }   
  #print $TITLE_OUT "[[Category:FanFic-NeedsIndex]]\n\n";   
  #print $TITLE_OUT "<!--Leave only the following (remove the comment container): [[Category:FanFic-Finished]] -->\n\n\n";  
  print $TITLE_OUT "<!-- FOOTER END -->\n"; 
      
      
  print "$COUNTER - $TITLE-\n";
  }
  ######## 
    $BMSTATUS="";         
    $SORT="";
    $TITLE="";
    $TITLE_FILE="";
    $AUTHOR="";
    $PERMISSION="";
    $DONE="";
    $BM="";
    $FANFIC="";
    $AO3="";
    $OTHER="";
    $RATING = "[[Category:Fanfic-Unrated]]";
    $LANGUAGE="";
    $STYLE="";
    $CHAPTERS="";
    $LENGTH="";
    $PUBLISHED="";
    $UPDATED="";
    $DESC="";
    $NOTES="";
     
 ####
  }
 
if (not $CSV->eof) 
    {
    $CSV->error_diag();
    }

close $DATA_IN;
print $DATA_OUT "|}\n";
FINISHED ();
close $DATA_OUT;

sub CATEGORY
  {
    my $in=shift;
    if (defined $in && length $in > 0)
      {
      #print $fh "[[Category:$in]]\n";
      }
    }
    
sub BOX_OUTPUT
  {
    my ($type, $val) = @_;
    if (defined $val && length $val > 0)
      {
      print "$type: $val\n";
      }
    }
    
    
  sub SETUP
    {
      print $DATA_OUT "See Also [[:Category:Fanfic]]\n\n";
      print $DATA_OUT "'''''Note:''' This page is under construction and there are parts missing from the list.''<br>\n";
      print $DATA_OUT "'''''Note:''' Titles in italics have not been cataloged and the stories are offsite''<br>\n";
      print $DATA_OUT "'''''Note:''' Titles without links have been cataloged and the stories are offsite''<br>\n";
      print $DATA_OUT "{| class=\"wikitable sortable\" style=\"margin: 1ex auto 1ex auto\"\n";
      print $DATA_OUT "! Sort\n";
      print $DATA_OUT "! Title\n";
      print $DATA_OUT "! Author\n";
      #print $DATA_OUT "! BM\n";
      print $DATA_OUT "! FF\n";
      print $DATA_OUT "! AO3\n";
      print $DATA_OUT "! Site\n";
      print $DATA_OUT "! Rating\n";
      #print $DATA_OUT "! Language\n";
      #print $DATA_OUT "! Style\n";
      #print $DATA_OUT "! Chapters\n";
      print $DATA_OUT "! Length\n";
      print $DATA_OUT "! Published\n";
      print $DATA_OUT "! Status\n";
      print $DATA_OUT "|-\n";
      }
      
    sub FINISHED
      {
      print $DATA_OUT "\n\n\n";
      print $DATA_OUT "[[Category:Spreadsheet]]\n";    
      print $DATA_OUT "[[Category:Perl]]\n";    
      }

Appearances fanfic.pl

#!/usr/bin/perl
use strict;
use warnings;
no warnings 'uninitialized';
use Data::Dumper;
use Text::CSV;
use feature 'unicode_strings';
use utf8;
use open ':encoding(utf8)';
binmode(STDOUT, ":utf8");
use open IN => ":encoding(utf8)", OUT => ":utf8";

my $filename='temp.txt';
my $NAME_CHECK="";
my $COUNTER=0;
my $INPUT_FILE = $ARGV[0] or die "Need to get CSV file on the command line\n";

my $CSV = Text::CSV->new ({
                                              binary    => 1,
                                              auto_diag => 1,
                                              sep_char  => ','    # not really needed as this is the default
                                              }
                                            );

open(my $DATA_IN, '<:encoding(utf8)', $INPUT_FILE) or die "Could not open '$INPUT_FILE' $! - exiting\n";




while (my $fields = $CSV->getline( $DATA_IN )) 
  {
  #FanFic Name,Type,Name,T Appearance\Reference,Notes,BM,Author,Category To Post,Author Category,Do not Edit,Do Not Edit,Do Not Edit
  my $TITLE;
  my $TITLE_FILE;
  my $CATEGORY;
  my $AUTHOR;
  
  ####
      $TITLE = $fields->[0];
      $CATEGORY = $fields->[7];
      $AUTHOR = $fields->[6];
     # if($TITLE=~m/(Raumj).*/){$TITLE="Raumjager"}
      $TITLE_FILE=$TITLE;


#############
 
my $TITLE_OUT;
$TITLE_FILE =~ s/\?|\'|  |\:|\!//g;

my $checkoutputexists = "fanfic/$TITLE_FILE-$AUTHOR-COMPLETE.txt";

if (-e $checkoutputexists) 
    {
    open($TITLE_OUT, '>>:encoding(utf8)', "fanfic/$TITLE_FILE-$AUTHOR-COMPLETE.txt") or die "Could not open $TITLE_FILE: $!\n";
    }
else
    {
    open($TITLE_OUT, '>>:encoding(utf8)', "fanfic/$TITLE_FILE-$AUTHOR.txt") or die "Could not open $TITLE_FILE: $!\n";
    }

print $TITLE_OUT "$CATEGORY\n";
print "$TITLE - $CATEGORY\n";
    $TITLE="";
    $TITLE_FILE="";
    $CATEGORY="";

close $TITLE_OUT;
 ####
  }
 
if (not $CSV->eof) 
    {
    $CSV->error_diag();
    }

close $DATA_IN;

#FINISHED ();


download.pl

use strict;
use warnings;

use LWP::Simple;



#my $url = 'https://docs.google.com/spreadsheets/d/1U_mtxhf4Qjx8RQWuWQoQFk57NlROtGReRHLcxClTgd0/gviz/tq?tqx=out:csv&sheet=FanFic - Master List';
my $url = 'https://docs.google.com/spreadsheets/d/1U_mtxhf4Qjx8RQWuWQoQFk57NlROtGReRHLcxClTgd0/export?gid=1454785779&format=csv';
my $file = 'Galaxy Rangers - The Spreadsheet - FanFic - Master List.csv';

getstore($url, $file);

$url = 'https://docs.google.com/spreadsheets/d/1U_mtxhf4Qjx8RQWuWQoQFk57NlROtGReRHLcxClTgd0/export?gid=854799729&format=csv';
$file = 'Galaxy Rangers - The Spreadsheet - Fanfic - Appearances.csv';
getstore($url, $file);