Docs: LazControls. Removes footer processing in project file and scripts.

This commit is contained in:
dsiders 2022-03-14 05:10:27 +01:00
parent 73afaa0226
commit 061ba75ede
3 changed files with 25 additions and 108 deletions

View File

@ -11,12 +11,12 @@
<option name="dont-trim" value="true"/> <option name="dont-trim" value="true"/>
<option name="emit-notes" value="false"/> <option name="emit-notes" value="false"/>
<option name="css-file" value="lazcontrols.css"/> <option name="css-file" value="lazcontrols.css"/>
<option name="footer" value="@lazcontrols-footer.xml"/>
<option name="auto-index" value="true"/> <option name="auto-index" value="true"/>
<option name="auto-toc" value="true"/> <option name="auto-toc" value="true"/>
<option name="chm-title" value="(LazControls) Lazarus Controls Package"/> <option name="chm-title" value="(LazControls) Lazarus Controls Package"/>
<!-- <!--
pass format as a command line argument: format="chm" <option name="footer" value="lazcontrols-footer.xml"/>
<option name="format" value="chm | html"/>
--> -->
</options> </options>
<packages> <packages>

View File

@ -1,10 +1,9 @@
@echo off @echo off
REM ======================================================================= REM =======================================================================
REM Builds CHM and HTML help files for the LazControls package using the fpdoc utility. REM Requires chm and xct files for rtl, fcl, lcl, and lazutils in the
REM Requires chm and xct files for rtl, fcl, lcl, and lazutils in the Lazarus docs\chm directory. REM Lazarus docs\chm directory.
REM fpdoc will fail if they are not present. REM fpdoc will fail if they are not present.
REM Requires git command line client to get the commit hash for the repository.
REM ======================================================================= REM =======================================================================
REM ====================================== REM ======================================
@ -12,70 +11,29 @@ REM SET THE CORRECT PATHS FOR YOUR SYSTEM
REM ====================================== REM ======================================
REM lazarus documentation directory REM lazarus documentation directory
set docdir=..\..\..\docs set docdir=..\..\..\docs
REM fpdoc executable directory REM fpdoc executable directory
REM set fpcdir=..\..\..\..\lazarus-2.2.0-RC2\fpc\3.2.2\bin\x86_64-win64 REM set fpcdir=..\..\..\..\lazarus-2.2.0-RC2\fpc\3.2.2\bin\x86_64-win64
set fpcdir=..\..\..\..\fpc331\fpc\bin\x86_64-win64 set fpcdir=..\..\..\..\fpc331\fpc\bin\x86_64-win64
REM directory with lazarus git repository
set gitdir=..\..\..\..\usr\work\git-lazarus
REM values used in the footer echo LazControls package
REM package title for CHM
set pkgtitle=Lazarus Controls Package (LazControls)
REM CHANGE THIS BEFORE BUILDING
set version=2.3.0
REM commit SHA
git -C %gitdir% describe --all --long > describe.txt
for /f "delims=-g tokens=1-3" %%a in (describe.txt) do set commit=%%c
del describe.txt
REM date stamp in YYYY-MM-DD format
for /f "usebackq tokens=2 delims== " %%i in (`wmic os get LocalDateTime /value`) do set token10=%%i
set dtstamp=%token10:~0,4%-%token10:~4,2%-%token10:~6,2%
set token10=
REM TODO: wmic is deprecated in Windows 11... check for powershell equivalent
echo %pkgtitle% %version%-%commit% %dtstamp%
REM generate footer with title, version, commit SHA, date stamp
REM footer is included using the fpdoc project file
echo|(set /p="<hr class='footer-sep'/>" & echo.) > lazcontrols-footer.xml
echo|(set /p="<table class='footer'>" & echo.) >> lazcontrols-footer.xml
echo|(set /p=" <tr>" & echo.) >> lazcontrols-footer.xml
echo|(set /p=" <td class='footer-doc'>%pkgtitle%</td>" & echo.) >> lazcontrols-footer.xml
echo|(set /p=" <td class='footer-ver'>Version %version%-%commit%</td>" & echo.) >> lazcontrols-footer.xml
echo|(set /p=" <td class='footer-date'>Generated %dtstamp%</td>" & echo.) >> lazcontrols-footer.xml
echo|(set /p=" </tr>" & echo.) >> lazcontrols-footer.xml
echo|(set /p="</table>" & echo.) >> lazcontrols-footer.xml
echo Generating CHM help... echo Generating CHM help...
REM generate chm format REM generate chm format without footers
REM imports done manually to set the correct prefix for the output format REM imports done manually to set the correct prefix for the output format
REM output to current directory REM output to current directory
%fpcdir%\fpdoc --project=lazcontrols-project.xml --format=chm --verbose --import="%docdir%\chm\rtl.xct,ms-its:rtl.chm::/" --import="%docdir%\chm\fcl.xct,ms-its:fcl.chm::/" --import="%docdir%\chm\lcl.xct,ms-its:lcl.chm::/" --import="%docdir%\chm\lazutils.xct,ms-its:lazutils.chm::/" > .\build_chm.log %fpcdir%\fpdoc --project=lazcontrols-project.xml --format=chm --import="%docdir%\chm\rtl.xct,ms-its:rtl.chm::/" --import="%docdir%\chm\fcl.xct,ms-its:fcl.chm::/" --import="%docdir%\chm\lcl.xct,ms-its:lcl.chm::/" --import="%docdir%\chm\lazutils.xct,ms-its:lazutils.chm::/" > .\build_chm.log
echo Generating HTML help... echo Generating HTML help...
REM generate html format REM generate html format without footers
REM imports done manually to set the correct prefix for the output format REM imports done manually to set the correct prefix for the output format
REM html written to lazcontrols sub-directory REM html written to lazcontrols sub-directory
%fpcdir%\fpdoc --project=lazcontrols-project.xml --format=html --verbose --import="%docdir%\chm\rtl.xct,..\rtl\" --import="%docdir%\chm\fcl.xct,..\fcl\" --import="%docdir%\chm\lcl.xct,..\lcl\" --import="%docdir%\chm\lazutils.xct,..\lazutils\" --output=lazcontrols > .\build_html.log %fpcdir%\fpdoc --project=lazcontrols-project.xml --format=html --import="%docdir%\chm\rtl.xct,..\rtl\" --import="%docdir%\chm\fcl.xct,..\fcl\" --import="%docdir%\chm\lcl.xct,..\lcl\" --import="%docdir%\chm\lazutils.xct,..\lazutils\" --output=lazcontrols > .\build_html.log
REM create an archive file with html content REM copy generated chm, xct to lazarus docs directory
REM echo Creating archive: docs-html-lazcontrols-%dtstamp%.7z copy /Y lazcontrols.chm %docdir%\chm\
REM 7z a -t7z -mx9 -r docs-html-lazcontrols-%dtstamp%.7z .\lazcontrols\ > NUL copy /Y lazcontrols.xct %docdir%\chm\
REM move generated html to lazarus docs\html directory
REM move /Y .\lazcontrols %docdir%\html\
REM move generated chm, xct to lazarus docs directory
REM move /Y lazcontrols.chm %docdir%\chm\
REM move /Y lazcontrols.xct %docdir%\chm\
REM discard generated footer file
del lazcontrols-footer.xml

