Skip to content

Commit

Permalink
Some minor fixes for \showdate
Browse files Browse the repository at this point in the history
- Better warning when the date parameter does not cover all parts of
  the format.
- Use of \showdate in the internal documentation
- Fixed typo
  • Loading branch information
doxygen committed Aug 25, 2022
1 parent b2d2c8d commit 3a2247f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/datetime.h
Expand Up @@ -55,7 +55,7 @@ constexpr const char *SF_bit2str(int bitNumber)
QCString dateTimeFromString(const QCString &spec,std::tm &dt,int &format);


/** Return a string representation for a given std::tm value that is formated according to the
/** Return a string representation for a given std::tm value that is formatted according to the
* pattern given by a format.
* @param[in] format the string used for format the date and time, e.g. `%Y-%m-%d`
* @param[in] dt the date and time value to fill in
Expand Down
10 changes: 5 additions & 5 deletions src/docnode.cpp
Expand Up @@ -3235,8 +3235,8 @@ void DocPara::handleShowDate(DocNodeVariant *thisVariant)
}

std::tm dat{};
int format=0;
QCString err = dateTimeFromString(specDate,dat,format);
int specFormat=0;
QCString err = dateTimeFromString(specDate,dat,specFormat);
if (!err.isEmpty())
{
warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"invalid date argument for command '\\showdate': %s",qPrint(err));
Expand All @@ -3251,10 +3251,10 @@ void DocPara::handleShowDate(DocNodeVariant *thisVariant)
for (int i=0;i<SF_NumBits;i++)
{
int bitMask = 1<<i;
if ((usedFormat&bitMask) && !(format&bitMask))
if ((usedFormat&bitMask) && !(specFormat&bitMask)) // a part was used in the format string but its value was not specified.
{
warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"'\\showdate' format '%s' has %s related markers not specified in date parameter '%s'. Using current time values.",
qPrint(fmt),SF_bit2str(i),qPrint(specDate));
warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"'\\showdate' format '%s' has %s related markers which are not specified in date parameter '%s'. Filling in the current value for %s instead.",
qPrint(fmt),SF_bit2str(i),qPrint(specDate),SF_bit2str(i));
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/doxygen.md
@@ -1,6 +1,8 @@
%Doxygen Internals {#mainpage}
=================

Generated on \showdate "%A, %B %-d, %Y"

Introduction
============

Expand Down

0 comments on commit 3a2247f

Please sign in to comment.