Hi,

a patch for enabling/disabling line numbers in \example listings is attached. Using the switch
  EXAMPLE_WITH_LINES = [YES/NO]
one can now toggle line numbers. The default is 'NO' in order to be consistent with the current behavior.

Best regards,
Karli
Index: src/doxygen.cpp
===================================================================
--- src/doxygen.cpp	(revision 838)
+++ src/doxygen.cpp	(working copy)
@@ -8406,6 +8406,7 @@
   g_outputList->disable(OutputGenerator::Man);
   PageSDict::Iterator pdi(*Doxygen::exampleSDict);
   PageDef *pd=0;
+  bool withLineNumbers = Config_getBool("EXAMPLE_LINE_NUMBERS");
   for (pdi.toFirst();(pd=pdi.current());++pdi)
   {
     msg("Generating docs for example %s...\n",pd->name().data());
@@ -8420,7 +8421,7 @@
                          pd->docLine(),                            // startLine
                          pd,                                       // context
                          0,                                        // memberDef
-                         pd->documentation()+"\n\n\\include "+pd->name(),          // docs
+                         pd->documentation()+ (withLineNumbers ? "\n\n\\includelineno " : "\n\n\\include ")+pd->name(),          // docs
                          TRUE,                                     // index words
                          TRUE,                                     // is example
                          pd->name()
Index: src/config.xml
===================================================================
--- src/config.xml	(revision 838)
+++ src/config.xml	(working copy)
@@ -722,6 +722,11 @@
 commands irrespective of the value of the RECURSIVE tag. 
 Possible values are YES and NO. If left blank NO is used. 
 ' defval='0'/>
+    <option type='bool' id='EXAMPLE_LINE_NUMBERS' docs='
+If the EXAMPLE_LINE_NUMBERS tag is set to YES, then line numbers
+will be printed in the example listings.
+Possible values are YES and NO. If left blank NO is used. 
+' defval='0'/>
     <option type='list' id='IMAGE_PATH' format='dir' docs='
 The IMAGE_PATH tag can be used to specify one or more files or 
 directories that contain image that are included in the documentation (see 
Index: src/configoptions.cpp
===================================================================
--- src/configoptions.cpp	(revision 838)
+++ src/configoptions.cpp	(working copy)
@@ -1016,6 +1016,14 @@
                  FALSE
                 );
   //----
+  cb = cfg->addBool(
+                 "EXAMPLE_LINE_NUMBERS",
+                 "If the EXAMPLE_LINE_NUMBERS tag is set to YES, then line numbers\n"
+                 "will be printed in the example listings.\n"
+                 "Possible values are YES and NO. If left blank NO is used.",
+                 FALSE
+                );
+  //----
   cl = cfg->addList(
                  "IMAGE_PATH",
                  "The IMAGE_PATH tag can be used to specify one or more files or\n"
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
Doxygen-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/doxygen-develop

Reply via email to