After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 319705 - gnome-doc-utils should valid OMF categories
gnome-doc-utils should valid OMF categories
Status: RESOLVED FIXED
Product: gnome-doc-utils
Classification: Deprecated
Component: build utils
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-doc-utils maintainers
gnome-doc-utils maintainers
Depends on:
Blocks:
 
 
Reported: 2005-10-25 04:37 UTC by Gregory Leblanc
Modified: 2006-11-08 15:06 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Gregory Leblanc 2005-10-25 04:37:40 UTC
gnome-doc-utils should yell and scream and whinge and yell and, well, something
like that...  when the category in OMF files is not set to something out of the
controlled list.  The list is at 
http://scrollkeeper.sourceforge.net/documentation/categories.html
Comment 1 Shaun McCance 2005-12-02 23:50:14 UTC
Here's a rough attempt that could probably be cleaned up into something good:

@subjects=`echo \
  '<stylesheet xmlns="http://www.w3.org/1999/XSL/Transform" '		\
  'xmlns:str="http://exslt.org/strings" version="1.0" '			\
  'extension-element-prefixes="str"><output method="text"/>'		\
  '<template match="/"><for-each select="//subject/@category">'		\
  '<for-each select="str:tokenize(.)"><value-of select="."/>'		\
  '<if test="position() != last()"><text>_</text></if></for-each>'	\
  '<text> </text></for-each></template></stylesheet>' 			\
  | xsltproc - $(_DOC_OMF_IN)`;						\
for subject in $$subjects; do						\
  code=`echo $$subject | sed -e 's/|//g' -e 's/_/ /g'`;			\
  valid=`echo								\
    '<stylesheet xmlns="http://www.w3.org/1999/XSL/Transform" '		\
    'version="1.0"><output method="text"/><template match="/">'		\
    '<if test="//sect[@categorycode='"'$$code'"']">1</if>'		\
    '</template></stylesheet>' | xsltproc - 				\
  /usr/share/scrollkeeper/Templates/C/scrollkeeper_cl.xml`;		\
  if [ "x$$valid" != "x1" ]; then					\
    echo -n "Invalid OMF category code: ";				\
    echo $$subject | sed -e 's/_/ /g';					\
    exit 1;								\
  fi;									\
done;

This would be put in the rule for building $(_DOC_OMF_DB).  There are a few
issues with this:

1) I hard-coded the path to scrollkeeper_cl.xml.
2) I don't think the echo/exit business is the proper way to handle the error.
3) This will wrong for each OMF file we build, as in once for each language.  I
suppose we could just let that happen, and maybe even make each language OMF
check against the appropriate language's scrollkeeper_cl.xml file.  But if
there's actually a difference in codes between languages, we've got more serious
problems.

Since we're just verifying an input file (the .omf.in file), we don't really
need to check it for every output file it makes.  I suppose an easy solution is
just to wrap the whole check in a conditional that checks if we're outputting
the C OMF file.

(Yeah, the inline XSLT makes me cringe too.  But I'm not allowed to use XML
Starlet here.)
Comment 2 Shaun McCance 2005-12-02 23:51:02 UTC
Under point (3), s/This will wrong/This will run/
Comment 3 Shaun McCance 2005-12-03 00:02:53 UTC
On point (1):

`scrollkeeper-config --pkgdatadir`/Templates/C/scrollkeeper_cl.xml

That'll give us the file less stupidly.
Comment 4 Shaun McCance 2006-11-08 15:06:56 UTC
I did this in db2omf.xsl instead.