if (SOURCE_IS_SOURCE_DISTRIBUTION)
set(build_help_default OFF)
endif()
-gmx_option_trivalue(GMX_BUILD_HELP "Build man pages, HTML help, and completions automatically (requires that compiled binaries can be executed on the build host)" ${build_help_default})
+gmx_option_trivalue(GMX_BUILD_HELP "Build completions automatically (requires that compiled binaries can be executed on the build host) and install man pages if built (requires building the 'man' target manually)" ${build_help_default})
mark_as_advanced(GMX_BUILD_HELP)
if (GMX_BUILD_HELP AND SOURCE_IS_SOURCE_DISTRIBUTION AND BUILD_IS_INSOURCE)
message(FATAL_ERROR
- "Rebuilding HTML and man pages or shell completions is not supported "
- "for in-source builds from a source distribution. "
+ "Rebuilding shell completions or man pages is not supported for "
+ "in-source builds from a source distribution. "
"Set GMX_BUILD_HELP=OFF or do an out-of-source build to proceed.")
endif()
# directories to include to keep the probe file names at the same place.
# And this does not detect if things have been built in the past, but are
# outdated.
- if (NOT EXISTS "${CMAKE_BINARY_DIR}/docs/man/man1/gmx-view.1" OR
+ if (NOT EXISTS "${CMAKE_BINARY_DIR}/docs/man/gmx-view.1" OR
NOT EXISTS "${CMAKE_BINARY_DIR}/docs/install-guide/text/INSTALL" OR
- NOT EXISTS "${CMAKE_BINARY_DIR}/docs/old-html/final/online/gro.html" OR
- NOT EXISTS "${CMAKE_BINARY_DIR}/src/programs/completion/gmx-completion.bash" OR
- NOT EXISTS "${CMAKE_BINARY_DIR}/docs/old-html/final/programs/gmx-view.html")
+ NOT EXISTS "${CMAKE_BINARY_DIR}/src/programs/completion/gmx-completion.bash")
message(FATAL_ERROR
"To create a complete source package, bash completions, "
- "man and HTML pages, and INSTALL need to be generated. "
- "Run 'make completion man html install-guide' to build "
- "these parts. You can also configure with "
- "GMX_BUILD_HELP=ON to automatically build the HTML parts.")
+ "man pages, and INSTALL need to be generated. "
+ "Run 'make completion man install-guide' to build "
+ "these parts (you will need Sphinx). You can also configure with "
+ "GMX_BUILD_HELP=ON to automatically build the completions.")
endif()
else()
- # TODO: If GMX_BUILD_HELP is AUTO, it may happen that the generation fails,
- # and things are silently left out.
+ # TODO: If GMX_BUILD_HELP is AUTO, it may happen that the generation
+ # fails, and things are silently left out.
# Also, it is currently impossible to get these files into the binary
# package for cross-compilation. However, binary packages are not
# currently used much, either...
if (NOT CPACK_GMX_BUILD_HELP)
message(WARNING
- "To create a complete binary package, bash completions, and "
- "man and HTML pages need to be generated. "
+ "To create a complete binary package, bash completions and "
+ "man pages need to be generated. "
"You need to configure with GMX_BUILD_HELP=ON to include all "
"in the binary package.")
- # Building the man, html, ... targets is not sufficient because than the
+ # Building the man etc. targets is not sufficient because then the
# install is still not done.
endif()
endif()
set(HTML_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/html")
file(MAKE_DIRECTORY ${HTML_OUTPUT_DIR})
+set(MAN_PAGE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+
find_package(PythonInterp)
find_package(Sphinx 1.2.3 COMPONENTS pygments)
-add_subdirectory(man)
add_subdirectory(old-html)
add_subdirectory(doxygen)
download.rst
online.rst
install-guide/index.rst
+ man/gromacs.7.rst
user-guide/index.rst
user-guide/getting-started.rst
user-guide/cutoff-schemes.rst
VERBATIM
)
add_dependencies(webpage-sphinx sphinx-input sphinx-programs)
+
+ add_custom_target(man
+ COMMAND
+ ${SPHINX_EXECUTABLE}
+ -q -b man
+ -w sphinx-man.log
+ -d ${SPHINX_CACHE_DIR}
+ -t do_man
+ ${SPHINX_INPUT_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}/man
+ COMMENT "Building man pages with Sphinx"
+ VERBATIM)
+ add_dependencies(man sphinx-input sphinx-programs)
+ if (NOT SOURCE_IS_SOURCE_DISTRIBUTION OR GMX_BUILD_HELP)
+ set(MAN_PAGE_DIR ${CMAKE_CURRENT_BINARY_DIR}/man)
+ endif()
+endif()
+if (SOURCE_IS_SOURCE_DISTRIBUTION OR (GMX_BUILD_HELP AND SPHINX_FOUND))
+ install(DIRECTORY ${MAN_PAGE_DIR}/
+ DESTINATION ${MAN_INSTALL_DIR}/man1
+ COMPONENT man OPTIONAL
+ FILES_MATCHING PATTERN "*.1")
+ install(DIRECTORY ${MAN_PAGE_DIR}/
+ DESTINATION ${MAN_INSTALL_DIR}/man7
+ COMPONENT man OPTIONAL
+ FILES_MATCHING PATTERN "*.7")
endif()
+gmx_cpack_add_generated_source_directory(man)
set(HTML_BUILD_IS_POSSIBLE OFF)
# We can only configure to build the webpage if the user asked for it,
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
-# exclude_patterns = []
+if not tags.has('do_man'):
+ exclude_patterns = ['man']
+else:
+ exclude_patterns = ['man/bytopic.rst']
# The reST default role (used for this markup: `text`) to use for all
# documents.
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
-man_pages = [
- ('index', 'gromacs', u'Gromacs Documentation',
- [u'Gromacs development team'], 1)
-]
+execfile('conf-man.py')
# If true, show URL addresses after external links.
#man_show_urls = False
+++ /dev/null
-#
-# This file is part of the GROMACS molecular simulation package.
-#
-# Copyright (c) 2014, by the GROMACS development team, led by
-# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
-# and including many others, as listed in the AUTHORS file in the
-# top-level source directory and at http://www.gromacs.org.
-#
-# GROMACS is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public License
-# as published by the Free Software Foundation; either version 2.1
-# of the License, or (at your option) any later version.
-#
-# GROMACS is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with GROMACS; if not, see
-# http://www.gnu.org/licenses, or write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# If you want to redistribute modifications to GROMACS, please
-# consider that scientific software is very special. Version
-# control is crucial - bugs must be traceable. We will be happy to
-# consider code for inclusion in the official distribution, but
-# derived work must not be called official GROMACS. Details are found
-# in the README & COPYING files - if they are missing, get the
-# official version at http://www.gromacs.org.
-#
-# To help us fund GROMACS development, we humbly ask that you cite
-# the research papers on the package. Check out http://www.gromacs.org.
-
-if (NOT DEFINED GMX_EXECUTABLE OR NOT DEFINED SOURCE_DIR)
- message(FATAL_ERROR "Required input parameter not set")
-endif()
-
-file(MAKE_DIRECTORY man1)
-file(MAKE_DIRECTORY man7)
-file(COPY ${SOURCE_DIR}/man7/gromacs.7.in DESTINATION man7/)
-execute_process(
- COMMAND ${GMX_EXECUTABLE} -quiet help -export man
- RESULT_VARIABLE exitcode)
-if (exitcode)
- # Ensure that no partial output is left behind.
- file(REMOVE_RECURSE man1)
- file(REMOVE man7/gromacs.7)
- if (ERRORS_ARE_FATAL)
- message(FATAL_ERROR
- "Failed to generate man pages. "
- "Set GMX_BUILD_HELP=OFF if you want to skip them.\n"
- "Error/exit code: ${exitcode}")
- else()
- message(
- "Failed to generate man pages, will build GROMACS without. "
- "Set GMX_BUILD_HELP=OFF if you want to skip this notification and "
- "warnings during installation.")
- endif()
-endif()
+++ /dev/null
-#
-# This file is part of the GROMACS molecular simulation package.
-#
-# Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
-# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
-# and including many others, as listed in the AUTHORS file in the
-# top-level source directory and at http://www.gromacs.org.
-#
-# GROMACS is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public License
-# as published by the Free Software Foundation; either version 2.1
-# of the License, or (at your option) any later version.
-#
-# GROMACS is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with GROMACS; if not, see
-# http://www.gnu.org/licenses, or write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# If you want to redistribute modifications to GROMACS, please
-# consider that scientific software is very special. Version
-# control is crucial - bugs must be traceable. We will be happy to
-# consider code for inclusion in the official distribution, but
-# derived work must not be called official GROMACS. Details are found
-# in the README & COPYING files - if they are missing, get the
-# official version at http://www.gromacs.org.
-#
-# To help us fund GROMACS development, we humbly ask that you cite
-# the research papers on the package. Check out http://www.gromacs.org.
-
-include(gmxCustomCommandUtilities)
-
-set(MAN_PAGE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
-if (GMX_BUILD_HELP)
- gmx_add_custom_output_target(man OUTPUT STAMP
- COMMAND ${CMAKE_COMMAND}
- -D GMX_EXECUTABLE=$<TARGET_FILE:gmx>
- -D SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
- -D ERRORS_ARE_FATAL=${GMX_BUILD_HELP_FORCE}
- -P ${CMAKE_CURRENT_SOURCE_DIR}/BuildManPages.cmake
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- DEPENDS gmx
- ${CMAKE_CURRENT_SOURCE_DIR}/man7/gromacs.7.in
- ${CMAKE_CURRENT_SOURCE_DIR}/BuildManPages.cmake
- COMMENT "Generating man pages")
- set_target_properties(man PROPERTIES EXCLUDE_FROM_ALL OFF)
- set_directory_properties(PROPERTIES
- ADDITIONAL_MAKE_CLEAN_FILES "man1;man7/gromacs.7")
- set(MAN_PAGE_DIR ${CMAKE_CURRENT_BINARY_DIR})
-endif()
-
-# man pages are only available if they are either build or this is a source archive
-if (SOURCE_IS_SOURCE_DISTRIBUTION OR GMX_BUILD_HELP)
- install(FILES ${MAN_PAGE_DIR}/man7/gromacs.7
- DESTINATION ${MAN_INSTALL_DIR}/man7
- COMPONENT man OPTIONAL)
- install(DIRECTORY ${MAN_PAGE_DIR}/man1
- DESTINATION ${MAN_INSTALL_DIR}
- COMPONENT man OPTIONAL)
-endif()
-gmx_cpack_add_generated_source_directory(man1)
-gmx_cpack_add_generated_source_directory(man7)
--- /dev/null
+:orphan:
+
+GROMACS
+=======
+
+Description
+-----------
+
+**GROMACS** is a full-featured suite of programs to perform molecular dynamics
+simulations - in other words, to simulate the behavior of systems with hundreds
+to millions of particles, using Newtonian equations of motion.
+It is primarily used for research on proteins, lipids, and polymers, but can be
+applied to a wide variety of chemical and biological research questions.
+
+Synopsis
+--------
+
+The following commands make up the GROMACS suite. Please refer to their
+individual man pages for further details.
+
+.. include:: bytopic.rst
+
+Additional documentation
+------------------------
+
+Consult the manual at <http://www.gromacs.org> for an introduction to molecular
+dynamics in general and GROMACS in particular, as well as an overview of the
+individual programs.
+
+References
+----------
+
+The development of GROMACS is mainly funded by academic research grants.
+To help us fund development, the authors humbly ask that you cite the GROMACS papers:
+
+H.J.C. Berendsen, D. van der Spoel and R. van Drunen. **GROMACS: A message-passing
+parallel molecular dynamics implementation**. Comp. Phys. Comm. *91*, 43-56 (1995)
+
+Erik Lindahl, Berk Hess and David van der Spoel. **GROMACS 3.0: A package for
+molecular simulation and trajectory analysis**. J. Mol. Mod. *7*, 306-317 (2001)
+
+B. Hess, C. Kutzner, D. van der Spoel, and E. Lindahl. **GROMACS 4: Algorithms for
+Highly Efficient, Load-Balanced, and Scalable Molecular Simulation**.
+J. Chem. Theory Comput. *4*, 3, 435-447 (2008),
+<http://dx.doi.org/10.1021/ct700301q>
+
+Authors
+-------
+
+Current developers:
+
+David van der Spoel <spoel@gromacs.org>
+Berk Hess <hess@gromacs.org>
+Erik Lindahl <lindahl@gromacs.org>
+
+A full list of present and former contributors
+is available at <http://www.gromacs.org>
+
+This manual page is largely based on the GROMACS online reference, and the text
+was prepared originally by Nicholas Breen <nbreen@ofb.net>.
+
+Bugs
+----
+
+GROMACS has no major known bugs, but be warned that it stresses your CPU more
+than most software. Systems with slightly flaky hardware may prove unreliable
+while running heavy-duty simulations. If at all possible, please try to
+reproduce bugs on another machine before reporting them.
+++ /dev/null
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
-.\" (and then reused elsewhere, since this isn't a perl package)
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
-.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
-.\" expand to `' in nroff, nothing in troff, for use with C<>.
-.tr \(*W-|\(bv\*(Tr
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-'br\}
-.\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. nr % 0
-. rr F
-.\}
-.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
-.\" Fear. Run. Save yourself. No user-serviceable parts.
-. \" fudge factors for nroff and troff
-.if n \{\
-. ds #H 0
-. ds #V .8m
-. ds #F .3m
-. ds #[ \f1
-. ds #] \fP
-.\}
-.if t \{\
-. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
-. ds #V .6m
-. ds #F 0
-. ds #[ \&
-. ds #] \&
-.\}
-. \" simple accents for nroff and troff
-.if n \{\
-. ds ' \&
-. ds ` \&
-. ds ^ \&
-. ds , \&
-. ds ~ ~
-. ds /
-.\}
-.if t \{\
-. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
-. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
-. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
-. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
-. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
-. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
-.\}
-. \" troff and (daisy-wheel) nroff accents
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
-.ds ae a\h'-(\w'a'u*4/10)'e
-.ds Ae A\h'-(\w'A'u*4/10)'E
-. \" corrections for vroff
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
-. \" for low resolution devices (crt and lpr)
-.if \n(.H>23 .if \n(.V>19 \
-\{\
-. ds : e
-. ds 8 ss
-. ds o a
-. ds d- d\h'-1'\(ga
-. ds D- D\h'-1'\(hy
-. ds th \o'bp'
-. ds Th \o'LP'
-. ds ae ae
-. ds Ae AE
-.\}
-.rm #[ #] #H #V #F C
-.\" ========================================================================
-.\"
-.IX Title "GROMACS 7"
-.TH GROMACS 7 "" "@VERSION@" "GROMACS Manual"
-.SH "NAME"
-gromacs \- molecular dynamics simulation suite
-.SH "DESCRIPTION"
-.B GROMACS
-(the Groningen Machine for Chemical Simulations) is a full-featured
-suite of programs to perform molecular dynamics simulations - in other
-words, to simulate the behavior of systems with hundreds to millions
-of particles, using Newtonian equations of motion. It is primarily
-used for research on proteins, lipids, and polymers, but can be applied
-to a wide variety of chemical and biological research questions.
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-.PP
-The following commands make up the GROMACS suite. Please refer to their
-individual man pages for further details.
-@PROGMANPAGES@
-.PP
-.SH "ADDITIONAL DOCUMENTATION"
-.IX Header "ADDITIONAL DOCUMENTATION"
-Consult the manual at <\fIhttp://www.gromacs.org/content/view/27/42/\fR> for an
-introduction to molecular dynamics in general and GROMACS in particular,
-as well as an overview of the individual programs.
-.PP
-The shorter HTML reference is available in \fB/usr/share/doc/gromacs/html/\fR .
-.SH "REFERENCES"
-.IX Header "REFERENCES"
-The development of GROMACS is mainly funded by academic research grants.
-To help us fund development, the authors humbly ask that you cite the GROMACS papers:
-.PP
-H.J.C. Berendsen, D. van der Spoel and R. van Drunen. \fBGROMACS: A message-passing
-parallel molecular dynamics implementation\fR. Comp. Phys. Comm. \fI91\fR, 43-56 (1995)
-.PP
-Erik Lindahl, Berk Hess and David van der Spoel. \fBGROMACS 3.0: A package for
-molecular simulation and trajectory analysis\fR. J. Mol. Mod. \fI7\fR, 306-317 (2001)
-.PP
-B. Hess, C. Kutzner, D. van der Spoel, and E. Lindahl. \fBGROMACS 4: Algorithms for
-Highly Efficient, Load-Balanced, and Scalable Molecular Simulation\fR. J. Chem. Theory
-Comput. \fI4\fR, 3, 435-447 (2008), <\fIhttp://dx.doi.org/10.1021/ct700301q\fR>
-.SH "AUTHORS"
-.IX Header "AUTHORS"
-Current developers:
-.PP
-David van der Spoel <spoel@gromacs.org>
-.br
-Berk Hess <hess@gromacs.org>
-.br
-Erik Lindahl <lindahl@gromacs.org>
-.PP
-A full list of present and former contributors
-is available at <http://www.gromacs.org>
-.PP
-This manual page is largely based on the GROMACS online reference, and was
-prepared in this format by Nicholas Breen <nbreen@ofb.net>.
-.SH "BUGS"
-.IX Header "BUGS"
-GROMACS has no major known bugs, but be warned that it stresses your CPU more
-than most software. Systems with slightly flaky hardware may prove unreliable
-while running heavy-duty simulations. If at all possible, please try to
-reproduce bugs on another machine before reporting them.
}
}
-/********************************************************************
- * HelpExportMan
- */
-
-/*! \internal \brief
- * Implements export for man pages.
- *
- * \ingroup module_commandline
- */
-class HelpExportMan : public HelpExportInterface
-{
- public:
- //! Initializes man page exporter.
- explicit HelpExportMan(const CommandLineHelpModuleImpl &helpModule)
- : links_(eHelpOutputFormat_Man)
- {
- initProgramLinks(&links_, helpModule);
- }
-
- virtual void startModuleExport() {}
- virtual void exportModuleHelp(
- const CommandLineModuleInterface &module,
- const std::string &tag,
- const std::string &displayName);
- virtual void finishModuleExport() {}
-
- virtual void startModuleGroupExport();
- virtual void exportModuleGroup(const char *title,
- const ModuleGroupContents &modules);
- virtual void finishModuleGroupExport();
-
- private:
- HelpLinks links_;
- boost::scoped_ptr<File> man7File_;
- std::string man7Footer_;
-};
-
-void HelpExportMan::exportModuleHelp(
- const CommandLineModuleInterface &module,
- const std::string &tag,
- const std::string &displayName)
-{
- File file("man1/" + tag + ".1", "w");
-
- // TODO: It would be nice to remove the VERSION prefix from the version
- // string to make it shorter.
- file.writeLine(formatString(".TH %s 1 \"\" \"%s\" \"GROMACS Manual\"\n",
- tag.c_str(), gmx_version()));
- file.writeLine(".SH NAME");
- file.writeLine(formatString("%s - %s", tag.c_str(),
- module.shortDescription()));
- file.writeLine();
-
- CommandLineHelpContext context(&file, eHelpOutputFormat_Man, &links_);
- context.setModuleDisplayName(displayName);
- module.writeHelp(context);
-
- file.writeLine(".SH SEE ALSO");
- file.writeLine(".BR gromacs(7)");
- file.writeLine();
- file.writeLine("More information about \\fBGROMACS\\fR is available at <\\fIhttp://www.gromacs.org/\\fR>.");
-}
-
-void HelpExportMan::startModuleGroupExport()
-{
- const char *const programListPlaceholder = "@PROGMANPAGES@";
-
- const std::string man7Template = gmx::File::readToString("man7/gromacs.7.in");
- const size_t index = man7Template.find(programListPlaceholder);
- GMX_RELEASE_ASSERT(index != std::string::npos,
- "gromacs.7.in must contain a @PROGMANPAGES@ line");
- std::string header = man7Template.substr(0, index);
- man7Footer_ = man7Template.substr(index + std::strlen(programListPlaceholder));
- header = replaceAll(header, "@VERSION@", gmx_version());
- man7File_.reset(new File("man7/gromacs.7", "w"));
- man7File_->writeLine(header);
-}
-
-void HelpExportMan::exportModuleGroup(const char *title,
- const ModuleGroupContents &modules)
-{
- man7File_->writeLine(formatString(".Sh \"%s\"", title));
- man7File_->writeLine(formatString(".IX Subsection \"%s\"", title));
- man7File_->writeLine(".Vb");
- man7File_->writeLine(".ta 16n");
-
- ModuleGroupContents::const_iterator module;
- for (module = modules.begin(); module != modules.end(); ++module)
- {
- const std::string &tag(module->first);
- man7File_->writeLine(formatString("\\& %s\t%s",
- tag.c_str(), module->second));
- }
-
- man7File_->writeLine(".Ve");
-}
-
-void HelpExportMan::finishModuleGroupExport()
-{
- man7File_->writeLine(man7Footer_);
- man7File_->close();
-}
-
/********************************************************************
* HelpExportHtml
*/
private:
HelpLinks links_;
boost::scoped_ptr<File> indexFile_;
+ boost::scoped_ptr<File> manPagesFile_;
};
HelpExportReStructuredText::HelpExportReStructuredText(
indexFile_.reset(new File("programs/byname.rst", "w"));
indexFile_->writeLine("Tools by Name");
indexFile_->writeLine("=============");
+ manPagesFile_.reset(new File("conf-man.py", "w"));
+ manPagesFile_->writeLine("man_pages = [");
}
void HelpExportReStructuredText::exportModuleHelp(
CommandLineHelpContext context(&file, eHelpOutputFormat_Rst, &links_);
context.setModuleDisplayName(displayName);
module.writeHelp(context);
+
+ file.writeLine();
+ file.writeLine(".. only:: man");
+ file.writeLine();
+ file.writeLine(" See also");
+ file.writeLine(" --------");
+ file.writeLine();
+ file.writeLine(" :manpage:`gromacs(7)`");
+ file.writeLine();
+ file.writeLine(" More information about |Gromacs| is available at <http://www.gromacs.org/>.");
file.close();
indexFile_->writeLine(formatString("* :doc:`%s <%s>` - %s",
displayName.c_str(), tag.c_str(),
module.shortDescription()));
+ manPagesFile_->writeLine(
+ formatString(" ('programs/%s', '%s', \"%s\", '', 1),",
+ tag.c_str(), tag.c_str(), module.shortDescription()));
}
void HelpExportReStructuredText::finishModuleExport()
{
indexFile_->close();
indexFile_.reset();
+ manPagesFile_->writeLine(" ('man/gromacs.7', 'gromacs', 'molecular dynamics simulation suite', '', 7)");
+ manPagesFile_->writeLine("]");
+ manPagesFile_->close();
+ manPagesFile_.reset();
}
void HelpExportReStructuredText::startModuleGroupExport()
indexFile_.reset(new File("programs/bytopic.rst", "w"));
indexFile_->writeLine("Tools by Topic");
indexFile_->writeLine("==============");
+ manPagesFile_.reset(new File("man/bytopic.rst", "w"));
}
void HelpExportReStructuredText::exportModuleGroup(
{
indexFile_->writeLine(title);
indexFile_->writeLine(std::string(std::strlen(title), '-'));
+ manPagesFile_->writeLine(title);
+ manPagesFile_->writeLine(std::string(std::strlen(title), '+'));
ModuleGroupContents::const_iterator module;
for (module = modules.begin(); module != modules.end(); ++module)
indexFile_->writeLine(formatString("| :doc:`%s <%s>` - %s",
displayName.c_str(), tag.c_str(),
module->second));
+ manPagesFile_->writeLine(formatString("| ``%s`` - %s",
+ displayName.c_str(),
+ module->second));
}
indexFile_->writeLine();
+ manPagesFile_->writeLine();
}
void HelpExportReStructuredText::finishModuleGroupExport()
{
indexFile_->close();
indexFile_.reset();
+ manPagesFile_->close();
+ manPagesFile_.reset();
}
/********************************************************************
// Add internal topics lazily here.
addTopic(HelpTopicPointer(new CommandsHelpTopic(*impl_)));
- const char *const exportFormats[] = { "man", "html", "rst", "completion" };
+ const char *const exportFormats[] = { "html", "rst", "completion" };
std::string exportFormat;
Options options(NULL, NULL);
options.addOption(StringOption("export").store(&exportFormat)
if (!exportFormat.empty())
{
boost::scoped_ptr<HelpExportInterface> exporter;
- if (exportFormat == "man")
- {
- exporter.reset(new HelpExportMan(*impl_));
- }
- else if (exportFormat == "html")
+ if (exportFormat == "html")
{
exporter.reset(new HelpExportHtml());
}
lineLength_ = 78;
file.writeString(name);
break;
- case eHelpOutputFormat_Man:
- lineLength_ = 70;
- file.writeString(name);
- break;
case eHelpOutputFormat_Rst:
lineLength_ = 74;
indent_ += 4;
ConstArrayRef<const char *>::const_iterator i;
for (i = bugs_.begin(); i != bugs_.end(); ++i)
{
- const char *const bug = *i;
- // TODO: The context should be able to do this also for console output, but
- // that requires a lot more elaborate parser for the markup.
- if (context.outputFormat() != eHelpOutputFormat_Man)
- {
- TextLineWrapperSettings settings;
- settings.setIndent(2);
- settings.setFirstLineIndent(0);
- settings.setLineLength(78);
- context.outputFile().writeLine(
- context.substituteMarkupAndWrapToString(
- settings, formatString("* %s", bug)));
- }
- else
- {
- context.writeTextBlock(formatString("\n- %s", bug));
- }
+ const char *const bug = *i;
+ TextLineWrapperSettings settings;
+ settings.setIndent(2);
+ settings.setFirstLineIndent(0);
+ settings.setLineLength(78);
+ context.outputFile().writeLine(
+ context.substituteMarkupAndWrapToString(
+ settings, formatString("* %s", bug)));
}
}
{ "[tanh]", ")" },
{ "[PAR]", "\n\n" },
{ "[BR]", "\n"},
- /* [UL], [LI], [ul] cannot be implemented properly with the current
- * approach. */
- { "[GRK]", "" },
- { "[grk]", "" }
-};
-
-//! List of replacements for man page output.
-const t_sandr sandrMan[] = {
- { "\\*", "*" },
- { "\\=", "=" },
- { "[TT]", "\\fB" },
- { "[tt]", "\\fR" },
- { "[BB]", "\\fB" },
- { "[bb]", "\\fR" },
- { "[IT]", "\\fI" },
- { "[it]", "\\fR" },
- { "[MATH]", "" },
- { "[math]", "" },
- { "[CHEVRON]", "<" },
- { "[chevron]", ">" },
- { "[MAG]", "|" },
- { "[mag]", "|" },
- { "[INT]", "integral" },
- { "[FROM]", " from " },
- { "[from]", "" },
- { "[TO]", " to " },
- { "[to]", " of" },
- { "[int]", "" },
- { "[SUM]", "sum" },
- { "[sum]", "" },
- { "[SUB]", "_" },
- { "[sub]", "" },
- { "[SQRT]", "sqrt(" },
- { "[sqrt]", ")", },
- { "[EXP]", "exp(" },
- { "[exp]", ")" },
- { "[LN]", "ln(" },
- { "[ln]", ")" },
- { "[LOG]", "log(" },
- { "[log]", ")" },
- { "[COS]", "cos(" },
- { "[cos]", ")" },
- { "[SIN]", "sin(" },
- { "[sin]", ")" },
- { "[TAN]", "tan(" },
- { "[tan]", ")" },
- { "[COSH]", "cosh(" },
- { "[cosh]", ")" },
- { "[SINH]", "sinh(" },
- { "[sinh]", ")" },
- { "[TANH]", "tanh(" },
- { "[tanh]", ")" },
- { "[PAR]", "\n\n" },
- { "\n ", "\n" },
- // The following three work only in the specific context in which they are
- // currently used.
- { "[UL]", "" },
- { "[LI]", "\n- " },
- { "[ul]", "" },
- { "<", "" },
- { ">", "" },
- { "^", "" },
- { "#", "" },
- { "[BR]", "\n"},
- { "-", "\\-"},
{ "[GRK]", "" },
{ "[grk]", "" }
};
case eHelpOutputFormat_Console:
replacement = repall(displayName, sandrTty);
break;
- case eHelpOutputFormat_Man:
- replacement = repall(displayName, sandrMan);
- break;
case eHelpOutputFormat_Rst:
replacement = formatString(
":doc:`%s <%s>`", repall(displayName, sandrTty).c_str(),
result = replaceLinks(result);
return wrapper->wrap(result);
}
- case eHelpOutputFormat_Man:
- {
- // Needs to be done first to avoid '-' -> '\-' messing up the links.
- result = replaceLinks(result);
- result = repall(result, sandrMan);
- return wrapper->wrap(result);
- }
case eHelpOutputFormat_Rst:
{
result = repall(result, sandrRst);
file.writeLine(toUpperCase(title));
file.writeLine();
break;
- case eHelpOutputFormat_Man:
- file.writeLine(formatString(".SH %s", toUpperCase(title).c_str()));
- break;
case eHelpOutputFormat_Rst:
file.writeLine(title);
file.writeLine(std::string(title.length(), '-'));
// special implementation is in CommandLineHelpWriter.
GMX_THROW(NotImplementedError("Option item formatting for console output not implemented"));
break;
- case eHelpOutputFormat_Man:
- file.writeLine(formatString(".BI \"\\%s\" \" %s\"", name.c_str(), args.c_str()));
- file.writeString(" ");
- writeTextBlock(description);
- file.writeLine();
- break;
case eHelpOutputFormat_Rst:
{
file.writeLine(formatString("``%s`` %s", name.c_str(), args.c_str()));
enum HelpOutputFormat
{
eHelpOutputFormat_Console, //!< Plain text directly on the console.
- eHelpOutputFormat_Man, //!< Man page.
- eHelpOutputFormat_Rst, //!< reStructuredText for online manual.
+ eHelpOutputFormat_Rst, //!< reStructuredText for online manual and man pages.
eHelpOutputFormat_Other, //!< Used for extensions in other modules.
eHelpOutputFormat_NR //!< Used for the number of output formats.
};