You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by "Peter B. West" <pb...@powerup.com.au> on 2003/03/01 12:20:28 UTC

Foreign html + javascript links + .js file

Hi,

I haven't been following the argument for a few weeks, so I am after the 
  currently recommended method of creating and integrating files which 
should source a .js file in script tags, and support javascript: hrefs 
which will have the effect of displaying/hiding foreign html in inline 
frames.  In a previous life, the foreign html (including the html which 
referenced it) was dropped into src/documentation/content beside xdocs/

So, in a nutshell;

How do I describe the main files?
How do these files get the .js contents into the script element?
Where do I put the foreign html and how do I refer to it?

-- 
Peter B. West  pbwest@powerup.com.au  http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"


Re: Foreign html + javascript links + .js file

Posted by "Peter B. West" <pb...@powerup.com.au>.
Peter B. West wrote:
> How do I describe the main files?
> How do these files get the .js contents into the script element?
> Where do I put the foreign html and how do I refer to it?


And how do I get the hrefs defined.  E.g.
<span id ="span04" ></span ><a href= "javascript:toggleCode( 'span04',
         'Direction.html#getEnumIndex', '50%', '100%' )" ><span
         class="codefrag">int getEnumIndex(String)</span></a>

The Direction.html is "foreign" html.
-- 
Peter B. West  pbwest@powerup.com.au  http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"


Re: Foreign html + javascript links + .js file

Posted by "Peter B. West" <pb...@powerup.com.au>.
Jeff Turner wrote:
> On Mon, Mar 03, 2003 at 11:06:42AM +1000, Peter B. West wrote:
> 
> 
>>In .../xdocs/design/alt.design/properties/book.xml I have
>>
>>    <menu-item label="Classes overview" href="classes-overview.html"/>
>>
>>in .../xdocs/design/alt.design/properties/ is
>>classes-overview.ehtml
>>
>>The validation proceeds ok, but the link is broken.  What am I doing wrong?
> 
> 
> Could you commit to FOP CVS or mail me the directory?  It all seems to
> work for me:

I have committed most of this, except the .js file, and I cannot access 
CVS at the moment.

> 
> * [0] design/alt.design/properties/classes-overview.html
> 
> Attached is the properties/ directory I used.
> 
> --Jeff
> 
> 
>>>src/documentation/content/xdocs/design/alt.design/properties.ehtml
>>>src/documentation/content/design/alt.design/properties/Property.html
>>>
>>>Then <a href="Property.html">property</a> in properties.ehtml should
>>>work.

I am missing something here.  Is a search of the subdirectories of 
.../alt.design conducted to find the references?

-- 
Peter B. West  pbwest@powerup.com.au  http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"


Re: Foreign html + javascript links + .js file

Posted by Jeff Turner <je...@apache.org>.
On Mon, Mar 03, 2003 at 11:06:42AM +1000, Peter B. West wrote:
> Jeff Turner wrote:
> >On Sat, Mar 01, 2003 at 09:59:52PM +1000, Peter B. West wrote:
> >
> >>Jeff,
> >>
> >>Thanks.  That's exactly what I want to do.  I presume that I must simply 
> >>maintain all the proper relativities in the links between these files, 
> >>and back to the generated files?
> >
> >
> >Yes, usual linking rules apply (you can use 'site:' links if you want).
> >If you had:
> 
> We have no site.xml, which I assume is why site: does not work in book.xml.

Yes, site.xml is optional.  It allows <link href="site:<ref>">, where
<ref> is a partial XPath locator into a site.xml file.  Info at
http://xml.apache.org/forrest/linking.html

> In .../xdocs/design/alt.design/properties/book.xml I have
> 
>     <menu-item label="Classes overview" href="classes-overview.html"/>
> 
> in .../xdocs/design/alt.design/properties/ is
> classes-overview.ehtml
> 
> The validation proceeds ok, but the link is broken.  What am I doing wrong?

Could you commit to FOP CVS or mail me the directory?  It all seems to
work for me:

* [0] design/alt.design/properties/classes-overview.html

Attached is the properties/ directory I used.

--Jeff

