unclebob / fitnesse

FitNesse -- The Acceptance Test Wiki
fitnesse.org
Other
2.04k stars 713 forks source link

!today -t and -xml options not recognized if followed by literal (non-space) text #461

Closed stanio closed 10 years ago

stanio commented 10 years ago

Using latest Release 20140418, but this appears issue ever since the new parser has been introduced.

Today's Date

Actual:

Markup Text Displayed as
XML is !today -xml. XML is 01 Jun, 2014 -xml.
Right now it is !today -t. Right now it is 01 Jun, 2014 -t.

Expected:

Markup Text Displayed as
XML is !today -xml. XML is 2014-06-01T14:08:08.
Right now it is !today -t. Right now it is 01 Jun, 2014 14:08.

I guess the lexer needs to recognize just the exact -xml and -t options, such as the following is possible:

Markup Text Displayed as
XML is !today -xmlfoo XML is 2014-06-01T14:08:08foo
XML is !today -xml777 XML is 2014-06-01T14:08:08777
Right now it is !today -tfoo Right now it is 01 Jun, 2014 14:08foo
Right now it is !today -t777 Right now it is 01 Jun, 2014 14:08777

Or the syntax needs to be extended with an optional separator which doesn't appear in the generated result:

Markup Text Displayed as
XML is !today -xml.. XML is 2014-06-01T14:08:08.
Right now it is !today -t.. Right now it is 01 Jun, 2014 14:08.

The separator would allow adding new options/flags to !today in future, also.

jediwhale commented 10 years ago

Problem is Today just looks for following SymbolType.Text

     List<Symbol> lookAhead = parser.peek(new SymbolType[] 

{SymbolType.Whitespace, SymbolType.Text});

and then compares it to date format options

         if (isDateFormatOption(option)) {

We need to define a new SymbolType, say DateFormatOption that matches -t, -xml etc exactly and Today will peek for that. Or alternately we could do a more general SymbolOption that matches - plus list of letters plus optional separator as in your last option.

I don't have time to work on it now but it shouldn't be too hard...

On 2014-06-01 05:26, Stanimir Stamenkov wrote:

Using latest Release 20140418 http://fitnesse.org/.FrontPage.FitNesseDevelopment.FitNesseRelease20140418, but this appears issue ever since the new parser has been introduced.

Today's Date http://fitnesse.org/FitNesse.UserGuide.FitNesseWiki.MarkupLanguageReference.TodaysDate

Actual:

Markup Text Displayed as |XML is !today -xml.| XML is 01 Jun, 2014 -xml. |Right now it is !today -t.| Right now it is 01 Jun, 2014 -t.

Expected:

Markup Text Displayed as |XML is !today -xml.| XML is 2014-06-01T14:08:08. |Right now it is !today -t.| Right now it is 01 Jun, 2014 14:08.

I guess the lexer needs to recognize just the exact |-xml| and |-t| options, such as the following is possible:

Markup Text Displayed as |XML is !today -xmlfoo| XML is 2014-06-01T14:08:08foo |XML is !today -xml777| XML is 2014-06-01T14:08:08777 |Right now it is !today -tfoo| Right now it is 01 Jun, 2014 14:08foo |Right now it is !today -t777| Right now it is 01 Jun, 2014 14:08777

Or the syntax needs to be extended with an optional separator which doesn't appear in the generated result:

Markup Text Displayed as |XML is !today -xml..| XML is 2014-06-01T14:08:08. |Right now it is !today -t..| Right now it is 01 Jun, 2014 14:08.

The separator would allow adding new options/flags to |!today| in future, also.

— Reply to this email directly or view it on GitHub https://github.com/unclebob/fitnesse/issues/461.

Cheers, Mike Stockdale

/fit/Sharp http://fitsharp.github.com Syterra Software Inc. http://www.syterra.com

amolenaar commented 10 years ago

Fixed by #520.