Sophie

Sophie

distrib > PLD > th > x86_64 > by-pkgid > 6e0ece3abf067a5110df895a543616f7 > files > 54

NaturalDocs-1.52-1.noarch.rpm



<html><head><title>Organizing the Menu - Natural Docs</title><link rel=stylesheet type="text/css" href="styles.css"><link rel=stylesheet type="text/css" href="examples.css"><style type="text/css"><!--


		.TimestampTable {
			margin: 1em 4ex;
			}
		.TimestampTable td {
			padding: 0 3ex 0 0;
			vertical-align: bottom;
			}

	
--></style><script language=JavaScript src="javascript/PNGHandling.js"></script><script language=JavaScript src="javascript/BrowserStyles.js"></script><script language=JavaScript src="example/NaturalDocs.js"></script></head><body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0><script language=JavaScript><!--
OpeningBrowserTags();// --></script>

<!-- saved from url=(0026)http://www.naturaldocs.org -->

<table width=100% border=0 cellspacing=0 cellpadding=0 class=PageTable float=center><tr><td colspan=3 class=Header><table width=100% border=0 cellspacing=0 cellpadding=0><tr><td><img src="images/header/leftside.png" width=30 height=75><a href="index.html"><img src="images/header/logo.png" width=524 height=75 alt="Natural Docs"></a></td><td align=right><img src="images/header/rightside.png" width=30 height=75></td></tr></table></td></tr><tr><td><img src="images/header/overleftmargin.png" width=10 height=6></td><td class=SideMenuTop><img src="images/header/overmenu.png" width=14 height=6></td><td class=BodyTop><img src="images/header/overbody.png" width=24 height=6></td></tr><tr><td></td><td class=SideMenu nowrap><div class=SideMenuSection><div class=SideMenuTitle><img src="images/menu/about.png" width=52 height=13 alt="About"></div><div class=SideMenuBody><a href="languages.html" class=SideMenuEntry>Language Support</a><a href="output.html" class=SideMenuEntry>Output Formats</a></div></div><div class=SideMenuSection><div class=SideMenuTitle><img src="images/menu/using.png" width=45 height=13 alt="Using"></div><div class=SideMenuBody><a href="documenting.html" class=SideMenuEntry>Documenting<br>Your Code</a><a href="keywords.html" class=SideMenuEntry>Keywords</a><a href="running.html" class=SideMenuEntry>Running</a><a href="troubleshooting.html" class=SideMenuEntry>Troubleshooting</a></div></div><div class=SideMenuSection><div class=SideMenuTitle><img src="images/menu/customizing.png" width=96 height=13 alt="Customizing"></div><div class=SideMenuBody><span class=SideMenuEntry id=SelectedSideMenuEntry>Organizing the Menu</span><a href="styles.html" class=SideMenuEntry>CSS Styles</a><a href="customizingtopics.html" class=SideMenuEntry>Topics and Keywords</a><a href="customizinglanguages.html" class=SideMenuEntry>Languages, Indexes,<br>and Prototypes</a></div></div><div class=SideMenuSection><div class=SideMenuTitle><img src="images/menu/community.png" width=86 height=13 alt="Community"></div><div class=SideMenuBody><a href="http://www.naturaldocs.org/" class=SideMenuEntry>Web Site</a><a href="http://www.naturaldocs.org/mailinglist.html" class=SideMenuEntry>Mailing Lists</a><a href="http://www.naturaldocs.org/messageboards.html" class=SideMenuEntry>Message Boards</a><a href="http://www.naturaldocs.org/bugs.html" class=SideMenuEntry>Bugs and<br>Feature Requests</a></div></div></td><td class=Body width=100%><div class=PageTitle>Organizing the Menu</div><div class=TOC><a href="#OrderAndTitles">Order and Titles</a> &middot; <a href="#Grouping">Grouping</a> &middot; <a href="#IndexesAndSearch">Indexes and Search</a> &middot; <a href="#AutomaticChanges">Automatic Changes</a><br><a href="#Extras">Extras</a> &middot; <a href="#Errors">Errors</a> &middot; <a href="#PortabilityAndVersioningSystems">Portability and Versioning Systems</a></div><div class=Topic><p>Natural Docs creates a file called <code>Menu.txt</code> in your <a href="running.html#CommandLine">project directory</a> that you can edit to organize the menu.&nbsp; It normally takes care of this on its own, but you have the option of improving it manually if you want to.</p></div><div class=Topic><a name="OrderAndTitles"></a><div class=TopicTitle>Order and Titles</div><p>If you&rsquo;ve never looked in it before, the menu file will have some comments explaining its syntax and a list like you see below.</p><pre class=Example>File: ClassA  (ClassA.h)
File: ClassB  (ClassB.h)
File: Globals  (Globals.h)
</pre><p>The list gets turned into a menu that looks like this:</p><table class=NDMenu><tr><td><div class=MEntry><div class=MFile><a href="#" onClick="return false;">ClassA</a></div></div><div class=MEntry><div class=MFile><a href="#" onClick="return false;">ClassB</a></div></div><div class=MEntry><div class=MFile><a href="#" onClick="return false;">Globals</a></div></div></td></tr></table><p>The lines are in the format &ldquo;<code>File: <i>[title]</i> (<i>[filename]</i>)</code>&rdquo;.&nbsp; When Natural Docs made the menu, it decided on its own what the title of each file should be and then put them in alphabetical order.&nbsp; However, suppose we don&rsquo;t want this.&nbsp; We want Globals above the classes and we want spaces in the menu titles.&nbsp; So we edit the file.</p><pre class=Example>File: Globals  (Globals.h)
File: Class A  (ClassA.h)
File: Class B  (ClassB.h)
</pre><p>Run Natural Docs again and the menu is updated.</p><table class=NDMenu><tr><td><div class=MEntry><div class=MFile><a href="#" onClick="return false;">Globals</a></div></div><div class=MEntry><div class=MFile><a href="#" onClick="return false;">Class A</a></div></div><div class=MEntry><div class=MFile><a href="#" onClick="return false;">Class B</a></div></div></td></tr></table><p>However, open the menu file again and you&rsquo;ll see something interesting.</p><pre class=Example>File: Globals  (Globals.h)
File: Class A  (no auto-title, ClassA.h)
File: Class B  (no auto-title, ClassB.h)
</pre><p>Natural Docs noticed that you changed a couple of the titles and added a <code>no auto-title</code> attribute to each one.&nbsp; This tells it to never change them on it&rsquo;s own in the future, so your changes won&rsquo;t be lost.&nbsp; You don&rsquo;t have to worry about adding this, Natural Docs will always do it automatically.&nbsp; However, to go back to automatic titles you&rsquo;d have to manually remove it.</p></div><div class=Topic><a name="Grouping"></a><div class=TopicTitle>Grouping</div><p>This menu is good for our example, but in the real world they get much, much longer.&nbsp; We can add groups to organize it further.&nbsp; Natural Docs will create them automatically based on the each file&rsquo;s directory, but once again you can improve it manually if that&rsquo;s not good enough.</p><p>You can add groups as shown below.</p><pre class=Example>File: Globals  (Globals.h)
Group: Classes {
   File: Class A  (no auto-title, ClassA.h)
   File: Class B  (no auto-title, ClassB.h) }
