提交 3f320699 authored 作者: xinjunguo's avatar xinjunguo

--no commit message

上级 d48db864
......@@ -479,8 +479,7 @@ public class EpubResolve {
* @return
*/
@SuppressWarnings("unchecked")
public Object[] setContent(List<TOCReference> listReferences, Set<ArticleLibrary> contentSet, Ebook ebook,
Map<String, String> imgtzMap, Object[] data) {
public Object[] setContent(List<TOCReference> listReferences, Set<ArticleLibrary> contentSet, Ebook ebook, Map<String, String> imgtzMap, Object[] data) {
// 遍历章节的内容
for (TOCReference spineReference : listReferences) {
// 顶级目录 用resourceId 标识
......@@ -517,11 +516,9 @@ public class EpubResolve {
if (e.nextElementSibling() != null) {
after = e.nextElementSibling().attr("class");
}
if (StringUtils.anyEquals(before,
"picture_figure_note,picture_table_note,picture_table_title,picture_figure_title,tableCaption")) {
if (StringUtils.anyEquals(before, "picture_figure_note,picture_table_note,picture_table_title,picture_figure_title,tableCaption")) {
imgtz = e.previousElementSibling().text();
} else if (StringUtils.anyEquals(after,
"picture_figure_note,picture_table_note,picture_table_title,picture_figure_title,tableCaption")) {
} else if (StringUtils.anyEquals(after, "picture_figure_note,picture_table_note,picture_table_title,picture_figure_title,tableCaption")) {
imgtz = e.nextElementSibling().text();
}
imgtzMap.put(imgsrc, imgtz);
......@@ -572,17 +569,15 @@ public class EpubResolve {
// 1.xxx
// 2.xxx
// 二.xxxx
List<Element> subchapter = elements.subList(elements.indexOf(hlabel1),
hlabel2 == null ? elements.size() : elements.indexOf(hlabel2));
List<Element> subchapter = elements.subList(elements.indexOf(hlabel1), hlabel2 == null ? elements.size() : elements.indexOf(hlabel2));
es = new Elements();
// markid
String tagName =hlabel1.tagName();
String markid="";
if(tagName.equals("h1")) {
markid=ebook.getId() + "-"+resourceId;
}else {
markid = ebook.getId() + "-"
+ (hlabel1.attr("id").equals("") ? resourceId : hlabel1.attr("id"));
String tagName = hlabel1.tagName();
String markid = "";
if (tagName.equals("h1")) {
markid = ebook.getId() + "-" + resourceId;
} else {
markid = ebook.getId() + "-" + (hlabel1.attr("id").equals("") ? resourceId : hlabel1.attr("id"));
}
for (Element element : subchapter) {
if (!element.toString().contains("<h")) {
......@@ -603,8 +598,7 @@ public class EpubResolve {
// 内容相关信息,为正文时才去设置关键字,预览,简介(3)
if (!StringUtils.anyEquals(hlabel1.text(), "封面,版权页,目录")) {
content.setSynopsis(filterText.toString().substring(0,
filterText.length() > 300 ? 200 : filterText.length()));
content.setSynopsis(filterText.toString().substring(0, filterText.length() > 300 ? 200 : filterText.length()));
}
// 设置公共信息(6)
setContentCommInfo(content, ebook, es);
......@@ -617,16 +611,14 @@ public class EpubResolve {
}
}
// =============递归 遍历子章节内容============
/*
* if (spineReference.getChildren().size() > 0) { if
* (spineReference.getChildren().get(0).getFragmentId().contains("_")) { String
* spchild = spineReference.getChildren().get(0).getFragmentId().substring(0,
* spineReference.getChildren().get(0).getFragmentId().indexOf("_")); if
* (!spineReference.getFragmentId().contains(spchild))
* setContent(spineReference.getChildren(), contentSet, ebook, imgtzMap, data);
* } else { setContent(spineReference.getChildren(), contentSet, ebook,
* imgtzMap, data); } }
*/
if (spineReference.getChildren().size() > 0) {
for(TOCReference toc :spineReference.getChildren()) {
if(!spineReference.getResource().getId().equals(toc.getResource().getId())) {
setContent(spineReference.getChildren(), contentSet, ebook, imgtzMap, data);
}
}
}
// =============递归 遍历子章节内容============
} // for循环结束
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论