/*   -*- coding: utf-8 -*-  */

/**********************************************************************
*
*  module   : Explor
*  fichier  : ExplorGenerPagesTools.c
*
*********************************************************************/
#include "ExplorGenerPages.h"
#include "MediaWiki.h"

char    *ExplorGenerAreaTitle;
char    *ExplorGenerAreaPath;
char    *ExplorGenerPagesAreaCode;
char    *ExplorGenerPagesGenericCode;
char    *ExplorGenerPagesWikiCode;
char    *ExplorGenerPagesWikiLink;
char    *ExplorGenerPagesIstexQuery=NULL;
char    *ExplorGenerPagesWebSite=NULL;

StrDict *ExplorGenerPagesParamFile;
StrDict *ExplorGenerPagesUrlLogos;

SxmlNode *ExplorGenerPagesListStreams;
SxmlNode *ExplorGenerPagesStreamIstex;
SxmlNode *ExplorGenerPagesStreamPmc;
SxmlNode *ExplorGenerPagesStreamNcbi;
SxmlNode *ExplorGenerPagesStreamPubMed;
SxmlNode *ExplorGenerPagesStreamStanalyst;
SxmlNode *ExplorGenerPagesStreamHal;
SxmlNode *ExplorGenerPagesStreamHalInra;
char     *ExplorGenerPagesStreamStanalystName;

int      ExplorGenerPagesMapOption;
int      ExplorGenerPagesNumberOfStreams;
int      ExplorGenerPagesNumberOfDownloads;
int      ExplorGenerPagesDownloadSize;
int      ExplorGenerPagesHasZoomFrance;
int      ExplorGenerPagesExecCode;

int       ExplorGenerNumberOfZooms;
SxmlNode *ExplorGenerPagesListZooms;

void ExplorGenerPagesInit()
{
  char *DILIB;
  Buffer* bufTableName;
  ExplorGenerAreaTitle="Serveur d'exploration test";
  ExplorGenerPagesAreaCode="TestExplor";
  ExplorGenerPagesGenericCode=NULL;
  ExplorGenerPagesWikiLink="artist.fr";
  ExplorGenerPagesWikiCode="Wicri/Artist";
  ExplorGenerAreaPath=NULL;
  DILIB=getenv("DILIB");
  bufTableName=NewBuffer();
  BufferStrcpy(bufTableName, DILIB);
  BufferStrcat(bufTableName, "/data/Explor/ExplorParamTable.dict"); 
  ExplorGenerPagesParamFile=StrDictFromFile(BufferString(bufTableName));
  BufferStrcpy(bufTableName, DILIB);
  BufferStrcat(bufTableName, "/data/Wicri/Wicri/wicriUrlLogos.tab"); 
  ExplorGenerPagesUrlLogos=StrDictFromFile(BufferString(bufTableName));

  ExplorGenerPagesMapOption=0;

  ExplorGenerPagesListStreams=SxmlElementCreate("area");
  ExplorGenerPagesStreamPmc=NULL;
  ExplorGenerPagesStreamNcbi=NULL;
  ExplorGenerPagesStreamPubMed=NULL;
  ExplorGenerPagesStreamStanalyst=NULL;
  ExplorGenerPagesStreamHal=NULL;
  ExplorGenerPagesStreamHalInra=NULL;
  ExplorGenerPagesListZooms=SxmlElementCreate("zooms");
  ExplorGenerNumberOfZooms=0;
  ExplorGenerPagesHasZoomFrance=0;
  ExplorGenerPagesExecCode=2;
}

char *ExplorGenerGetBandeauCode(SxmlNode *stream, char*type, char *monoMulti)
{
  SxmlNode *paramNode;
  SxmlNode *bandeauNode;
  paramNode=SxmlGetFirstChildByTagName(stream, "param");
  if ((bandeauNode=SxmlGetFirstChildTagAtt(paramNode, "Bandeau", "type", monoMulti))) return SxmlLeafText(bandeauNode);
  else return NULL;
}

void ExplorGenerStreamBrowsing(int rank, SxmlNode *streamNode)
{
  char *type;
  static int rankPmc=0;
  static int rankPubMed=0;

  type=SxmlGetAttribute(streamNode, "type");
  printf("|-\n!{{Explor icon number|n=%d}}", rank);
  if (strcmp(type,"Ncbi")==0)
    {
      int minRank;
      int maxRank;
      if (rankPmc<rankPubMed) {minRank=rankPmc; maxRank=rankPubMed;}
      else {maxRank=rankPmc; minRank=rankPubMed;}
      printf ("\n!{{Explor icon number|n=%d}}{{Explor icon number|n=%d}}\n|", minRank, maxRank); 
    }
  else
    {
      if (strcmp(type,"Pmc")==0)  rankPmc=rank;
      else if (strcmp(type,"PubMed")==0)  rankPubMed=rank;
      printf("\n|colspan=2|\n");
    }
  if (strcmp(type, "PascalFrancis")==0)
    {
      printf("\n{{Explor bandeau flux|type=Stanalyst|code=%s|path=%s}}\n", type, ExplorGenerPagesAreaCode);
      printf("|Ce flux traite {{%s, Explor size|stream=PascalFrancis|step=Corpus|index=biblio}} références, ", ExplorGenerPagesAreaCode); 
      printf("dont [[A pour taille Francis::{{%s, Explor size|stream=PascalFrancis|step=Corpus|index=biblioFrancis}}]] venant de [[A pour base utilisée::Francis (base de données)|Francis]], ", ExplorGenerPagesAreaCode);      
      printf("et [[A pour taille Pascal::{{%s, Explor size|stream=PascalFrancis|step=Corpus|index=biblioPascal}}]] venant de [[A pour base utilisée::Pascal (base de données)|Pascal]].\n", ExplorGenerPagesAreaCode); 
      
    }
  else
    {
      if  (strcmp(type, "PubMed")==0)
	printf("\n{{Explor bandeau flux|type=Medline|code=PubMed|path=%s}}\n", ExplorGenerPagesAreaCode);
      else if  (strcmp(type, "Pascal")==0)
	printf("\n{{Explor bandeau flux|type=StanPascal|code=Pascal|path=%s}}\n", ExplorGenerPagesAreaCode);
      else printf("\n{{Explor bandeau flux|type=%s|code=%s|path=%s}}\n", type, type, ExplorGenerPagesAreaCode);

      if (strcmp(type, "Hal")==0)
	printf("|Ce flux traite [[A pour taille HAL::{{%s, Explor size|stream=Hal|step=Corpus|index=biblio}}]] références [[A pour base utilisée::Hyper article en ligne|téléchargées de HAL]]. ", ExplorGenerPagesAreaCode); 
      else if  (strcmp(type, "Pascal")==0)
	printf("|Ce flux traite [[A pour taille Pascal::{{%s, Explor size|stream=Pascal|step=Corpus|index=biblio}}]] références ou documents provenance de l'archive [[A pour base utilisée::Pascal (base de données)|Pascal]]. ", ExplorGenerPagesAreaCode); 
      else if  (strcmp(type, "Pmc")==0)
	printf("|Ce flux traite [[A pour taille PubMed Central::{{%s, Explor size|stream=Pmc|step=Corpus|index=biblio}}]] références ou documents provenance de l'archive [[A pour base utilisée::PubMed Central]]. ", ExplorGenerPagesAreaCode); 
      else if  (strcmp(type, "PubMed")==0)
	printf("|Ce flux traite [[A pour taille PubMed::{{%s, Explor size|stream=PubMed|step=Corpus|index=biblio}}]] références ou documents provenance de l'archive [[A pour base utilisée::PubMed (MEDLINE)]]. ", ExplorGenerPagesAreaCode); 
      else if  (strcmp(type, "Ncbi")==0)printf("|Ce flux traite {{%s, Explor size|stream=Ncbi|step=Corpus|index=biblio}} références, ", ExplorGenerPagesAreaCode); 
      else printf("|Ce flux traite {{%s, Explor size|stream=type|step=Corpus|index=biblio}} références, ", ExplorGenerPagesAreaCode); 
    }
  printf("Après curation le volume est réduit à {{%s, Explor size|stream=%s|step=Checkpoint|index=biblio}}.\n", ExplorGenerPagesAreaCode, type); 
}

