Skip to content

Commit

Permalink
Update ghelp target to install docs according to the xdg help specifi…
Browse files Browse the repository at this point in the history
…cation

The spec can be found here: https://www.freedesktop.org/wiki/Specifications/help-spec/
"ghelp:" is hardly used still on linux. The new standard is well supported by yelp.

What this does is
* rename the primary documents from gnucash-guide.xml/gnucash-help.xml to index.docbook
* update book id's for manuals to "index" (required for the spec)
* reshuffle the target output directories from share/gnome/help/(docname)/lang to share/help/(lang)/(docname)
  • Loading branch information
gjanssens authored and jralls committed Sep 6, 2022
1 parent 1ff3733 commit 64e4323
Show file tree
Hide file tree
Showing 19 changed files with 68 additions and 219 deletions.
2 changes: 1 addition & 1 deletion cmake/AddChmTarget.cmake
Expand Up @@ -20,7 +20,7 @@ function (add_chm_target docname lang entities figures)
"-Dentities=\"${entities}\""
-D HHC=${HHC}
-P ${CMAKE_SOURCE_DIR}/cmake/MakeChm.cmake
DEPENDS ${entities} "${docname}.xml" "${CMAKE_SOURCE_DIR}/docbook/gnc-docbookx.dtd" ${figures}
DEPENDS ${entities} "index.docbook" "${CMAKE_SOURCE_DIR}/docbook/gnc-docbookx.dtd" ${figures}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/htmlhelp")

add_custom_target("${lang}-${docname}-chm"
Expand Down
4 changes: 2 additions & 2 deletions cmake/AddEpubTarget.cmake
Expand Up @@ -17,11 +17,11 @@ function (add_epub_target docname lang entities figures)
--stringparam epub.oebps.dir OEBPS/
--stringparam fop1.extensions 1
"${CMAKE_SOURCE_DIR}/xsl/1.79.2/epub/docbook.xsl"
"${CMAKE_CURRENT_SOURCE_DIR}/${docname}.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/index.docbook"
COMMAND cmake -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/figures" "${EPUB_TMPDIR}/OEBPS/figures"
COMMAND ${CMAKE_COMMAND} -E make_directory "${BUILD_DIR}"
COMMAND cd "${EPUB_TMPDIR}" && zip -X -r "${BUILD_DIR}/${epubfile}" mimetype META-INF OEBPS
DEPENDS ${entities} "${docname}.xml" "${CMAKE_SOURCE_DIR}/docbook/gnc-docbookx.dtd" ${figures})
DEPENDS ${entities} "index.docbook" "${CMAKE_SOURCE_DIR}/docbook/gnc-docbookx.dtd" ${figures})

add_custom_target("${lang}-${docname}-epub"
DEPENDS "${BUILD_DIR}/${epubfile}")
Expand Down
12 changes: 6 additions & 6 deletions cmake/AddGHelpTarget.cmake
Expand Up @@ -10,10 +10,10 @@

function (add_ghelp_target docname lang entities figures)

set(BUILD_DIR "${DATADIR_BUILD}/gnome/help/${docname}/${lang}")
set(BUILD_DIR "${DATADIR_BUILD}/help/${lang}/${docname}")

set(source_files "")
foreach(xml_file ${entities} ${docname}.xml)
foreach(xml_file ${entities} index.docbook)
list(APPEND source_files "${CMAKE_CURRENT_SOURCE_DIR}/${xml_file}")
endforeach()

Expand All @@ -25,7 +25,7 @@ function (add_ghelp_target docname lang entities figures)
list(APPEND source_files ${dtd_files})

set(dest_files "")
foreach(xml_file ${entities} ${docname}.xml gnc-docbookx.dtd)
foreach(xml_file ${entities} index.docbook gnc-docbookx.dtd)
list(APPEND dest_files "${BUILD_DIR}/${xml_file}")
endforeach()

Expand All @@ -39,7 +39,7 @@ function (add_ghelp_target docname lang entities figures)
add_custom_command(
OUTPUT ${dest_files}
COMMAND ${CMAKE_COMMAND} -E copy ${source_files} "${BUILD_DIR}"
DEPENDS ${entities} "${docname}.xml" ${dtd_files}
DEPENDS ${entities} "index.docbook" ${dtd_files}
WORKING_DIRECTORY "${BUILD_DIR}")