</pre><table class=NDMenu><tr><td><div class=MEntry><div class=MFile><a href="#" onClick="return false;">Globals</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MenuGroup11');">Classes</a><div class=MGroupContent id=MenuGroup11><div class=MEntry><div class=MFile><a href="#" onClick="return false;">Class A</a></div></div><div class=MEntry><div class=MFile><a href="#" onClick="return false;">Class B</a></div></div></div></div></div></td></tr></table><p>You can also nest them inside each other.</p><pre class=Example>File: Globals  (Globals.h)
Group: Classes {
   File: Class A  (no auto-title, ClassA.h)
   Group: Nested Group {
      File: Class B  (no auto-title, ClassB.h)  }
   }
</pre><table class=NDMenu><tr><td><div class=MEntry><div class=MFile><a href="#" onClick="return false;">Globals</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MenuGroup21');">Classes</a><div class=MGroupContent id=MenuGroup21><div class=MEntry><div class=MFile><a href="#" onClick="return false;">Class A</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MenuGroup22');">Nested Group</a><div class=MGroupContent id=MenuGroup22><div class=MEntry><div class=MFile><a href="#" onClick="return false;">Class B</a></div></div></div></div></div></div></div></div></td></tr></table><p>We&rsquo;ll get rid of the nested group because it doesn&rsquo;t make sense for our example.&nbsp; Run Natural Docs, open up the menu file again and take a look.</p><pre class=Example>File: Globals  (Globals.h)