> >src/documentation/content/xdocs/design/alt.design/properties.ehtml
> >src/documentation/content/design/alt.design/properties/Property.html
> >
> >Then <a href="Property.html">property</a> in properties.ehtml should
> >work.
> 
> -- 
> Peter B. West  pbwest@powerup.com.au  http://www.powerup.com.au/~pbwest/
> "Lord, to whom shall we go?"
> 

Re: Foreign html + javascript links + .js file

Posted by "Peter B. West" <pb...@powerup.com.au>.
Jeff Turner wrote:
> On Sat, Mar 01, 2003 at 09:59:52PM +1000, Peter B. West wrote:
> 
>>Jeff,
>>
>>Thanks.  That's exactly what I want to do.  I presume that I must simply 
>>maintain all the proper relativities in the links between these files, 
>>and back to the generated files?
> 
> 
> Yes, usual linking rules apply (you can use 'site:' links if you want).
> If you had:

We have no site.xml, which I assume is why site: does not work in book.xml.

In .../xdocs/design/alt.design/properties/book.xml I have

     <menu-item label="Classes overview" href="classes-overview.html"/>

in .../xdocs/design/alt.design/properties/ is
classes-overview.ehtml

The validation proceeds ok, but the link is broken.  What am I doing wrong?

> 
> src/documentation/content/xdocs/design/alt.design/properties.ehtml
> src/documentation/content/design/alt.design/properties/Property.html
> 
> Then <a href="Property.html">property</a> in properties.ehtml should
> work.

-- 
Peter B. West  pbwest@powerup.com.au  http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"


Re: Foreign html + javascript links + .js file

Posted by Jeff Turner <je...@apache.org>.
On Sat, Mar 01, 2003 at 09:59:52PM +1000, Peter B. West wrote:
> Jeff,
> 
> Thanks.  That's exactly what I want to do.  I presume that I must simply 
> maintain all the proper relativities in the links between these files, 
> and back to the generated files?

Yes, usual linking rules apply (you can use 'site:' links if you want).
If you had:

src/documentation/content/xdocs/design/alt.design/properties.ehtml
src/documentation/content/design/alt.design/properties/Property.html

Then <a href="Property.html">property</a> in properties.ehtml should
work.


--Jeff


[1] http://xml.apache.org/forrest/linking.html

> 
> Peter

Re: Foreign html + javascript links + .js file

Posted by "Peter B. West" <pb...@powerup.com.au>.
Jeff,

Thanks.  That's exactly what I want to do.  I presume that I must simply 
maintain all the proper relativities in the links between these files, 
and back to the generated files?

Peter

Jeff Turner wrote:
> On Sat, Mar 01, 2003 at 09:20:28PM +1000, Peter B. West wrote:
> 
>>Hi,
>>
>>I haven't been following the argument for a few weeks, so I am after the 
>> currently recommended method of creating and integrating files which 
>>should source a .js file in script tags, and support javascript: hrefs 
>>which will have the effect of displaying/hiding foreign html in inline 
>>frames.  In a previous life, the foreign html (including the html which 
>>referenced it) was dropped into src/documentation/content beside xdocs/
>>
>>So, in a nutshell;
>>
>>How do I describe the main files?
>>How do these files get the .js contents into the script element?
>>Where do I put the foreign html and how do I refer to it?
> 
> 
> You could have a regular well-formed HTML file:
> 
> <html>
>   <body>
>     <script language="JavaScript" type="text/javascript" src="resources/script.js"/>
>     <h1>Blah ..</h1>
>     ....
>   </body>
> </html>
> 
> If saved with a .ehtml extension ("embedded html"), everything below the
> <body> is copied across verbatim, and the header and menus are added.
> 
> There is an example of this at
> http://xml.apache.org/forrest/forrestbar.html
> 
> Does that help?  I'm a bit hazy on what you're trying to do.

-- 
Peter B. West  pbwest@powerup.com.au  http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"


Re: Foreign html + javascript links + .js file