# Copy figures for this document
Expand Down Expand Up @@ -67,9 +67,9 @@ function (add_ghelp_target docname lang entities figures)
add_dependencies(${docname}-ghelp "${lang}-${docname}-ghelp")

install(FILES ${source_files}
DESTINATION "${CMAKE_INSTALL_DATADIR}/gnome/help/${docname}/${lang}"
DESTINATION "${CMAKE_INSTALL_DATADIR}/help/${lang}/${docname}"
COMPONENT "ghelp")
install(FILES ${figures}
DESTINATION "${CMAKE_INSTALL_DATADIR}/gnome/help/${docname}/${lang}/figures"
DESTINATION "${CMAKE_INSTALL_DATADIR}/help/${lang}/${docname}/figures"
COMPONENT "ghelp")
endfunction()
39 changes: 22 additions & 17 deletions cmake/AddGncDocTargets.cmake
Expand Up @@ -2,22 +2,27 @@ function (add_gnc_doc_targets docname entities figures)

get_filename_component(lang ${CMAKE_CURRENT_SOURCE_DIR} NAME)

# Add a target to run xml lint checks on this document's source xml files
add_custom_target("${lang}-${docname}-check"
COMMAND ${XMLLINT} --postvalid
--xinclude
--noout
--path ${CMAKE_SOURCE_DIR}/docbook
${CMAKE_CURRENT_SOURCE_DIR}/${docname}.xml
COMMAND ${CMAKE_COMMAND}
-D XMLLINT=${XMLLINT}
-D GNC_SOURCE_DIR=${CMAKE_SOURCE_DIR}
-D GNC_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-D docname=${docname}
-D cmake_fig_list="${figures}"
-P ${CMAKE_SOURCE_DIR}/cmake/CheckFigures.cmake
DEPENDS ${entities} "${docname}.xml" "${CMAKE_SOURCE_DIR}/docbook/gnc-docbookx.dtd")
add_dependencies(${docname}-check "${lang}-${docname}-check")
file(GLOB_RECURSE figures
"${CMAKE_CURRENT_SOURCE_DIR}/figures/*.png"
"${CMAKE_CURRENT_SOURCE_DIR}/figures/*.svg")

if(entities)
# Add a target to run xml lint checks on this document's source xml files
add_custom_target("${lang}-${docname}-check"
COMMAND ${XMLLINT} --postvalid
--xinclude
--noout
--path ${CMAKE_SOURCE_DIR}/docbook
${CMAKE_CURRENT_SOURCE_DIR}/index.docbook
COMMAND ${CMAKE_COMMAND}
-D XMLLINT=${XMLLINT}
-D GNC_SOURCE_DIR=${CMAKE_SOURCE_DIR}
-D GNC_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-D docname=${docname}
-P ${CMAKE_SOURCE_DIR}/cmake/CheckFigures.cmake
DEPENDS ${entities} "index.docbook" "${CMAKE_SOURCE_DIR}/docbook/gnc-docbookx.dtd")
add_dependencies(${docname}-check "${lang}-${docname}-check")
endif()

# Add targets for each document format that is enabled
if (WITH_CHM)
Expand All @@ -41,7 +46,7 @@ function (add_gnc_doc_targets docname entities figures)

add_to_dist(
CMakeLists.txt
${docname}.xml
index.docbook
${entities}
${figures})

Expand Down
4 changes: 2 additions & 2 deletions cmake/AddHtmlTarget.cmake
Expand Up @@ -27,9 +27,9 @@ function (add_html_target docname lang entities figures)
--param use.id.as.filename "1"
--stringparam chunker.output.encoding UTF-8
"${CMAKE_SOURCE_DIR}/xsl/general-customization.xsl"
"${CMAKE_CURRENT_SOURCE_DIR}/${docname}.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/index.docbook"
COMMAND touch "${CMAKE_CURRENT_BINARY_DIR}/htmltrigger"
DEPENDS ${entities} "${docname}.xml" "${CMAKE_SOURCE_DIR}/docbook/gnc-docbookx.dtd")
DEPENDS ${entities} "index.docbook" "${CMAKE_SOURCE_DIR}/docbook/gnc-docbookx.dtd")

