academic/sword: Add patch to fix formatting.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Tim Dickson 2020-05-09 08:19:45 +07:00 committed by Willy Sudiarto Raharjo
parent f3ceff2451
commit 4cf823acab
No known key found for this signature in database
GPG key ID: 887B8374D7333381
3 changed files with 83 additions and 2 deletions

View file

@ -11,3 +11,6 @@ strongs and Greek and Hebrew dictionaries for use with this library. Many
more bibles, commentries etc. can be found on the crosswire.org website.
modules can be downloaded in raw format (zip) and extracted into the
/usr/share/sword directory.
You will also need a frontend, such as xiphos or bibletime (both on sbo) to
view the bible data.

View file

@ -5,7 +5,7 @@
# Copyright 2008-2011 Heinz Wiesinger, Amsterdam, The Netherlands
# All rights reserved.
#
# changes updating to v1.7.5a1 and v1.8.1 Copyright 2015-2018 Tim Dickson, Scotland
# changes updating to v1.7.5a1 and v1.8.1 Copyright 2015-2020 Tim Dickson, Scotland
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
@ -26,7 +26,7 @@
PRGNAM=sword
VERSION=${VERSION:-1.8.1}
BUILD=${BUILD:-2}
BUILD=${BUILD:-3}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@ -64,6 +64,9 @@ cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
#patch to fix pre-chapter text, required for xiphos. when sword tag>1.8.1
#remove this patch as it will be included.
patch -p0 -i $CWD/$PRGNAM.diff
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \

75
academic/sword/sword.diff Normal file
View file

@ -0,0 +1,75 @@
Index: src/mgr/stringmgr.cpp
===================================================================
--- src/mgr/stringmgr.cpp (revision 3718)
+++ src/mgr/stringmgr.cpp (revision 3721)
@@ -20,6 +20,7 @@
*
*/
+#include <ctype.h>
#include <stringmgr.h>
#include <swlog.h>
#include <localemgr.h>
Index: src/modules/filters/osisxhtml.cpp
===================================================================
--- src/modules/filters/osisxhtml.cpp (revision 3718)
+++ src/modules/filters/osisxhtml.cpp (revision 3721)
@@ -849,7 +849,11 @@
else if (tag.isEndTag()) {
outText("</div>", buf, u);
}
- else if (!(type == "colophon")) outText(tag, buf, u);
+ else if (!(type == "colophon")) {
+ if (tag.getAttribute("sID")) tag.setEmpty(false);
+ if (tag.getAttribute("eID")) tag.setEndTag(true);
+ outText(tag, buf, u);
+ }
}
else if (!strcmp(tag.getName(), "span")) {
Index: src/utilfuns/utilxml.cpp
===================================================================
--- src/utilfuns/utilxml.cpp (revision 3718)
+++ src/utilfuns/utilxml.cpp (revision 3721)
@@ -291,13 +291,16 @@
tag.append('/');
tag.append(getName());
- for (StringPairMap::iterator it = attributes.begin(); it != attributes.end(); it++) {
- //tag.appendFormatted(" %s=\"%s\"", it->first.c_str(), it->second.c_str());
- tag.append(' ');
- tag.append(it->first.c_str());
- tag.append((strchr(it->second.c_str(), '\"')) ? "=\'" : "=\"");
- tag.append(it->second.c_str());
- tag.append((strchr(it->second.c_str(), '\"'))? '\'' : '\"');
+
+ if (!isEndTag()) {
+ for (StringPairMap::iterator it = attributes.begin(); it != attributes.end(); it++) {
+ //tag.appendFormatted(" %s=\"%s\"", it->first.c_str(), it->second.c_str());
+ tag.append(' ');
+ tag.append(it->first.c_str());
+ tag.append((strchr(it->second.c_str(), '\"')) ? "=\'" : "=\"");
+ tag.append(it->second.c_str());
+ tag.append((strchr(it->second.c_str(), '\"'))? '\'' : '\"');
+ }
}
if (isEmpty())
Index: include/utilxml.h
===================================================================
--- include/utilxml.h (revision 3718)
+++ include/utilxml.h (revision 3721)
@@ -75,6 +75,13 @@
* otherwise, we return if we're a simple XML end </tag>.
*/
bool isEndTag(const char *eID = 0) const;
+ inline void setEndTag(bool value) {
+ if (!parsed)
+ parse();
+ endTag = value;
+ if (value)
+ empty = false;
+ }
const StringList getAttributeNames() const;
int getAttributePartCount(const char *attribName, char partSplit = '|') const;