Group: Classes  {

   File: Class A  (no auto-title, ClassA.h)
   File: Class B  (no auto-title, ClassB.h)
   }  # Group: Classes
</pre><p>Natural Docs reformatted it.&nbsp; When you&rsquo;re organizing the menu, you don&rsquo;t have to worry about the indentation or otherwise keeping it neat.&nbsp; The file is reformatted every time it changes, so you can make quick and dirty edits and Natural Docs will keep it readable.</p><p>Besides breaking up long lists, groups also serve another purpose.&nbsp; Clicking on them will make it expand and collapse.&nbsp; Go ahead and try it in the examples above.&nbsp; When the menu gets too long its groups will start being collapsed by default, allowing easier navigation on large projects where it would just be impractical to show everything at once.</p></div><div class=Topic><a name="IndexesAndSearch"></a><div class=TopicTitle>Indexes and Search</div><p>Natural Docs will automatically determine what indexes your project needs and add them to the menu.&nbsp; Anything indexed will also be used for the search feature.&nbsp; The entries will look like this:</p><pre class=Example>Group: Index {

   Index: Everything
   Class Index: Classes
   Function Index: Functions
   }  # Group: Index
</pre><p>Like the file entries we saw before, you can rename them by editing the title and reorder them by cutting and pasting.&nbsp; However, if you decide you don&rsquo;t want a particular index to be generated, just delete its entry and it will go away.&nbsp; Just like before, Natural Docs will detect this and add something new:</p><pre class=Example>Don't Index: Functions
</pre><p>As with <code>no auto-title</code>, Natural Docs adds this automatically to make sure it doesn&rsquo;t later undo your changes.</p></div><div class=Topic><a name="AutomaticChanges"></a><div class=TopicTitle>Automatic Changes</div><p>Natural Docs tries to manage the menu on its own as much as possible so you don&rsquo;t have to worry about it.&nbsp; This is just a peek into some of the things it does so you know what to expect.</p><p>You already saw that by default Natural Docs tries to guess what title should be for each file.&nbsp; If you leave it this way, Natural Docs will always update the menu for you if the file&rsquo;s content changes significantly enough to change its guess, such as if you rename the first class defined in it.&nbsp; If you&rsquo;d like to take advantage of this to define the menu title in each source file instead of in the menu itself, add a &ldquo;<code>Title: [title]</code>&rdquo; comment to the top of the file.</p><p>When you add and delete source files, Natural Docs will automatically add and remove them from the menu file.&nbsp; When adding one it will look for the best group to put it in by directory.&nbsp; If your grouping mirrors the source tree somewhat, this will be a lot more accurate.&nbsp; Also, if the group it&rsquo;s putting it in is alphabetized, Natural Docs will put it in the correct place to maintain that alphabetization.&nbsp; In fact, even if an existing file&rsquo;s automatic title changes, it will change it&rsquo;s position to make sure a previously alphabetized group stays that way.</p><p>There are exceptions in alphabetization for the indexes.&nbsp; If a group only contains indexes, it can be the last item on the menu or in its parent group without making it count as unsorted.&nbsp; Also, within groups that only contain indexes, the general index can be first, also without making the group count as unsorted.</p><p>Finally, if Natural Docs adds some files to a group that causes it to become too long, it will attempt to sub-group it based on directory.&nbsp; However, it will <i>only</i> do this when its adding files on its own, so you don&rsquo;t have to worry about it constantly messing up your groups.&nbsp; Since new files aren&rsquo;t added to a project that often, if you change the menu manually it should stay that way for quite some time.</p></div><div class=Topic><a name="Extras"></a><div class=TopicTitle>Extras</div><p>There&rsquo;s more you can do with the menu than just renaming and reorganizing its entries.&nbsp; Natural Docs has a few extras you can add to it as well.</p><a name="TitleAndSubtitle"></a><div class="SubTopic">Title and Subtitle</div><p>You can add a title and subtitle to your menu.</p><pre class=Example>Title: My Project
SubTitle: Something That Does Something