# Copy figures for this document
set(source_figures "")
Expand Down
4 changes: 2 additions & 2 deletions cmake/AddPdfTarget.cmake
Expand Up @@ -27,8 +27,8 @@ function (add_pdf_target docname lang entities figures)
--stringparam variablelist.as.blocks 1
--stringparam glosslist.as.blocks 1
"${CMAKE_SOURCE_DIR}/xsl/1.79.2/fo/docbook.xsl"
"${CMAKE_CURRENT_SOURCE_DIR}/${docname}.xml"
DEPENDS ${entities} "${docname}.xml" "${CMAKE_SOURCE_DIR}/docbook/gnc-docbookx.dtd")
"${CMAKE_CURRENT_SOURCE_DIR}/index.docbook"
DEPENDS ${entities} "index.docbook" "${CMAKE_SOURCE_DIR}/docbook/gnc-docbookx.dtd")

configure_file("${FOP_XCONF}" "${CMAKE_CURRENT_BINARY_DIR}/fop.xconf")

Expand Down
2 changes: 1 addition & 1 deletion cmake/CheckFigures.cmake
Expand Up @@ -5,7 +5,7 @@ execute_process(
--xinclude
--path ${GNC_SOURCE_DIR}/docbook
--xpath "//imagedata/@fileref"
${GNC_CURRENT_SOURCE_DIR}/${docname}.xml
${GNC_CURRENT_SOURCE_DIR}/index.docbook
RESULT_VARIABLE LINT_RESULT
OUTPUT_VARIABLE raw_xml_figures
)
Expand Down
2 changes: 1 addition & 1 deletion cmake/MakeChm.cmake
Expand Up @@ -17,7 +17,7 @@ execute_process(
COMMAND ${XSLTPROC} --path "${SRC_DIR}/docbook" --xinclude
--stringparam htmlhelp.chm ${chmfile}
"${SRC_DIR}/xsl/1.79.2/htmlhelp/htmlhelp.xsl"
"${CURRENT_SRC_DIR}/${docname}.xml"
"${CURRENT_SRC_DIR}/index.docbook"
WORKING_DIRECTORY "${htmlhelpdir}")

file(COPY "${CURRENT_SRC_DIR}/figures" DESTINATION "${htmlhelpdir}")
Expand Down
File renamed without changes.
File renamed without changes.
210 changes: 27 additions & 183 deletions guide/it/CMakeLists.txt
@@ -1,187 +1,31 @@
set (entities
${CMAKE_SOURCE_DIR}/guide/C/fdl-appendix.xml
${CMAKE_SOURCE_DIR}/guide/C/legal.xml
${CMAKE_SOURCE_DIR}/guide/C/ch_oview.xml
${CMAKE_SOURCE_DIR}/guide/C/ch_basics.xml
${CMAKE_SOURCE_DIR}/guide/C/ch_accts.xml
${CMAKE_SOURCE_DIR}/guide/C/ch_txns.xml
${CMAKE_SOURCE_DIR}/guide/C/ch_cbook.xml
${CMAKE_SOURCE_DIR}/guide/C/ch_cc.xml
${CMAKE_SOURCE_DIR}/guide/C/ch_expenses.xml
${CMAKE_SOURCE_DIR}/guide/C/ch_loans.xml
${CMAKE_SOURCE_DIR}/guide/C/ch_invest.xml
${CMAKE_SOURCE_DIR}/guide/C/ch_reports.xml
${CMAKE_SOURCE_DIR}/guide/C/ch_capgain.xml
${CMAKE_SOURCE_DIR}/guide/C/ch_currency.xml
${CMAKE_SOURCE_DIR}/guide/C/ch_dep.xml
${CMAKE_SOURCE_DIR}/guide/C/ch_bus_features.xml
${CMAKE_SOURCE_DIR}/guide/C/ch_budgets.xml
${CMAKE_SOURCE_DIR}/guide/C/ch_oth_assets.xml
${CMAKE_SOURCE_DIR}/guide/C/ch_python_bindings.xml
${CMAKE_SOURCE_DIR}/guide/C/ch_import_business_data.xml
${CMAKE_SOURCE_DIR}/guide/C/gnc-glossary.xml
${CMAKE_SOURCE_DIR}/guide/C/appendixa.xml
${CMAKE_SOURCE_DIR}/guide/C/appendixd.xml
)
set (COMPONENTS
${top_srcdir}/guide/C/index.docbook
${top_srcdir}/guide/C/fdl-appendix.xml
${top_srcdir}/guide/C/legal.xml
${top_srcdir}/guide/C/ch_oview.xml
${top_srcdir}/guide/C/ch_basics.xml
${top_srcdir}/guide/C/ch_accts.xml
${top_srcdir}/guide/C/ch_txns.xml
${top_srcdir}/guide/C/ch_cbook.xml
${top_srcdir}/guide/C/ch_cc.xml
${top_srcdir}/guide/C/ch_expenses.xml
${top_srcdir}/guide/C/ch_loans.xml
${top_srcdir}/guide/C/ch_invest.xml
${top_srcdir}/guide/C/ch_reports.xml
${top_srcdir}/guide/C/ch_capgain.xml
${top_srcdir}/guide/C/ch_currency.xml
${top_srcdir}/guide/C/ch_dep.xml
${top_srcdir}/guide/C/ch_bus_features.xml
${top_srcdir}/guide/C/ch_budgets.xml
${top_srcdir}/guide/C/ch_oth_assets.xml
${top_srcdir}/guide/C/ch_python_bindings.xml
${top_srcdir}/guide/C/ch_import_business_data.xml
${top_srcdir}/guide/C/gnc-glossary.xml
${top_srcdir}/guide/C/appendixa.xml
${top_srcdir}/guide/C/appendixd.xml)

