X4O: Formatted plugins and maisdoc

This commit is contained in:
Willem Cazander 2025-11-07 21:48:59 +01:00
parent a61ce241e1
commit bd4a04a813
63 changed files with 1690 additions and 1589 deletions

View file

@ -49,12 +49,13 @@ import org.x4o.sax3.io.SAX3PropertyConfig.PropertyConfigItem;
*/
@Deprecated // marked until make working to write multiple project or mix api docs in one big tree
public class MaisDocWriter {
// NOTE: this class is unused, and is waiting for ApiDocProject code and replaces most code in EldDocWriter to here.
private final static String PROPERTY_CONTEXT_PREFIX = SAX3PropertyConfig.X4O_PROPERTIES_PREFIX+"api-doc/";
private final static String PROPERTY_CONTEXT_PREFIX = SAX3PropertyConfig.X4O_PROPERTIES_PREFIX + "api-doc/";
public final static SAX3PropertyConfig DEFAULT_PROPERTY_CONFIG;
//@formatter:off
public final static String OUTPUT_PATH = PROPERTY_CONTEXT_PREFIX+"output/path";
public final static String DOC_NAME = PROPERTY_CONTEXT_PREFIX+"doc/name";
public final static String DOC_DESCRIPTION = PROPERTY_CONTEXT_PREFIX+"doc/description";
@ -92,18 +93,20 @@ public class MaisDocWriter {
new PropertyConfigItem(PAGE_PRINT_HELP,Boolean.class,true)
);
}
//@formatter:on
/** The config of this writer. */
private final SAX3PropertyConfig propertyConfig;
public MaisDocWriter(SAX3PropertyConfig parentConfig) {
this.propertyConfig=new SAX3PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
this.propertyConfig = new SAX3PropertyConfig(DEFAULT_PROPERTY_CONFIG, PROPERTY_CONTEXT_PREFIX);
this.propertyConfig.copyParentProperties(parentConfig);
}
/**
* Writes the language documentation to the base path.
* @throws IOException Is thrown when error is done.
*
* @throws IOException Is thrown when error is done.
*/
public void writeDocumentation() throws IOException {
File basePath = propertyConfig.getPropertyFile(OUTPUT_PATH);
@ -111,43 +114,44 @@ public class MaisDocWriter {
MaisDoc doc = buildLanguageDoc();
writer.write(doc, basePath);
}
/**
* Creates a fully configured ApiDoc object.
* @return The ApiDoc configured to write eld documentation.
*
* @return The ApiDoc configured to write eld documentation.
*/
private MaisDoc buildLanguageDoc() {
// Generic config
MaisDoc doc = new MaisDoc();
doc.setName( propertyConfig.getPropertyString(DOC_NAME));
doc.setDescription( propertyConfig.getPropertyString(DOC_DESCRIPTION));
doc.setDocAbout( propertyConfig.getPropertyString(DOC_ABOUT, () -> createDefaultAbout(doc.getName())));
doc.setDocCopyright( propertyConfig.getPropertyString(DOC_COPYRIGHT, () -> createForeverCopyright()));
doc.setDocPageSubTitle( propertyConfig.getPropertyString(DOC_PAGE_SUB_TITLE, () -> createDefaultPageSubTitle(doc.getName())));
doc.setMetaStyleSheetThema( propertyConfig.getPropertyString(META_STYLESHEET_THEMA));
doc.setMetaStyleSheet( propertyConfig.getPropertyFile(META_STYLESHEET));
doc.addMetaKeywordAll( propertyConfig.getPropertyList(META_KEYWORDS, () -> createDefaultKeywords()));
doc.setNoFrameAllName( propertyConfig.getPropertyString(DOC_NO_FRAME_ALL_NAME));
doc.setName(propertyConfig.getPropertyString(DOC_NAME));
doc.setDescription(propertyConfig.getPropertyString(DOC_DESCRIPTION));
doc.setDocAbout(propertyConfig.getPropertyString(DOC_ABOUT, () -> createDefaultAbout(doc.getName())));
doc.setDocCopyright(propertyConfig.getPropertyString(DOC_COPYRIGHT, () -> createForeverCopyright()));
doc.setDocPageSubTitle(propertyConfig.getPropertyString(DOC_PAGE_SUB_TITLE, () -> createDefaultPageSubTitle(doc.getName())));
doc.setMetaStyleSheetThema(propertyConfig.getPropertyString(META_STYLESHEET_THEMA));
doc.setMetaStyleSheet(propertyConfig.getPropertyFile(META_STYLESHEET));
doc.addMetaKeywordAll(propertyConfig.getPropertyList(META_KEYWORDS, () -> createDefaultKeywords()));
doc.setNoFrameAllName(propertyConfig.getPropertyString(DOC_NO_FRAME_ALL_NAME));
doc.setFrameNavPrintParent(true);
doc.setFrameNavPrintParentId(true);
doc.setGroupTypeName("summary", "Summary",1);
doc.setGroupTypeName("overview", "Overview",2);
doc.setGroupTypeName("summary", "Summary", 1);
doc.setGroupTypeName("overview", "Overview", 2);
// Javadoc linking config
List<String> javadocLinkList = propertyConfig.getPropertyList(JAVADOC_LINK);
Map<String,String> javadocLinkOfflineMap = propertyConfig.getPropertyMap(JAVADOC_LINK_OFFLINE);
if (javadocLinkList!=null) {
for (String javadocUrl:javadocLinkList) {
Map<String, String> javadocLinkOfflineMap = propertyConfig.getPropertyMap(JAVADOC_LINK_OFFLINE);
if (javadocLinkList != null) {
for (String javadocUrl : javadocLinkList) {
doc.addRemoteClass(new MaisDocRemoteClass(javadocUrl));
}
}
if (javadocLinkOfflineMap!=null) {
for (Map.Entry<String,String> offlineLink:javadocLinkOfflineMap.entrySet()) {
doc.addRemoteClass(new MaisDocRemoteClass(offlineLink.getKey(),offlineLink.getValue()));
if (javadocLinkOfflineMap != null) {
for (Map.Entry<String, String> offlineLink : javadocLinkOfflineMap.entrySet()) {
doc.addRemoteClass(new MaisDocRemoteClass(offlineLink.getKey(), offlineLink.getValue()));
}
}
// Tree and navagation config
// doc.setFrameNavConceptClass(ElementClass.class);
//
@ -168,7 +172,7 @@ public class MaisDocWriter {
// ApiDocConcept adcIface = doc.addConcept(new ApiDocConcept(adcMod,C_INTERFACE,ElementInterface.class));
// ApiDocConcept adcNs = doc.addConcept(new ApiDocConcept(adcMod,C_NAMESPACE,ElementNamespace.class));
// ApiDocConcept adcEc = doc.addConcept(new ApiDocConcept(adcNs,C_ELEMENT,ElementClass.class));
// mm maybe redo something here
// adcMod.addChildConcepts(new ApiDocConcept(adcMod,CC_ATTRIBUTE_H,ElementNamespaceAttribute.class));
// adcMod.addChildConcepts(new ApiDocConcept(adcMod,CC_CONFIGURATOR_G,ElementConfiguratorGlobal.class));
@ -177,13 +181,13 @@ public class MaisDocWriter {
// adcIface.addChildConcepts(new ApiDocConcept(adcMod,CC_CONFIGURATOR,ElementConfigurator.class));
// adcEc.addChildConcepts(new ApiDocConcept(adcEc,CC_CONFIGURATOR,ElementConfigurator.class));
// adcEc.addChildConcepts(new ApiDocConcept(adcEc,CC_ATTRIBUTE,ElementClassAttribute.class));
// Non-tree pages config
// if (propertyConfig.getPropertyBoolean(PAGE_PRINT_XTREE)) { doc.addDocPage(EldDocXTreePageWriter.createDocPage()); }
// if (propertyConfig.getPropertyBoolean(PAGE_PRINT_TREE)) { doc.addDocPage(DefaultPageWriterTree.createDocPage()); }
// if (propertyConfig.getPropertyBoolean(PAGE_PRINT_INDEX_ALL)) { doc.addDocPage(DefaultPageWriterIndexAll.createDocPage()); }
// if (propertyConfig.getPropertyBoolean(PAGE_PRINT_HELP)) { doc.addDocPage(DefaultPageWriterHelp.createDocPage()); }
// Doc tree config
// ApiDocNode rootNode = new ApiDocNode(language,"language",getLanguageNameUpperCase()+" Language","The X4O "+getLanguageNameUpperCase()+" Language");
// doc.setRootNode(rootNode);
@ -201,7 +205,7 @@ public class MaisDocWriter {
// }
return doc;
}
private String createDefaultPageSubTitle(String name) {
StringBuilder buf = new StringBuilder(100);
buf.append(name);
@ -209,7 +213,7 @@ public class MaisDocWriter {
buf.append("API");
return buf.toString();
}
private String createDefaultAbout(String name) {
Calendar calendar = Calendar.getInstance();
StringBuilder buf = new StringBuilder(100);
@ -218,7 +222,7 @@ public class MaisDocWriter {
buf.append(calendar.get(Calendar.YEAR));
return buf.toString();
}
private String createForeverCopyright() {
StringBuilder buf = new StringBuilder(100);
buf.append("Copyright&nbsp;&#x00a9;&nbsp;");
@ -229,7 +233,7 @@ public class MaisDocWriter {
buf.append("All Rights Reserved.");
return buf.toString();
}
private List<String> createDefaultKeywords() {
List<String> keywords = new ArrayList<String>(10);
keywords.add("language");