File: Globals  (Globals.h)
Group: Classes
   File: Class A  (no auto-title, ClassA.h)
   File: Class B  (no auto-title, ClassB.h)
</pre><table class=NDMenu><tr><td><div class=MTitle>My Project<div class=MSubTitle>Something That Does Something</div></div><div class=MEntry><div class=MFile><a href="#" onClick="return false;">Globals</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MenuGroup31');">Classes</a><div class=MGroupContent id=MenuGroup31><div class=MEntry><div class=MFile><a href="#" onClick="return false;">Class A</a></div></div><div class=MEntry><div class=MFile><a href="#" onClick="return false;">Class B</a></div></div></div></div></div></td></tr></table><p>In addition to adding the title to the menu, the Title tag will also change the HTML page titles from &ldquo;<i>Class A</i>&rdquo; to &ldquo;<i>Class A - My Project</i>&rdquo;, making bookmarks clearer.</p><a name="TextAndWebLinks"></a><div class="SubTopic">Text and Web Links</div><p>You can also add arbitrary text and web links to your menu.</p><pre class=Example>File: Globals  (Globals.h)
Group: Classes  {
   Text: I couldn't think of good names for these classes.
   File: Class A  (no auto-title, ClassA.h)
   File: Class B  (no auto-title, ClassB.h)
   }
