diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c9c5d3..8361f9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.20) SET(name g3kb-switch) SET(HOMEPAGE_URL https://github.com/lyokha/g3kb-switch) +STRING(TIMESTAMP BUILD_DATE "%d %B %Y") # get version from git tag in github action STRING(REGEX MATCH [[[0-9](\.[0-9])*]] VERSION "$ENV{GITHUB_REF_NAME}") IF(NOT VERSION) @@ -26,7 +27,6 @@ FIND_PACKAGE(PkgConfig REQUIRED) PKG_SEARCH_MODULE(GIO REQUIRED gio-2.0) CONFIGURE_FILE(config.h.in config.h) -CONFIGURE_FILE(docs/metadata.json.in docs/metadata.json) SET(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -126,17 +126,19 @@ ENDIF() OPTION(G3KBSWITCH_INSTALL_MAN_PAGE "Install man documentation" ON) IF(G3KBSWITCH_INSTALL_MAN_PAGE) SET(man_page ${name}.1) + CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/docs/${man_page}.in + ${CMAKE_BINARY_DIR}/docs/${man_page}) FIND_PROGRAM(GZIP gzip) - IF (GZIP) + IF(GZIP) SET(man_gz ${CMAKE_BINARY_DIR}/${man_page}.gz) ADD_CUSTOM_TARGET(man-${name} ALL DEPENDS ${man_gz}) ADD_CUSTOM_COMMAND( OUTPUT ${man_gz} COMMAND ${GZIP} -9 --no-name --to-stdout "${man_page}" >"${man_gz}" - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs) + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/docs) SET(man_page ${man_gz}) ELSE() - SET(man_page ${CMAKE_SOURCE_DIR}/docs/${man_page}) + SET(man_page ${CMAKE_BINARY_DIR}/docs/${man_page}) ENDIF() INSTALL(FILES ${man_page} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) @@ -151,3 +153,4 @@ SET(CPACK_RPM_PACKAGE_URL ${HOMEPAGE_URL}) INCLUDE(CPack) SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") SET(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") + diff --git a/docs/README.md b/docs/README.md index c400612..5ee621a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,17 +1,6 @@ -The man page *g3kb-switch.1* was generated by Pandoc 3.1.9. +The template for the man page *g3kb-switch.1.in* was generated by Pandoc 3.1.9. ```ShellSession -$ pandoc g3kb-switch.1.md -s -t man -M "date=$(LANG=C date +'%d %B %Y')" \ - --metadata-file ../build/docs/metadata.json | - sed 's/\[CR\]/[CB]/g' > g3kb-switch.1 +$ pandoc g3kb-switch.1.md -s -t man | sed 's/\[CR\]/[CB]/g' > g3kb-switch.1.in ``` -The metadata file *../build/docs/metadata.json* was preliminary generated by -running - -```ShellSession -$ cmake -Bbuild -``` - -in the top directory of the project. - diff --git a/docs/g3kb-switch.1 b/docs/g3kb-switch.1.in similarity index 90% rename from docs/g3kb-switch.1 rename to docs/g3kb-switch.1.in index 174ba1b..87fa738 100644 --- a/docs/g3kb-switch.1 +++ b/docs/g3kb-switch.1.in @@ -1,6 +1,6 @@ .\" Automatically generated by Pandoc 3.1.9 .\" -.TH "G3KB-SWITCH" "1" "06 December 2023" "g3kb-switch 1.4" "User Manual" +.TH "G3KB-SWITCH" "1" "${BUILD_DATE}" "${PROJECT_NAME} ${PROJECT_VERSION}" "User Manual" .SH NAME \f[B]g3kb-switch\f[R] - CLI keyboard layout switcher for Gnome 3 and 4x. .SH SYNOPSIS @@ -46,8 +46,8 @@ Details are documented at \c .UR https://github.com/lyokha/vim-xkbswitch .UE \c \&. -.SH AUTHOR -Written by Alexey Radkov. +.SH AUTHORS +Written by Alexey Radkov and Freed-Wu. .SH REPORTING BUGS Report bugs to \c .UR https://github.com/lyokha/g3kb-switch/issues diff --git a/docs/g3kb-switch.1.md b/docs/g3kb-switch.1.md index 86efc88..bdf72e5 100644 --- a/docs/g3kb-switch.1.md +++ b/docs/g3kb-switch.1.md @@ -1,3 +1,11 @@ +--- +title: G3KB-SWITCH +section: 1 +header: User Manual +footer: ${PROJECT_NAME} ${PROJECT_VERSION} +date: ${BUILD_DATE} +... + # NAME **g3kb-switch** - CLI keyboard layout switcher for Gnome 3 and 4x. @@ -39,8 +47,8 @@ layouts in Vim and Neovim when entering and leaving Insert mode via Vim plugin *vim-xkbswitch*. Details are documented at . -# AUTHOR -Written by Alexey Radkov. +# AUTHORS +Written by Alexey Radkov and Freed-Wu. # REPORTING BUGS Report bugs to . diff --git a/docs/metadata.json.in b/docs/metadata.json.in deleted file mode 100644 index 26d8e73..0000000 --- a/docs/metadata.json.in +++ /dev/null @@ -1,7 +0,0 @@ -{ - "title": "G3KB-SWITCH", - "section": "1", - "header": "User Manual", - "footer": "g3kb-switch @PROJECT_VERSION@" -} -