Posted by "Peter B. West" <pb...@powerup.com.au>.
Jeff Turner wrote:
> On Sun, Mar 09, 2003 at 12:04:27AM +1000, Peter B. West wrote:
> 
>>Jeff,
>>
>>I have these files now being successfully included.  However...
>>
>>Jeff Turner wrote:
>>
>>>On Sat, Mar 01, 2003 at 10:04:06PM +1000, Peter B. West wrote:
>>>
>>>
>>>>Jeff Turner wrote:
>>>>
>>>>
>>>>>You could have a regular well-formed HTML file:
>>>>>
>>>>><html>
>>>>><body>
>>>>> <script language="JavaScript" type="text/javascript" 
>>>>> src="resources/script.js"/>
>>>>> <h1>Blah ..</h1>
>>>>> ....
>>>>></body>
>>>>></html>
>>>>>
>>>>>If saved with a .ehtml extension ("embedded html"), everything below the
>>>>><body> is copied across verbatim, and the header and menus are added.
>>
>>The problem here is that the script element, not being in the body, is 
>>not being copied across.  Consequently, my javascript: links are not 
>>working.  Any way around this?
> 
> 
> Can you move the <script> into the body?
> 
> Adding support for stuff in <head> is possible, but a bit messy, so I'm
> interested to find out if there's any use-cases where things *have* to be
> in <head>..

Jeff,

Only if one is under the mistaken impression that <script> can only 
occur within <head>.  How embarassing.  Thanks.
-- 
Peter B. West  pbwest@powerup.com.au  http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"


Re: Why resources/images? (Re: Foreign html + javascript links + .js file)

Posted by Marc Portier <mp...@outerthought.org>.
coincidence: was solving a smaller thing on pass-through word 
docs today for a customer of us that started using forrest...

they can link ./diagram.gif  from an xdoc and just drop the image 
next to it

however they cannot do so with *.doc extended stuff

I'm all for removing differences between images and any other 
binary (non-processed) content, but *that* difference can maybe 
go along with it?

we might end up questioning why we keep holding onto the xdocs 
directory?


-marc=


Jeff Turner wrote:
> On Wed, Mar 12, 2003 at 11:53:24PM +1000, Peter B. West wrote:
> 
>>Jeff,
>>
>>Attached are the diffs of the changes I made to get the 
>>resources/scripts files to be picked up.
> 
> 
> I've never really understood the historical reason for 'resources' being
> different from 'content'.
> 
> Wouldn't it have the same effect to put these things in content/scripts?
> 
> IMHO, anything that gets served to the user is 'content', and anything
> that helps produce content (XSLT, DTDs, catalog files) are 'resources'.
> 
> But this is not the original plan, or we wouldn't have resources/images/
> 
> So a question for everyone: are there any reasons for resources/images/,
> or can we deprecate it in favour of content/images/?
> 
> 
>>I also had a lot of fun trying to work out why some of my .ehtml files
>>would be recognised, while others generated empty files.  The
>>difference turned out to be that the <HTML/> tags were upper case.
> 
> 
> :/  Well we could turn on JTidy when parsing *.ehtml.  Simply a matter of
> changing:
> 
> <map:generate src="content/xdocs/{../1}.ehtml"/>
> 
> to
> 
> <map:generate type="html" src="content/xdocs/{../1}.ehtml"/>
> 
> However I found that JTidy doesn't like/expect input to contain the <?xml
> version="1.0"?> XML declaration, so it would break backwards-compat.
> JTidy is generally yucky - wish someone would add support for NekoHTML.
> 
> --Jeff
> 
> 
>>Peter
>>
> 
> 

-- 
Marc Portier                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at              http://radio.weblogs.com/0116284/
mpo@outerthought.org                              mpo@apache.org


Why resources/images? (Re: Foreign html + javascript links + .js file)

Posted by Jeff Turner <je...@apache.org>.
On Wed, Mar 12, 2003 at 11:53:24PM +1000, Peter B. West wrote:
> Jeff,
> 
> Attached are the diffs of the changes I made to get the 
> resources/scripts files to be picked up.

I've never really understood the historical reason for 'resources' being
different from 'content'.

Wouldn't it have the same effect to put these things in content/scripts?

IMHO, anything that gets served to the user is 'content', and anything
that helps produce content (XSLT, DTDs, catalog files) are 'resources'.

But this is not the original plan, or we wouldn't have resources/images/