SxmlNode *ExplorGenerPagesParamZoom(char *param)
{
  SxmlNode *nodeStream;
  ExplorGenerNumberOfZooms++;
  SxmlAppendChild(ExplorGenerPagesListZooms, nodeStream=SxmlElementCreate("stream"));
  SxmlSetAttribute(nodeStream, "name", param);
  if (strcmp(param, "France")==0)ExplorGenerPagesHasZoomFrance=1;
  return nodeStream;
}

SxmlNode *ExplorGenerPagesParamStream(char *param)
{
  SxmlNode *nodeStream;
  char *paramStr;
  SxmlNode *dictParamNode;

  ExplorGenerPagesNumberOfStreams++;
  SxmlAppendChild(ExplorGenerPagesListStreams, nodeStream=SxmlElementCreate("stream"));
  SxmlSetAttribute(nodeStream, "type", param);
  SxmlSetAttribute(nodeStream, "name", param);
  if ((paramStr=StrDictSearch(ExplorGenerPagesParamFile, param)))
    {
      SxmlNode *paramNode;
      SxmlNode *c3Node;
      dictParamNode=SxmlFromString(paramStr);
      c3Node=SxmlGetFirstChildByTagName(dictParamNode, "c3");
      SxmlAppendChild(nodeStream, paramNode=SxmlClone(c3Node));
      SxmlReplaceName(paramNode, strdup("param"));
    }
  else
    {
      ExceptSetError("ExplorGenerAreaPages","UN","Type stream", param, "unknown",2);
      return NULL;
    }
  if (strcmp(param, "Pmc")==0) ExplorGenerPagesStreamPmc=nodeStream;
  else if (strcmp(param, "PubMed")==0) ExplorGenerPagesStreamPubMed=nodeStream;
  else if (strcmp(param, "Istex")==0) ExplorGenerPagesStreamIstex=nodeStream;
  else if (strcmp(param, "Ncbi")==0) ExplorGenerPagesStreamNcbi=nodeStream;
  else if (strcmp(param, "Hal")==0) ExplorGenerPagesStreamHal=nodeStream;
  else if (strcmp(param, "HalInra")==0) ExplorGenerPagesStreamHalInra=nodeStream;
  else if (strcmp(param, "Stanalyst")==0) 
    {
      ExplorGenerPagesStreamStanalyst=nodeStream;
      ExplorGenerPagesStreamStanalystName="Stanalyst";
    }
  else if (strcmp(param, "PascalFrancis")==0) 
    {
      ExplorGenerPagesStreamStanalyst=nodeStream;
      ExplorGenerPagesStreamStanalystName="PascalFrancis";
    }
  else if (strcmp(param, "Pascal")==0) 
    {
      ExplorGenerPagesStreamStanalyst=nodeStream;
      ExplorGenerPagesStreamStanalystName="Pascal";
    }
  return dictParamNode;
}

void ExplorGenerCorpus()
{
  SxmlNode *nodeStream;
  printf("==Corpus==\n{| class=\"wikitable sortable\"\n|-\n!type\n!rubrique\n!valeur\n");
  SxmlReset(ExplorGenerPagesListStreams);
  while ((nodeStream=SxmlNextNode(ExplorGenerPagesListStreams)))
    {
      printf("|-\n|importFile\n");
      if (ExplorGenerPagesNumberOfStreams==1) printf("|Area/Main/Corpus\n");
      printf("|'' à insérer ''\n");
    }
  printf("|-\n|}\n");
}

void ExplorGenerGener(int isIstex)
{
  SxmlNode *nodeStream;
  printf("         -x%c   \\\n", ExplorGenerPagesExecCode);
  if (ExplorGenerAreaPath) printf ("       -p %s   \\\n", ExplorGenerAreaPath);
  printf ("       -w %s  \\\n", ExplorGenerPagesWikiLink);
  printf ("       -W %s   \\\n", ExplorGenerPagesWikiCode);
  if ((!isIstex)&&(ExplorGenerPagesNumberOfStreams ==3)&&ExplorGenerPagesStreamNcbi)
    printf ("       -s Ncbi   \\\n" );
  else
    {
      SxmlReset(ExplorGenerPagesListStreams);
      while ((nodeStream=SxmlNextNode(ExplorGenerPagesListStreams)))
	{
	  char *type;
	  type =SxmlGetAttribute(nodeStream,"type");
	  if (isIstex&&(strcmp(type,"Istex")==0))continue;
	  printf ("       -s %s   \\\n",type );
	}
    }
  SxmlReset(ExplorGenerPagesListZooms);
  while ((nodeStream=SxmlNextNode(ExplorGenerPagesListZooms)))
    {
      printf ("       -z %s   \\\n", SxmlGetAttribute(nodeStream,"name"));
    }
  if (ExplorGenerPagesIstexQuery) printf ("       -q \"%s\"   \\\n", ExplorGenerPagesIstexQuery);
  if (ExplorGenerPagesNumberOfDownloads!=0)
    {
      printf ("       -d \"%d\"   \\\n", ExplorGenerPagesNumberOfDownloads);
      printf ("       -D \"%d\"   \\\n", ExplorGenerPagesDownloadSize);
    }
  printf ("       -t \"%s\"   \n", ExplorGenerAreaTitle);
  printf("\n</source>\n");

}