set (figures
figures/accts_CreateAssetsAccount.png
figures/accts_DefaultExpenseAccounts.png
figures/accts_DefaultIncomeAccounts.png
figures/accts_toplevel.png
figures/accts_tree.png
figures/basics_AccountRelationships.png
figures/basics_AccountRelationships.svg
figures/basics_Accounts.png
figures/basics_CheckAccount.png
figures/basics_EmptyAccounts.png
figures/basics_NewAccountHierarchySetup.png
figures/basics_NewAccountHierarchySetup_Accounts.png
figures/basics_NewAccountHierarchySetup_Finish.png
figures/basics_NewAccountHierarchySetup_Setup.png
figures/basics_NewAccountHierarchySetup_currency.png
figures/basics_NewBookOpts.png
figures/basics_SaveSQL.png
figures/basics_SaveXML.png
figures/basics_TipOfDay.png
figures/bus_ap_billedit.png
figures/bus_ap_billnew.png
figures/bus_ap_billpost.png
figures/bus_ap_jobnew.png
figures/bus_ap_payment.png
figures/bus_ap_vendorfind.png
figures/bus_ap_vendornew.png
figures/bus_ar_custfind.png
figures/bus_ar_custnew.png
figures/bus_ar_invoicechange1.png
figures/bus_ar_invoicechange2.png
figures/bus_ar_invoicechange3.png
figures/bus_ar_invoiceedit.png
figures/bus_ar_invoicenew.png
figures/bus_ar_invoicepost.png
figures/bus_ar_invoiceprint.png
figures/bus_ar_jobnew.png
figures/bus_ar_payment.png
figures/bus_pay_ex1.png
figures/bus_pay_ex2.png
figures/bus_pay_ex3.png
figures/bus_pay_ex4.png
figures/capgain_app2main.png
figures/capgain_app3main.png
figures/capgain_appmain.png
figures/cbook_CashFlow.png
figures/cbook_TransactionRptAssets.png
figures/cbook_TransactionRptExpenses.png
figures/cbook_atm.png
figures/cbook_bankstmt.png
figures/cbook_chartaccts5.png
figures/cbook_checkexamp.png
figures/cbook_gcashdata4.png
figures/cbook_reconciledCheckAct.png
figures/cbook_reconexamp.png
figures/cbook_servch.png
figures/cbook_transferin.png
figures/cc_CashFlow.png
figures/cc_Reversing_Transaction_1.png
figures/cc_Reversing_Transaction_2.png
figures/cc_TransactionRptExpenses.png
figures/cc_TransactionRptVisa.png
figures/cc_accounts.png
figures/cc_final.png
figures/cc_interest.png
figures/cc_payment.png
figures/cc_purchases.png
figures/cc_reconcile.png
figures/cc_reconcile_init.png
figures/cc_refund.png
figures/currency_AfterGetOnlineQuotes.png
figures/currency_BeforeGetOnlineQuotes.png
figures/currency_addcurr.png
figures/currency_main1.png
figures/currency_main2.png
figures/currency_main3.png
figures/currency_peditor.png
figures/currency_purchase_AfterBoat.png
figures/currency_purchase_AfterStocks.png
figures/currency_purchase_BeforeBoat.png
figures/currency_purchase_BeforeStocks.png
figures/currency_purchase_Commodities.png
figures/currency_purchase_MoveMoney.png
figures/currency_purchase_SetExchangeRate.png
figures/currency_purchase_ToAmount.png
figures/dep_assetmain.png
figures/dep_assetreg.png
figures/dep_example.png
figures/invest_AccountsPredef.png
figures/invest_SetupPortfolio2.png
figures/invest_dividendcash.png
figures/invest_dividendreinvest1.png
figures/invest_int1.png
figures/invest_int2.png
figures/invest_int3.png
figures/invest_merge2.png
figures/invest_merge3.png
figures/invest_newaccount.png
figures/invest_newsecurity.png
figures/invest_peditor.png
figures/invest_peditor2.png
figures/invest_selectsecurity.png
figures/invest_sellstock.png
figures/invest_sellstock2.png
figures/invest_sellstockLoss.png
figures/invest_sellstockLoss2.png
figures/invest_setup_current.png
figures/invest_setup_portfolio1.png
figures/invest_simplesplit1.png
figures/invest_split1.png
figures/invest_split2.png
figures/invest_split3.png
figures/invest_split4.png
figures/invest_stockmerge1.png
figures/invest_stockvalue.png
figures/invest_stockvalue_report.png
figures/invest_stockvalue_report_options.png
figures/loans_PrivateLoanCalculation.png
figures/loans_PrivateLoanFirstPayment.png
figures/loans_PrivateLoanInitial.png
figures/loans_PrivateLoanSecondPayment.png
figures/loans_PrivateLoanSecondPaymentAccounts.png
figures/loans_fcalc.png
figures/loans_mortgage1.png
figures/loans_mortgage2.png
figures/loans_mortgage3.png
figures/oview_intro.png
figures/txns_CashFlow.png
figures/txns_TransactionRptChecking.png
figures/txns_TransactionRptExpenses.png
figures/txns_puttoget_Charts.png
figures/txns_puttoget_Charts1.png
figures/txns_puttoget_Charts2.png
figures/txns_reconcile_window1.png
figures/txns_reconcile_window2.png
figures/txns_reconcile_window3.png
figures/txns_register_2account.png
figures/txns_register_2account2.png
figures/txns_register_multiaccount.png
figures/txns_registersplit2.png
figures/txns_registersplit3.png
figures/txns_registersplit4.png
figures/txns_registersplit5.png
figures/txns_registersplit6.png
figures/txns_sxn_editor-2.png
figures/txns_sxn_editor-3-frequency.png
figures/txns_sxn_editor-3-overview.png
figures/txns_sxn_editor-3-template.png
figures/txns_sxn_editor-4.png
figures/txns_sxn_editor_slr.png
figures/txns_sxn_ledger1.png
figures/txns_sxn_ledger2.png
figures/txns_sxn_ledger3.png
figures/txns_sxn_ledger4.png
)