So a question for everyone: are there any reasons for resources/images/,
or can we deprecate it in favour of content/images/?

> I also had a lot of fun trying to work out why some of my .ehtml files
> would be recognised, while others generated empty files.  The
> difference turned out to be that the <HTML/> tags were upper case.

:/  Well we could turn on JTidy when parsing *.ehtml.  Simply a matter of
changing:

<map:generate src="content/xdocs/{../1}.ehtml"/>

to

<map:generate type="html" src="content/xdocs/{../1}.ehtml"/>

However I found that JTidy doesn't like/expect input to contain the <?xml
version="1.0"?> XML declaration, so it would break backwards-compat.
JTidy is generally yucky - wish someone would add support for NekoHTML.

--Jeff

> Peter
> 

Re: Foreign html + javascript links + .js file

Posted by "Peter B. West" <pb...@powerup.com.au>.
Jeff,

Attached are the diffs of the changes I made to get the 
resources/scripts files to be picked up.  I also had a lot of fun trying 
to work out why some of my .ehtml files would be recognised, while 
others generated empty files.  The difference turned out to be that the 
<HTML/> tags were upper case.

Peter

Peter B. West wrote:
> Peter B. West wrote:
> 
>> Jeff,
>>
>> One more question might be the last.  Where do I put the .js files and 
>> how do I refer to them within the .ehtml?
> 
> 
> Forrest is aware that a script src should be found under resources, but 
> was not copying any such files into context.  I added references to the 
> resources/scripts directory in parallel to the resources/images 
> properties in forrest.build.xml and, presto, the links were resolved.
> 

-- 
Peter B. West  pbwest@powerup.com.au  http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"

Re: Foreign html + javascript links + .js file

Posted by "Peter B. West" <pb...@powerup.com.au>.
Peter B. West wrote:
> Jeff,
> 
> One more question might be the last.  Where do I put the .js files and 
> how do I refer to them within the .ehtml?

Forrest is aware that a script src should be found under resources, but 
was not copying any such files into context.  I added references to the 
resources/scripts directory in parallel to the resources/images 
properties in forrest.build.xml and, presto, the links were resolved.

-- 
Peter B. West  pbwest@powerup.com.au  http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"


Re: Foreign html + javascript links + .js file

Posted by "Peter B. West" <pb...@powerup.com.au>.
Jeff,

One more question might be the last.  Where do I put the .js files and 
how do I refer to them within the .ehtml?

Peter

Jeff Turner wrote:
> On Sun, Mar 09, 2003 at 12:04:27AM +1000, Peter B. West wrote:
> 
> 
> Can you move the <script> into the body?
> 
> Adding support for stuff in <head> is possible, but a bit messy, so I'm
> interested to find out if there's any use-cases where things *have* to be
> in <head>..

-- 
Peter B. West  pbwest@powerup.com.au  http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"


Re: Foreign html + javascript links + .js file

Posted by Jeff Turner <je...@apache.org>.
On Sun, Mar 09, 2003 at 12:04:27AM +1000, Peter B. West wrote:
> Jeff,
> 
> I have these files now being successfully included.  However...
> 
> Jeff Turner wrote:
> >On Sat, Mar 01, 2003 at 10:04:06PM +1000, Peter B. West wrote:
> >
> >>Jeff Turner wrote:
> >>
> >>>You could have a regular well-formed HTML file:
> >>>
> >>><html>
> >>><body>
> >>>  <script language="JavaScript" type="text/javascript" 
> >>>  src="resources/script.js"/>
> >>>  <h1>Blah ..</h1>
> >>>  ....
> >>></body>
> >>></html>
> >>>
> >>>If saved with a .ehtml extension ("embedded html"), everything below the
> >>><body> is copied across verbatim, and the header and menus are added.
> 
> The problem here is that the script element, not being in the body, is 
> not being copied across.  Consequently, my javascript: links are not 
> working.  Any way around this?

Can you move the <script> into the body?

Adding support for stuff in <head> is possible, but a bit messy, so I'm
interested to find out if there's any use-cases where things *have* to be
in <head>..

--Jeff

> Peter
> -- 
> Peter B. West  pbwest@powerup.com.au  http://www.powerup.com.au/~pbwest/
> "Lord, to whom shall we go?"
> 

