This question about Topic Markup Language and applications: Answered

HTML comment affects SEARCH output formatting

The placement of a html comment related to the end of the SEARCH macro affects the output. Example below. The problem is easily avoided, if you know the cause. But there are many examples on this site that show the contruct as valid.

This works

%SEARCH{ "ReportedBy =~ 'George'"
  type="query"
  web="Tasks"
  limit="3"

nonoise="on"

 header="| header |||||"

 format="| $topic | $topic | $topic | $topic | $topic |"
}%
<!-- -->

header
Item10048 Item10048 Item10048 Item10048 Item10048
Item10058 Item10058 Item10058 Item10058 Item10058
Item10059 Item10059 Item10059 Item10059 Item10059

And this does not

Note: the comment <!-- --> is on the same line as the closing bracket }%. The last line in the table is not formatted correctly
%SEARCH{ "ReportedBy =~ 'George'"
  type="query"
  web="Tasks"
  limit="3"

nonoise="on"

 header="| header |||||"

 format="| $topic | $topic | $topic | $topic | $topic |"
}%<!-- -->

header
Item10048 Item10048 Item10048 Item10048 Item10048
Item10058 Item10058 Item10058 Item10058 Item10058
| Item10059 | Item10059 | Item10059 | Item10059 | Item10059 |

-- BramVanOosterhout - 06 Jan 2016

I'm not sure what the question here is. This is working as intended. It's important that the SEARCH macro doesn't output extra newlines, etc. or it would break other applications where a search is used to build input to other macros.

-- GeorgeClark - 07 Jan 2016

Sorry to be unclear. I have expanded above. The question is possibly about my expectation. I expected the construct under "This works" to be equivalent to the construct under "An this does not". And they clearly are not.

Why does the placement of the comment following the }% affect the formatting of the SEARCH:
  • On a new line gives the desired result
  • On the same line as the }% breaks the formatting of the SEARCH

-- BramVanOosterhout - 07 Jan 2016

Eeeeeek! I have formatted the question and now neither works?!?. Sorry, I will try to reproduce.

I worked it out. I use the editor in wiki text mode and put the <!-- --> on the next line. On save the comment gets moved and appended to the line above. That would be fine if it was semantically the same. But it is not. That move is however a separate problem. My problem essentially as I don't like WYSIWYG. Since it does not really give you the WYG.

This question is exclusively about the different results for }%<space><!-- --> and }%<newline><!-- -->

-- BramVanOosterhout - 07 Jan 2016

  • Set NOWYSIWYG = 1
TML,Topic Markup Language, is generally a line oriented markup, delimited by white space. So a table row is by definition, a line with | column | data |, and has white space at the beginning (optional) and end of the lines. Once the HTML comment was appended to the | table | line |, the line no longer ended with white space, and the render did not recognize the line as a table.

This is a Table
So is This with leading whitespace
but | this | is | not |

| and | neither | is | This

Also with TML, It doesn't span lines, unless explicitly continued *This is bold text But is broken by a newline*

This is multiline bold that continues

-- GeorgeClark - 07 Jan 2016

Oh... and Wysiwyg wrapping the HTML comment into the table is a bug in the Wysiwyg plugin.

-- GeorgeClark - 07 Jan 2016

Thanks George,

  • Yes, I understand the TML.
  • I also understand that the change I observed from }%newline<!-- --> to }%space<!-- --> is a known Wysiwyg issue.
  • Ahhh, and I now (after re-reading your comments three times frown, sad smile ) I understand that a table row line MUST start with whitespace | and end with | whitespace

  • The root cause of my problem is that I believed that the SEARCH adds a final newline. On re-reading the documentation I realise the default nofinalnewline=*on*. I believed the default was the reverse. My apologies. Thanks very much for your patience and extensive explanation.

And to make it work

I have to set nofinalnewline="off"
%SEARCH{ "ReportedBy =~ 'George'"
  type="query"
  web="Tasks"
  limit="3"

nonoise="on"
nofinalnewline="off"
 header="| header |||||"

 format="| $topic | $topic | $topic | $topic | $topic |"
}%<!-- -->

header
Item10048 Item10048 Item10048 Item10048 Item10048
Item10058 Item10058 Item10058 Item10058 Item10058
Item10059 Item10059 Item10059 Item10059 Item10059

-- BramVanOosterhout - 07 Jan 2016
 

QuestionForm edit

Subject Topic Markup Language and applications
Extension
Version Foswiki 2.0.3
Status Answered
Related Topics
Topic revision: r6 - 08 Jan 2016, BramVanOosterhout - This page was cached on 25 May 2017 - 03:20.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License