Link: Built with Natural Docs  (http://www.naturaldocs.org)
</pre><table class=NDMenu><tr><td><div class=MEntry><div class=MFile><a href="#" onClick="return false;">Globals</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MenuGroup51');">Classes</a><div class=MGroupContent id=MenuGroup51><div class=MEntry><div class=MText>I couldn&rsquo;t think of good names for these classes.</div></div><div class=MEntry><div class=MFile><a href="#" onClick="return false;">Class A</a></div></div><div class=MEntry><div class=MFile><a href="#" onClick="return false;">Class B</a></div></div></div></div></div><div class=MEntry><div class=MLink><a href="#" onClick="return false;">Built with Natural Docs</a></div></div></td></tr></table><p>Even though comments use the # character, adding an anchor to a link (such as &ldquo;http://www.website.com/page.html#anchor&rdquo;) will still work.</p><a name="Footers"></a><div class="SubTopic">Footers</div><p>Finally, you can add a footer to all your pages, such as a copyright notice.&nbsp; Natural Docs will change any (c)&rsquo;s it finds into real copyright symbols.</p><pre class=Example>Footer: Copyright (C) 2010 Me
</pre><table class=NDFooter><tr><td>Copyright &copy; 2010 Me&nbsp; &middot;&nbsp; <a href="http://www.naturaldocs.org">Generated by Natural Docs</a></td></tr></table><p>You can also add a timestamp in any format you want.&nbsp; The tokens you can use in building it are:</p><p><table class=TimestampTable></p><p><tr><td><code>m</code></td><td>One or two digit month.</td><td>January is &ldquo;1&rdquo;</td></tr></p><p><tr><td><code>mm</code></td><td>Always two digit month.</td><td>January is &ldquo;01&rdquo;</td></tr></p><p><tr><td><code>mon</code></td><td>Short month word.</td><td>January is &ldquo;Jan&rdquo;</td></tr></p><p><tr><td><code>month</code></td><td>Long month word.</td><td>January is &ldquo;January&rdquo;</td></tr></p><p><tr><td><code>d</code></td><td>One or two digit day.</td><td>1 is &ldquo;1&rdquo;</td></tr></p><p><tr><td><code>dd</code></td><td>Always two digit day.</td><td>1 is &ldquo;01&rdquo;</td></tr></p><p><tr><td><code>day</code></td><td>Day with letter extension.</td><td>1 is &ldquo;1st&rdquo;</td></tr></p><p><tr><td><code>yy</code></td><td>Two digit year.</td><td>2010 is &ldquo;10&rdquo;</td></tr></p><p><tr><td><code>yyyy</code></td><td>Four digit year.</td><td>2010 is &ldquo;2010&rdquo;</td></tr></p><p><tr><td><code>year</code></td><td>Four digit year.</td><td>2010 is &ldquo;2010&rdquo;</td></tr></p><p></table></p><p>Everything else appears literally, so we can add:</p><pre class=Example>Timestamp: Updated month day, year
</pre><p>and get:</p><table class=NDFooter><tr><td>Copyright &copy; 2010 Me&nbsp; &middot;&nbsp; Updated January 1st, 2010&nbsp; &middot;&nbsp; <a href="http://www.naturaldocs.org">Generated by Natural Docs</a></td></tr></table></div><div class=Topic><a name="Errors"></a><div class=TopicTitle>Errors</div><p>If there&rsquo;s ever an error in the menu file, Natural Docs will tell you when it&rsquo;s run.&nbsp; It also adds a comment for each one in the menu file itself so that you can search for them in a text editor.</p><pre class=Example># There is an error in this file.  Search for ERROR to find it.

File: Globals  (Globals.h)
Group: Classes  {
# ERROR: Txet is not a valid keyword.
   Txet: I couldn't think of good names for these classes.
   File: Class A  (no auto-title, ClassA.h)
   File: Class B  (no auto-title, ClassB.h)
   }
</pre><p>Remember that Natural Docs reformats the menu file whenever it&rsquo;s run, so you only need to correct the error.&nbsp; Natural Docs will remove the error comments on its own.</p></div><div class=Topic><a name="PortabilityAndVersioningSystems"></a><div class=TopicTitle>Portability and Versioning Systems</div><p>If you only use <a href="running.html">one input directory</a>, all the files in the menu will have relative paths.&nbsp; However, if you have more Natural Docs will use the absolute path instead.</p><p>This is not a problem.&nbsp; The menu file can still be shared between machines even if they don&rsquo;t keep the source tree in the exact same location.&nbsp; As long as you have the same layout within the source tree and point to the same base directories in the command line, Natural Docs will be able to convert the paths automatically for the new machine.</p><p>However, if you&rsquo;re putting the menu file in a versioning system like Subversion or SourceSafe, it might be very desirable to only have relative paths so anybody can check it in and only the real changes show.&nbsp; In that case, instead of using multiple input directories, see if it&rsquo;s possible to only have one input directory and use the <a href="running.html#CommandLine"><code>-xi</code> command line option</a> to exclude the subdirectories you don&rsquo;t want scanned.</p></div><div class=Topic><a name="ThatsIt"></a><div class=TopicTitle>That&rsquo;s It!</div><p>And we&rsquo;re done.&nbsp; The syntax to do all of this is included in the menu file itself, so you don&rsquo;t need to memorize everything.&nbsp; You shouldn&rsquo;t need to organize the menu very often, just after a lot of new files have been added and if you don&rsquo;t like the default.</p><p>Note that if you&rsquo;re using the non-framed HTML output format, changing the menu does require every output file to be updated.&nbsp; However, Natural Docs has a special process just for this so it won&rsquo;t take nearly as long as if it were rebuilding them all from scratch.&nbsp; Still, if you&rsquo;re working on a large project, it may be worth considering the framed HTML output format.</p></div></td></tr><tr><td></td><td class=SideMenuBottom><table width=100% border=0 cellspacing=0 cellpadding=0><tr><td class=SideMenuBottomLeft><img src="images/menu/bottomleft.png" width=18 height=19></td><td class=SideMenuBottomRight><img src="images/menu/bottomright.png" width=18 height=19></td></tr></table></td><td class=BodyBottom>Copyright &copy; 2003-2010 Greg Valure</td></tr></table><script language=JavaScript><!--
ClosingBrowserTags();// --></script></body></html>