[kdiff3] /: Generate man page for docbook/xml file.
Michael Reeves
null at kde.org
Sun Apr 29 21:24:29 UTC 2018
Git commit ac868cbf68137eec5ba68ec9a1ca7944ab195c60 by Michael Reeves.
Committed on 29/04/2018 at 21:06.
Pushed by mreeves into branch 'master'.
Generate man page for docbook/xml file.
*fix install location for man page.
M +2 -1 CMakeLists.txt
A +95 -0 cmake/Modules/FindDocbook2X.cmake
M +3 -1 doc/en/CMakeLists.txt
D +0 -87 doc/en/kdiff3.1
A +215 -0 doc/en/man-kdiff3.1.docbook
https://commits.kde.org/kdiff3/ac868cbf68137eec5ba68ec9a1ca7944ab195c60
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c120be..37961ac 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
#cmake < 3.1 has no sane way of checking C++11 features and needed flags
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
-
project(kdiff3)
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
set(CMAKE_CXX_EXTENSIONS OFF ) #don't use non-standard extentions
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
@@ -48,6 +48,7 @@ find_package(
IconThemes
)
+find_package(Docbook2X)
set(KDiff3_LIBRARIES ${Qt5PrintSupport_LIBRARIES} KF5::I18n KF5::CoreAddons KF5::Crash KF5::IconThemes )
diff --git a/cmake/Modules/FindDocbook2X.cmake b/cmake/Modules/FindDocbook2X.cmake
new file mode 100644
index 0000000..8d3bc68
--- /dev/null
+++ b/cmake/Modules/FindDocbook2X.cmake
@@ -0,0 +1,95 @@
+# Attempt to find docbook-to-man binary from docbook2x package
+#
+# This module defines:
+# - DOCBOOK_TO_MAN_EXECUTABLE, path to docbook2x-man binary
+#
+# Note that the binary docbook-to-man in debian systems is a different application
+# than in other distributions.
+#
+# Debian systems
+# * docbook-to-man comes from the package docbook-to-man
+# * docbook2man comes from the package docbook-utils
+# * docbook2x-man comes from the package docbook2x
+# Suse
+# * docbook-to-man comes from the package docbook2x
+# * docbook2man comes from the package docbook-utils-minimal
+# ArchLinux
+# * docbook-to-man comes from the package docbook-to-man
+# * docbook2man comes from the package docbook2x
+#
+# We actually want the binary from docbook2x, which supports XML
+
+#=============================================================================
+# Copyright 2013 Kevin Funk <kfunk at kde.org>
+# Copyright 2015 Alex Merry <alexmerry at kde.org>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+macro(_check_docbook2x_executable)
+ if (DOCBOOK_TO_MAN_EXECUTABLE)
+ execute_process(
+ COMMAND ${DOCBOOK_TO_MAN_EXECUTABLE} --version
+ OUTPUT_VARIABLE _output
+ ERROR_QUIET
+ )
+ if("${_output}" MATCHES "docbook2X ([0-9]+\\.[0-9]+\\.[0-9]+)")
+ set(DOCBOOK_TO_MAN_EXECUTABLE ${_docbook_to_man_executable})
+ set(Docbook2X_VERSION ${CMAKE_MATCH_1})
+ else()
+ unset(DOCBOOK_TO_MAN_EXECUTABLE)
+ unset(DOCBOOK_TO_MAN_EXECUTABLE CACHE)
+ endif()
+ endif()
+endmacro()
+
+if (DOCBOOK_TO_MAN_EXECUTABLE)
+ _check_docbook2x_executable()
+else()
+ foreach(test_exec docbook2x-man docbook-to-man db2x_docbook2man docbook2man)
+ find_program(DOCBOOK_TO_MAN_EXECUTABLE
+ NAMES ${test_exec}
+ )
+ _check_docbook2x_executable()
+ if (DOCBOOK_TO_MAN_EXECUTABLE)
+ break()
+ endif()
+ endforeach()
+endif()
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(Docbook2X
+ FOUND_VAR Docbook2X_FOUND
+ REQUIRED_VARS DOCBOOK_TO_MAN_EXECUTABLE
+ VERSION_VAR Docbook2X_VERSION
+)
+
+if (Docbook2X_FOUND)
+ macro(install_docbook_man_page name section)
+ set(inputfn "man-${name}.${section}.docbook")
+ set(input "${CMAKE_CURRENT_SOURCE_DIR}/${inputfn}")
+ set(outputfn "${name}.${section}")
+ set(output "${CMAKE_CURRENT_BINARY_DIR}/${outputfn}")
+ set(target "manpage-${outputfn}")
+
+ add_custom_command(
+ OUTPUT ${output}
+ COMMAND ${DOCBOOK_TO_MAN_EXECUTABLE} --encoding "UTF-8" ${input}
+ DEPENDS ${input}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ )
+ add_custom_target(${target} ALL
+ DEPENDS "${output}"
+ )
+ install(
+ FILES ${output}
+ DESTINATION ${CMAKE_INSTALL_MANDIR}/man${section}
+ )
+ endmacro()
+endif()
diff --git a/doc/en/CMakeLists.txt b/doc/en/CMakeLists.txt
index 34e10ce..d8084f7 100644
--- a/doc/en/CMakeLists.txt
+++ b/doc/en/CMakeLists.txt
@@ -1,3 +1,5 @@
kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kdiff3)
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/kdiff3.1 DESTINATION ${MAN_INSTALL_DIR})
\ No newline at end of file
+if (Docbook2X_FOUND)
+ install_docbook_man_page(kdiff3 1)
+endif()
\ No newline at end of file
diff --git a/doc/en/kdiff3.1 b/doc/en/kdiff3.1
deleted file mode 100644
index 80de937..0000000
--- a/doc/en/kdiff3.1
+++ /dev/null
@@ -1,87 +0,0 @@
-.TH "KDIFF3" "1"
-.SH "NAME"
-KDiff3 \(em compares two or three input files or directories
-.SH "SYNOPSIS"
-.PP
-\fBKDiff3\fR [\fBQT options\fP] [\fBKDE options\fP] [\fBKDiff3 options\fP] [\fB\fIFile1/base\fR\fP] [\fB\fIFile2\fR\fP] [\fB\fIFile3\fR\fP]
-.SH "DESCRIPTION"
-.PP
-This manual page briefly documents the
-\fBKDiff3\fR tool.
-.PP
-For comprehensive help, please see \fBkhelpcenter help:/kdiff3\fR.
-
-.PP
-\fBKDiff3\fR is a program that
-
-.IP " \(bu" 6
-compares or merges two or three text input files or directories
-.IP " \(bu" 6
-shows the differences line by line and character by character
-.IP " \(bu" 6
-provides an automatic merge-facility and
-.IP " \(bu" 6
-an integrated editor for comfortable solving of merge-conflicts
-.IP " \(bu" 6
-supports Unicode, UTF-8 and other codecs
-.IP " \(bu" 6
-supports KIO on KDE (allows accessing ftp, sftp, fish, smb etc.)
-.IP " \(bu" 6
-Printing of differences
-.IP " \(bu" 6
-Manual alignment of lines
-.IP " \(bu" 6
-Automatic merging of version control history ($Log$)
-.SH "OPTIONS"
-.PP
-This program follows the usual GNU command line syntax,
-with long options starting with two dashes (`\-'). A summary of
-options is included below. For a full summary of options, run
-\fBKDiff3 \-\-help\fR.
-
-.IP "\fB-m, \-\-merge\fP " 10
-Merge the input.
-.IP "\fB-b, \-\-base file\fP " 10
-Explicit base file. For compatibility with certain tools.
-.IP "\fB-o, \-\-output file\fP " 10
-Output file. Implies \-m. E.g.: \-o newfile.txt
-.IP "\fB\-\-out file\fP " 10
-Output file, again. (For compatibility with certain tools.)
-.IP "\fB\-\-auto\fP " 10
-No GUI if all conflicts are auto-solvable. (Needs \-o file)
-.IP "\fB\-\-qall\fP " 10
-Don't solve conflicts automatically. (For compatibility...)
-.IP "\fB-L1 alias\fP " 10
-Visible name replacement for first file/base file.
-.IP "\fB-L2 alias\fP " 10
-Visible name replacement for second file.
-.IP "\fB-L3 alias\fP " 10
-Visible name replacement for third file.
-.IP "\fB-L, \-\-fname alias\fP " 10
-Visible name replacement. May by supplied for each input.
-.IP "\fB\-\-cs string\fP " 10
-Change a setting, e. g. \-\-cs "AutoAdvance=1".
-.IP "\fB\-\-confighelp\fP " 10
-Show a list of all settings and their values.
-.IP "\fB\-\-config file \fP " 10
-Use a different settings file.
-.IP "\fB\-\-author\fP " 10
-Show author of program.
-.IP "\fB-v, \-\-version\fP " 10
-Show version of program.
-.IP "\fB\-\-license\fP " 10
-Show license of program.
-.SH "AUTHOR"
-.PP
-This manual page was written by Eike Sauer <eike at debian.org> for
-the \fBDebian\fP system (but may be used by others). Permission is
-granted to copy, distribute and/or modify this document under
-the terms of the GNU General Public License, Version 2
-(or, at your option, any later version published by the Free
-Software Foundation).
-
-.PP
-On Debian systems, the complete text of the GNU General Public
-License can be found in /usr/share/common-licenses/GPL.
-
-.\" created by instant / docbook-to-man
diff --git a/doc/en/man-kdiff3.1.docbook b/doc/en/man-kdiff3.1.docbook
new file mode 100644
index 0000000..14b4d0f
--- /dev/null
+++ b/doc/en/man-kdiff3.1.docbook
@@ -0,0 +1,215 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<!-- lifted from man+troff by doclifter -->
+<refentry id='kdiff3'>
+<refmeta>
+<refentrytitle>kdiff3</refentrytitle>
+<manvolnum>1</manvolnum>
+</refmeta>
+<refnamediv>
+<refname>KDiff3</refname>
+<refpurpose> compares two or three input files or directories </refpurpose>
+</refnamediv>
+<!-- body begins here -->
+<refsynopsisdiv id='synopsis'>
+<cmdsynopsis>
+ <command>KDiff3</command> <arg choice='opt'><arg choice='plain'><replaceable>QT</replaceable></arg><arg choice='plain'><replaceable>options</replaceable></arg></arg>
+ <arg choice='opt'><arg choice='plain'><replaceable>KDE</replaceable></arg><arg choice='plain'><replaceable>options</replaceable></arg></arg>
+ <arg choice='opt'><arg choice='plain'><replaceable>KDiff3</replaceable></arg><arg choice='plain'><replaceable>options</replaceable></arg></arg>
+ <arg choice='opt'><replaceable>File1/base</replaceable></arg>
+ <arg choice='opt'><replaceable>File2</replaceable></arg>
+ <arg choice='opt'><replaceable>File3</replaceable></arg>
+</cmdsynopsis>
+</refsynopsisdiv>
+
+
+<refsect1 id='description'><title>DESCRIPTION</title>
+<para>This manual page briefly documents the
+<command>KDiff3</command> tool.</para>
+
+<para>For comprehensive help, please see <emphasis remap='B'>khelpcenter help:/kdiff3</emphasis>.</para>
+
+
+<para><command>KDiff3</command> is a program that</para>
+
+<variablelist remap='IP'>
+ <varlistentry>
+ <term> •</term>
+ <listitem>
+<para>compares or merges two or three text input files or directories</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term> •</term>
+ <listitem>
+<para>shows the differences line by line and character by character</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term> •</term>
+ <listitem>
+<para>provides an automatic merge-facility and</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term> •</term>
+ <listitem>
+<para>an integrated editor for comfortable solving of merge-conflicts</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term> •</term>
+ <listitem>
+<para>supports Unicode, UTF-8 and other codecs</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term> •</term>
+ <listitem>
+<para>supports KIO on KDE (allows accessing ftp, sftp, fish, smb etc.)</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term> •</term>
+ <listitem>
+<para>Printing of differences</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term> •</term>
+ <listitem>
+<para>Manual alignment of lines</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term> •</term>
+ <listitem>
+<para>Automatic merging of version control history ($Log$)</para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</refsect1>
+
+<refsect1 id='options'><title>OPTIONS</title>
+<para>This program follows the usual GNU command line syntax,
+with long options starting with two dashes (`-'). A summary of
+options is included below. For a full summary of options, run
+<userinput>KDiff3 --help</userinput>.</para>
+
+<variablelist remap='IP'>
+ <varlistentry>
+ <term><option>-m, --merge</option> </term>
+ <listitem>
+<para>Merge the input.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-b, --base file</option> </term>
+ <listitem>
+<para>Explicit base file. For compatibility with certain tools.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-o, --output file</option> </term>
+ <listitem>
+<para>Output file. Implies -m. E.g.: -o newfile.txt</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>--out file</option> </term>
+ <listitem>
+<para>Output file, again. (For compatibility with certain tools.)</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>--auto</option> </term>
+ <listitem>
+<para>No GUI if all conflicts are auto-solvable. (Needs -o file)</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>--qall</option> </term>
+ <listitem>
+<para>Don't solve conflicts automatically. (For compatibility...)</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-L1 alias</option> </term>
+ <listitem>
+<para>Visible name replacement for first file/base file.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-L2 alias</option> </term>
+ <listitem>
+<para>Visible name replacement for second file.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-L3 alias</option> </term>
+ <listitem>
+<para>Visible name replacement for third file.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-L, --fname alias</option> </term>
+ <listitem>
+<para>Visible name replacement. May by supplied for each input.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>--cs string</option> </term>
+ <listitem>
+<para>Change a setting, e. g. --cs "AutoAdvance=1".</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>--confighelp</option> </term>
+ <listitem>
+<para>Show a list of all settings and their values.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>--config file </option> </term>
+ <listitem>
+<para>Use a different settings file.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>--author</option> </term>
+ <listitem>
+<para>Show author of program.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-v, --version</option> </term>
+ <listitem>
+<para>Show version of program.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>--license</option> </term>
+ <listitem>
+<para>Show license of program.</para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</refsect1>
+
+<refsect1 id='author'><title>AUTHOR</title>
+<para>This manual page was written by Eike Sauer <eike at debian.org> for
+the <emphasis remap='B'>Debian</emphasis> system (but may be used by others). Permission is
+granted to copy, distribute and/or modify this document under
+the terms of the GNU General Public License, Version 2
+(or, at your option, any later version published by the Free
+Software Foundation).</para>
+
+
+<para>On Debian systems, the complete text of the GNU General Public
+License can be found in /usr/share/common-licenses/GPL.</para>
+
+<!-- created by instant / docbook\-to\-man -->
+</refsect1>
+</refentry>
+
More information about the kde-doc-english
mailing list