void ExplorGenerPagesPrintDefExplorArea()
{
  printf(";Définition $EXPLOR_AREA:\n<source lang=\"sh\">\n");
  printf("EXPLOR_AREA=");
  if (ExplorGenerAreaPath)
    {
      if(ExplorGenerPagesWebSite)
	{
	  if (strcmp(ExplorGenerPagesWebSite, "LorExplor")==0)
	    {
	      printf("$WICRI_ROOT/%s/explor/", ExplorGenerAreaPath);
	    }
	  else printf("$WICRI_ROOT/%s/corpus/", ExplorGenerAreaPath);
	}
      else printf("$WICRI_ROOT/%s/explor/", ExplorGenerAreaPath);
    }
  if (ExplorGenerPagesGenericCode) printf("%s.storage/", ExplorGenerPagesGenericCode);
  printf("%s\n", ExplorGenerPagesAreaCode);
  printf("export EXPLOR_AREA\n");
  printf("export LC_ALL=\'C\'\n");
  printf("</source>\n");
}

void ExplorGenerPagesInitDirTree(int code)
{
  /*
      code =0 sur machine dev seule
      code =1 sur machine LorExplor
   */
  static Buffer *bufDirDate=NULL;
  if (!bufDirDate)bufDirDate=NewBuffer();

  ExplorGenerPagesPrintDefExplorArea();

  printf(";Création des répertoires:\n<source lang=\"sh\">\n");
  if (ExplorGenerPagesGenericCode) 
    {
      printf("mkdir $WICRI_ROOT/%s/explor/%s.storage\n", ExplorGenerAreaPath, ExplorGenerPagesGenericCode);
    }
  if (code==0)
    {
      printf("mkdir $EXPLOR_AREA\n");
      printf("mkdir $EXPLOR_AREA/Import\n");
    }
  if (code>0)
    { 
      printf("cd $WICRI_ROOT/%s/explor/%s.storage\n", ExplorGenerAreaPath, ExplorGenerPagesGenericCode);
      BufferStrcpy(bufDirDate,  ExplorGenerPagesAreaCode);
      BufferStrcat(bufDirDate,  ".");
      BufferAppendIsoDateOfTheDay(bufDirDate);

      printf("mkdir %s.corpus\n", ExplorGenerPagesAreaCode);
      printf("mkdir %s.corpus/Import\n", ExplorGenerPagesAreaCode);
      printf("mkdir %s\n", BufferString(bufDirDate));
      printf("ln -s %s %s\n", BufferString(bufDirDate), ExplorGenerPagesAreaCode );
      printf("ln -s %s %s.new\n", BufferString(bufDirDate), ExplorGenerPagesAreaCode );
    }
  printf("</source>\n");

}

void ExplorGenerPagesPrintGetParGener()
{
  printf(";Importation des paramètres de génération:\n<source lang=\"sh\">\n");
  printf("WicriGetPage -l %s -p \"Wicri:%s/Paramètres, data\"\\\n",ExplorGenerPagesWikiLink, ExplorGenerPagesAreaCode);
  printf("      > $EXPLOR_AREA/Import/WicriAreaParam.data.wiki \n");
  printf("</source>\n");
}

void ExplorGenerPagesPrintGetParNavi()
{
    printf(";Importation des paramètres de navigation:\n<source lang=\"sh\">\n");
  printf("WicriGetPage -l %s -p \"Wicri:%s/Paramètres, fr\"\\\n",ExplorGenerPagesWikiLink, ExplorGenerPagesAreaCode);
  printf("      > $EXPLOR_AREA/Import/WicriAreaSiteParam.fr.wiki \n");
  printf("</source>\n");
}

void ExplorGenerPagesGenerListZooms()
{
  SxmlNode *streamNode;
  SxmlReset(ExplorGenerPagesListZooms);
  while ((streamNode=SxmlNextNode(ExplorGenerPagesListZooms)))
    {
      char *streamName;
      streamName=SxmlGetAttribute(streamNode,"name");
      printf("; %s ",streamName); 
    }
}

void ExplorGenerPagesGenerListTypesZoom()
{
  SxmlNode *streamNode;
  SxmlReset(ExplorGenerPagesListZooms);
  while ((streamNode=SxmlNextNode(ExplorGenerPagesListZooms)))
    {
      char *streamName;
      streamName=SxmlGetAttribute(streamNode,"name");
      printf("|-\n|typeStream\n|Area/%s\n|Explor:IndexSelect\n", streamName);
    }
}

void ExplorGenerPagesPrintCompilData()
{
  printf ("Si reprise\n");
  printf("<source lang=\"sh\">\n");
  printf("sh $EXPLOR_AREA/bin/AreaReset.sh\n");
  printf("</source>\n");

  printf("<source lang=\"sh\">\n");
  printf("ExplorAreaDataCreate -d $EXPLOR_AREA\n");
  printf("make -f $EXPLOR_AREA/bin/area.mk\n");
  printf("</source>\n");
}

void ExplorGenerPagesWikiMain()
{
  printf("============  * Lien initial * ===============\n");
  printf("*[[%s]]\n", ExplorGenerAreaTitle);
  printf("=============Page : %s  ==================\n", ExplorGenerAreaTitle);
  printf("{{Wicri travaux|texte=Page et serveurs en cours de construction}}\n");
  printf("Cette page introduit le « [[%s]] ».\n", ExplorGenerAreaTitle);
}

void ExplorGenerPagesBeginNavi()
{
    printf("==Navigation==\n");
    printf("{| class=\"wikitable\"\n|-\n\n");
}

void ExplorGenerPagesListIndex(char *title, char *section, char* stream, char *step, char *indexCode, int class)
{
  printf(";%s:\n", title);
  printf("{{Explor lien\n  |wiki=%s\n |area=%s\n", ExplorGenerPagesWikiCode, ExplorGenerPagesAreaCode);
  printf(" |url=%s/%s/indexHead.php?index=%s\n", stream, step, indexCode);
  if (class!=0)   printf(" |texte=Lien vers l'index complet (avec classification) \n}}\n");
  else printf(" |texte=Lien vers l'index complet \n}}\n");
  printf("{{%s, include|section=%s}}\n", ExplorGenerPagesAreaCode, section);
}