#gnucash-guide.xml: ${CMAKE_SOURCE_DIR}/guide/C/gnucash-guide.xml ${entities} ${srcdir}/it.po
# xml2po -e -p ${srcdir}/it.po -o $@ ${CMAKE_SOURCE_DIR}/guide/C/gnucash-guide.xml
#index.docbook: ${COMPONENTS} ${srcdir}/it.po
# xml2po -e -p ${srcdir}/it.po -o $@ ${top_srcdir}/guide/C/index.docbook
# if test "${srcdir}" != "${builddir}"; then mv $@ ${srcdir}; fi

add_gnc_doc_targets(${docname} "" "${figures}")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion manual/C/gnucash-help.xml → manual/C/index.docbook
Expand Up @@ -9,7 +9,7 @@
Translators:
(translators put your name and email here)
-->
<book id="help" lang="en"
<book id="index" lang="en"
xmlns:xi="http://www.w3.org/2001/XInclude">
<!-- please do not change the id; for translations, change lang to -->
<!-- appropriate code -->
Expand Down
2 changes: 1 addition & 1 deletion manual/de/gnucash-help.xml → manual/de/index.docbook
Expand Up @@ -18,7 +18,7 @@
Structure of translation adjusted to rev 19776
Frank Ellenberger (f.ellenberger@online.de)
-->
<book id='help' lang="de"
<book id='index' lang="de"
xmlns:xi="http://www.w3.org/2001/XInclude">
<!-- please do not change the id; for translations, change lang to -->
<!-- appropriate code -->
Expand Down

0 comments on commit 64e4323

Please sign in to comment.