You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by Mike Beckerle <mb...@apache.org> on 2022/07/14 22:55:56 UTC

javascript question - add a search to a URL

I need a small javascript hack. Well perhaps small.

The DFDL spec was created using MS-Word.

It doesn't have a civilized index. Even URLs for headings below level 3 do
not exist. MS-Word was simply not up to the job.
You can't bookmark many things in the DFDL spec that you really would like
to bookmark with a URL.

I'd like to add some javascript to the HTML version of the spec, so that
one could take a URL like

    https://daffodil.apache.org/docs/dfdl/#_Toc62570072

(which takes you to Section 6.3.1 DFDL String Literals) I'd like to add to
this URL, or encapsulate it in an enclosing URL, or somehow create
something I can bookmark as a URL which allows me to add a follow-on
string-search to the above URL, and have the document be searched for that
string from that point downwards and position the window at the result of
the string search.

For example, I have no idea if one can do this just using the query part of
the URL, but perhaps adding to the URL to create this:

    https://daffodil.apache.org/docs/dfdl/#_Toc62570072?search=6.3.1.3

That would find the Section "6.3.1.3      DFDL Character Class Entities in
DFDL String Literals" and position the browser at that section.

Is this feasible from javascript executing in the browser?







Mike Beckerle
Apache Daffodil PMC | daffodil.apache.org
OGF DFDL Workgroup Co-Chair | www.ogf.org/ogf/doku.php/standards/dfdl/dfdl
Owl Cyber Defense | www.owlcyberdefense.com

RE: javascript question - add a search to a URL

Posted by "Ramaka, Shashi" <sr...@owlcyberdefense.com>.
I am not sure if it is possible to do this with just JavaScript without having named anchor tags for the location you want to jump to (6.3.1.3, in your example). 

Microsoft Word allows specifying the number of levels in a Table of Contents. If you can update the source Word document, it may be simpler to recreate the TOC in Word with more levels than the current setting (3). That way, we will have named anchor tags for each section heading, which can then be bookmarked and saved. 

Regards,

   Shashi Ramaka
   sramaka@owlcyberdefense.com 
   Tel: 703-965-3656

-----Original Message-----
From: Mike Beckerle <mb...@apache.org> 
Sent: Thursday, July 14, 2022 6:56 PM
To: dev@daffodil.apache.org
Subject: javascript question - add a search to a URL

I need a small javascript hack. Well perhaps small.

The DFDL spec was created using MS-Word.

It doesn't have a civilized index. Even URLs for headings below level 3 do not exist. MS-Word was simply not up to the job.
You can't bookmark many things in the DFDL spec that you really would like to bookmark with a URL.

I'd like to add some javascript to the HTML version of the spec, so that one could take a URL like

    https://daffodil.apache.org/docs/dfdl/#_Toc62570072

(which takes you to Section 6.3.1 DFDL String Literals) I'd like to add to this URL, or encapsulate it in an enclosing URL, or somehow create something I can bookmark as a URL which allows me to add a follow-on string-search to the above URL, and have the document be searched for that string from that point downwards and position the window at the result of the string search.

For example, I have no idea if one can do this just using the query part of the URL, but perhaps adding to the URL to create this:

    https://daffodil.apache.org/docs/dfdl/#_Toc62570072?search=6.3.1.3

That would find the Section "6.3.1.3      DFDL Character Class Entities in
DFDL String Literals" and position the browser at that section.

Is this feasible from javascript executing in the browser?







Mike Beckerle
Apache Daffodil PMC | daffodil.apache.org OGF DFDL Workgroup Co-Chair | www.ogf.org/ogf/doku.php/standards/dfdl/dfdl
Owl Cyber Defense | www.owlcyberdefense.com