[PATCH] Fix anchors for docset generation and provide publisher information

Guido Tack <[email protected]>
Newsgroups gmane.text.doxygen.devel
Message-ID <[email protected]>
Hi,

here's a tiny patch against the doxygen trunk that fixes XCode docset generation.  It generates <Anchor> tags in Nodes.xml instead of using url#anchor syntax (which docsetutil does not support).  I've also added DOCSET_PUBLISHER_ID and DOCSET_PUBLISHER_NAME as config options, because Apple suggests to always provide these in Info.plist (otherwise the docset will be filed under "Unknown publisher"):
http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/Documentation_Sets/030-Configuring_Documentation_Sets/configuring_docsets.html#//apple_ref/doc/uid/TP40005266-CH11-SW22

Best regards,
	Guido

------------------------------------------------------------------------------

_______________________________________________
Doxygen-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/doxygen-develop
docsetfixes.diff (application/octet-stream, 3.9 KB)
Index: src/config.xml
===================================================================
--- src/config.xml	(revision 729)
+++ src/config.xml	(working copy)
@@ -832,6 +832,14 @@
 reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen 
 will append .docset to the name. 
 ' defval='org.doxygen.Project' depends='GENERATE_DOCSET'/>
+    <option type='string' id='DOCSET_PUBLISHER_ID' format='string' docs='
+When GENERATE_DOCSET tag is set to YES, this tag specifies a string that 
+should uniquely identify the documentation publisher. This should be a 
+reverse domain-name style string, e.g. com.mycompany.MyDocSet.documentation. 
+' defval='org.doxygen.Publisher' depends='GENERATE_DOCSET'/>
+    <option type='string' id='DOCSET_PUBLISHER_NAME' format='string' docs='
+When GENERATE_DOCSET tag is set to YES, this tag identifies the documentation publisher.
+' defval='Publisher' depends='GENERATE_DOCSET'/>
     <option type='bool' id='GENERATE_HTMLHELP' docs='
 If the GENERATE_HTMLHELP tag is set to YES, additional index files 
 will be generated that can be used as input for tools like the 
Index: src/configoptions.cpp
===================================================================
--- src/configoptions.cpp	(revision 729)
+++ src/configoptions.cpp	(working copy)
@@ -1205,6 +1205,22 @@
   cs->setDefaultValue("org.doxygen.Project");
   cs->addDependency("GENERATE_DOCSET");
   //----
+  cs = cfg->addString(
+                 "DOCSET_PUBLISHER_ID",
+                 "When GENERATE_DOCSET tag is set to YES, this tag specifies a string that\n"
+                 "should uniquely identify the documentation publisher. This should be a\n"
+                 "reverse domain-name style string, e.g. com.mycompany.MyDocSet.documentation."
+                );
+  cs->setDefaultValue("org.doxygen.Publisher");
+  cs->addDependency("GENERATE_DOCSET");
+  //----
+  cs = cfg->addString(
+                 "DOCSET_PUBLISHER_NAME",
+                 "When GENERATE_DOCSET tag is set to YES, this tag identifies the documentation publisher."
+                );
+  cs->setDefaultValue("Publisher");
+  cs->addDependency("GENERATE_DOCSET");
+  //----
   cb = cfg->addBool(
                  "GENERATE_HTMLHELP",
                  "If the GENERATE_HTMLHELP tag is set to YES, additional index files\n"
Index: src/docsets.cpp
===================================================================
--- src/docsets.cpp	(revision 729)
+++ src/docsets.cpp	(working copy)
@@ -44,6 +44,10 @@
   if (bundleId.isEmpty()) bundleId="org.doxygen.Project";
   QCString feedName = Config_getString("DOCSET_FEEDNAME");
   if (feedName.isEmpty()) feedName="FeedName";
+  QCString publisherId = Config_getString("DOCSET_PUBLISHER_ID");
+  if (publisherId.isEmpty()) publisherId="PublisherId";
+  QCString publisherName = Config_getString("DOCSET_PUBLISHER_NAME");
+  if (publisherName.isEmpty()) publisherName="PublisherName";
 
   // -- write Makefile
   {
@@ -117,6 +121,10 @@
         "     <string>" << bundleId << ".docset</string>\n" 
         "     <key>DocSetFeedName</key>\n" 
         "     <string>" << feedName << "</string>\n"
+        "     <key>DocSetPublisherIdentifier</key>\n"
+        "     <string>" << publisherId << "</string>\n"
+        "     <key>DocSetPublisherName</key>\n"
+        "     <string>" << publisherName << "</string>\n"
         "</dict>\n"
         "</plist>\n";
   }
@@ -218,12 +226,11 @@
     m_firstNode.at(m_dc-1)=FALSE;
     m_nts << indent() << " <Node>" << endl;
     m_nts << indent() << "  <Name>" << convertToXML(name) << "</Name>" << endl;
-    m_nts << indent() << "  <Path>" << file << Doxygen::htmlFileExtension;
+    m_nts << indent() << "  <Path>" << file << Doxygen::htmlFileExtension << "</Path>" << endl;
     if (anchor)
     {
-      m_nts << "#" << anchor;
+      m_nts << indent() << "  <Anchor>" << anchor << "</Anchor>" << endl;
     }
-    m_nts << "</Path>" << endl;
   }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.