Re: Foreign html + javascript links + .js file

Posted by "Peter B. West" <pb...@powerup.com.au>.
Jeff,

I have these files now being successfully included.  However...

Jeff Turner wrote:
> On Sat, Mar 01, 2003 at 10:04:06PM +1000, Peter B. West wrote:
> 
>>Jeff Turner wrote:
>>
>>>You could have a regular well-formed HTML file:
>>>
>>><html>
>>> <body>
>>>   <script language="JavaScript" type="text/javascript" 
>>>   src="resources/script.js"/>
>>>   <h1>Blah ..</h1>
>>>   ....
>>> </body>
>>></html>
>>>
>>>If saved with a .ehtml extension ("embedded html"), everything below the
>>><body> is copied across verbatim, and the header and menus are added.

The problem here is that the script element, not being in the body, is 
not being copied across.  Consequently, my javascript: links are not 
working.  Any way around this?

Peter
-- 
Peter B. West  pbwest@powerup.com.au  http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"


Re: Foreign html + javascript links + .js file

Posted by Jeff Turner <je...@apache.org>.
On Sat, Mar 01, 2003 at 10:04:06PM +1000, Peter B. West wrote:
> Jeff Turner wrote:
> >
> >You could have a regular well-formed HTML file:
> >
> ><html>
> >  <body>
> >    <script language="JavaScript" type="text/javascript" 
> >    src="resources/script.js"/>
> >    <h1>Blah ..</h1>
> >    ....
> >  </body>
> ></html>
> >
> >If saved with a .ehtml extension ("embedded html"), everything below the
> ><body> is copied across verbatim, and the header and menus are added.
> 
> Jeff,
> 
> Where do the .ehtml files go?  In xdocs/ or beside the foreign html 
> (which must not get the headers and menus)?

In xdocs/, as they are XML.

--Jeff

> -- 
> Peter B. West  pbwest@powerup.com.au  http://www.powerup.com.au/~pbwest/
> "Lord, to whom shall we go?"
> 

Re: Foreign html + javascript links + .js file

Posted by "Peter B. West" <pb...@powerup.com.au>.
Jeff Turner wrote:
> 
> You could have a regular well-formed HTML file:
> 
> <html>
>   <body>
>     <script language="JavaScript" type="text/javascript" src="resources/script.js"/>
>     <h1>Blah ..</h1>
>     ....
>   </body>
> </html>
> 
> If saved with a .ehtml extension ("embedded html"), everything below the
> <body> is copied across verbatim, and the header and menus are added.

Jeff,

Where do the .ehtml files go?  In xdocs/ or beside the foreign html 
(which must not get the headers and menus)?
-- 
Peter B. West  pbwest@powerup.com.au  http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"


Re: Foreign html + javascript links + .js file

Posted by Jeff Turner <je...@apache.org>.
On Sat, Mar 01, 2003 at 09:20:28PM +1000, Peter B. West wrote:
> Hi,
> 
> I haven't been following the argument for a few weeks, so I am after the 
>  currently recommended method of creating and integrating files which 
> should source a .js file in script tags, and support javascript: hrefs 
> which will have the effect of displaying/hiding foreign html in inline 
> frames.  In a previous life, the foreign html (including the html which 
> referenced it) was dropped into src/documentation/content beside xdocs/
> 
> So, in a nutshell;
> 
> How do I describe the main files?
> How do these files get the .js contents into the script element?
> Where do I put the foreign html and how do I refer to it?

You could have a regular well-formed HTML file:

<html>
  <body>
    <script language="JavaScript" type="text/javascript" src="resources/script.js"/>
    <h1>Blah ..</h1>
    ....
  </body>
</html>

If saved with a .ehtml extension ("embedded html"), everything below the
<body> is copied across verbatim, and the header and menus are added.

There is an example of this at
http://xml.apache.org/forrest/forrestbar.html

Does that help?  I'm a bit hazy on what you're trying to do.

--Jeff

> -- 
> Peter B. West  pbwest@powerup.com.au  http://www.powerup.com.au/~pbwest/
> "Lord, to whom shall we go?"
>