void ExplorGenerPagesWikiMainEnd()
{
  if (ExplorGenerPagesMapOption==1)
    {
      printf("==Projections géographiques==\n");
      printf("{{Début 2 colonnes}}\n");
      printf("{{Explor plateforme %s/Carte France|taille=400}}\n", ExplorGenerPagesAreaCode);
      printf("{{saut 2 colonnes}}\n");
      printf("{{Explor plateforme %s/Carte France Regions 2016|taille=400}}\n", ExplorGenerPagesAreaCode);
      printf("{{Fin 2 colonnes}}\n");
      printf("{{Explor plateforme %s/Carte Europe}}\n", ExplorGenerPagesAreaCode);
      printf("{{Explor plateforme %s/Carte Monde Europe réunie}}\n", ExplorGenerPagesAreaCode);
      printf("{{boîte déroulante\n");
      printf(" |titre= production mondiale (détail Europe)\n");
      printf(" |contenu=\n");
      printf("{{Explor plateforme %s/Carte Monde}}\n", ExplorGenerPagesAreaCode);
      printf("}}\n");
    }

  printf("===Listes de résultats bruts===\n");
  /*
  printf("{{Début 2 colonnes}}\n;Auteurs:\n");
  printf("{{%s, include|section=auteurs}}\n", ExplorGenerPagesAreaCode);
  */
  printf("{{Début 2 colonnes}}\n") ;
  ExplorGenerPagesListIndex("Auteurs", "auteurs", "Main", "Exploration", "Author.i",1);
  printf("{{Saut 2 colonnes}}\n;");
  ExplorGenerPagesListIndex("Affiliations", "org", "Main", "Exploration", "AffOrg.i",0);
  printf("{{Fin 2 colonnes}}\n{{Début 3 colonnes}}\n");
  ExplorGenerPagesListIndex("Pays", "pays", "Main", "Exploration", "AffPays.i",0);
  /* printf("{{%s, include|section=pays}}\n", ExplorGenerPagesAreaCode); */
  printf("{{Saut 3 colonnes}}\n");
  ExplorGenerPagesListIndex("Régions", "region", "Main", "Exploration", "AffRegion.i",0);
  /* printf("{{%s, include|section=region}}\n", ExplorGenerPagesAreaCode); */
  printf("{{Saut 3 colonnes}}\n");
  /* printf("{{%s, include|section=ville}}\n", ExplorGenerPagesAreaCode); */
  ExplorGenerPagesListIndex("Villes", "ville", "Main", "Exploration", "AffVille.i",0);
  printf("{{Fin 3 colonnes}}\n{{Début 3 colonnes}}\n");
  ExplorGenerPagesListIndex("Mots des abstracts", "abstract", "Main", "Exploration", "AbsEn.i",0);
  printf("{{Saut 3 colonnes}}\n");
  ExplorGenerPagesListIndex("Mots des titres", "title", "Main", "Exploration", "Title.i",1);
  printf("{{Saut 3 colonnes}}\n");
  ExplorGenerPagesListIndex("Revues (ISSN)", "ISSN", "Main", "Exploration", "ISSN.i",0);
  printf("{{Fin 3 colonnes}}\n;");

  printf("{{Début 2 colonnes}}\n;");
  ExplorGenerPagesListIndex("MeSH (anglais)", "Mesh", "Main", "Exploration", "Mesh.i",0);
  printf("{{Saut 2 colonnes}}\n;");
  ExplorGenerPagesListIndex("MeSH (français)", "MeshFr", "Main", "Exploration", "MeshFr.i",0);
  printf("{{Fin 2 colonnes}}\n;");

  printf("{{Début 3 colonnes}}\n;");
  ExplorGenerPagesListIndex("Keywords", "KwdEn", "Main", "Exploration", "KwdEn.i",1);
  printf("{{Saut 3 colonnes}}\n;");
  ExplorGenerPagesListIndex("Pascal (français)", "pascalFr", "Main", "Exploration", "PascalFr.i",0);
  printf("{{Saut 3 colonnes}}\n;");
  ExplorGenerPagesListIndex("Teeft (ISTEX)", "teeft", "Main", "Exploration", "Teeft.i",0);
  printf("{{Fin 3 colonnes}}\n;");

  /*
  printf("{{%s, include|section=KwdEn}}\n", ExplorGenerPagesAreaCode);
  printf("{{Saut 3 colonnes}}\n;Mots des titres:\n");
  printf("{{%s, include|section=title}}\n", ExplorGenerPagesAreaCode);
  printf("{{Saut 3 colonnes}}\n;ISSN/revue:\n");
  printf("{{%s, include|section=ISSN}}\n", ExplorGenerPagesAreaCode);
  printf("{{Fin 3 colonnes}}\n;");
  */
  if (ExplorGenerPagesHasZoomFrance!=0)
    {
      printf (";Sur le Zoom France:\n");
      /*
      printf("{{Début 2 colonnes}}\n;Auteurs:\n");
      printf("{{%s, include|section=auteursFrance}}\n", ExplorGenerPagesAreaCode);
      printf("{{Saut 2 colonnes}}\n;Affiliations:\n");
      printf("{{%s, include|section=orgFrance}}\n", ExplorGenerPagesAreaCode);
      */
      printf("{{Début 2 colonnes}}\n") ;
      ExplorGenerPagesListIndex("Auteurs", "auteursFrance", "France", "Analysis", "Author.i", 1);
      printf("{{Saut 2 colonnes}}\n;");
      ExplorGenerPagesListIndex("Affiliations", "orgFrance", "France", "Analysis", "AffOrg.i", 0);

      printf("{{Fin 2 colonnes}}\n{{Début 3 colonnes}}\n");
      ExplorGenerPagesListIndex("Pays", "paysFrance", "France", "Analysis", "AffPays.i",1);
      printf("{{Saut 3 colonnes}}\n");
      ExplorGenerPagesListIndex("Régions", "regionFrance", "France", "Analysis", "AffRegion.i",0);
      printf("{{Saut 3 colonnes}}\n");
      ExplorGenerPagesListIndex("Ville", "villeFrance", "France", "Analysis", "AffVille.i",0);
      printf("{{Fin 3 colonnes}}\n");

      printf("{{Début 3 colonnes}}\n");
      ExplorGenerPagesListIndex("Mots des abstracts", "abstractFrance", "France", "Analysis", "AbsEn.i",0);
      printf("{{Saut 3 colonnes}}\n");
      ExplorGenerPagesListIndex("Mots des titres", "titleFrance", "France", "Analysis", "Title.i",1);
      printf("{{Saut 3 colonnes}}\n");
      ExplorGenerPagesListIndex("Revues (ISSN)", "IssnFrance", "France", "Analysis", "ISSN.i",0);
      printf("{{Fin 3 colonnes}}\n");

      printf("{{Début 2 colonnes}}\n");
      ExplorGenerPagesListIndex("MeSH (anglais)", "MeshFrance", "France", "Analysis", "Mesh.i",0);
      printf("{{Saut 2 colonnes}}\n");
      ExplorGenerPagesListIndex("MeSH (français)", "MeshFrFrance", "France", "Analysis", "MeshFr.i",0);
      printf("{{Fin 2 colonnes}}\n");

      printf("{{Début 3 colonnes}}\n");
      ExplorGenerPagesListIndex("Keywords", "KwdEnFrance", "France", "Analysis", "KwdEn.i",1);
      printf("{{Saut 3 colonnes}}\n");
      ExplorGenerPagesListIndex("Pascal (français)", "pascalFrFrance", "France", "Analysis", "PascalFr.i",0);
      printf("{{Saut 3 colonnes}}\n");
      ExplorGenerPagesListIndex("Teeft (ISTEX)", "teeftFrance", "France", "Analysis", "Teeft.i",0);
      printf("{{Fin 3 colonnes}}\n");
    }

  printf("==Paramétrage==\n");
  printf("*[[Wicri:%s]] - ''introduction''\n", ExplorGenerPagesAreaCode);
  printf("*[[Wicri:%s/Paramètres, data]] - ''génération des données''\n", ExplorGenerPagesAreaCode);
  printf("*[[Wicri:%s/Paramètres, fr]] - ''génération de l'interface''\n", ExplorGenerPagesAreaCode);
  if (ExplorGenerPagesMapOption==1) printf("*[[Wicri:%s/Paramètres, génération des cartes]] - ''génération de cartes géographiques''\n", ExplorGenerPagesAreaCode);
  printf("*[[Wicri:%s/Paramètres, templates size]] - ''paramétrage des modèles liés aux valeurs numériques''\n", ExplorGenerPagesAreaCode);
  printf("*[[Wicri:%s/Paramètres, template include]] - ''génération du modèle d'affichage des résultats bruts''\n", ExplorGenerPagesAreaCode);
  printf("\n[[Catégorie:Serveur d'exploration]]\n__SHOWFACTBOX__\n");
}

