Skip to content

Commit

Permalink
Merge pull request #44 from fugerit-org/feature/issue_43_pdf_a
Browse files Browse the repository at this point in the history
Feature/issue 43 pdf a
  • Loading branch information
fugerit79 authored Jul 13, 2023
2 parents 0567c12 + 5a5351a commit f04148b
Show file tree
Hide file tree
Showing 42 changed files with 580 additions and 348 deletions.
4 changes: 2 additions & 2 deletions docgen/parameters.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"title" : "Venus (Fugerit Document Generation Framework)",
"name": "Venus",
"version" : "1.3.0-rc.007",
"date" : "12/07/2023",
"version" : "1.3.1-rc.001",
"date" : "13/07/2023",
"organization" : {
"name" : "Fugerit Org",
"url" : "https://www.fugerit.org"
Expand Down
10 changes: 7 additions & 3 deletions docgen/release-notes.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
1.3.0-rc.007 (2023-07-12)
1.3.1-rc.001 (2023-07-13)
------------------
+ [New freemarker configuration model, compatibility mode](https://github.com/fugerit-org/fj-bom/issues/38)
+ [[fj-doc-mod-fop] add pdf/a support](https://github.com/fugerit-org/fj-doc/issues/43)

1.3.0-rc.007 (2023-07-12)
------------------
+ [New freemarker configuration model, compatibility mode](https://github.com/fugerit-org/fj-doc/issues/38)

1.3.0-rc.004 (2023-07-11)
------------------
+ fj-bom updated to 1.2.3

1.3.0-rc.001 (2023-07-09)
------------------
+ [New freemarker configuration model](https://github.com/fugerit-org/fj-bom/issues/38)
+ [New freemarker configuration model](https://github.com/fugerit-org/fj-doc/issues/38)

1.2.0-rc.001 (2023-07-07)
------------------
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-base-json/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>1.3.0-rc.007</version>
<version>1.3.1-rc.001</version>
</parent>

<name>fj-doc-base-json</name>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-base-yaml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>1.3.0-rc.007</version>
<version>1.3.1-rc.001</version>
</parent>

<name>fj-doc-base-yaml</name>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>1.3.0-rc.007</version>
<version>1.3.1-rc.001</version>
</parent>

<name>fj-doc-base</name>
Expand Down
220 changes: 206 additions & 14 deletions fj-doc-base/src/main/docs/fdp_xsd_config_ref.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ public class DocConfig {
public static final String TYPE_XML = "xml";

public static final String TYPE_PDF = "pdf";
public static final String FORMAT_PDF_A_1A = "PDF/A-1a";
public static final String FORMAT_PDF_A_1B = "PDF/A-1b";

public static final String TYPE_RTF = "rtf";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public interface DocTypeHandler extends KeyString {

String getMime();

String getFormat();

Charset getCharset();

void handle( DocInput docInput, DocOutput docOutput ) throws Exception;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

import lombok.AccessLevel;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class DocTypeHandlerDefault extends XMLConfigurableObject implements DocTypeHandler, Serializable {

/**
Expand All @@ -19,6 +24,8 @@ public class DocTypeHandlerDefault extends XMLConfigurableObject implements DocT

public static final String TAG_NAME_CONFIG = "config";

public static final String TAG_NAME_CONFIG_ALT = "docHandlerCustomConfig";

public static final String ATT_NAME_CHARSET = "charset";

private String type;
Expand All @@ -27,6 +34,8 @@ public class DocTypeHandlerDefault extends XMLConfigurableObject implements DocT

private String mime;

@Setter(value = AccessLevel.PROTECTED) private String format;

private Charset charset;

@Override
Expand All @@ -40,7 +49,7 @@ public String getMime() {

@Override
public String getKey() {
return createKey( this.getType() , this.getModule() ) ;
return createKey( this.getFormat() , this.getModule() ) ;
}

@Override
Expand All @@ -53,6 +62,11 @@ public String getModule() {
return module;
}

@Override
public String getFormat() {
return StringUtils.valueWithDefault( this.format , this.getType() );
}

@Override
public Charset getCharset() {
return charset;
Expand All @@ -64,10 +78,15 @@ public void handle(DocInput docInput, DocOutput docOutput) throws Exception {
}

public DocTypeHandlerDefault(String type, String module, String mime, Charset charset) {
this( type, module, mime, charset, null );
}

public DocTypeHandlerDefault(String type, String module, String mime, Charset charset, String format) {
super();
this.type = type;
this.module = module;
this.mime = mime;
this.format = format;
this.charset = DocCharsetProvider.getDefaultProvider().resolveCharset(charset);
}

Expand All @@ -87,17 +106,37 @@ protected void handleConfigTag( Element config ) throws ConfigException {

}

@Override
public void configure(Element tag) throws ConfigException {
NodeList nl = tag.getElementsByTagName( TAG_NAME_CONFIG );
private Element lookupConfig( Element tag, String tagName ) {
Element configTag = null;
NodeList nl = tag.getElementsByTagName( tagName );
if ( nl.getLength() > 0 ) {
Element config = (Element)nl.item( 0 );
String charsetAtt = config.getAttribute( ATT_NAME_CHARSET );
configTag = (Element)nl.item( 0 );
String charsetAtt = configTag.getAttribute( ATT_NAME_CHARSET );
if ( StringUtils.isNotEmpty( charsetAtt ) ) {
this.charset = Charset.forName( charsetAtt );
}
this.handleConfigTag(config);
}
return configTag;
}

@Override
public void configure(Element tag) throws ConfigException {
log.info( "configure : {}", tag.getAttribute( "id" ) );
Element configTag = this.lookupConfig(tag, TAG_NAME_CONFIG_ALT );
if ( configTag == null ) {
configTag = this.lookupConfig(tag, TAG_NAME_CONFIG );
}
if ( configTag != null ) {
this.handleConfigTag(configTag);
}
}

@Override
public String toString() {
return this.getClass().getSimpleName()+" [type=" + type + ", module=" + module + ", format=" + format + "]";
}




}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import org.fugerit.java.doc.base.config.DocInput;
import org.fugerit.java.doc.base.config.DocOutput;
import org.fugerit.java.doc.base.config.DocTypeHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import lombok.extern.slf4j.Slf4j;

/**
* DocHandlerFacade
Expand All @@ -24,10 +24,9 @@
* @author fugerit
*
*/
@Slf4j
public class DocHandlerFacade implements Serializable {

private static final Logger logger = LoggerFactory.getLogger( DocHandlerFacade.class );

/**
*
*/
Expand All @@ -47,30 +46,33 @@ public DocHandlerFacade() {
}

private void doRegister( DocTypeHandler handler, String id ) {
logger.info( "Registering handler with id {} : {}", id, handler.getClass().getName() );
log.info( "Registering handler with id {} : {}", id, handler.getClass().getName() );
this.mapHandlers.put( id, handler );
ListMapStringKey<DocTypeHandler> list = this.mapTypeHandlers.get( handler.getType() );
ListMapStringKey<DocTypeHandler> list = this.mapTypeHandlers.get( handler.getFormat() );
if ( list == null ) {
list = new ListMapStringKey<DocTypeHandler>();
this.mapTypeHandlers.put( handler.getType() , list );
this.mapTypeHandlers.put( handler.getFormat() , list );
}
list.add( handler );
}

public void registerHandler( DocTypeHandler handler, boolean registerForType, boolean errorOnDuplicate ) throws Exception {
doRegister( handler, handler.getKey() );
if ( registerForType ) {
String format = handler.getFormat();
String type = handler.getType();
DocTypeHandler previous = this.mapHandlers.get( type );
DocTypeHandler previous = this.mapHandlers.get( format );
if ( previous != null ) {
if ( errorOnDuplicate ) {
throw new ConfigException( "Duplicate handler for type : "+type );
throw new ConfigException( "Duplicate handler for format : "+format+" (type:"+type+")" );
} else {
logger.warn( "Warning duplicate handler for type, {} will replace {}", type, handler.getKey(), previous.getKey() );
log.warn( "Warning duplicate handler for format, {} will replace {}", format, handler.getKey(), previous.getKey() );
}
}
doRegister(handler, type);
doRegister(handler, format);
}
log.info( "list keys current -> {} : list {}", handler, this.mapHandlers.keySet() );
log.debug( "test" );
}

public void registerHandler( DocTypeHandler handler ) throws Exception {
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-bom-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>1.3.0-rc.007</version>
<version>1.3.1-rc.001</version>
</parent>

<name>fj-doc-bom-core</name>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-bom-fop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>1.3.0-rc.007</version>
<version>1.3.1-rc.001</version>
</parent>

<name>fj-doc-bom-fop</name>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-freemarker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>1.3.0-rc.007</version>
<version>1.3.1-rc.001</version>
</parent>

<name>fj-doc-freemarker</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.fugerit.java.doc.base.process.DocProcessContext;
import org.fugerit.java.doc.base.process.DocProcessData;
import org.fugerit.java.doc.base.process.DocProcessorBasic;
import org.fugerit.java.doc.freemarker.process.ConfigInitModel;

import freemarker.template.Configuration;
import freemarker.template.TemplateExceptionHandler;
Expand All @@ -22,10 +21,10 @@ public class FreeMarkerConfigStep extends DocProcessorBasic {
public static final String ATT_DEFAULT = "FreeMarkerConfigStep.DEFAULT";

public static final String ATT_FREEMARKER_CONFIG_KEY_VERSION = "version";
public static final String ATT_FREEMARKER_CONFIG_KEY_VERSION_2_3_31 = ConfigInitModel.VERSION_2_3_31;
public static final String ATT_FREEMARKER_CONFIG_KEY_VERSION_2_3_31 = "2.3.31";
public static final String ATT_FREEMARKER_CONFIG_KEY_VERSION_2_3_30 = "2.3.30";
public static final String ATT_FREEMARKER_CONFIG_KEY_VERSION_2_3_29 = "2.3.29";
public static final String ATT_FREEMARKER_CONFIG_KEY_VERSION_DEFAULT = ConfigInitModel.DEFAULT_VERSION;
public static final String ATT_FREEMARKER_CONFIG_KEY_VERSION_DEFAULT = ATT_FREEMARKER_CONFIG_KEY_VERSION_2_3_31;

public static final String ATT_FREEMARKER_CONFIG_KEY_MODE = "mode";
public static final String ATT_FREEMARKER_CONFIG_KEY_MODE_CLASS = "class";
Expand Down
Loading

0 comments on commit f04148b

Please sign in to comment.