Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Normal View/HTML View Woes

I'm sure this has been posted before, but I'll throw in my example in hopes of raising it in priority.

I entered the following content in HTML View:

{$ foreach x in (folder "archives\month") $}
<li><a href="{$x.link$}">{$x.headline$}</a></li>{$ before $}<h2>Monthly Archive</h2>
<ul>{$ after $}
</ul>{$ next $}

{$ foreach x in (folder "archives\categories") $}
<li><a href="{$x.link$}">{$x.headline$}</a></li>{$ before $}<h2>Topical Archive</h2>
<ul>{$ after $}
</ul>{$ next $}

When I inadvertently switched to Normal View and back again to HTML view this is what I ended up with:

{$ foreach x in (folder "archives\month") $}
<ul class="noindent">
<li><a href="{$x.link$}">{$x.headline$}</a>{$ before $}</li>
</ul>
<h2>Monthly Archive</h2>
<ul>
{$ after $}

</ul>
{$ next $}

{$ foreach x in (folder "archives\categories") $}
<ul class="noindent">
<li><a href="{$x.link$}">{$x.headline$}</a>{$ before $}</li>
</ul>
<h2>Topical Archive</h2>
<ul>
{$ after $}

</ul>
{$ next $}
<ul class="noindent"></ul>

Ouch. I have a lot of index pages of this sort, and I've taken to backing them up in text files in case I accidently slip up again.

Tell me there's a fix in the works for this one.

Scott McDonald
Sunday, November 30, 2003

Can you have a heading tag within an unordered list tag? I don't think it's valid (X)HTML.

John Topley (www.johntopley.com)
Monday, December 01, 2003

Interesting....

Some peculiar things seem to happen to markeup when switching between modes.

First, get it how you like, don't switch to 'normal' mode, publish, and validate.  There might be something that the xhtml control doesn't like, and it proceeds to fix it in a weird way.

Second, Put what scripting you can in variables.  They won't get involved in the activity that occurs when switching modes.

hth

joel goldstick
Monday, December 01, 2003

The <h2> is valid in a <ul> , but it has to be inside an <li> as well.

Michael Wild
Monday, December 01, 2003

But there's another problem. It's possible, and occurs in this case, for the article to be correct XHTML only after Cityscript expansion. Problem is, the CD editor tries to correct what it thinks is incorrect XHTML.

Even the example in the helpfile doesn't work!! :

{$ forEach x in (all) $}
    <li>{$ x.headline $}</li>
{$ before $}
    <ul>
{$ after $}
    </ul>
{$ next $}

gets mangled to

{$ forEach x in (all) $}
    <ul class="noindent">
<li>{$ x.headline $}
{$ before $}
    </li>
</ul>
<ul>
{$ after $}
   
</ul>
{$ next $}<ul class="noindent"></ul>

Michael Wild
Monday, December 01, 2003

Thanks, all, for your input. Yes, the expanded codes is valid XHTML, and outputs thusly:

<h2>Monthly Archive</h2>
<ul>
<li><a href="../archives/month/November_2003.html">November 2003 Archive</a></li>
<li><a href="../archives/month/October_2003.html">October 2003 Archive</a></li>
</ul>

<h2>Topical Archive</h2>
<ul>
<li><a href="../archives/categories/baseball.html">Baseball</a></li>
<li><a href="../archives/categories/cycling.html">Cycling</a></li>
<li><a href="../archives/categories/family.html">Family</a></li>
<li><a href="../archives/categories/school.html">Home Schooling</a></li>
</ul>

I think Michael is on the right track, that is, Citydesk's parser balks at the pre-processed code and trys to "fix" it. Interesting, is it the {$ before $} and {$ after $} tags that's throwing it off? I'll have to test this without those tags and see if it likes it better.

Scott McDonald
Monday, December 01, 2003

Aside from the woes described, it'd be nice if you could disable Normal view for specific pages. Sometimes you just know that you'll *never* want to edit them in Normal view, and this option would save you from inadvertently hitting the 'normal' button.

Pat Galea
Monday, December 01, 2003

I second Pat's excellent suggestion!

joel goldstick
Monday, December 01, 2003

How about putting it in a HTML file (in CD) in the first place, instead of an article ? You loose the extra fields but there would be no risk of switching to normal view.

Patrick

Patrick Thomas
Wednesday, December 03, 2003

You could define some variables, ul=<ul> and _ul=</ul>,
then use {$.ul$} and {$._ul$} in the article. Or define L=< and G=> then use {$.L$}ul{$.G$}, etc.

Michael Wild
Wednesday, December 03, 2003

Patrick, if you put the content into an .html file instead of in an article, you can no longer include it in CityScript loops.

Darren Collins
Wednesday, December 03, 2003

*  Recent Topics

*  Fog Creek Home