void ExplorGenerPagesWikiTechBegin()
{
  printf("=============Page : Wicri:%s  ==================\n", ExplorGenerPagesAreaCode);
  printf("Cette page introduit les aspects techniques de la version [[Wicri:%s|%s]] ",ExplorGenerPagesAreaCode, ExplorGenerPagesAreaCode );
  if (strncmp(ExplorGenerAreaTitle, "Serveur ", 8)==0)printf("du « [[%s]] ».\n",  ExplorGenerAreaTitle);
  else printf("du [[Serveur d\'exploration]] « [[%s]] ».\n",  ExplorGenerAreaTitle);
  printf("\nVoir aussi :\n");
  printf("*[[Wicri:%s/Paramètres, data]] - ''génération des données''\n", ExplorGenerPagesAreaCode);
  printf("*[[Wicri:%s/Paramètres, fr]] - ''génération de l'interface''\n", ExplorGenerPagesAreaCode);
  if (ExplorGenerPagesMapOption==1) printf("*[[Wicri:%s/Paramètres, génération des cartes]] - ''génération de cartes géographiques''\n", ExplorGenerPagesAreaCode);
  printf("*[[Wicri:%s/Paramètres, templates size]] - ''paramétrage des modèles liés aux valeurs numériques''\n", ExplorGenerPagesAreaCode);
 printf("*[[Wicri:%s/Paramètres, template include]] - ''génération du modèle d'affichage des résultats bruts''\n", ExplorGenerPagesAreaCode);

  printf("==Mise en œuvre==\n");

  printf("===Sur la machine de développement===\n");
  printf("====Initialisations====\n");
}

void ExplorGenerPagesWikiDiscussionBegin()
{
  printf("=============Page : Discussion:%s  ==================\n", ExplorGenerAreaTitle);
  printf("Cette page introduit des éléments de discussion, liés notamment à la curation, pour la version [[Wicri:%s|%s]] \n", ExplorGenerPagesAreaCode, ExplorGenerPagesAreaCode);
  if (strncmp(ExplorGenerAreaTitle, "Serveur ", 8)==0)printf("du « [[%s]] ».\n",  ExplorGenerAreaTitle);
  else printf("du [[Serveur d\'exploration]] « [[%s]] ».\n",  ExplorGenerAreaTitle);
}

void ExplorGenerPagesWikiDiscussionIndexCurationByStream(char *stream)
{
  printf("===Flux %s===\n", stream);
  printf("{{Début 3 colonnes}}\n");
  printf("{{%s, include|section=AutAff%sCorpus}}\n", ExplorGenerPagesAreaCode, stream);
  printf("{{Saut 3 colonnes}}\n");
  printf("{{%s, include|section=PaysInc%sCuration}}\n", ExplorGenerPagesAreaCode, stream);
  printf("{{Saut 3 colonnes}}\n");
  printf("{{%s, include|section=RegInc%sCheckpoint}}\n", ExplorGenerPagesAreaCode, stream);
  printf("{{Fin 3 colonnes}}\n");
}

void ExplorGenerPagesWikiDiscussionIndexCuration()
{
  printf("==Index spécialisés pour la curation==\n");
  printf("{{Début 3 colonnes}}\n");
  printf(";Étape Corpus:index AutAff, combinant auteurs (patronymes) et affiliations\n");
  printf("{{Saut 3 colonnes}}\n");
  printf(";Étape Curation:index PaysInc pays inconnus\n");
  printf("{{Saut 3 colonnes}}\n");
  printf(";Étape Checkpoint:index RegInc régions inconnues\n");
  printf("{{Fin 3 colonnes}}\n");
  if (ExplorGenerPagesStreamIstex)ExplorGenerPagesWikiDiscussionIndexCurationByStream("Istex");
  if (ExplorGenerPagesStreamPubMed)ExplorGenerPagesWikiDiscussionIndexCurationByStream("PubMed");
}

void ExplorGenerPagesWikiDataBegin()
{
  printf("=============Page : Wicri:%s/Paramètres, data  ==================\n", ExplorGenerPagesAreaCode);
  printf("Cette page introduit les paramètres de génération des données de la version [[Wicri:%s|%s]] \n", ExplorGenerPagesAreaCode, ExplorGenerPagesAreaCode);
  if (strncmp(ExplorGenerAreaTitle, "Serveur ", 8)==0)printf("du « [[%s]] ».\n",  ExplorGenerAreaTitle);
  else printf("du [[Serveur d\'exploration]] « [[%s]] ».\n",  ExplorGenerAreaTitle);

  printf("\nVoir aussi :\n* [[Wicri:%s/Paramètres, fr]] - ''paramètres de navigation''.\n", ExplorGenerPagesAreaCode);
  if (ExplorGenerPagesMapOption==1) printf("*[[Wicri:%s/Paramètres, génération des cartes]] - ''génération de cartes géographiques''\n", ExplorGenerPagesAreaCode);
  printf("*[[Wicri:%s/Paramètres, templates size]] - ''paramétrage des modèles liés aux valeurs numériques''\n", ExplorGenerPagesAreaCode);
  printf("==La table des paramètres==\n{| class=\"wikitable sortable\"\n|-\n!type\n!rubrique\n!valeur\n");
  printf("|-\n|areaCode\n|Area\n|%s\n",ExplorGenerPagesAreaCode );
  printf("|-\n|wikiCode\n|Area\n|%s\n",ExplorGenerPagesWikiCode );
  printf("|-\n|langs\n|Area\n|fr\n");
}

void ExplorGenerPagesWikiDataEnd()
{
  printf("==Mise en œuvre==\n");
  ExplorGenerPagesPrintDefExplorArea();
  ExplorGenerPagesPrintGetParGener();
  ExplorGenerPagesPrintCompilData();
}

