Skip to content

Commit

Permalink
better NCName() handling using new folia::create_NCName() function
Browse files Browse the repository at this point in the history
  • Loading branch information
kosloot committed Nov 1, 2024
1 parent 20b37dd commit d922edf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ PKG_CHECK_MODULES([ucto], [ucto >= 0.9.4] )
CXXFLAGS="$ucto_CFLAGS $CXXFLAGS"
LIBS="$ucto_LIBS $LIBS"

PKG_CHECK_MODULES([folia], [folia >= 2.19] )
PKG_CHECK_MODULES([folia], [folia >= 2.21] )
CXXFLAGS="$folia_CFLAGS $CXXFLAGS"
LIBS="$folia_LIBS $LIBS"

Expand Down
7 changes: 1 addition & 6 deletions src/FoLiA-pm.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -393,12 +393,7 @@ Paragraph *add_par( Division *root, xmlNode *p, list<Note*>& notes ){
note = new Note( args, doc );
}
else {
if ( !isNCName( ref ) ){
ref = "v." + ref;
if ( !isNCName( ref ) ){
throw ( "the ref attribute in note cannot be converted to an ID" );
}
}
ref = create_NCName( ref );
KWargs args;
args["xml:id"] = ref;
note = new Note( args, doc );
Expand Down
9 changes: 1 addition & 8 deletions src/FoLiA-txt.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,9 @@ bool handle_one_file( const string& fileName ){
if ( !outputDir.empty() ){
nameNoExt = docid;
}
if ( !isNCName( docid ) ){
docid = "doc-" + docid;
if ( !isNCName( docid ) ){
cerr << "unable to generate a Document ID from the filename: '"
<< fileName << "'" << endl;
return false;
}
}
Document *d = 0;
try {
docid = create_NCName( docid );
d = new Document( "xml:id='"+ docid + "'" );
}
catch ( exception& e ){
Expand Down

0 comments on commit d922edf

Please sign in to comment.