Skip to content

Commit

Permalink
Merge pull request #230 from gama-platform/Fix-documentation-issues
Browse files Browse the repository at this point in the history
Fix documentation issues
  • Loading branch information
lesquoyb authored Jun 27, 2024
2 parents c294e99 + a8ef63b commit 9e9f852
Show file tree
Hide file tree
Showing 7 changed files with 297 additions and 201 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
*/
public interface IConstantCategory {

/** The Constant PREFIX_CONSTANT. */
public static final String PREFIX_CONSTANT = "#";


/** The Constant LENGTH. */
// Units
public static final String LENGTH = "Length units";
Expand Down Expand Up @@ -45,7 +49,7 @@ public interface IConstantCategory {
// Math
public static final String MATH = "Math constants";


/** The Constant COLOR_CSS. */
public static final String COLOR_CSS = "Colors";

}
8 changes: 4 additions & 4 deletions gama.documentation/files/input/pandocPDF/gama_style.sty

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wiki="www.google.fr">
<xsl:variable name="fileSpecies" select="'BuiltInSpecies'" />
<xsl:variable name="fileSkills" select="'BuiltInSkills'" />

<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<xsl:variable name="space" select="' '" />
<xsl:variable name="minus" select="'-'" />


<xsl:template match="/">

Expand Down Expand Up @@ -96,6 +101,8 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wiki="www.google.fr">
<xsl:value-of select="@name" />
<xsl:text>](</xsl:text>
<xsl:value-of select="$fileUnitsConstants" />
<xsl:text>#</xsl:text>
<xsl:value-of select="translate(translate(categories/category/@id, $uppercase, $lowercase), $space, $minus)" />
<xsl:text>)</xsl:text>
<xsl:if test="@altNames">
<xsl:text> (</xsl:text>
Expand Down Expand Up @@ -219,7 +226,7 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wiki="www.google.fr">

## Other concepts
[scheduling](RuntimeConcepts#Scheduling_of_Agents ), [step](RuntimeConcepts#agents-step), [Key concepts](BasicProgrammingConceptsInGAML),
[Object-oriented paradigm to GAML](Introduction#vocabulary-correspondence-with-the-object-oriented-paradigm-as-in-java), [Correspondence GAML and Netlogo](/Introduction#vocabulary-correspondence-with-the-agent-based-paradigm-as-in-netlogo)
[Object-oriented paradigm to GAML](Introduction#vocabulary-correspondence-with-the-object-oriented-paradigm-as-in-java), [Correspondence GAML and Netlogo](Introduction#vocabulary-correspondence-with-the-agent-based-paradigm-as-in-netlogo)


</xsl:template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.io.File;

import gama.annotations.precompiler.doc.utils.Constants;
import gama.documentation.transform.XmlToCategoryXML;
import gama.documentation.transform.XmlToWiki;
import gama.documentation.transform.XmlTransform;
import gama.documentation.util.GamaStyleGeneration;
Expand Down Expand Up @@ -50,9 +49,9 @@ public static void main(final String[] args) {
XmlToWiki.createExtentionsWiki();
System.out.println("DONE\n");

System.out.print("Creation of the page for keywords.....");
XmlToCategoryXML.createCategoryWiki();
System.out.println("DONE\n");
// System.out.print("Creation of the page for keywords.....");
// XmlToCategoryXML.createCategoryWiki();
// System.out.println("DONE\n");


System.out.print("GENERATION of the prism highlight JS file.....");
Expand Down
37 changes: 36 additions & 1 deletion gama.documentation/src/gama/documentation/util/UnifyDoc.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
package gama.documentation.util;

import java.io.File;
import java.io.FileOutputStream;
import java.nio.file.Files;
import java.util.HashMap;
import java.util.List;
Expand All @@ -24,6 +23,8 @@
import org.jdom2.output.Format;
import org.jdom2.output.XMLOutputter;

import gama.annotations.precompiler.IConstantCategory;
import gama.annotations.precompiler.constants.ColorCSS;
import gama.annotations.precompiler.doc.utils.Constants;
import gama.annotations.precompiler.doc.utils.TypeConverter;
import gama.annotations.precompiler.doc.utils.XMLElements;
Expand Down Expand Up @@ -148,13 +149,47 @@ private static Document mergeFiles(final HashMap<String, File> hmFilesPackages)
doc.getRootElement().getChild(XMLElements.OPERATORS_CATEGORIES).addContent(new Element(XMLElements.CATEGORY)
.setAttribute(XMLElements.ATT_CAT_ID, new TypeConverter().getProperCategory("Types")));

// Add the colors constant category
doc.getRootElement().getChild(XMLElements.CONSTANTS_CATEGORIES).addContent(new Element(XMLElements.CATEGORY)
.setAttribute(XMLElements.ATT_CAT_ID, IConstantCategory.COLOR_CSS));

// Add the color in constants
Element constantsElt = doc.getRootElement().getChild(XMLElements.CONSTANTS);
final Object[] colorTab = ColorCSS.array;
for (int i = 0; i < colorTab.length; i += 2) {
constantsElt.addContent(createColorConstantElement(colorTab,i));
}

return doc;
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}

private static Element createColorConstantElement(Object[] colorTab, int i) {
final Element constantElt = new Element(XMLElements.CONSTANT);
constantElt.setAttribute(XMLElements.ATT_CST_NAME, IConstantCategory.PREFIX_CONSTANT + colorTab[i]);
constantElt.setAttribute(XMLElements.ATT_CST_VALUE,
"r=" + ((int[]) colorTab[i + 1])[0] + ", g=" + ((int[]) colorTab[i + 1])[1] + ", b="
+ ((int[]) colorTab[i + 1])[2] + ", alpha=" + ((int[]) colorTab[i + 1])[3]);

// Category
final Element categoriesElt = new Element(XMLElements.CATEGORIES);
final Element colorCatElt = new Element(XMLElements.CATEGORY).setAttribute(XMLElements.ATT_CAT_ID, IConstantCategory.COLOR_CSS);
categoriesElt.addContent(colorCatElt);
constantElt.addContent(categoriesElt);

// Concept
final Element conceptsElt = new Element(XMLElements.CONCEPTS);
final Element conceptElt = new Element(XMLElements.CONCEPT).setAttribute(XMLElements.ATT_CAT_ID, IConstantCategory.COLOR_CSS);
conceptsElt.addContent(conceptElt);
constantElt.addContent(conceptsElt);

return constantElt;
}


/**
* The main method.
*
Expand Down
Binary file modified gama.processor/gama.processor.jar
Binary file not shown.
Loading

0 comments on commit 9e9f852

Please sign in to comment.