void ExplorGenerPagesWikiNaviBegin()
{
  char *urlLogoWiki;

  printf("=============Page : Wicri:%s/Paramètres, fr  ==================\n", ExplorGenerPagesAreaCode);
  printf("Cette page introduit les paramètres de génération de l'interface de navigation de la version [[Wicri:%s|%s]] ", ExplorGenerPagesAreaCode, ExplorGenerPagesAreaCode);
  if (strncmp(ExplorGenerAreaTitle, "Serveur ", 8)==0)printf("du « [[%s]] ».\n",  ExplorGenerAreaTitle);
  else printf("du [[Serveur d\'exploration]] « [[%s]] ».\n",  ExplorGenerAreaTitle);
  printf("\nVoir aussi :\n* [[Wicri:%s/Paramètres, data]] - ''génération des données''\n", ExplorGenerPagesAreaCode);
  if (ExplorGenerPagesMapOption==1) printf("*[[Wicri:%s/Paramètres, génération des cartes]] - ''génération de cartes géographiques''\n", ExplorGenerPagesAreaCode);
    printf("==Paramètres de navigation==\n{| class=\"wikitable sortable\"\n|-\n!type\n!rubrique\n!valeur\n");
  printf ("|-\n|interwikiLink\n|Area\n|%s\n", ExplorGenerPagesWikiLink);
  printf ("|-\n|areaTitle\n|Area\n|%s\n", ExplorGenerAreaTitle);
  printf ("|-\n|areaName\n|Area\n|%s\n", ExplorGenerPagesAreaCode);
  if (ExplorGenerPagesMapOption==1)
    {
      printf ("|-\n|indexUrl\n|Area/Main/Exploration/AffRegion.i\n|ExplorationRegion\n");
      printf ("|-\n|indexUrl\n|Area/Main/Exploration/AffPays.i\n|ExplorationPays\n");
    }

  urlLogoWiki=StrDictSearch(ExplorGenerPagesUrlLogos, ExplorGenerPagesWikiLink);
  if(urlLogoWiki)
    {
      printf ("|-\n|linkImg\n|Area/sidebar/logo1\n|%s\n", urlLogoWiki);
      printf ("|-\n|linkPage\n|Area/sidebar/logo1\n|https://lorexplor.istex.fr/%s/index.php?title=%s\n", ExplorGenerPagesWikiLink, MediaWikiNameToUrlLink(ExplorGenerAreaTitle));
    }

}

void ExplorGenerPagesWikiNaviEnd()
{
  printf("|-\n|}\n");
  printf("==Mise en œuvre==\n");
  printf ("Rappel, (si reprise globale)\n");
  ExplorGenerPagesPrintDefExplorArea();
  ExplorGenerPagesPrintGetParGener();
  printf (";Génération de la navigation:\n");
  ExplorGenerPagesPrintGetParNavi();
  printf("En cas de reprise :\n");
  printf("<source lang=\"sh\">\n");
  printf("sh $EXPLOR_AREA/bin/AreaResetSite.sh\n");
  printf("</source>\n");
  printf("Puis :\n");
  printf("<source lang=\"sh\">\n");
  printf("sh $EXPLOR_AREA/bin/AreaCreateSite.fr.sh\n");
  printf("</source>\n");
}

void ExplorGenerPagesWikiTemplateSize()
{
  printf("=============Page : Wicri:%s/Template size, data  ==================\n", ExplorGenerPagesAreaCode);
  printf("Cette page introduit les paramètres de génération des modèles de volumétrie de la version [[Wicri:%s|%s]] \n", ExplorGenerPagesAreaCode, ExplorGenerPagesAreaCode);
  if (strncmp(ExplorGenerAreaTitle, "Serveur ", 8)==0)printf("du « [[%s]] ».\n",  ExplorGenerAreaTitle);
  else printf("du [[Serveur d\'exploration]] « [[%s]] ».\n",  ExplorGenerAreaTitle);

  printf("\nVoir aussi :\n*[[Wicri:%s/Paramètres, data]] - ''génération des données''\n", ExplorGenerPagesAreaCode);
  printf("* [[Wicri:%s/Paramètres, fr]] - ''paramètres de navigation''.\n", ExplorGenerPagesAreaCode);
  if (ExplorGenerPagesMapOption==1) printf("*[[Wicri:%s/Paramètres, génération des cartes]] - ''génération de cartes géographiques''\n", ExplorGenerPagesAreaCode);
  printf("==La liste==\n{| class=\"wikitable sortable\"\n|-\n!type\n!rubrique\n!valeur\n");
  printf("|-\n|Main\n|Exploration\n|AffPays\n|top ; 20\n");
  printf("|-\n|Main\n|Exploration\n|AffOrg\n|top ; 20\n");
  printf("|-\n|Main\n|Exploration\n|AffRegion\n|top ; 20\n");
  printf("|-\n|Main\n|Exploration\n|AffVille\n|top ; 20\n");
  printf("|-\n|Main\n|Exploration\n|ISSN\n|top ; 20\n");
  printf("|-\n|Main\n|Exploration\n|Author\n|top ; 50\n");
  printf("|-\n|}\n");
  printf("==Mise en œuvre==\n");
  ExplorGenerPagesPrintDefExplorArea();
  printf(";Importation de la liste:\n");
  printf("<source lang=\"sh\">\n");
  printf("WicriGetPage -l %s -p \"Wicri:%s/Paramètres, templates size\"\\\n",ExplorGenerPagesWikiLink, ExplorGenerPagesAreaCode);
  printf("      > $EXPLOR_AREA/Import/ListeCles.wiki\n");
  printf("</source>\n");
  printf(";Reformatage:\n");
  printf("<source lang=\"sh\">\n");
  printf("cat Import/ListeCles.wiki       \\\n");
  printf("  |  MediaWikiCleanTable        \\\n");
  printf("  | MediaWikiTable2SxmlRowCol   \\\n");
  printf("  | MediaWikiTableTransformCol -t 123 -T 4 > $EXPLOR_AREA/Input/ListKey.xml\n");
  printf("</source>\n");
  printf(";Génération des modèles:\n");
  printf("<source lang=\"sh\">\n");
  printf("ExplorGenerTemplateSize -f Input/ListKey.xml > exportSize.xml\n");
  printf("</source>\n");

}


void ExplorGenerPagesWikiTechCompilArea()
{
  printf("====Génération de la plateforme====\n");
  ExplorGenerPagesPrintGetParGener();
  ExplorGenerPagesPrintCompilData();
  ExplorGenerPagesPrintGetParNavi();
  printf(";Génération de l'interface :\n");
  printf("<source lang=\"sh\">\n");
  printf("sh $EXPLOR_AREA/bin/AreaCreateSite.fr.sh\n");
  printf("</source>\n");
}

void ExplorGenerPagesGenerFtp(int import)
{
 printf("====Génération des FTP====\n<source lang=\"sh\">\n");
  printf("cd $EXPLOR_AREA\n");
  printf("rm Site.tar.gz \n");
  printf("tar -cvf Site.tar Site \n");
  printf("gzip Site.tar \n");
  printf("rm Data.tar.gz \n");
  printf("tar -cvf Data.tar Data \n");
  printf("gzip Data.tar \n");
  if (import!=0)
    {
      printf("rm Import.tar.gz\n");
      printf("tar -cvf Import.tar Import\n");
      printf("gzip Import.tar\n");
    }
  else
    {
      printf("\nrm ImportMetadata.tar.gz\n");
      printf("tar -cvf ImportMetadata.tar Import/istexMetadata.hcs Import/istexMetadata.hfd\n");
      printf("gzip ImportMetadata.tar\n");
    }
  printf("</source>\n");
}

