Created a "fcdoc" writer for FC18-Alpha1 documentation
This commit is contained in:
parent
95ff5c1745
commit
06270b2326
|
@ -27,6 +27,7 @@
|
|||
|
||||
package org.eobjects.metamodel.doc;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -57,7 +58,7 @@ public class DocModelWriterSchema {
|
|||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={Schema.class})
|
||||
public void writeSchemaTableSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeSchemaTableSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
ApiDocContentWriter writer = event.getWriter();
|
||||
Schema schema = (Schema)event.getEventObject().getUserData();
|
||||
DataContext dc = (DataContext)event.getEventObject().getParent().getUserData();
|
||||
|
@ -82,7 +83,7 @@ public class DocModelWriterSchema {
|
|||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={Schema.class})
|
||||
public void writeSchemaViewSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeSchemaViewSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
ApiDocContentWriter writer = event.getWriter();
|
||||
Schema schema = (Schema)event.getEventObject().getUserData();
|
||||
List<Table> tables = filterTables(schema,TableType.VIEW,true);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
package org.eobjects.metamodel.doc;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
@ -167,7 +168,7 @@ public class DocModelWriterTable {
|
|||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={Table.class},nodeBodyOrders={3},contentGroup="Columns",contentGroupType="summary")
|
||||
public void writeTableSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeTableSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
ApiDocContentWriter writer = event.getWriter();
|
||||
Table table = (Table)event.getEventObject().getUserData();
|
||||
if (TableType.VIEW.equals(table.getType())) {
|
||||
|
@ -229,7 +230,7 @@ public class DocModelWriterTable {
|
|||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={Table.class},nodeBodyOrders={2},contentGroup="Indexes",contentGroupType="summary")
|
||||
public void writeTableIDXSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeTableIDXSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
ApiDocContentWriter writer = event.getWriter();
|
||||
Table table = (Table)event.getEventObject().getUserData();
|
||||
DBTable tableDB = getDBTable(event);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
*/
|
||||
package org.x4o.xml.eld.doc;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.o2o.io.ContentWriterHtml.Tag;
|
||||
|
@ -65,17 +66,17 @@ public class EldDocWriterElementClass implements ApiDocContentPrinter {
|
|||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={ElementClass.class},nodeBodyOrders={1},contentGroup="element",contentGroupType="summary")
|
||||
public void writeElementX4OSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeElementX4OSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
printApiTableBean(event, "Element", "class","id","description");
|
||||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={ElementClass.class},nodeBodyOrders={2},contentGroup="attribute",contentGroupType="summary")
|
||||
public void writeElementClassAttribute(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeElementClassAttribute(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
printApiTable(event,"Element Class Attribute Summary",ElementClassAttribute.class);
|
||||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={ElementClass.class},nodeBodyOrders={3},contentGroup="configurator",contentGroupType="summary")
|
||||
public void writeElementConfigurator(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeElementConfigurator(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
printApiTable(event,"Element Configurator Summary",ElementConfigurator.class);
|
||||
}
|
||||
|
||||
|
@ -98,7 +99,7 @@ public class EldDocWriterElementClass implements ApiDocContentPrinter {
|
|||
*/
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={ElementClass.class},nodeBodyOrders={10},contentGroup="bean",contentGroupType="summary")
|
||||
public void writeElementObjectPropertiesSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeElementObjectPropertiesSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
ElementClass ec = (ElementClass)event.getEventObject().getUserData();
|
||||
Class<?> beanClass = ec.getObjectClass();
|
||||
if (beanClass==null) {
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
*/
|
||||
package org.x4o.xml.eld.doc;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.x4o.o2o.tdoc.ApiDocContentPrinter;
|
||||
import org.x4o.o2o.tdoc.ApiDocNodeDataConfiguratorMethod;
|
||||
import org.x4o.o2o.tdoc.ApiDocNodeWriterMethod;
|
||||
|
@ -53,22 +55,22 @@ public class EldDocWriterElementInterface implements ApiDocContentPrinter {
|
|||
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={ElementInterface.class},nodeBodyOrders={1},contentGroup="interface",contentGroupType="summary")
|
||||
public void writeElementNamespaceBeanProperties(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeElementNamespaceBeanProperties(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
printApiTableBean(event,"Interface","description");
|
||||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={ElementInterface.class},nodeBodyOrders={2},contentGroup="attribute",contentGroupType="summary")
|
||||
public void writeElementClassAttribute(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeElementClassAttribute(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
printApiTable(event,"Element Class Attribute Summary",ElementClassAttribute.class);
|
||||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={ElementInterface.class},nodeBodyOrders={3},contentGroup="binding",contentGroupType="summary")
|
||||
public void writeElementBindingHandler(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeElementBindingHandler(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
printApiTable(event,"Element Binding Handler Summary",ElementBindingHandler.class);
|
||||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={ElementInterface.class},nodeBodyOrders={4},contentGroup="configurator",contentGroupType="summary")
|
||||
public void writeElementConfigurator(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeElementConfigurator(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
printApiTable(event,"Element Configurator Summary",ElementConfigurator.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
*/
|
||||
package org.x4o.xml.eld.doc;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.x4o.o2o.tdoc.ApiDocContentPrinter;
|
||||
import org.x4o.o2o.tdoc.ApiDocNodeDataConfiguratorMethod;
|
||||
import org.x4o.o2o.tdoc.ApiDocNodeWriterMethod;
|
||||
|
@ -48,12 +50,12 @@ public class EldDocWriterElementNamespace implements ApiDocContentPrinter {
|
|||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={ElementNamespace.class},nodeBodyOrders={1},contentGroup="namespace",contentGroupType="summary")
|
||||
public void writeElementNamespaceBeanProperties(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeElementNamespaceBeanProperties(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
printApiTableBean(event,"Namespace","description","elementClasses","elementNamespaceInstanceProvider","prefixMapping");
|
||||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={ElementNamespace.class},nodeBodyOrders={2},contentGroup="element",contentGroupType="summary")
|
||||
public void writeElementNamespaceElements(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeElementNamespaceElements(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
printApiTable(event,"Element Summary",ElementClass.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
*/
|
||||
package org.x4o.xml.eld.doc;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.x4o.o2o.tdoc.ApiDocContentCss;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentPrinter;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentWriter;
|
||||
|
@ -47,25 +49,25 @@ public class EldDocWriterLanguage implements ApiDocContentPrinter {
|
|||
|
||||
// TODO move
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={ElementBindingHandler.class})
|
||||
public void writeElementBindingHandlerBean(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeElementBindingHandlerBean(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
printApiTableBean(event,"BindingHandler","description");
|
||||
}
|
||||
|
||||
// TODO move
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={ElementConfigurator.class})
|
||||
public void writeElementConfiguratorBean(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeElementConfiguratorBean(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
printApiTableBean(event,"Configurator","description");
|
||||
}
|
||||
|
||||
// TODO move
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={ElementClassAttribute.class})
|
||||
public void writeElementClassAttributeBean(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeElementClassAttributeBean(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
printApiTableBean(event,"Element Class Attribute","description");
|
||||
}
|
||||
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={X4OLanguage.class},nodeBodyOrders={1})
|
||||
public void writeLanguageSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeLanguageSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
ApiDocContentWriter writer = event.getWriter();
|
||||
ApiDocNode node = event.getEventObject();
|
||||
X4OLanguage language = (X4OLanguage)node.getUserData();
|
||||
|
@ -100,12 +102,12 @@ public class EldDocWriterLanguage implements ApiDocContentPrinter {
|
|||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={X4OLanguage.class},nodeBodyOrders={2})
|
||||
public void writeModulesSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeModulesSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
printApiTable(event,"Module Summary",X4OLanguageModule.class);
|
||||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={X4OLanguage.class},nodeBodyOrders={3})
|
||||
public void writeNamespaceSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeNamespaceSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
ApiDocContentWriter writer = event.getWriter();
|
||||
ApiDocNode node = event.getEventObject();
|
||||
X4OLanguage language = (X4OLanguage)node.getUserData();
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
package org.x4o.xml.eld.doc;
|
||||
|
||||
import org.x4o.xml.element.ElementNamespaceAttribute;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.x4o.o2o.tdoc.ApiDocContentPrinter;
|
||||
import org.x4o.o2o.tdoc.ApiDocNodeDataConfiguratorMethod;
|
||||
import org.x4o.o2o.tdoc.ApiDocNodeWriterMethod;
|
||||
|
@ -56,27 +59,27 @@ public class EldDocWriterLanguageModule implements ApiDocContentPrinter {
|
|||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={X4OLanguageModule.class},nodeBodyOrders={1},contentGroup="interface",contentGroupType="summary")
|
||||
public void writeInterfaceSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeInterfaceSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
printApiTable(event,"Interface Summary",ElementInterface.class);
|
||||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={X4OLanguageModule.class},nodeBodyOrders={2},contentGroup="binding",contentGroupType="summary")
|
||||
public void writeBindingSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeBindingSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
printApiTable(event,"Binding Summary",ElementBindingHandler.class);
|
||||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={X4OLanguageModule.class},nodeBodyOrders={3},contentGroup="attribute",contentGroupType="summary")
|
||||
public void writeAttributeSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeAttributeSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
printApiTable(event,"Attribute Summary",ElementNamespaceAttribute.class);
|
||||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={X4OLanguageModule.class},nodeBodyOrders={4},contentGroup="configurator",contentGroupType="summary")
|
||||
public void writeConfigutorSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeConfigutorSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
printApiTable(event,"Configurator Summary",ElementConfigurator.class);
|
||||
}
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={X4OLanguageModule.class},nodeBodyOrders={5},contentGroup="namespace",contentGroupType="summary")
|
||||
public void writeNamespaceSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||
public void writeNamespaceSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
printApiTable(event,"Namespace Summary",ElementNamespace.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,372 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.fc18;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotAPL0127DashP7A;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotAPL0127DashP7B;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotAPL0127DashP7C;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotBYD0127DashP7D;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotBYD0127DashP7E;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotBYD0127DashP7F;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotDEC0127DashPX0;
|
||||
|
||||
/**
|
||||
* Writes fc example markdown document.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 05, 2025
|
||||
*/
|
||||
public class FourCornerWriteExampleMD {
|
||||
|
||||
static public void main(String[] args) {
|
||||
FourCornerWriteExampleMD run = new FourCornerWriteExampleMD();
|
||||
try {
|
||||
run.writeExample();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeExample() throws IOException {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
writeTitle1(buf, "Four Corner");
|
||||
buf.append("\n");
|
||||
buf.append("Overview of four corner chars...\n");
|
||||
buf.append("\n");
|
||||
writeTableBlocks(buf);
|
||||
buf.append("<br><br>\n");
|
||||
|
||||
writeTitle2(buf, "Blocks");
|
||||
|
||||
writeTitle3(buf, "FC.CDC1604-P6");
|
||||
writeTableStart17(buf);
|
||||
writeCDC(buf, 0x00);
|
||||
writeCDC(buf, 0x10);
|
||||
writeCDC(buf, 0x20);
|
||||
writeCDC(buf, 0x30);
|
||||
writeTableEnd(buf);
|
||||
buf.append("<br><br>\n");
|
||||
|
||||
int startAPL = FourCornerDotCake.FC_APL0127_P7A.getStart();
|
||||
writeTitle3(buf, "FC.APL0127-P7(ABC)");
|
||||
writeTableStart28(buf);
|
||||
writeAPL(buf, startAPL + 0, v -> FCDotAPL0127DashP7A.valueOf(v).codePoints()[0]);
|
||||
writeAPL(buf, startAPL + 27, v -> FCDotAPL0127DashP7B.valueOf(v).codePoints()[0]);
|
||||
writeAPL(buf, startAPL + 54, v -> FCDotAPL0127DashP7C.valueOf(v).codePoints()[0]);
|
||||
writeTableEnd(buf);
|
||||
buf.append("<br><br>\n");
|
||||
|
||||
int startBYD = FourCornerDotCake.FC_BYD0127_P7D.getStart();
|
||||
writeTitle3(buf, "FC.BYD0127-P7(DEF)");
|
||||
writeTableStart28(buf);
|
||||
writeBYD(buf, startBYD + 0, v -> FCDotBYD0127DashP7D.valueOf(v).codePoints()[0]);
|
||||
writeBYD(buf, startBYD + 27, v -> FCDotBYD0127DashP7E.valueOf(v).codePoints()[0]);
|
||||
writeBYD(buf, startBYD + 54, v -> FCDotBYD0127DashP7F.valueOf(v).codePoints()[0]);
|
||||
writeTableEnd(buf);
|
||||
buf.append("<br><br>\n");
|
||||
|
||||
writeTitle3(buf, "FC.PIE9C-(01-27)");
|
||||
writeTableStart28(buf);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_01);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_02);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_03);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_04);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_05);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_06);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_07);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_08);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_09);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_10);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_11);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_12);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_13);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_14);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_15);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_16);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_17);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_18);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_19);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_20);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_21);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_22);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_23);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_24);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_25);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_26);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9C_27);
|
||||
writeTableEnd(buf);
|
||||
buf.append("<br><br>\n");
|
||||
|
||||
writeTitle3(buf, "FC.PIE9D-(01-27)");
|
||||
writeTableStart28(buf);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_01);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_02);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_03);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_04);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_05);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_06);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_07);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_08);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_09);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_10);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_11);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_12);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_13);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_14);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_15);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_16);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_17);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_18);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_19);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_20);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_21);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_22);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_23);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_24);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_25);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_26);
|
||||
writePIE(buf, FourCornerDotCake.FC_PIE9D_27);
|
||||
writeTableEnd(buf);
|
||||
buf.append("<br><br>\n");
|
||||
|
||||
writeTitle3(buf, "FC.PIN9D-XX");
|
||||
writeTableStart28(buf);
|
||||
writePIN(buf);
|
||||
writeTableEnd(buf);
|
||||
buf.append("<br><br>\n");
|
||||
|
||||
File out = new File("../src/site/wigiti/README-fc18.md");
|
||||
Files.writeString(out.toPath(), buf.toString(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
|
||||
}
|
||||
|
||||
private void writeTableBlocks(StringBuilder buf) {
|
||||
buf.append("<table border=\"1px\">\n");
|
||||
buf.append("<tr>");
|
||||
buf.append("<th>Block</th>");
|
||||
buf.append("<th>Start</th>");
|
||||
buf.append("<th>End</th>");
|
||||
buf.append("<th>Size</th>");
|
||||
buf.append("</tr>\n");
|
||||
|
||||
for (FourCornerDotCake v : FourCornerDotCake.values()) {
|
||||
buf.append("<tr>");
|
||||
buf.append("<td>" + v.nameSpec() + "</td>");
|
||||
buf.append(String.format("<td>%06X</td>", v.getStart()));
|
||||
buf.append(String.format("<td>%06X</td>", v.getStop()));
|
||||
buf.append("<td>" + v.getLength() + "</td>");
|
||||
buf.append("</tr>\n");
|
||||
}
|
||||
|
||||
writeTableEnd(buf);
|
||||
}
|
||||
|
||||
private void writeCDC(StringBuilder buf, int off) {
|
||||
String prefixHex = Integer.toHexString(off).toUpperCase();
|
||||
buf.append("<tr>");
|
||||
buf.append("<td>U+0000");
|
||||
buf.append(prefixHex.charAt(0));
|
||||
buf.append("x</td>");
|
||||
for (int i=off; i<16+off;i++) {
|
||||
FCDotCDC1604DashP6 cdc = FCDotCDC1604DashP6.valueOf(i);
|
||||
int codePoint = cdc.codePoints()[0];
|
||||
buf.append("<td>");
|
||||
if (codePoint == '\u0000') {
|
||||
buf.append("␀");
|
||||
} else if (codePoint == '\u0001') {
|
||||
buf.append("␁");
|
||||
} else if (codePoint == '\u0002') {
|
||||
buf.append("␂");
|
||||
} else if (codePoint == '\u0003') {
|
||||
buf.append("␃");
|
||||
} else if (codePoint == ' ') {
|
||||
buf.append("␠");
|
||||
} else if (codePoint == '\n') {
|
||||
buf.append("␊");
|
||||
} else if (codePoint == '<') {
|
||||
buf.append("<");
|
||||
} else if (codePoint == '>') {
|
||||
buf.append(">");
|
||||
} else {
|
||||
buf.appendCodePoint(codePoint);
|
||||
}
|
||||
buf.append("</td>");
|
||||
}
|
||||
buf.append("</tr>\n");
|
||||
}
|
||||
|
||||
private void writeAPL(StringBuilder buf, int off, Function<Integer, Integer> conv) {
|
||||
String prefixHex = Integer.toHexString(off).toUpperCase();
|
||||
buf.append("<tr>");
|
||||
buf.append("<td>U+0000");
|
||||
buf.append(prefixHex);
|
||||
buf.append("x</td>");
|
||||
for (int i=0; i<27;i++) {
|
||||
//FCDotAPL0127DashP7A apl = c.indexOf(i);
|
||||
//int codePoint = apl.codePoints()[0];
|
||||
int codePoint = conv.apply(i);
|
||||
buf.append("<td>");
|
||||
if (codePoint == '\u0000') {
|
||||
buf.append("␀");
|
||||
} else {
|
||||
buf.appendCodePoint(codePoint);
|
||||
}
|
||||
buf.append("</td>");
|
||||
}
|
||||
buf.append("</tr>\n");
|
||||
}
|
||||
|
||||
private void writeBYD(StringBuilder buf, int off, Function<Integer, Integer> conv) {
|
||||
String prefixHex = Integer.toHexString(off).toUpperCase();
|
||||
buf.append("<tr>");
|
||||
buf.append("<td>U+0000");
|
||||
buf.append(prefixHex);
|
||||
buf.append("x</td>");
|
||||
for (int i=0; i<27;i++) {
|
||||
//FCDotBYD0127DashP7D byd = FCDotBYD0127DashP7D.indexOf(i);
|
||||
//int codePoint = byd.codePoints()[0];
|
||||
int codePoint = conv.apply(i);
|
||||
buf.append("<td>");
|
||||
if (codePoint == '\u0000') {
|
||||
buf.append("␀");
|
||||
} else {
|
||||
buf.appendCodePoint(codePoint);
|
||||
}
|
||||
buf.append("</td>");
|
||||
}
|
||||
buf.append("</tr>\n");
|
||||
}
|
||||
|
||||
private void writePIE(StringBuilder buf, FourCornerDotCake slice) {
|
||||
buf.append("<tr>");
|
||||
buf.append("<td>");
|
||||
buf.append(slice.nameSpec());
|
||||
buf.append("</td>");
|
||||
for (int i=0; i<27;i++) {
|
||||
if (i >= slice.getLength()) {
|
||||
buf.append("<td></td>");
|
||||
continue;
|
||||
}
|
||||
int char18 = slice.getStart() + i;
|
||||
String char18Str = FourCornerUnicodeDisplay.text().renderFromInt18(List.of(char18));
|
||||
buf.append("<td>");
|
||||
for (int c : char18Str.codePoints().toArray()) {
|
||||
if (c == '\u0000') {
|
||||
buf.append("␀");
|
||||
} else {
|
||||
buf.appendCodePoint(c);
|
||||
}
|
||||
}
|
||||
buf.append("</td>");
|
||||
}
|
||||
buf.append("</tr>\n");
|
||||
}
|
||||
|
||||
private void writePIN(StringBuilder buf) {
|
||||
for (int t=0; t<27;t++) {
|
||||
buf.append("<tr>");
|
||||
buf.append("<td>T");
|
||||
buf.append(String.format("%03d", t + 1));
|
||||
buf.append("</td>");
|
||||
for (int i=0; i<27;i++) {
|
||||
if (i > t) {
|
||||
buf.append("<td></td>");
|
||||
continue;
|
||||
}
|
||||
List<Integer> piNum = new ArrayList<>();
|
||||
//piNum.add(FCDotCDC1604DashP6.__NCR68.ordinal());\
|
||||
for (int letter : FCDotDEC0127DashPX0.ESC68_NCR.baklavaPoints()) {
|
||||
piNum.add(letter);
|
||||
}
|
||||
piNum.add(FCDotCDC1604DashP6.NX01_A.ordinal() + t);
|
||||
piNum.add(FCDotCDC1604DashP6.NX01_A.ordinal() + i);
|
||||
String char18Str = FourCornerUnicodeDisplay.text().renderFromInt18(piNum);
|
||||
buf.append("<td>");
|
||||
for (int c : char18Str.codePoints().toArray()) {
|
||||
if (c == '\u0000') {
|
||||
buf.append("␀");
|
||||
} else {
|
||||
buf.appendCodePoint(c);
|
||||
}
|
||||
}
|
||||
buf.append("</td>");
|
||||
}
|
||||
buf.append("</tr>\n");
|
||||
}
|
||||
}
|
||||
|
||||
private void writeTableStart28(StringBuilder buf) {
|
||||
buf.append("<table border=\"1px\">\n");
|
||||
buf.append("<tr>");
|
||||
buf.append("<th></th>");
|
||||
for (int i=0; i<27;i++) {
|
||||
buf.append("<th>");
|
||||
buf.append(i + 1);
|
||||
buf.append("</th>");
|
||||
}
|
||||
buf.append("</tr>\n");
|
||||
}
|
||||
|
||||
private void writeTableStart17(StringBuilder buf) {
|
||||
buf.append("<table border=\"1px\">\n");
|
||||
buf.append("<tr>");
|
||||
buf.append("<th></th>");
|
||||
for (int i=0; i<16;i++) {
|
||||
buf.append("<th>0x");
|
||||
buf.append(Integer.toHexString(i).toUpperCase());
|
||||
buf.append("</th>");
|
||||
}
|
||||
buf.append("</tr>\n");
|
||||
}
|
||||
|
||||
private void writeTableEnd(StringBuilder buf) {
|
||||
buf.append("</table>\n");
|
||||
}
|
||||
|
||||
private void writeTitle1(StringBuilder buf, String title) {
|
||||
buf.append("\n# ");
|
||||
buf.append(title);
|
||||
buf.append("\n\n");
|
||||
}
|
||||
|
||||
private void writeTitle2(StringBuilder buf, String title) {
|
||||
buf.append("\n## ");
|
||||
buf.append(title);
|
||||
buf.append("\n\n");
|
||||
}
|
||||
|
||||
private void writeTitle3(StringBuilder buf, String title) {
|
||||
buf.append("\n### ");
|
||||
buf.append(title);
|
||||
buf.append("\n\n");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.fc18.tdoc;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.o2o.io.ContentWriterHtml.Tag;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentCss;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentWriter;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocPage;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocPageWriter;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
/**
|
||||
* Cake doc stack page writer.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 17, 2025
|
||||
*/
|
||||
public class FCDocPageWriterCakeTower implements ApiDocPageWriter {
|
||||
|
||||
public static ApiDocPage createDocPage() {
|
||||
return new ApiDocPage("overview-tower","Tower","Overview of the cake tower.",new FCDocPageWriterCakeTower());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writePageContent(ApiDocWriteEvent<ApiDocPage> e) throws SAXException, IOException {
|
||||
ApiDocContentWriter writer = e.getWriter();
|
||||
try (Closeable content = writer.docPageContent()) {
|
||||
try (Closeable table = writer.docTable("Cake Splices", null, ApiDocContentCss.overviewSummary)) {
|
||||
writeTableBoxHeader(writer, new String[] {"Name", "Start", "Stop", "Size"});
|
||||
for (FourCornerDotCake slice : FourCornerDotCake.values()) {
|
||||
writeCake(e, slice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void writeCake(ApiDocWriteEvent<ApiDocPage> e, FourCornerDotCake slice) throws SAXException, IOException {
|
||||
String rootId = e.getDoc().getRootNode().getId();
|
||||
ApiDocContentWriter writer = e.getWriter();
|
||||
try (Closeable tableRow = writer.docTableRow()) {
|
||||
writer.printTagStart(Tag.td, ApiDocContentCss.colFirst);
|
||||
if (slice.ordinal() >= e.getDoc().getRootNode().getNodes().size()) {
|
||||
writer.printCharacters(slice.nameSpec());
|
||||
} else {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(ApiDocContentWriter.toSafeUri(rootId));
|
||||
buf.append("/");
|
||||
buf.append(ApiDocContentWriter.toSafeUri(slice.name()));
|
||||
buf.append("/index.html");
|
||||
writer.printHref(buf.toString(), slice.description(), slice.nameSpec(), "strong"); // TODO: reverse href method arguments
|
||||
}
|
||||
writer.printTagEnd(Tag.td);
|
||||
|
||||
writer.printTagStart(Tag.td, ApiDocContentCss.colOne);
|
||||
writer.printCharacters(String.format("0x%06X", slice.getStart()));
|
||||
writer.printTagEnd(Tag.td);
|
||||
|
||||
writer.printTagStart(Tag.td, ApiDocContentCss.colLast);
|
||||
writer.printCharacters(String.format("0x%06X", slice.getStop()));
|
||||
writer.printTagEnd(Tag.td);
|
||||
|
||||
writer.printTagStart(Tag.td, ApiDocContentCss.colLast);
|
||||
writer.printCharacters(String.format("%d", slice.getLength()));
|
||||
writer.printTagEnd(Tag.td);
|
||||
}
|
||||
}
|
||||
|
||||
private void writeTableBoxHeader(ApiDocContentWriter writer, String[] headers) throws SAXException {
|
||||
writer.printTagStart(Tag.tr);
|
||||
AttributesImpl atts;
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
atts = new AttributesImpl();
|
||||
if (i == 0) {
|
||||
atts.addAttribute ("", "class", "", "", ApiDocContentCss.colFirst.name());
|
||||
} else if (i == 1) {
|
||||
atts.addAttribute ("", "class", "", "", ApiDocContentCss.colOne.name());
|
||||
} else {
|
||||
atts.addAttribute ("", "class", "", "", ApiDocContentCss.colLast.name());
|
||||
}
|
||||
atts.addAttribute ("", "scope", "", "", "col");
|
||||
writer.printTagStart(Tag.th, atts);
|
||||
writer.printCharacters(headers[i]);
|
||||
writer.printTagEnd(Tag.th);
|
||||
}
|
||||
writer.printTagEnd(Tag.tr);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,337 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.fc18.tdoc;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.x4o.fc18.FourCornerUnicodeDisplay;
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotAPL0127DashP7A;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotAPL0127DashP7B;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotAPL0127DashP7C;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotBYD0127DashP7D;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotBYD0127DashP7E;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotBYD0127DashP7F;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotDEC0127DashPX0;
|
||||
import org.x4o.o2o.io.ContentWriterHtml.Tag;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentCss;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentWriter;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocPage;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocPageWriter;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
/**
|
||||
* Cake doc muffin page writer.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 17, 2025
|
||||
*/
|
||||
public class FCDocPageWriterMuffin implements ApiDocPageWriter {
|
||||
|
||||
public static ApiDocPage createDocPage() {
|
||||
return new ApiDocPage("overview-muffin","Muffins","Overview of all muffin symbols.",new FCDocPageWriterMuffin());
|
||||
}
|
||||
|
||||
// TODO: make all symbols href links
|
||||
|
||||
@Override
|
||||
public void writePageContent(ApiDocWriteEvent<ApiDocPage> e) throws SAXException, IOException {
|
||||
ApiDocContentWriter writer = e.getWriter();
|
||||
try (Closeable content = writer.docPageContent()) {
|
||||
try (Closeable table = writer.docTable(FourCornerDotCake.FC_CDC1604_P6.nameSpec(), null, ApiDocContentCss.overviewSummary)) {
|
||||
writeTableBoxHeader(writer, 17);
|
||||
writeCDC(writer, 0x00);
|
||||
writeCDC(writer, 0x10);
|
||||
writeCDC(writer, 0x20);
|
||||
writeCDC(writer, 0x30);
|
||||
}
|
||||
}
|
||||
try (Closeable content = writer.docPageContent()) {
|
||||
String xSpec = FourCornerDotCake.FC_APL0127_P7A.nameSpec().replaceAll("P7A", "P7x");
|
||||
try (Closeable table = writer.docTable(xSpec, null, ApiDocContentCss.overviewSummary)) {
|
||||
writeTableBoxHeader(writer, 28, true);
|
||||
writeP7x(writer, FourCornerDotCake.FC_APL0127_P7A, v -> FCDotAPL0127DashP7A.valueOf(v).codePoints()[0]);
|
||||
writeP7x(writer, FourCornerDotCake.FC_APL0127_P7B, v -> FCDotAPL0127DashP7B.valueOf(v).codePoints()[0]);
|
||||
writeP7x(writer, FourCornerDotCake.FC_APL0127_P7C, v -> FCDotAPL0127DashP7C.valueOf(v).codePoints()[0]);
|
||||
}
|
||||
}
|
||||
try (Closeable content = writer.docPageContent()) {
|
||||
String xSpec = FourCornerDotCake.FC_BYD0127_P7D.nameSpec().replaceAll("P7D", "P7x");
|
||||
try (Closeable table = writer.docTable(xSpec, null, ApiDocContentCss.overviewSummary)) {
|
||||
writeTableBoxHeader(writer, 28, true);
|
||||
writeP7x(writer, FourCornerDotCake.FC_BYD0127_P7D, v -> FCDotBYD0127DashP7D.valueOf(v).codePoints()[0]);
|
||||
writeP7x(writer, FourCornerDotCake.FC_BYD0127_P7E, v -> FCDotBYD0127DashP7E.valueOf(v).codePoints()[0]);
|
||||
writeP7x(writer, FourCornerDotCake.FC_BYD0127_P7F, v -> FCDotBYD0127DashP7F.valueOf(v).codePoints()[0]);
|
||||
}
|
||||
}
|
||||
try (Closeable content = writer.docPageContent()) {
|
||||
String xSpec = FourCornerDotCake.FC_PIE9C_01.nameSpec().replaceAll("01", "baklava");
|
||||
try (Closeable table = writer.docTable(xSpec, null, ApiDocContentCss.overviewSummary)) {
|
||||
writeTableBoxHeader(writer, 28, true);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_01);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_02);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_03);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_04);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_05);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_06);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_07);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_08);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_09);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_10);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_11);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_12);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_13);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_14);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_15);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_16);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_17);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_18);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_19);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_20);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_21);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_22);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_23);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_24);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_25);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_26);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9C_27);
|
||||
}
|
||||
}
|
||||
try (Closeable content = writer.docPageContent()) {
|
||||
String xSpec = FourCornerDotCake.FC_PIE9D_01.nameSpec().replaceAll("01", "baklava");
|
||||
try (Closeable table = writer.docTable(xSpec, null, ApiDocContentCss.overviewSummary)) {
|
||||
writeTableBoxHeader(writer, 28, true);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_01);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_02);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_03);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_04);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_05);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_06);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_07);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_08);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_09);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_10);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_11);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_12);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_13);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_14);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_15);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_16);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_17);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_18);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_19);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_20);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_21);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_22);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_23);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_24);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_25);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_26);
|
||||
writePIE(writer, FourCornerDotCake.FC_PIE9D_27);
|
||||
}
|
||||
}
|
||||
try (Closeable content = writer.docPageContent()) {
|
||||
try (Closeable table = writer.docTable(FourCornerDotCake.FC_NCR1632_XD.nameSpec().replaceAll("XD", "baklava"), null, ApiDocContentCss.overviewSummary)) {
|
||||
writeTableBoxHeader(writer, 28);
|
||||
writePIN(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void writePIN(ApiDocContentWriter writer) throws SAXException, IOException {
|
||||
for (int t = 0; t < 27; t++) {
|
||||
try (Closeable tableRow = writer.docTableRow()) {
|
||||
String prefixNCR = String.format("T%03d", t + 1);
|
||||
writer.printTagStart(Tag.td, ApiDocContentCss.colOne);
|
||||
writer.printCharacters(prefixNCR);
|
||||
writer.printTagEnd(Tag.td);
|
||||
for (int i = 0; i < 27; i++) {
|
||||
if (i + 1 < 27) {
|
||||
writer.printTagStart(Tag.td);
|
||||
} else {
|
||||
writer.printTagStart(Tag.td, ApiDocContentCss.colLast);
|
||||
}
|
||||
if (i > t) {
|
||||
writer.printTagEnd(Tag.td);
|
||||
continue;
|
||||
}
|
||||
List<Integer> piNum = new ArrayList<>();
|
||||
//piNum.add(FCDotCDC1604DashP6.__NCR68.ordinal());\
|
||||
for (int letter : FCDotDEC0127DashPX0.ESC68_NCR.baklavaPoints()) {
|
||||
piNum.add(letter);
|
||||
}
|
||||
piNum.add(FCDotCDC1604DashP6.NX01_A.ordinal() + t);
|
||||
piNum.add(FCDotCDC1604DashP6.NX01_A.ordinal() + i);
|
||||
String char18Str = FourCornerUnicodeDisplay.text().renderFromInt18(piNum);
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int c : char18Str.codePoints().toArray()) {
|
||||
if (c == '\u0000') {
|
||||
buf.append("␀");
|
||||
} else {
|
||||
buf.appendCodePoint(c);
|
||||
}
|
||||
}
|
||||
writer.printCharacters(buf.toString());
|
||||
writer.printTagEnd(Tag.td);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void writePIE(ApiDocContentWriter writer, FourCornerDotCake slice) throws IOException, SAXException {
|
||||
try (Closeable tableRow = writer.docTableRow()) {
|
||||
String prefixHex = String.format("0x%06X", slice.getStart());
|
||||
writer.printTagStart(Tag.td, ApiDocContentCss.colFirst);
|
||||
writer.printCharacters(prefixHex);
|
||||
writer.printTagEnd(Tag.td);
|
||||
writer.printTagStart(Tag.td, ApiDocContentCss.colOne);
|
||||
writer.printCharacters(slice.nameSpec());
|
||||
writer.printTagEnd(Tag.td);
|
||||
for (int i = 0; i < 27; i++) {
|
||||
if (i + 1 < 27) {
|
||||
writer.printTagStart(Tag.td);
|
||||
} else {
|
||||
writer.printTagStart(Tag.td, ApiDocContentCss.colLast);
|
||||
}
|
||||
if (i >= slice.getLength()) {
|
||||
writer.printTagEnd(Tag.td);
|
||||
continue;
|
||||
}
|
||||
int char18 = slice.getStart() + i;
|
||||
String char18Str = FourCornerUnicodeDisplay.text().renderFromInt18(List.of(char18));
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int c : char18Str.codePoints().toArray()) {
|
||||
if (c == '\u0000') {
|
||||
buf.append("␀");
|
||||
} else {
|
||||
buf.appendCodePoint(c);
|
||||
}
|
||||
}
|
||||
writer.printCharacters(buf.toString());
|
||||
writer.printTagEnd(Tag.td);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void writeP7x(ApiDocContentWriter writer, FourCornerDotCake slice, Function<Integer, Integer> conv) throws SAXException, IOException {
|
||||
String prefixHex = String.format("0x%06X", slice.getStart());
|
||||
try (Closeable tableRow = writer.docTableRow()) {
|
||||
writer.printTagStart(Tag.td, ApiDocContentCss.colFirst);
|
||||
writer.printCharacters(prefixHex);
|
||||
writer.printTagEnd(Tag.td);
|
||||
writer.printTagStart(Tag.td, ApiDocContentCss.colOne);
|
||||
writer.printCharacters(slice.nameSpec());
|
||||
writer.printTagEnd(Tag.td);
|
||||
for (int i = 0; i < 27; i++) {
|
||||
int codePoint = conv.apply(i);
|
||||
if (i + 1 < 27) {
|
||||
writer.printTagStart(Tag.td);
|
||||
} else {
|
||||
writer.printTagStart(Tag.td, ApiDocContentCss.colLast);
|
||||
}
|
||||
StringBuilder buf = new StringBuilder();
|
||||
if (codePoint == '\u0000') {
|
||||
buf.append("␀");
|
||||
} else {
|
||||
buf.appendCodePoint(codePoint);
|
||||
}
|
||||
writer.printCharacters(buf.toString());
|
||||
writer.printTagEnd(Tag.td);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void writeCDC(ApiDocContentWriter writer, int off) throws SAXException, IOException {
|
||||
String prefixHex = String.format("0x%05X0", off >> 4);
|
||||
try (Closeable tableRow = writer.docTableRow()) {
|
||||
writer.printTagStart(Tag.td, ApiDocContentCss.colOne);
|
||||
writer.printCharacters(prefixHex);
|
||||
writer.printTagEnd(Tag.td);
|
||||
for (int i = off; i < 16 + off; i++) {
|
||||
FCDotCDC1604DashP6 cdc = FCDotCDC1604DashP6.valueOf(i);
|
||||
int codePoint = cdc.codePoints()[0];
|
||||
if (i + 1 < 16 + off) {
|
||||
writer.printTagStart(Tag.td);
|
||||
} else {
|
||||
writer.printTagStart(Tag.td, ApiDocContentCss.colLast);
|
||||
}
|
||||
StringBuilder buf = new StringBuilder();
|
||||
if (codePoint == '\u0000') {
|
||||
buf.append("␀");
|
||||
} else if (codePoint == '\u0001') {
|
||||
buf.append("␁");
|
||||
} else if (codePoint == '\u0002') {
|
||||
buf.append("␂");
|
||||
} else if (codePoint == '\u0003') {
|
||||
buf.append("␃");
|
||||
} else if (codePoint == ' ') {
|
||||
buf.append("␠");
|
||||
} else if (codePoint == '\n') {
|
||||
buf.append("␊");
|
||||
} else {
|
||||
buf.appendCodePoint(codePoint);
|
||||
}
|
||||
writer.printCharacters(buf.toString());
|
||||
writer.printTagEnd(Tag.td);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void writeTableBoxHeader(ApiDocContentWriter writer, int num) throws SAXException {
|
||||
writeTableBoxHeader(writer, num, false);
|
||||
}
|
||||
|
||||
private void writeTableBoxHeader(ApiDocContentWriter writer, int num, boolean colFirst) throws SAXException {
|
||||
writer.printTagStart(Tag.tr);
|
||||
AttributesImpl atts;
|
||||
if (colFirst) {
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "class", "", "", ApiDocContentCss.colFirst.name());
|
||||
atts.addAttribute ("", "scope", "", "", "col");
|
||||
writer.printTagStart(Tag.th, atts);
|
||||
writer.printTagEnd(Tag.th);
|
||||
}
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "class", "", "", ApiDocContentCss.colOne.name());
|
||||
atts.addAttribute ("", "scope", "", "", "col");
|
||||
writer.printTagStart(Tag.th, atts);
|
||||
writer.printTagEnd(Tag.th);
|
||||
for (int i = 0; i < num - 1; i++) {
|
||||
atts = new AttributesImpl();
|
||||
atts.addAttribute ("", "class", "", "", ApiDocContentCss.colLast.name());
|
||||
atts.addAttribute ("", "scope", "", "", "col");
|
||||
writer.printTagStart(Tag.th, atts);
|
||||
writer.printCharacters("0x");
|
||||
writer.printCharacters(Integer.toHexString(i).toUpperCase());
|
||||
writer.printTagEnd(Tag.th);
|
||||
}
|
||||
writer.printTagEnd(Tag.tr);
|
||||
}
|
||||
}
|
183
nx01-x4o-fc18/src/test/java/org/x4o/fc18/tdoc/FCDocWriter.java
Normal file
183
nx01-x4o-fc18/src/test/java/org/x4o/fc18/tdoc/FCDocWriter.java
Normal file
|
@ -0,0 +1,183 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.fc18.tdoc;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.o2o.tdoc.ApiDocGenerator;
|
||||
import org.x4o.o2o.tdoc.DefaultPageWriterHelp;
|
||||
import org.x4o.o2o.tdoc.DefaultPageWriterTree;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDoc;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocConcept;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocNode;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Cake doc writer.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 17, 2025
|
||||
*/
|
||||
public class FCDocWriter {
|
||||
|
||||
private static final String[] C_FC_ROOT = {"fc-root","Wedding","All cake slices.","The cake slices of the four corner cake tower."};
|
||||
private static final String[] C_FC_SLICE = {"fc-slice","Cake","The cake slice information.","The four corner cake slice provides the layout of boundries."};
|
||||
private static final String[] C_FC_WORD = {"fc-word","Word","An FC18 word.","The word of an number."};
|
||||
|
||||
private ApiDocGenerator writer = null;
|
||||
private ApiDoc doc = null;
|
||||
|
||||
static public void main(String[] args) {
|
||||
Iterator<String> arguments = Arrays.asList(args).iterator();
|
||||
String outputFolder = null;
|
||||
Integer stopCakePoint = null;
|
||||
while (arguments.hasNext()) {
|
||||
String arg = arguments.next();
|
||||
if ("-output".equals(arg)) {
|
||||
if (!arguments.hasNext()) {
|
||||
System.err.println("No output folder given.");
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
outputFolder = arguments.next();
|
||||
}
|
||||
if ("-stop".equals(arg)) {
|
||||
if (!arguments.hasNext()) {
|
||||
System.err.println("No stop argument given, try; 255");
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
String stopNum = arguments.next();
|
||||
stopCakePoint = Integer.parseInt(stopNum);
|
||||
}
|
||||
}
|
||||
if (outputFolder == null) {
|
||||
System.err.println("Missing output argument");
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
System.out.println("Writing fcdoc, ... it takes a while ...");
|
||||
if (stopCakePoint != null) {
|
||||
System.out.println("Writing fcdoc, stop requested at: " + stopCakePoint);
|
||||
}
|
||||
FCDocWriter run = new FCDocWriter(stopCakePoint);
|
||||
try {
|
||||
File out = new File(outputFolder);
|
||||
//out.mkdir();
|
||||
run.writeModelDoc(out);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Writing fcdoc, DONE");
|
||||
}
|
||||
|
||||
public FCDocWriter(Integer stopCakePoint) {
|
||||
this.doc = buildApiDoc(new TDocCake(), stopCakePoint);
|
||||
this.writer = new ApiDocGenerator(); // TODO: fix the cake "frame" links
|
||||
}
|
||||
|
||||
public ApiDoc getApiDoc() {
|
||||
return doc;
|
||||
}
|
||||
|
||||
public void writeModelDoc(File basePath) throws IOException, SAXException {
|
||||
doc.checkModel();
|
||||
writer.write(doc,basePath);
|
||||
}
|
||||
|
||||
private ApiDoc buildApiDoc(TDocCake docCake, Integer stopCakePoint) {
|
||||
ApiDoc doc = new ApiDoc();
|
||||
doc.setName("FourCorner");
|
||||
doc.setDescription("FourCorner 18 bit text encoding format.");
|
||||
doc.setDocAbout("FourCorner Indexes\nThe World Of Words.");
|
||||
doc.createDocCopyright(System.getProperty("user.name"), "תשפ״ה"); // use hebrew quotation mark, the interweb uses latin which break unicode rendering
|
||||
doc.setDocPageSubTitle("FC18-Alpha1");
|
||||
doc.addMetaKeywordAll(List.of("FC18", "documentation", "four-corner", "china", "MSX"));
|
||||
doc.setNoFrameAllName("All cake slices");
|
||||
doc.setFrameNavOverviewPrintParent(true);
|
||||
doc.setFrameNavPrintParent(true);
|
||||
doc.setFrameNavPrintParentParent(true);
|
||||
doc.setGroupTypeName("summary", "Summary",1);
|
||||
doc.setGroupTypeName("overview", "Overview",2);
|
||||
|
||||
//doc.addTreeNodeClassExclude();
|
||||
doc.setFrameNavConceptClass(TDocCakeWord.class);
|
||||
|
||||
doc.addTreeNodePageModeClass(TDocCake.class);
|
||||
doc.addTreeNodePageModeClass(FourCornerDotCake.class);
|
||||
|
||||
doc.addAnnotatedClasses(FCDocWriterCake.class);
|
||||
doc.addAnnotatedClasses(FCDocWriterCakeWord.class);
|
||||
|
||||
ApiDocConcept adc1 = doc.addConcept(new ApiDocConcept(null,C_FC_ROOT,TDocCake.class));
|
||||
ApiDocConcept adc2 = doc.addConcept(new ApiDocConcept(adc1,C_FC_SLICE,FourCornerDotCake.class));
|
||||
ApiDocConcept adc3 = doc.addConcept(new ApiDocConcept(adc2,C_FC_WORD,TDocCakeWord.class));
|
||||
|
||||
//ApiDocConcept adc4 = doc.addConcept(new ApiDocConcept(adc3,C_TABLE,Table.class));
|
||||
//adc4.addChildConcepts(new ApiDocConcept(adc4, CC_RS, Relationship.class));
|
||||
|
||||
doc.addDocPage(FCDocPageWriterMuffin.createDocPage());
|
||||
doc.addDocPage(FCDocPageWriterCakeTower.createDocPage());
|
||||
doc.addDocPage(DefaultPageWriterTree.createDocPage());
|
||||
//doc.addDocPage(DefaultPageWriterIndexAll.createDocPage());
|
||||
doc.addDocPage(DefaultPageWriterHelp.createDocPage());
|
||||
|
||||
ApiDocNode rootNode = new ApiDocNode(docCake,"fc-root","WeddingNode","All cake slices in four corner.");
|
||||
doc.setRootNode(rootNode);
|
||||
for (FourCornerDotCake dotCake : FourCornerDotCake.values()) {
|
||||
if (stopCakePoint != null && dotCake.getStart() > stopCakePoint) {
|
||||
break;
|
||||
}
|
||||
if (FourCornerDotCake.__RESERVED_WORDS.equals(dotCake)) {
|
||||
continue;
|
||||
}
|
||||
if (FourCornerDotCake.FC_UNI2K_11.ordinal() <= dotCake.ordinal()) {
|
||||
continue; // TODO: add as other class
|
||||
}
|
||||
ApiDocNode sliceNode = rootNode.addNode(createNodeCakeSlice(dotCake));
|
||||
|
||||
// TODO: maybe add extra grouping layer, as the `setFrameNavConceptClass` list is too big
|
||||
|
||||
for (int i = 0; i < dotCake.getLength(); i++) {
|
||||
ApiDocNode wordNode = sliceNode.addNode(createNodeCakeWord(dotCake, i));
|
||||
}
|
||||
|
||||
// TODO: print full 21 bit unicode range too
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
|
||||
private ApiDocNode createNodeCakeSlice(FourCornerDotCake dotCake) {
|
||||
return new ApiDocNode(dotCake,dotCake.name(),dotCake.nameSpec(),dotCake.description());
|
||||
}
|
||||
private ApiDocNode createNodeCakeWord(FourCornerDotCake dotCake, int offset) {
|
||||
int cakePoint = dotCake.getStart() + offset;
|
||||
String name = String.format("%s.0x%06X", dotCake.name(), cakePoint);
|
||||
return new ApiDocNode(new TDocCakeWord(dotCake, offset),name,name,name);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.fc18.tdoc;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.x4o.o2o.io.ContentWriterHtml.Tag;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentWriter;
|
||||
import org.x4o.o2o.tdoc.ApiDocNodeWriterMethod;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocNode;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocNodeBody;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Cake doc slice writer.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 17, 2025
|
||||
*/
|
||||
public class FCDocWriterCake {
|
||||
|
||||
private final String[] FC_FEATURES = new String[] {
|
||||
"VT-06 terminal control for CDC1604(1960) 6 bit main frames",
|
||||
"Has underscored letters to migrate EBCDIC(1963) APL code from z/OS",
|
||||
"Program with (local) words not with lettersssss",
|
||||
"New Counting Rods, define up to 576 bit fractions",
|
||||
"Use datagrams for decimals/hex/bits to render for china locale",
|
||||
"Embed 21 bit unicode for 6/8 and 18 bit computers",
|
||||
"The lower 6/8 bit part is pattern graphic renderable",
|
||||
"Supports the CP/M plus(1983) block graphics",
|
||||
"Contains the BIP0039(2013) keyword encoding too",
|
||||
};
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.DESCRIPTION_NODE,targetClasses={TDocCake.class})
|
||||
public void writeSchemaViewSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
ApiDocContentWriter writer = event.getWriter();
|
||||
writer.printCharacters("Four corner is 18 bit text encoding for 144 bit computers.");
|
||||
writer.printTagStartEnd(Tag.br);
|
||||
writer.printTagStartEnd(Tag.br);
|
||||
writer.printCharacters("Features;");
|
||||
try (Closeable content = writer.docPageContent()) {
|
||||
writer.printTagStart(Tag.ul);
|
||||
for (String feature : FC_FEATURES) {
|
||||
writer.printTagStart(Tag.li,"",null,"circle");
|
||||
writer.printCharacters(feature);
|
||||
writer.printTagEnd(Tag.li);
|
||||
}
|
||||
writer.printTagEnd(Tag.ul);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.fc18.tdoc;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerX00PetitVidePoints;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentCss;
|
||||
import org.x4o.o2o.tdoc.ApiDocContentWriter;
|
||||
import org.x4o.o2o.tdoc.ApiDocNodeWriterMethod;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocNode;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocNodeBody;
|
||||
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Cake doc word writer.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 17, 2025
|
||||
*/
|
||||
public class FCDocWriterCakeWord {
|
||||
|
||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={TDocCakeWord.class})
|
||||
public void writeSchemaViewSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException {
|
||||
ApiDocContentWriter writer = event.getWriter();
|
||||
TDocCakeWord word = (TDocCakeWord)event.getEventObject().getUserData();
|
||||
FourCornerX00PetitVidePoints[] videPoints = word.getSlice().getVidePoints();
|
||||
if (videPoints.length == 0) {
|
||||
return;
|
||||
}
|
||||
writer.docTableStart("Points Summary", "Encode point for all systems.",ApiDocContentCss.overviewSummary);
|
||||
writer.docTableHeader("System", "Point Sequence");
|
||||
FourCornerX00PetitVidePoints videPoint = videPoints[word.getOffset()];
|
||||
if (videPoint.isX06()) {
|
||||
writeSequence(writer, "X06", videPoint.toX06().baklavaPoints());
|
||||
}
|
||||
if (videPoint.isX08()) {
|
||||
writeSequence(writer, "X08", videPoint.toX08().muffinPoints());
|
||||
}
|
||||
if (videPoint.isX18()) {
|
||||
writeSequence(writer, "X18", videPoint.toX18().cakePoints());
|
||||
}
|
||||
if (videPoint.isX21()) {
|
||||
writeSequence(writer, "X21", videPoint.toX21().codePoints());
|
||||
}
|
||||
writer.docTableEnd();
|
||||
}
|
||||
|
||||
private void writeSequence(ApiDocContentWriter writer, String system, int[] sequence) throws SAXException, IOException {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int i = 0; i < sequence.length; i++) {
|
||||
int seq = sequence[i];
|
||||
String hex = String.format("0x%02X", seq);
|
||||
buf.append(hex);
|
||||
if (i + 1 < sequence.length) {
|
||||
buf.append(" - ");
|
||||
}
|
||||
}
|
||||
writer.docTableRow(system, buf.toString());
|
||||
}
|
||||
}
|
35
nx01-x4o-fc18/src/test/java/org/x4o/fc18/tdoc/TDocCake.java
Normal file
35
nx01-x4o-fc18/src/test/java/org/x4o/fc18/tdoc/TDocCake.java
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.fc18.tdoc;
|
||||
|
||||
/**
|
||||
* Cake root doc model type.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 17, 2025
|
||||
*/
|
||||
public class TDocCake {
|
||||
|
||||
public TDocCake() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.fc18.tdoc;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
|
||||
/**
|
||||
* Cake word doc model type.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 17, 2025
|
||||
*/
|
||||
public class TDocCakeWord {
|
||||
|
||||
private final FourCornerDotCake slice;
|
||||
private final int offset;
|
||||
|
||||
public TDocCakeWord(FourCornerDotCake slice, int offset) {
|
||||
this.slice = Objects.requireNonNull(slice);
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public FourCornerDotCake getSlice() {
|
||||
return slice;
|
||||
}
|
||||
|
||||
public int getOffset() {
|
||||
return offset;
|
||||
}
|
||||
}
|
|
@ -22,6 +22,7 @@
|
|||
*/
|
||||
package org.x4o.o2o.tdoc;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
|
@ -58,7 +59,7 @@ public interface ApiDocContentPrinter {
|
|||
link.setHref(null);
|
||||
}
|
||||
|
||||
default void printApiTable(ApiDocWriteEvent<ApiDocNode> event,String name,Class<?> interfaceClass) throws SAXException {
|
||||
default void printApiTable(ApiDocWriteEvent<ApiDocNode> event,String name,Class<?> interfaceClass) throws SAXException, IOException {
|
||||
printApiTable(
|
||||
event.getEventObject(),
|
||||
filterUserDataClassType(event.getEventObject(),interfaceClass),
|
||||
|
@ -67,7 +68,7 @@ public interface ApiDocContentPrinter {
|
|||
);
|
||||
}
|
||||
|
||||
default void printApiTable(ApiDocNode parent,List<ApiDocNode> nodes,ApiDocContentWriter writer,String name) throws SAXException {
|
||||
default void printApiTable(ApiDocNode parent,List<ApiDocNode> nodes,ApiDocContentWriter writer,String name) throws SAXException, IOException {
|
||||
if (nodes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -93,19 +94,19 @@ public interface ApiDocContentPrinter {
|
|||
return result;
|
||||
}
|
||||
|
||||
default void printApiTableBean(ApiDocWriteEvent<ApiDocNode> event,String name,String...skipProperties) throws SAXException {
|
||||
default void printApiTableBean(ApiDocWriteEvent<ApiDocNode> event,String name,String...skipProperties) throws SAXException, IOException {
|
||||
printApiTableBean(event.getDoc(), event.getWriter(), event.getEventObject().getUserData(), name, skipProperties);
|
||||
}
|
||||
|
||||
default void printApiTableBean(ApiDoc doc,ApiDocContentWriter writer,Object bean,String name,String...skipProperties) throws SAXException {
|
||||
default void printApiTableBean(ApiDoc doc,ApiDocContentWriter writer,Object bean,String name,String...skipProperties) throws SAXException, IOException {
|
||||
printApiTableBeanClass(doc, writer, bean, bean.getClass(), name, skipProperties);
|
||||
}
|
||||
|
||||
default void printApiTableBeanClass(ApiDocWriteEvent<ApiDocNode> event,Class<?> beanClass,String name,String...skipProperties) throws SAXException {
|
||||
default void printApiTableBeanClass(ApiDocWriteEvent<ApiDocNode> event,Class<?> beanClass,String name,String...skipProperties) throws SAXException, IOException {
|
||||
printApiTableBeanClass(event.getDoc(), event.getWriter(), null,beanClass, name, skipProperties);
|
||||
}
|
||||
|
||||
private void printApiTableBeanClass(ApiDoc doc,ApiDocContentWriter writer,Object bean,Class<?> beanClass,String name,String...skipProperties) throws SAXException {
|
||||
private void printApiTableBeanClass(ApiDoc doc,ApiDocContentWriter writer,Object bean,Class<?> beanClass,String name,String...skipProperties) throws SAXException, IOException {
|
||||
writer.docTableStart(name+" Properties", name+" properties overview.",ApiDocContentCss.overviewSummary);
|
||||
writer.docTableHeader("Name", "Value");
|
||||
for (Method m:beanClass.getMethods()) {
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
*/
|
||||
package org.x4o.o2o.tdoc;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -38,7 +40,7 @@ import org.xml.sax.helpers.AttributesImpl;
|
|||
*/
|
||||
public class ApiDocContentWriter extends ContentWriterHtml {
|
||||
|
||||
private boolean isAltRow = true;
|
||||
private boolean isRowAlt = false;
|
||||
|
||||
public ApiDocContentWriter(Writer out,String encoding) {
|
||||
super(out,encoding);
|
||||
|
@ -143,6 +145,11 @@ public class ApiDocContentWriter extends ContentWriterHtml {
|
|||
printComment("======== END OF CLASS DATA ========");
|
||||
}
|
||||
|
||||
public Closeable docPageContent() throws SAXException {
|
||||
docPageContentStart();
|
||||
return printAutoClosable(() -> docPageContentEnd());
|
||||
}
|
||||
|
||||
public void docPageContentStart() throws SAXException {
|
||||
printTagStart(Tag.div,ApiDocContentCss.contentContainer);
|
||||
}
|
||||
|
@ -175,7 +182,13 @@ public class ApiDocContentWriter extends ContentWriterHtml {
|
|||
printTagStart(Tag.li,ApiDocContentCss.blockList);
|
||||
}
|
||||
|
||||
public Closeable docTable(String tableTitle, String tableDescription, ApiDocContentCss tableCss) throws SAXException {
|
||||
docTableStart(tableTitle, tableDescription, tableCss);
|
||||
return printAutoClosable(() -> docTableEnd());
|
||||
}
|
||||
|
||||
public void docTableStart(String tableTitle, String tableDescription, ApiDocContentCss tableCss) throws SAXException {
|
||||
isRowAlt = false;
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
if (tableCss != null) {
|
||||
atts.addAttribute ("", "class", "", "", tableCss.name());
|
||||
|
@ -196,7 +209,6 @@ public class ApiDocContentWriter extends ContentWriterHtml {
|
|||
|
||||
public void docTableEnd() throws SAXException {
|
||||
printTagEnd(Tag.table);
|
||||
isAltRow = true;
|
||||
}
|
||||
|
||||
public void docTableHeader(String titleFirst,String titleLast) throws SAXException {
|
||||
|
@ -224,19 +236,19 @@ public class ApiDocContentWriter extends ContentWriterHtml {
|
|||
printTagEnd(Tag.tr);
|
||||
}
|
||||
|
||||
public void docTableRowLink(String dataFirstHref,String dataFirst,String dataLast) throws SAXException {
|
||||
public void docTableRowLink(String dataFirstHref,String dataFirst,String dataLast) throws SAXException, IOException {
|
||||
docTableRowHref(dataFirstHref,dataFirst,dataLast,null,false,false,false);
|
||||
}
|
||||
|
||||
public void docTableRow(String dataFirst,String dataLast) throws SAXException {
|
||||
public void docTableRow(String dataFirst,String dataLast) throws SAXException, IOException {
|
||||
docTableRow(dataFirst,dataLast,null);
|
||||
}
|
||||
|
||||
public void docTableRow(String dataFirst,String dataLast,String dataBlock) throws SAXException {
|
||||
public void docTableRow(String dataFirst,String dataLast,String dataBlock) throws SAXException, IOException {
|
||||
docTableRowHref(null,dataFirst,dataLast,dataBlock,false,false,false);
|
||||
}
|
||||
|
||||
public void docTableRowLastStart(String dataFirst,String dataFirstHref) throws SAXException {
|
||||
public void docTableRowLastStart(String dataFirst,String dataFirstHref) throws SAXException, IOException {
|
||||
docTableRowHref(dataFirstHref,dataFirst,null,null,false,false,true);
|
||||
}
|
||||
|
||||
|
@ -245,13 +257,18 @@ public class ApiDocContentWriter extends ContentWriterHtml {
|
|||
printTagEnd(Tag.tr);
|
||||
}
|
||||
|
||||
private void docTableRowHref(String dataFirstHref,String dataFirst,String dataLast,String dataBlock,boolean dataFirstCode,boolean dataLastCode,boolean skipLast) throws SAXException {
|
||||
if (isAltRow) {
|
||||
public Closeable docTableRow() throws SAXException {
|
||||
if (isRowAlt) {
|
||||
printTagStart(Tag.tr,ApiDocContentCss.altColor);
|
||||
} else {
|
||||
printTagStart(Tag.tr,ApiDocContentCss.rowColor);
|
||||
}
|
||||
isAltRow = !isAltRow;
|
||||
isRowAlt = !isRowAlt;
|
||||
return printAutoClosable(() -> printTagEnd(Tag.tr));
|
||||
}
|
||||
|
||||
private void docTableRowHref(String dataFirstHref,String dataFirst,String dataLast,String dataBlock,boolean dataFirstCode,boolean dataLastCode,boolean skipLast) throws SAXException, IOException {
|
||||
Closeable tableRow = docTableRow();
|
||||
if (dataLast==null) {
|
||||
printTagStart(Tag.td,ApiDocContentCss.colOne);
|
||||
} else {
|
||||
|
@ -291,7 +308,7 @@ public class ApiDocContentWriter extends ContentWriterHtml {
|
|||
}
|
||||
printTagEnd(Tag.td);
|
||||
|
||||
printTagEnd(Tag.tr);
|
||||
tableRow.close();
|
||||
}
|
||||
|
||||
|
||||
|
@ -342,4 +359,24 @@ public class ApiDocContentWriter extends ContentWriterHtml {
|
|||
}
|
||||
return prefix;
|
||||
}
|
||||
|
||||
/// TODO: move up to o2o writers
|
||||
@FunctionalInterface
|
||||
interface TagClose {
|
||||
void closeTag() throws SAXException;
|
||||
}
|
||||
|
||||
private Closeable printAutoClosable(TagClose end) {
|
||||
return new Closeable() {
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
try {
|
||||
end.closeTag();
|
||||
} catch (SAXException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ public class ApiDocGenerator implements ApiDocContentPrinter {
|
|||
}
|
||||
}
|
||||
|
||||
private void writeNode(ApiDocNode node) throws SAXException {
|
||||
private void writeNode(ApiDocNode node) throws SAXException, IOException {
|
||||
ApiDocConcept concept = doc.findConceptByClass(node.getUserData().getClass());
|
||||
if (concept==null) {
|
||||
concept = doc.findConceptChildByNode(node);
|
||||
|
@ -240,7 +240,7 @@ public class ApiDocGenerator implements ApiDocContentPrinter {
|
|||
writer.printTagEnd(Tag.div); // description
|
||||
}
|
||||
|
||||
private void writeNodeSummary(ApiDocWriteEvent<ApiDocNode> event,boolean isPageMode) throws SAXException {
|
||||
private void writeNodeSummary(ApiDocWriteEvent<ApiDocNode> event,boolean isPageMode) throws SAXException, IOException {
|
||||
ApiDocContentWriter writer = event.getWriter();
|
||||
List<ApiDocNodeWriter> bodyWriterSummary = findNodeBodyWriters(event.getEventObject(),ApiDocNodeBody.SUMMARY);
|
||||
if (!isPageMode) {
|
||||
|
@ -395,7 +395,7 @@ public class ApiDocGenerator implements ApiDocContentPrinter {
|
|||
}
|
||||
}
|
||||
|
||||
public void defaultWriteSummary(ApiDocNode node,ApiDocContentWriter writer) throws SAXException {
|
||||
public void defaultWriteSummary(ApiDocNode node,ApiDocContentWriter writer) throws SAXException, IOException {
|
||||
ApiDocConcept concept = doc.findConceptByClass(node.getUserData().getClass());
|
||||
printApiTable(node, node.getNodes(), writer, concept.getName()+" Summary");
|
||||
}
|
||||
|
@ -864,7 +864,7 @@ public class ApiDocGenerator implements ApiDocContentPrinter {
|
|||
}
|
||||
}
|
||||
|
||||
private void writePage(ApiDocPage page) throws SAXException {
|
||||
private void writePage(ApiDocPage page) throws SAXException, IOException {
|
||||
File outputFile = createOutputPathFile(basePath,page.getId()+".html");
|
||||
ApiDocContentWriter writer = createContentWriter(outputFile);
|
||||
String pathPrefix = "";
|
||||
|
|
|
@ -347,9 +347,19 @@ public class ApiDoc {
|
|||
*/
|
||||
public void createDocCopyright(String owner) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
String year = Integer.toString(calendar.get(Calendar.YEAR));
|
||||
createDocCopyright(owner, year);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates default copyright message for owner and year.
|
||||
* @param owner The owner of the copyright.
|
||||
* @param year The year of the copyright.
|
||||
*/
|
||||
public void createDocCopyright(String owner, String year) {
|
||||
StringBuilder buf = new StringBuilder(100);
|
||||
buf.append("Copyright © ");
|
||||
buf.append(calendar.get(Calendar.YEAR));
|
||||
buf.append(year);
|
||||
buf.append(" ");
|
||||
buf.append(owner.toUpperCase());
|
||||
buf.append(" ");
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
*/
|
||||
package org.x4o.o2o.tdoc.dom;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
|
@ -32,5 +34,5 @@ import org.xml.sax.SAXException;
|
|||
*/
|
||||
public interface ApiDocPageWriter {
|
||||
|
||||
void writePageContent(ApiDocWriteEvent<ApiDocPage> e) throws SAXException;
|
||||
void writePageContent(ApiDocWriteEvent<ApiDocPage> e) throws SAXException, IOException;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ X4O is very old code from pre 1.5 non-generics nice object java.
|
|||
- Remove some features to ease "write" and SAX4 support
|
||||
- Move all XML uri's to oasis style thus replacing all internal http namespace locators
|
||||
- Add jaxb annotation support to define a x4o language and have XSD and documention tools
|
||||
- Remove SAXException and replace with IOException for auto close tag printer API support
|
||||
- Cleanup old todo/ideas from below
|
||||
|
||||
## OLD todo
|
||||
|
|
Loading…
Reference in a new issue