View File

@ -1,9 +1,9 @@
#!/bin/bash #!/bin/bash
#====================================================================== #======================================================================
# Builds CHM and HTML help files for the LazControls package using the fpdoc utility. # Builds CHM and HTML help files for the LazControls package using fpdoc.
# Requires chm and xct files for rtl, fcl, lcl, and lazutils in the Lazarus docs/chm directory. # Requires chm and xct files for rtl, fcl, lcl, and lazutils in the
# Lazarus docs/chm directory.
# fpdoc will fail if they are not present. # fpdoc will fail if they are not present.
# Requires git command line client to get the commit hash for the repository.
#====================================================================== #======================================================================
#======================================= #=======================================
@ -11,65 +11,24 @@
#======================================= #=======================================
# lazarus documentation directory # lazarus documentation directory
docdir="../../../docs" docdir="../../../docs"
# fpdoc executable directory # fpdoc executable directory
#fpcdir="../../../../lazarus-2.2.0-RC2/fpc/3.2.2/bin/x86_64-win64" #fpcdir="../../../fpc/3.2.2/bin/x86_64-win64"
fpcdir="../../../../fpc331/fpc/bin/x86_64-win64" fpcdir="../../../../fpc331/fpc/bin/x86_64-win64"
# directory with lazarus git repository
gitdir="../../../../usr/work/git-lazarus"
# values used in the footer
# package title for CHM
pkgtitle="Lazarus Controls Package (LazControls)"
# CHANGE THIS BEFORE BUILDING
version="2.3.0"
# commit SHA
commit=`git -C "$gitdir" describe --all --long | cut -d "-" -f 3 | cut -b "2-"`
# date stamp in YYYY-MM-DD format
dtstamp=`date +"%Y-%m-%d"`
echo -e "\n\e[7m $pkgtitle $version$commit $dtstamp \e[0m"; echo -e "\n\e[7m LazControls package \e[0m";
# generate footer with title, version, commit SHA, date stamp # generate chm format without footers
# footer is included using the fpdoc project file
cat << EOT > lazcontrols-footer.xml
<hr class="footer-sep"/>
<table class="footer">
<tr>
<td class="footer-doc">$pkgtitle</td>
<td class="footer-ver">Version $version-$commit</td>
<td class="footer-date">Generated $dtstamp</td>
</tr>
</table>
EOT
# generate chm format
# imports done manually to set the correct prefix for the output format # imports done manually to set the correct prefix for the output format
# output to current directory # output to current directory
echo "Generating CHM help..." echo "Generating CHM help..."
$fpcdir/fpdoc --project=lazcontrols-project.xml --format=chm --verbose --import="$docdir/chm/rtl.xct,ms-its:rtl.chm::/" --import="$docdir/chm/fcl.xct,ms-its:fcl.chm::/" --import="$docdir/chm/lcl.xct,ms-its:lcl.chm::/" --import="$docdir/chm/lazutils.xct,ms-its:lazutils.chm::/" 2>&1 | tee ./build_chm.log $fpcdir/fpdoc --project=lazcontrols-project.xml --format=chm --import="$docdir/chm/rtl.xct,ms-its:rtl.chm::/" --import="$docdir/chm/fcl.xct,ms-its:fcl.chm::/" --import="$docdir/chm/lcl.xct,ms-its:lcl.chm::/" --import="$docdir/chm/lazutils.xct,ms-its:lazutils.chm::/" 2>&1 | tee ./build_chm.log
# generate html format # generate html format without footers
# imports done manually to set the correct prefix for the output format # imports done manually to set the correct prefix for the output format
# html written to lazcontrols sub-directory # html written to lazcontrols sub-directory
echo "Generating HTML help..." echo "Generating HTML help..."
$fpcdir/fpdoc --project=lazcontrols-project.xml --format=html --verbose --import="$docdir/chm/rtl.xct,../rtl/" --import="$docdir/chm/fcl.xct,../fcl/" --import="$docdir/chm/lcl.xct,../lcl/" --import="$docdir/chm/lazutils.xct,../lazutils/" --output=lazcontrols 2>&1 | tee ./build_html.log $fpcdir/fpdoc --project=lazcontrols-project.xml --format=html --import="$docdir/chm/rtl.xct,../rtl/" --import="$docdir/chm/fcl.xct,../fcl/" --import="$docdir/chm/lcl.xct,../lcl/" --import="$docdir/chm/lazutils.xct,../lazutils/" --output=lazcontrols 2>&1 | tee ./build_html.log
# convert CRLF to LF so git doesn't complain # copy generated chm, xct to lazarus docs directory
#echo "Converting CRLF to LF in HTML files..." cp -v lazcontrols.{chm,xct} $docdir/chm/
#cd lazcontrols
#dos2unix *.{css,html}
#dos2unix **/*.{css,html}
#cd ..
# create an archive file with html content
#echo "Creating archive: docs-html-lazcontrols-$dtstamp.7z"
#7z a -t7z -mx9 -r docs-html-lazcontrols-$dtstamp.7z ./lazcontrols/ > /dev/null
# copy or move generated html to lazarus docs/html directory
#rm -vrf $docdir/html/lazcontrols/*
#cp -vrf ./lazcontrols/* $docdir/html/lazcontrols/
# copy or move generated chm, xct to lazarus docs directory
#cp -v lazcontrols.{chm,xct} $docdir/chm/
# discard generated footer file
rm lazcontrols-footer.xml