Buffer * ExplorGenerPagesBufTime=NULL;

void ExplorGenerPagesTargetInit()
{
  if (!ExplorGenerPagesBufTime) ExplorGenerPagesBufTime=NewBuffer();
  else BufferReset(ExplorGenerPagesBufTime);
  printf("===Sur la machine cible===\n");
  printf("Aller sur le répertoire corpus correspondant au wiki cible\n");
  printf("<source lang=\"sh\">\n");
  printf(". ... Dilib/init.sh  \n");
  printf("newgrp ticri\n");
  printf("EXPLOR_AREA=");
  if (ExplorGenerPagesWikiCode)
    {
      printf("$WICRI_ROOT/%s/corpus/", ExplorGenerPagesWikiCode);
    }
  if (ExplorGenerPagesGenericCode) 
    {
      printf("%s.storage/", ExplorGenerPagesGenericCode);
      printf("%s.%s\n", ExplorGenerPagesAreaCode,BufferAppendIsoDateOfTheDay(ExplorGenerPagesBufTime));
      printf("</source>\n");
      printf("Si nouveau code générique :\n");
      printf("<source lang=\"sh\">\n");
      printf("mkdir $WICRI_ROOT/%s/corpus/%s.storage\n", ExplorGenerPagesWikiCode, ExplorGenerPagesGenericCode);
      printf("</source>\n");
    }
  else
    {
      printf("%s\n", ExplorGenerPagesAreaCode);
      printf("</source>\n");
    }
  
  printf("Création du répertoire plateforme\n");
  printf("<source lang=\"sh\">\n");
  printf("mkdir $EXPLOR_AREA\n");
  printf("</source>\n");
}

void  ExplorGenerPagesTargetInstall()
{
  printf(";Installation:\n");
  printf("<source lang=\"sh\">\n");
  printf("cd $EXPLOR_AREA\n");
  printf("gunzip Site.tar.gz \n");
  printf("tar -xvf Site.tar \n");
  printf("gzip Site.tar \n\n");
  printf("gunzip Data.tar.gz \n");
  printf("tar -xvf Data.tar \n");
  printf("gzip Data.tar \n");
  printf("</source>\n");
}

void ExplorGenerPagesMap()
{
  if (ExplorGenerPagesMapOption!=1)return;
  printf("=============Page : Wicri:%s/Paramètres, géo  ==================\n", ExplorGenerPagesAreaCode);
  printf("Cette page introduit les paramètres de génération des cartes avec géolocalisation pour la version [[Wicri:%s|%s]] du « [[%s]] ».\n", ExplorGenerPagesAreaCode, ExplorGenerPagesAreaCode, ExplorGenerAreaTitle);
  printf("\nVoir aussi :\n* [[Wicri:%s/Paramètres, data]] - ''génération des données''", ExplorGenerPagesAreaCode);
  printf(",\n* [[Wicri:%s/Paramètres, fr]] - ''paramètres de navigation''.\n", ExplorGenerPagesAreaCode);

  printf("==Commandes de génération==\n");

  ExplorGenerPagesPrintDefExplorArea();
  printf("<source lang=\"sh\" dilib:file=\"%s/bin/generPagesWiki.sh\">\n", ExplorGenerPagesAreaCode);
  /*
  printf("cat <<... > $EXPLOR_AREA/export.xml\n");
  printf("<mediawiki xmlns=\"http://www.mediawiki.org/xml/export-0.8/\" \n");
  printf("   xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n");
  printf("   xsi:schemaLocation=\"http://www.mediawiki.org/xml/export-0.8/ http://www.mediawiki.org/xml/export-0.8.xsd\"    \n");
  printf("   version=\"0.8\" \n");
  printf("   xml:lang=\"fr\"> \n");
  printf("...\n");
  */
  printf("MediaWikiExportCommand -c fileBegin > $EXPLOR_AREA/exportMaps.xml\n\n"); 

  printf("\nHfdCat $EXPLOR_AREA/Data/Main/Exploration/AffRegion.i.hfd \\\n");
  printf("    | SxmlCut idx/l        \\\n");
  printf("    | MediaWikiGeoStatMap -o w -g $DILIB/data/Wicri/France/localisationRegionFrance.dict \\\n");
  printf("            -m France -f \"France location map-Regions.svg\" -s 650  \\\n");
  printf("            -a %s -t \"Carte France\"                        \\\n",ExplorGenerPagesAreaCode );
  printf("            -h https://lorexplor.istex.fr/Wicri/%s/explor \\\n", ExplorGenerAreaPath);
  printf("     >> $EXPLOR_AREA/exportMaps.xml\n");

  printf("\nHfdCat $EXPLOR_AREA/Data/Main/Exploration/AffRegion.i.hfd \\\n");
  printf("    | SxmlCut idx/l        \\\n");
  printf("    | MediaWikiGeoStatMap -o w -g $DILIB/data/Wicri/France/localisationRegionFrance2016.dict \\\n");
  printf("            -m France -f \"France location map-Regions-2016.svg\" -s 650  \\\n");
  printf("            -a %s -t \"Carte France Regions 2016\"                        \\\n",ExplorGenerPagesAreaCode );
  printf("            -h https://lorexplor.istex.fr/Wicri/%s/explor \\\n", ExplorGenerAreaPath);
  printf("     >> $EXPLOR_AREA/exportMaps.xml\n");
  
  printf("\nHfdCat $EXPLOR_AREA/Data/Main/Exploration/AffPays.i.hfd \\\n");
  printf("    | SxmlCut idx/l        \\\n");
  printf("    | MediaWikiGeoStatMap -o w -g $DILIB/data/Wicri/Europe/localisationPaysEurope.dict \\\n");
  printf("            -m Europe -f \"Europe laea location map.svg\" -s 650  \\\n");
  printf("            -a %s -t \"Carte Europe\"                        \\\n",ExplorGenerPagesAreaCode );
  printf("            -h https://lorexplor.istex.fr/Wicri/%s/explor -I AffPays.i \\\n", ExplorGenerAreaPath);
  printf("     >> $EXPLOR_AREA/exportMaps.xml\n");

  printf("\nHfdCat $EXPLOR_AREA/Data/Main/Exploration/AffPays.i.hfd \\\n");
  printf("    | SxmlCut idx/l        \\\n");
  printf("    | MediaWikiGeoStatMap -o w -g $DILIB/data/Wicri/Europe/localisationPaysEurope.dict \\\n");
  printf("                             -g $DILIB/data/Wicri/Amerique/localisationPaysAmerique.dict \\\n");
  printf("                             -g $DILIB/data/Wicri/Asie/localisationPaysAsie.dict \\\n");
  printf("                             -g $DILIB/data/Wicri/Afrique/localisationPaysAfrique.dict \\\n");
  printf("                             -g $DILIB/data/Wicri/Oceanie/localisationPaysOceanie.dict \\\n");
  printf("              -m Monde -f \"1000pxWorld location map (equirectangular 180).svg.png\" -s 1000  \\\n");
  printf("               -a %s -t \"Carte Monde\"                        \\\n",  ExplorGenerPagesAreaCode);
  printf("            -h https://lorexplor.istex.fr/Wicri/%s/explor -I AffPays.i \\\n", ExplorGenerAreaPath);
  printf("     >> $EXPLOR_AREA/exportMaps.xml\n");

  printf("\nHfdCat $EXPLOR_AREA/Data/Main/Exploration/AffPays.i.hfd \\\n");
  printf("    | SxmlCut idx/l        \\\n");
  printf("    | MediaWikiGeoStatMap -o w -g $DILIB/data/Wicri/Europe/localisationPaysEurope.dict \\\n");
  printf("                             -g $DILIB/data/Wicri/Amerique/localisationPaysAmerique.dict \\\n");
  printf("                             -g $DILIB/data/Wicri/Asie/localisationPaysAsie.dict \\\n");
  printf("                             -g $DILIB/data/Wicri/Afrique/localisationPaysAfrique.dict \\\n");
  printf("                             -g $DILIB/data/Wicri/Oceanie/localisationPaysOceanie.dict \\\n");
  printf("              -m Monde -f \"1000pxWorld location map (equirectangular 180).svg.png\" -s 1000  \\\n");
  printf("              -r $DILIB/data/Wicri/Europe/paysEurope.dict      \\\n");
  printf("               -a %s -t \"Carte Monde Europe réunie\"                   \\\n",  ExplorGenerPagesAreaCode);
  printf("            -h https://lorexplor.istex.fr/Wicri/%s/explor -I AffPays.i \\\n", ExplorGenerAreaPath);
  printf("     >> $EXPLOR_AREA/exportMaps.xml\n");

  printf("\nMediaWikiExportCommand -c fileEnd >> $EXPLOR_AREA/exportMaps.xml\n");


  /*  printf("\n\ncat <<... >> $EXPLOR_AREA/export.xml\n</mediawiki>\n...\n"); */

  printf("</source>\n");
}

