mirror of https://github.com/rd235/cado
update man page in markdown support (currently unused)
This commit is contained in:
parent
4be60595bb
commit
70744d6390
|
@ -1,21 +1,20 @@
|
|||
cmake_minimum_required(VERSION 3.13)
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
|
||||
set(RONN_ORGANIZATION "VirtualSquare")
|
||||
set(RONN_ARGS --organization=${RONN_ORGANIZATION})
|
||||
set(PANDOC_ORG "VirtualSquare")
|
||||
|
||||
# #ronn pages
|
||||
# ### pandoc pages
|
||||
|
||||
file(GLOB VU_RONN_PAGES ${CMAKE_CURRENT_SOURCE_DIR}/*.[1-8].ronn)
|
||||
file(GLOB VU_PANDOC_PAGES ${CMAKE_CURRENT_SOURCE_DIR}/*.[1-8].md)
|
||||
set(VU_MAN_FILES)
|
||||
foreach(VU_RONN_PATH IN LISTS VU_RONN_PAGES)
|
||||
# VU_RONNPAGE: basename of VU_RONN_PATH
|
||||
get_filename_component(VU_RONNPAGE ${VU_RONN_PATH} NAME)
|
||||
# VU_MANPAGE: VU_RONNPAGE without the suffix
|
||||
string(REGEX REPLACE "\.ronn$" "" VU_MANPAGE ${VU_RONNPAGE})
|
||||
foreach(VU_PANDOC_PATH IN LISTS VU_PANDOC_PAGES)
|
||||
# VU_PANDOCPAGE: basename of VU_PANDOC_PATH
|
||||
get_filename_component(VU_PANDOCPAGE ${VU_PANDOC_PATH} NAME)
|
||||
# VU_MANPAGE: VU_PANDOCPAGE without the suffix
|
||||
string(REGEX REPLACE "\.md$" "" VU_MANPAGE ${VU_PANDOCPAGE})
|
||||
list(APPEND VU_MAN_FILES ${VU_MANPAGE})
|
||||
endforeach(VU_RONN_PATH)
|
||||
endforeach(VU_PANDOC_PATH)
|
||||
|
||||
add_custom_target(${PROJECT_NAME}_manpages ALL make RONN_ARGS="${RONN_ARGS}" ${VU_MAN_FILES}
|
||||
add_custom_target(${PROJECT_NAME}_manpages ALL make PANDOC_ORG="${PANDOC_ORG}" ${VU_MAN_FILES}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
### man pages
|
||||
|
|
20
man/Makefile
20
man/Makefile
|
@ -1,16 +1,18 @@
|
|||
RONN=ronn
|
||||
RONNOK := $(shell command -v ${RONN} 2> /dev/null)
|
||||
PANDOC=pandoc
|
||||
PANDOCOK := $(shell command -v ${PANDOC} 2> /dev/null)
|
||||
|
||||
none:
|
||||
|
||||
% : %.ronn
|
||||
ifdef RONNOK
|
||||
% : %.md
|
||||
ifdef PANDOCOK
|
||||
# copy copyright notice
|
||||
grep "^\.\\\\\"" $< > $@ || true
|
||||
# run ronn
|
||||
$(RONN) -r ${RONN_ARGS} --pipe $< >> $@
|
||||
# delete useless trailing "" in .TH
|
||||
sed -i '/^\.TH /s/ ""$$//' $@
|
||||
# run pandoc
|
||||
$(eval SECTION := $(subst .,,$(suffix $@)))
|
||||
$(eval BASENAME := $(basename $@))
|
||||
$(eval TITLE := $(shell echo "${BASENAME}\(${SECTION}\)" | tr [:lower:] [:upper:]))
|
||||
$(eval HEADER := "$(shell man ${SECTION} intro | head -1 | sed -e 's/^[^[:blank:]]*[[:blank:]]*//' -e 's/[[:blank:]]*[^[:blank:]]*$$//' )")
|
||||
$(PANDOC) -standalone -M title=${TITLE} -M section=${SECTION} -M header=${HEADER} -M footer=${PANDOC_ORG} -M "date=`date +\"%B %Y\"`" --to man $< >> $@
|
||||
else
|
||||
echo "${RONN} is not available. Manpage $@ cannot be updated" >/dev/stderr >&2
|
||||
echo "${PANDOC} is not available. Manpage $@ cannot be updated" >/dev/stderr >&2
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue