[libfolia] 01/03: New upstream version 1.5
Maarten van Gompel
proycon-guest at moszumanska.debian.org
Mon Nov 14 17:23:17 UTC 2016
This is an automated email from the git hooks/post-receive script.
proycon-guest pushed a commit to branch master
in repository libfolia.
commit 804162fb75f7ee67fd658ddfde0a71f6a3387fc7
Author: proycon <proycon at anaproy.nl>
Date: Mon Nov 14 08:38:30 2016 +0100
New upstream version 1.5
---
ChangeLog | 47 +++++++++++++++++++
NEWS | 9 ++++
configure | 38 +++++++--------
configure.ac | 4 +-
include/libfolia/folia_document.h | 3 ++
include/libfolia/folia_impl.h | 7 +--
src/Makefile.am | 2 +-
src/Makefile.in | 2 +-
src/folia_document.cxx | 19 ++++++--
src/folia_impl.cxx | 97 +++++++++++++++++++--------------------
src/folia_utils.cxx | 21 ++-------
11 files changed, 150 insertions(+), 99 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 068a2f9..5869a7d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,50 @@
+2016-11-10 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/folia_impl.cxx: check for empty attributes in Feature creation
+
+2016-11-08 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/libfolia/folia_impl.h, src/folia_document.cxx,
+ src/folia_impl.cxx: make document::text() work
+
+2016-11-08 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * : commit da88fb6050c5b27d10fb2d26aae89517ebd26d17 Author: Ko van
+ der Sloot <K.vanderSloot at let.ru.nl> Date: Tue Nov 8 10:46:57 2016
+ +0100
+
+2016-11-07 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/libfolia/folia_document.h, src/folia_document.cxx: changed
+ signature: text() should return a UnicodeString
+
+2016-11-07 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/libfolia/folia_document.h, src/folia_document.cxx: added a
+ stub for Document::test(). Should be implements RSN
+
+2016-11-07 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/libfolia/folia_impl.h, src/folia_impl.cxx: some cleanup in
+ text() members. Still problematic
+
+2016-11-01 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/folia_document.cxx: better error message
+
+2016-11-01 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: added missing dependency in .travis.yml
+
+2016-11-01 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/folia_utils.cxx: use a generic libxml NCname validation
+ function.
+
+2016-10-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * configure.ac: bumped version after release
+
2016-10-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
* NEWS: typos
diff --git a/NEWS b/NEWS
index a3d361f..cac216a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,12 @@
+1.5 2016-11-14
+[Ko van der Sloot]
+* Bumped the .so name. Should have been done in 1.4!
+* addition: text() mebmer for document-
+* minor bug fixes:
+ - isNCname test now conforms to XML definition
+ - improved am error messag in Document
+ - check empty attributes in Feature() construction
+
1.4 2016-10-18
[Ko van der Sloot]
* Now fully implements Folia spec 1.3.2
diff --git a/configure b/configure
index bfc8360..298d52a 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libfolia 1.4.
+# Generated by GNU Autoconf 2.69 for libfolia 1.5.
#
# Report bugs to <lamasoftware at science.ru.nl>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libfolia'
PACKAGE_TARNAME='libfolia'
-PACKAGE_VERSION='1.4'
-PACKAGE_STRING='libfolia 1.4'
+PACKAGE_VERSION='1.5'
+PACKAGE_STRING='libfolia 1.5'
PACKAGE_BUGREPORT='lamasoftware at science.ru.nl'
PACKAGE_URL=''
@@ -1363,7 +1363,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libfolia 1.4 to adapt to many kinds of systems.
+\`configure' configures libfolia 1.5 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1434,7 +1434,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libfolia 1.4:";;
+ short | recursive ) echo "Configuration of libfolia 1.5:";;
esac
cat <<\_ACEOF
@@ -1562,7 +1562,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libfolia configure 1.4
+libfolia configure 1.5
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2082,7 +2082,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libfolia $as_me 1.4, which was
+It was created by libfolia $as_me 1.5, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2945,7 +2945,7 @@ fi
# Define the identity of the package.
PACKAGE='libfolia'
- VERSION='1.4'
+ VERSION='1.5'
cat >>confdefs.h <<_ACEOF
@@ -17356,12 +17356,12 @@ if test -n "$ticcutils_CFLAGS"; then
pkg_cv_ticcutils_CFLAGS="$ticcutils_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ticcutils >= 0.5 \""; } >&5
- ($PKG_CONFIG --exists --print-errors "ticcutils >= 0.5 ") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ticcutils >= 0.14 \""; } >&5
+ ($PKG_CONFIG --exists --print-errors "ticcutils >= 0.14 ") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_ticcutils_CFLAGS=`$PKG_CONFIG --cflags "ticcutils >= 0.5 " 2>/dev/null`
+ pkg_cv_ticcutils_CFLAGS=`$PKG_CONFIG --cflags "ticcutils >= 0.14 " 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -17373,12 +17373,12 @@ if test -n "$ticcutils_LIBS"; then
pkg_cv_ticcutils_LIBS="$ticcutils_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ticcutils >= 0.5 \""; } >&5
- ($PKG_CONFIG --exists --print-errors "ticcutils >= 0.5 ") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ticcutils >= 0.14 \""; } >&5
+ ($PKG_CONFIG --exists --print-errors "ticcutils >= 0.14 ") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_ticcutils_LIBS=`$PKG_CONFIG --libs "ticcutils >= 0.5 " 2>/dev/null`
+ pkg_cv_ticcutils_LIBS=`$PKG_CONFIG --libs "ticcutils >= 0.14 " 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -17399,14 +17399,14 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- ticcutils_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ticcutils >= 0.5 " 2>&1`
+ ticcutils_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ticcutils >= 0.14 " 2>&1`
else
- ticcutils_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ticcutils >= 0.5 " 2>&1`
+ ticcutils_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ticcutils >= 0.14 " 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$ticcutils_PKG_ERRORS" >&5
- as_fn_error $? "Package requirements (ticcutils >= 0.5 ) were not met:
+ as_fn_error $? "Package requirements (ticcutils >= 0.14 ) were not met:
$ticcutils_PKG_ERRORS
@@ -17978,7 +17978,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libfolia $as_me 1.4, which was
+This file was extended by libfolia $as_me 1.5, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -18044,7 +18044,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-libfolia config.status 1.4
+libfolia config.status 1.5
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index e6559fc..306cd46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
-AC_INIT([libfolia], [1.4], [lamasoftware at science.ru.nl])
+AC_INIT([libfolia], [1.5], [lamasoftware at science.ru.nl])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])
@@ -96,7 +96,7 @@ AC_ARG_WITH(ticcutils,
[PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$withval/lib/pkgconfig"],
[PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$prefix/lib/pkgconfig"])
# AC_MSG_NOTICE( [pkg-config search path: $PKG_CONFIG_PATH] )
-PKG_CHECK_MODULES([ticcutils], [ticcutils >= 0.5] )
+PKG_CHECK_MODULES([ticcutils], [ticcutils >= 0.14] )
CXXFLAGS="$CXXFLAGS $ticcutils_CFLAGS"
LIBS="$ticcutils_LIBS $LIBS"
diff --git a/include/libfolia/folia_document.h b/include/libfolia/folia_document.h
index c081f4c..7abfc0d 100644
--- a/include/libfolia/folia_document.h
+++ b/include/libfolia/folia_document.h
@@ -105,6 +105,9 @@ namespace folia {
void set_foreign_metadata( xmlNode * );
void addStyle( const std::string&, const std::string& );
void replaceStyle( const std::string&, const std::string& );
+ UnicodeString text( const std::string& = "current",
+ bool = false,
+ bool = false ) const;
std::vector<Paragraph*> paragraphs() const;
std::vector<Sentence*> sentences() const;
std::vector<Sentence*> sentenceParts() const;
diff --git a/include/libfolia/folia_impl.h b/include/libfolia/folia_impl.h
index 3210765..d413e7e 100644
--- a/include/libfolia/folia_impl.h
+++ b/include/libfolia/folia_impl.h
@@ -882,8 +882,6 @@ namespace folia {
void setAttributes( const KWargs& );
KWargs collectAttributes() const;
const FoliaElement* resolveid() const;
- const UnicodeString text( const std::string& = "current",
- bool = false, bool = false ) const;
protected:
const std::string& getTextDelimiter( bool ) const { return EMPTY_STRING; };
std::string idref;
@@ -963,8 +961,6 @@ namespace folia {
FoliaImpl( PROPS, d ){ classInit(a); }
void setAttributes( const KWargs& );
KWargs collectAttributes() const;
- const UnicodeString text( const std::string& = "current",
- bool = false, bool = false ) const;
int offset() const { return _offset; };
TextContent *postappend();
std::vector<FoliaElement*> findreplacables( FoliaElement * ) const;
@@ -999,7 +995,8 @@ namespace folia {
FoliaImpl( PROPS,d) { classInit(); }
FoLiA( const KWargs& a, Document *d = 0 ):
FoliaImpl( PROPS, d ) { classInit( a ); }
-
+ const UnicodeString text( const std::string& = "current",
+ bool = false, bool = false ) const;
private:
static properties PROPS;
};
diff --git a/src/Makefile.am b/src/Makefile.am
index 24a3729..ad1b4d9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,7 +5,7 @@ AM_CXXFLAGS = -std=c++0x -g -O3 # -Weffc++
LDADD = libfolia.la
lib_LTLIBRARIES = libfolia.la
-libfolia_la_LDFLAGS = -version-info 4:0:0
+libfolia_la_LDFLAGS = -version-info 5:0:0
libfolia_la_SOURCES = folia_impl.cxx folia_document.cxx folia_utils.cxx \
folia_types.cxx folia_properties.cxx
diff --git a/src/Makefile.in b/src/Makefile.in
index a0f2ea1..536d90d 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -540,7 +540,7 @@ AM_CPPFLAGS = -I at top_srcdir@/include
AM_CXXFLAGS = -std=c++0x -g -O3 # -Weffc++
LDADD = libfolia.la
lib_LTLIBRARIES = libfolia.la
-libfolia_la_LDFLAGS = -version-info 4:0:0
+libfolia_la_LDFLAGS = -version-info 5:0:0
libfolia_la_SOURCES = folia_impl.cxx folia_document.cxx folia_utils.cxx \
folia_types.cxx folia_properties.cxx
diff --git a/src/folia_document.cxx b/src/folia_document.cxx
index 8c7ea0c..69cd9a9 100644
--- a/src/folia_document.cxx
+++ b/src/folia_document.cxx
@@ -180,7 +180,9 @@ namespace folia {
_id = it->second;
}
else {
- // isNCName throws
+ throw XmlError( "'"
+ + it->second
+ + "' is not a valid NCName." );
}
happy = true;
}
@@ -368,8 +370,8 @@ namespace folia {
return toXml( fn, nsLabel, kanon );
}
}
- catch ( ... ){
- throw runtime_error( "saving to file " + fn + " failed" );
+ catch ( const exception& e ){
+ throw runtime_error( "saving to file " + fn + " failed: " + e.what() );
return false;
}
}
@@ -400,6 +402,12 @@ namespace folia {
throw range_error( "Document index out of range" );
}
+ UnicodeString Document::text( const std::string& cls,
+ bool retaintok,
+ bool strict ) const {
+ return foliadoc->text( cls, retaintok, strict );
+ }
+
vector<Paragraph*> Document::paragraphs() const {
return foliadoc->select<Paragraph>();
}
@@ -875,7 +883,10 @@ namespace folia {
if ( isNCName( result->id() ) )
_id = result->id();
else {
- // isNCName throws
+ // can this ever happen? parseFoliaDoc should fail
+ throw XmlError( "'"
+ + result->id()
+ + "' is not a valid NCName." );
}
}
}
diff --git a/src/folia_impl.cxx b/src/folia_impl.cxx
index 15fc756..adfcf9a 100644
--- a/src/folia_impl.cxx
+++ b/src/folia_impl.cxx
@@ -235,15 +235,15 @@ namespace folia {
throw ValueError("ID is not supported for " + classname() );
}
else {
- try {
- isNCName( it->second );
+ if ( isNCName( it->second ) ){
+ _id = it->second;
+ kwargs.erase( it );
}
- catch ( const XmlError& xe ){
- throw XmlError( "while processing a " + classname() + " node:\n"
- + xe.what() );
+ else {
+ throw XmlError( "'"
+ + it->second
+ + "' is not a valid NCName." );
}
- _id = it->second;
- kwargs.erase( it );
}
}
}
@@ -870,6 +870,21 @@ namespace folia {
if ( strict ) {
return textcontent(cls)->text();
}
+ else if ( element_id() == TextContent_t
+ || element_id() == AbstractTextMarkup_t ){ // TEXTCONTAINER property
+ UnicodeString result;
+ for ( const auto& d : data ){
+ if ( !result.isEmpty() ){
+ const string& delim = d->getTextDelimiter( retaintok );
+ result += UTF8ToUnicode(delim);
+ }
+ result += d->text( cls );
+ }
+#ifdef DEBUG_TEXT
+ cerr << "TEXT op a textcontainer :" << xmltag() << " returned '" << result << "'" << endl;
+#endif
+ return result;
+ }
else if ( !printable() ) {
throw NoSuchText( "NON printable element: " + xmltag() );
}
@@ -885,6 +900,26 @@ namespace folia {
}
}
+ const UnicodeString FoLiA::text( const string& cls,
+ bool retaintok,
+ bool strict ) const {
+#ifdef DEBUG_TEXT
+ cerr << "FoLiA::TEXT(" << cls << ")" << endl;
+#endif
+ UnicodeString result;
+ for ( const auto& d : data ){
+ if ( !result.isEmpty() ){
+ const string& delim = d->getTextDelimiter( retaintok );
+ result += UTF8ToUnicode(delim);
+ }
+ result += d->text( cls, retaintok, strict );
+ }
+#ifdef DEBUG_TEXT
+ cerr << "FoLiA::TEXT returnes '" << result << "'" << endl;
+#endif
+ return result;
+ }
+
UnicodeString trim_space( const UnicodeString& in ){
UnicodeString cmp = " ";
// cerr << "in = '" << in << "'" << endl;
@@ -2144,41 +2179,6 @@ namespace folia {
return result;
}
- const UnicodeString TextContent::text( const string& cls,
- bool retaintok,
- bool ) const {
- // get the UnicodeString value of underlying elements
- // default cls="current"
-#ifdef DEBUG_TEXT
- cerr << "TextContent::TEXT(" << cls << ") " << endl;
-#endif
- UnicodeString result;
- for ( const auto& el : data ) {
- // try to get text dynamically from children
-#ifdef DEBUG_TEXT
- cerr << "TextContent: bekijk node[" << el->xmltag() << "]" << endl;
-#endif
- try {
-#ifdef DEBUG_TEXT
- cerr << "roep text(" << cls << ") aan op " << el << endl;
-#endif
- UnicodeString tmp = el->text( cls, retaintok );
-#ifdef DEBUG_TEXT
- cerr << "TextContent found '" << tmp << "'" << endl;
-#endif
- result += tmp;
- } catch ( NoSuchText& e ) {
-#ifdef DEBUG_TEXT
- cerr << "TextContent::HELAAS" << endl;
-#endif
- }
- }
-#ifdef DEBUG_TEXT
- cerr << "TextContent return " << result << endl;
-#endif
- return result;
- }
-
const UnicodeString PhonContent::phon( const string& cls,
bool ) const {
// get the UnicodeString value of underlying elements
@@ -3843,15 +3843,20 @@ namespace folia {
if ( _subset.empty() ){
throw ValueError("subset attribute is required for " + classname() );
}
-
}
else {
+ if ( it->second.empty() ) {
+ throw ValueError("subset attribute may never be empty: " + classname() );
+ }
_subset = it->second;
}
it = kwargs.find( "class" );
if ( it == kwargs.end() ) {
throw ValueError("class attribute is required for " + classname() );
}
+ if ( it->second.empty() ) {
+ throw ValueError("class attribute may never be empty: " + classname() );
+ }
_class = it->second;
}
@@ -3987,12 +3992,6 @@ namespace folia {
FoliaImpl::setAttributes( argl );
}
- const UnicodeString AbstractTextMarkup::text( const string& cls,
- bool, bool ) const {
- // we assume al TextMarkup to be tokenized already
- return FoliaImpl::text( cls, true );
- }
-
const UnicodeString TextMarkupCorrection::text( const string& cls,
bool ret,
bool strict ) const{
diff --git a/src/folia_utils.cxx b/src/folia_utils.cxx
index 6444ff9..e055dba 100644
--- a/src/folia_utils.cxx
+++ b/src/folia_utils.cxx
@@ -485,24 +485,9 @@ namespace folia {
}
bool isNCName( const string& s ){
- const string extra=".-_";
- if ( s.empty() ){
- throw XmlError( "an empty string is not a valid NCName." );
- }
- else if ( !isalpha(s[0]) ){
- throw XmlError( "'"
- + s
- + "' is not a valid NCName. (must start with character)." );
- }
- else {
- for ( const auto& let : s ){
- if ( !isalnum(let) &&
- extra.find(let) == string::npos ){
- throw XmlError( "'" + s
- + "' is not a valid NCName.(invalid '"
- + char(let) + "' found" );
- }
- }
+ int test = xmlValidateNCName( (const xmlChar*)s.c_str(), 0 );
+ if ( test != 0 ){
+ return false;
}
return true;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/libfolia.git
More information about the debian-science-commits
mailing list