void ExplorGenerNaviZooms()
{
  SxmlNode *nodeStream;
  SxmlReset(ExplorGenerPagesListZooms);
  while ((nodeStream=SxmlNextNode(ExplorGenerPagesListZooms)))
    {
      char *codeZoom;
      codeZoom= SxmlGetAttribute(nodeStream,"name");
      printf("|-\n!Zoom\n!%s\n",codeZoom);
      /* if (ExplorGenerPagesGenericCode) printf("|\n{{Explor bandeau flux|type=zoom|code=%s|path=%s/%s}}\n", codeZoom, ExplorGenerPagesGenericCode, ExplorGenerPagesAreaCode);
	 else  printf("|\n{{Explor bandeau flux|type=zoom|code=%s|path=%s}}\n", codeZoom, ExplorGenerPagesAreaCode); */
      printf("|\n{{Explor bandeau flux|type=zoom|code=%s|path=%s}}\n", codeZoom, ExplorGenerPagesAreaCode); 
      printf("|Ce flux donne accès à une bibliographie contenant {{%s, Explor size|stream=%s|step=Analysis|index=biblio}} références", ExplorGenerPagesAreaCode, codeZoom);
      switch (*codeZoom)
	{
	case 'A':
	  if (strcmp(codeZoom, "Allemagne")==0) printf(" ayant au moins un auteur avec une affiliation allemande");
	  break;
	case 'F':
	  if (strcmp(codeZoom, "France")==0) printf(" ayant au moins un auteur avec une affiliation française");
	  break;
	case 'U':
	  if (strcmp(codeZoom, "UK")==0) printf(" ayant au moins un auteur avec une affiliation du Royaume-Uni");
	  else if (strcmp(codeZoom, "USA")==0) printf(" ayant au moins un auteur avec une affiliation des Etats-Unis d'Amérique");
	}
      printf(".\n");
    }
}

void ExplorGenerPagesWikiTemplateIncludeInoutStream(char *stream)
{
  printf("         -S %s -s Curation	  	      \\\n", stream);
  printf("                      -i AffPaysInc -g PaysInc%sCuration  \\\n", stream);
  printf("         -S %s -s Corpus                      \\\n", stream);
  printf("            -i AutAff     -g AutAff%sCorpus  \\\n", stream);
  printf("        -S %s -s Checkpoint                   \\\n", stream);
  printf("            -i AffRegInc -g RegInc%sCheckpoint  \\\n", stream);
}

void ExplorGenerPagesWikiTemplateInclude()
{
  printf("=============Page : Wicri:%s/Paramètres, include  ==================\n", ExplorGenerPagesAreaCode);
  printf("Cette page introduit les paramètres de génération du modèle d'inclusion de tables de résultats pour la version [[Wicri:%s|%s]] du « [[%s]] ».\n", ExplorGenerPagesAreaCode, ExplorGenerPagesAreaCode, ExplorGenerAreaTitle);
  printf("\nVoir aussi :\n* [[Wicri:%s/Paramètres, data]] - ''génération des données''", ExplorGenerPagesAreaCode);
  printf(",\n* [[Wicri:%s/Paramètres, fr]] - ''génération des paramètres''.\n", ExplorGenerPagesAreaCode);

  printf("==Mise en œuvre==\n");
  printf("<source lang=\"sh\">\n");
  printf("ExplorGenerTemplateInclude -l 15 -g org  \\\n");
  printf("          -i AffVille   -g ville \\\n");
  printf("          -i AffPays    -g pays \\\n");
  printf("          -i Author     -g auteurs \\\n");
  printf("          -i ISSN       -g ISSN \\\n");
  printf("          -i KwdEn      -g KwdEn \\\n");
  printf("          -i Title      -g title \\\n");
  printf("          -i AffRegion  -g region \\\n");
  if (ExplorGenerPagesHasZoomFrance)
    {
      printf("     -S France -l 10 -s Analysis   \\\n");
      printf("          -i Author    -g auteursFrance \\\n");
      printf("          -i AffOrg    -g orgFrance        \\\n");
      printf("          -i AffVille  -g villeFrance \\\n");
      printf("          -i AffPays   -g paysFrance \\\n");
      printf("          -i ISSN      -g IssnFrance \\\n");
      printf("          -i KwdEn     -g KwdEnFrance \\\n");
      printf("          -i Title     -g titleFrance \\\n");
      printf("          -i AffRegion -g regionFrance \\\n");
    }
  if (ExplorGenerPagesStreamIstex)  ExplorGenerPagesWikiTemplateIncludeInoutStream("Istex");
  if (ExplorGenerPagesStreamPubMed)  ExplorGenerPagesWikiTemplateIncludeInoutStream("PubMed");
  printf("             > exportInclude.xml\n");
  printf("</source>\n");
}
