Skip to content

Commit

Permalink
Merge pull request #616 from veraPDF/marked_lang
Browse files Browse the repository at this point in the history
Add method getLang to GFSEMarkedContent
  • Loading branch information
MaximPlusov authored and Git User committed Dec 4, 2023
1 parent d74549e commit 6eb1389
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,23 @@ public String getParentsTags() {
return parentsTags + "&" + tag;
}

public String getParentLang() {
public String getInheritedLang() {
String structParentLang = getStructParentLang();
if (structParentLang != null) {
return structParentLang;
}
if (markedContent == null) {
return null;
}
COSString lang = markedContent.getLang();
if (lang != null) {
return lang.getString();
}
if (GFOp_BDC.OP_BDC_TYPE.equals(markedContent.getObjectType())) {
String structParentLang = ((GFOp_BDC)markedContent).getstructParentLang();
if (structParentLang != null) {
return structParentLang;
}
}
return markedContent.getParentLang();
return markedContent.getInheritedLang();
}

public String getStructParentLang() {
return null;
}

public COSObject getParentStructElem() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ private COSObject getStructElem() {
return null;
}

public String getstructParentLang() {
@Override
public String getStructParentLang() {
COSObject structureElement = getStructElem();
if (structureElement == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private List<XMPPackage> getXMPPackage() {
}
}
} catch (XMPException | IOException e) {
LOGGER.log(Level.FINE, "Problems with parsing metadata. " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Problems with parsing metadata. " + e.getMessage(), e);
if (isMainMetadata) {
xmp.add(new AXLMainXMPPackage(null, false, flavour));
} else if (flavour == null || flavour.getPart() != PDFAFlavour.Specification.ISO_19005_1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import org.verapdf.as.ASAtom;
import org.verapdf.cos.COSObject;
import org.verapdf.gf.model.impl.pd.gfse.GFSEFactory;
import org.verapdf.model.operator.Operator;
import org.verapdf.model.selayer.SEGroupedContent;
import org.verapdf.pd.structure.PDStructElem;
Expand Down Expand Up @@ -74,7 +73,7 @@ public Boolean getisSignature() {
return isSignature;
}

public String getLang() {
public String getLangValue() {
return defaultLang;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,16 @@ public List<CosLang> getLinkLang() {
return operator.getLinkLang();
}

@Override
public String getLang() {
COSString lang = operator.getLang();
return lang != null ? lang.getString() : null;
}

@Override
public String getinheritedLang() {
String inheritedLang = operator.getParentLang();
return inheritedLang != null ? inheritedLang : defaultLang;
String inheritedLang = operator.getInheritedLang();
return inheritedLang != null ? inheritedLang : super.getLangValue();
}

@Override
Expand All @@ -144,11 +150,6 @@ public String gettag() {
return tag != null ? tag.getString() : null;
}

@Override
public String getstructureTag() {
return parentStructElem != null ? parentStructElem.getNameKeyStringValue(ASAtom.S) : null;
}

@Override
public String getE() {
COSString E = operator.getE();
Expand All @@ -173,19 +174,9 @@ public String getparentsTags() {
}

@Override
public String getLang() {
COSString lang = operator.getLang();
if (lang != null) {
return lang.getString();
}
if (GFOp_BDC.OP_BDC_TYPE.equals(operator.getObjectType())) {
String structParentLang = ((GFOp_BDC)operator).getstructParentLang();
if (structParentLang != null) {
return structParentLang;
}
}
String parentLang = operator.getParentLang();
return parentLang != null ? parentLang : super.getLang();
public String getLangValue() {
String lang = getLang();
return lang != null ? lang : getinheritedLang();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public Double getscaleFactor() {

@Override
public String getLang() {
return groupedContent.getLang();
return groupedContent.getLangValue();
}

@Override
Expand Down

0 comments on commit 6eb1389

Please sign in to comment.