jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/876306 )

Change subject: [doc] Allow setting a theme with make.bat
......................................................................

[doc] Allow setting a theme with make.bat

The default furo build needs several minutes to be completed.
This patch enables to use other themes like "basic" od "nature"
to speed up building a documentation. The theme must be added to
the target option like

  make html nature

The time usage was also added.

Bug: T322979
Change-Id: I3daa81a12cbeff708cea7cf3334b3199dca2b1b3
---
M docs/make.bat
1 file changed, 56 insertions(+), 2 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/docs/make.bat b/docs/make.bat
index 6726495..7819bc3 100644
--- a/docs/make.bat
+++ b/docs/make.bat
@@ -15,6 +15,10 @@
 if "%1" == "" goto help
 if "%1" == "help" goto help
 
+if "%2" == "" goto notheme
+set SPHINXOPTS=%SPHINXOPTS% -D "html_theme=%2"
+:notheme
+
 %SPHINXBUILD% >NUL 2>NUL
 if errorlevel 9009 (
        echo.
@@ -28,14 +32,45 @@
        exit /b 1
 )
 
+set STARTTIME=%TIME:~0,8%
 %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
+set ENDTIME=%TIME:~0,8%
+
+echo Start:   %STARTTIME%
+echo End:     %ENDTIME%
+
+rem calculate elapsed time, code modified from
+rem 
https://stackoverflow.com/questions/4487100/how-can-i-use-a-windows-batch-file-to-measure-the-performance-of-console-applica
+
+rem convert STARTTIME and ENDTIME to seconds
+set /A STARTTIME=(1%STARTTIME:~0,2%-100)*3600 + (1%STARTTIME:~3,2%-100)*60 + 
(1%STARTTIME:~6,2%-100)
+set /A ENDTIME=(1%ENDTIME:~0,2%-100)*3600 + (1%ENDTIME:~3,2%-100)*60 + 
(1%ENDTIME:~6,2%-100)
+
+rem calculating the duratyion is easy
+set /A DURATION=%ENDTIME%-%STARTTIME%
+
+rem we might have measured the time inbetween days
+if %ENDTIME% LSS %STARTTIME% set set /A DURATION=%STARTTIME%-%ENDTIME%
+
+rem now break the seconds down to hors, minutes, seconds
+set /A DURATIONH=%DURATION% / 3600
+set /A DURATIONM=(%DURATION% - %DURATIONH%*3600) / 60
+set /A DURATIONS=(%DURATION% - %DURATIONH%*3600 - %DURATIONM%*60)
+
+rem some formatting
+if %DURATIONH% LSS 10 set DURATIONH=0%DURATIONH%
+if %DURATIONM% LSS 10 set DURATIONM=0%DURATIONM%
+if %DURATIONS% LSS 10 set DURATIONS=0%DURATIONS%
+
+echo Elapsed: %DURATIONH%:%DURATIONM%:%DURATIONS%
+
 goto end
 
 :help
 echo.
 echo make has the following options:
-echo     make ^<target^> [^<sphinx options^>]
-echo     make html -D "html_theme=basic"
+echo     make ^<target^> [^<theme^>]
+echo     make html basic
 echo.
 %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR%
 

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/876306
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I3daa81a12cbeff708cea7cf3334b3199dca2b1b3
Gerrit-Change-Number: 876306
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <i...@gno.de>
Gerrit-Reviewer: Xqt <i...@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org

Reply via email to