• Extending shtmlview with www URLs

    From Alexandru@21:1/5 to All on Sat Oct 21 01:18:11 2023
    I started to extend the code of shtmlview to support www URLS.
    It works already when I do "browse https://something".
    The content is displayed as expected with one exception:
    When the content contains an achor tag to another www URL, the tag is ignored and the result is just text.
    I tried to find out where in the code this happens, but no success until now. Since the code relies (unfortuantelly) heavilly on the assumption, that all URL are local files, I guess somewhere in the code there is a validation if the URL is a local file and if not the URL is discarded. I true, this is bad method, since a not
    working URL should still be visible as an URL.
    Maybe can someone help with this point since I'm pretty sucked with this.

    Many thanks
    Alexandru

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From D Groth@21:1/5 to Alexandru on Thu Oct 26 10:35:53 2023
    Alexandru schrieb am Samstag, 21. Oktober 2023 um 10:18:15 UTC+2:
    I started to extend the code of shtmlview to support www URLS.
    It works already when I do "browse https://something".
    The content is displayed as expected with one exception:
    When the content contains an achor tag to another www URL, the tag is ignored and the result is just text.
    I tried to find out where in the code this happens, but no success until now.
    Since the code relies (unfortuantelly) heavilly on the assumption, that all URL are local files, I guess somewhere in the code there is a validation if the URL is a local file and if not the URL is discarded. I true, this is bad method, since a not
    working URL should still be visible as an URL.
    Maybe can someone help with this point since I'm pretty sucked with this.

    Many thanks
    Alexandru

    shtmlview is only thought to browse local files, for instance help pages for an Tk application.
    There is no plan to support using shtmlview to browse the web.

    If you really need this you might consider creating as well a vfs::https version of vfs::http

    https://wiki.tcl-lang.org/page/vfs%3A%3Ahttp

    Which allows you to browse the web as it the web is then taken as local files.

    Not sure how difficult that could be.

    Detlef

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Alexandru@21:1/5 to D Groth on Thu Oct 26 11:04:40 2023
    D Groth schrieb am Donnerstag, 26. Oktober 2023 um 19:35:57 UTC+2:
    Alexandru schrieb am Samstag, 21. Oktober 2023 um 10:18:15 UTC+2:
    I started to extend the code of shtmlview to support www URLS.
    It works already when I do "browse https://something".
    The content is displayed as expected with one exception:
    When the content contains an achor tag to another www URL, the tag is ignored and the result is just text.
    I tried to find out where in the code this happens, but no success until now.
    Since the code relies (unfortuantelly) heavilly on the assumption, that all URL are local files, I guess somewhere in the code there is a validation if the URL is a local file and if not the URL is discarded. I true, this is bad method, since a not
    working URL should still be visible as an URL.
    Maybe can someone help with this point since I'm pretty sucked with this.

    Many thanks
    Alexandru
    shtmlview is only thought to browse local files, for instance help pages for an Tk application.
    There is no plan to support using shtmlview to browse the web.

    Hi Detlef, glad that you answered, as the developer of shtmlview.

    Question: Why not support also files from the web?

    I'm planing to create an help system for my software.
    The help files are online, so that the user does not need to download the whole bunch of html files to it's computer.
    Besides, updates to the online files are easy done with imediate effect to all users.

    The fact that I could already adapt your code in one hour or so and that it already works for online content shows that it can be done with little effort. And the changes done by me are only a few lines.

    The function to dowload file content to a string, I had already. I don't think this function must be part of your package. I could be an external procedure that each user can configure in the package as an optional setting.

    Would you take a look I my changes and give it a thought?

    Many thanks
    Alexandru


    If you really need this you might consider creating as well a vfs::https version of vfs::http

    https://wiki.tcl-lang.org/page/vfs%3A%3Ahttp

    Which allows you to browse the web as it the web is then taken as local files.

    Not sure how difficult that could be.

    Detlef

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pd@21:1/5 to All on Sat Oct 28 04:38:28 2023
    El jueves, 26 de octubre de 2023 a las 20:04:44 UTC+2, Alexandru escribió:

    Question: Why not support also files from the web?

    I'm planing to create an help system for my software.
    The help files are online, so that the user does not need to download the whole bunch of html files to it's computer.
    Besides, updates to the online files are easy done with imediate effect to all users.

    consider to include help files in the distribution package in order to consult them offline, there're pros and cons both for keeping help online or offline, but it may be quite annoying to have to look for something in help docs while not having
    internet access so you cannot do it.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Alexandru@21:1/5 to All on Sat Oct 28 07:44:08 2023
    pd schrieb am Samstag, 28. Oktober 2023 um 13:38:32 UTC+2:
    El jueves, 26 de octubre de 2023 a las 20:04:44 UTC+2, Alexandru escribió:

    Question: Why not support also files from the web?

    I'm planing to create an help system for my software.
    The help files are online, so that the user does not need to download the whole bunch of html files to it's computer.
    Besides, updates to the online files are easy done with imediate effect to all users.
    consider to include help files in the distribution package in order to consult them offline, there're pros and cons both for keeping help online or offline, but it may be quite annoying to have to look for something in help docs while not having
    internet access so you cannot do it.

    Yes, I considered this option already an trust me, I would ask here my questions if offline help would be an option.

    Besides: Our software manages licenses and users using our online database. And it also has acces to Gigabites of simulation models. So without internet, no software at all. It's that simple.

    Secondly: The kind of help I'm planing is not the old school kind: It's kind of atomic help to single functions//buttons in the suftware. It's presented as small crumbs of text + images in a larger tooltip.

    Thirdly: Having offline help files would logically mean that the local files will get outdated. Updating those local help files means online connection so here we are back to the point that an internet connection is needed.

    Fourth: We are updating the software on a weekly basis. We do few improvements in short time distance. We don't do one large update once a year or so. So each week new small help files will be added to our server data base.

    I know this has nothing to do with my original question but you started ;)

    Cheers
    Alex

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pd@21:1/5 to All on Sat Oct 28 12:38:08 2023
    I just don't want to feed a long off topic so just a comment to finish it up ;-)

    El sábado, 28 de octubre de 2023 a las 16:44:12 UTC+2, Alexandru escribió:
    pd schrieb am Samstag, 28. Oktober 2023 um 13:38:32 UTC+2:

    consider to include help files in the distribution package in order to consult them offline, there're pros and cons both for keeping help online or offline, but it may be quite annoying to have to look for something in help docs while not having
    internet access so you cannot do it.
    Yes, I considered this option already an trust me, I would ask here my questions if offline help would be an option.
    Thirdly: Having offline help files would logically mean that the local files will get outdated. Updating those local help files means online connection so here we are back to the point that an internet connection is needed.
    ...
    Thirdly: Having offline help files would logically mean that the local files will get outdated. Updating those local help files means online connection so here we are back to the point that an internet connection is needed.

    The other points are good ones but this one seems contradictory to me, of course help files will get outdated as well as the software itself, saying it's not appropiate to have help offline because of you need to be online to update it is the same as
    saying it's not appropiate to distribute your software for offline use because of updates, it's better to use it online in a web app or cloud. Even having frequent updates you can consult the help offline it you have the files locally and that is an
    advantage.

    But as I have said there's cons and pros for both strategies so it's a decision to make taking into account the environment and target.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From D Groth@21:1/5 to All on Sun Oct 29 01:50:01 2023
    Dear Alex,

    I suggest, that you do a fork of shtml to do so. I have no intension to add new features, just like to fix possible bugs.
    My gut feeling tells me that it might be more appropiate for this topic to use one of many binary extensions which can be used to display web pages.
    The most promising is the Tcl webview wrapper: https://www.androwish.org/home/dir?name=undroid/twv
    Although the server seems currently down.

    See as well here: https://wiki.tcl-lang.org/page/Taygete+Scrap+Book
    Best,
    Detlef


    pd schrieb am Samstag, 28. Oktober 2023 um 21:38:12 UTC+2:
    I just don't want to feed a long off topic so just a comment to finish it up ;-)
    El sábado, 28 de octubre de 2023 a las 16:44:12 UTC+2, Alexandru escribió:
    pd schrieb am Samstag, 28. Oktober 2023 um 13:38:32 UTC+2:

    consider to include help files in the distribution package in order to consult them offline, there're pros and cons both for keeping help online or offline, but it may be quite annoying to have to look for something in help docs while not having
    internet access so you cannot do it.
    Yes, I considered this option already an trust me, I would ask here my questions if offline help would be an option.
    Thirdly: Having offline help files would logically mean that the local files will get outdated. Updating those local help files means online connection so here we are back to the point that an internet connection is needed.
    ...
    Thirdly: Having offline help files would logically mean that the local files will get outdated. Updating those local help files means online connection so here we are back to the point that an internet connection is needed.
    The other points are good ones but this one seems contradictory to me, of course help files will get outdated as well as the software itself, saying it's not appropiate to have help offline because of you need to be online to update it is the same as
    saying it's not appropiate to distribute your software for offline use because of updates, it's better to use it online in a web app or cloud. Even having frequent updates you can consult the help offline it you have the files locally and that is an
    advantage.

    But as I have said there's cons and pros for both strategies so it's a decision to make taking into account the environment and target.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From D Groth@21:1/5 to All on Sun Oct 29 01:42:10 2023
    pd schrieb am Samstag, 28. Oktober 2023 um 21:38:12 UTC+2:
    I just don't want to feed a long off topic so just a comment to finish it up ;-)
    El sábado, 28 de octubre de 2023 a las 16:44:12 UTC+2, Alexandru escribió:
    pd schrieb am Samstag, 28. Oktober 2023 um 13:38:32 UTC+2:

    consider to include help files in the distribution package in order to consult them offline, there're pros and cons both for keeping help online or offline, but it may be quite annoying to have to look for something in help docs while not having
    internet access so you cannot do it.
    Yes, I considered this option already an trust me, I would ask here my questions if offline help would be an option.
    Thirdly: Having offline help files would logically mean that the local files will get outdated. Updating those local help files means online connection so here we are back to the point that an internet connection is needed.
    ...
    Thirdly: Having offline help files would logically mean that the local files will get outdated. Updating those local help files means online connection so here we are back to the point that an internet connection is needed.
    The other points are good ones but this one seems contradictory to me, of course help files will get outdated as well as the software itself, saying it's not appropiate to have help offline because of you need to be online to update it is the same as
    saying it's not appropiate to distribute your software for offline use because of updates, it's better to use it online in a web app or cloud. Even having frequent updates you can consult the help offline it you have the files locally and that is an
    advantage.

    But as I have said there's cons and pros for both strategies so it's a decision to make taking into account the environment and target.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Alexandru@21:1/5 to D Groth on Sun Oct 29 02:11:13 2023
    D Groth schrieb am Sonntag, 29. Oktober 2023 um 09:50:04 UTC+1:
    Dear Alex,

    I suggest, that you do a fork of shtml to do so. I have no intension to add new features, just like to fix possible bugs.
    My gut feeling tells me that it might be more appropiate for this topic to use one of many binary extensions which can be used to display web pages.
    The most promising is the Tcl webview wrapper: https://www.androwish.org/home/dir?name=undroid/twv
    Although the server seems currently down.

    See as well here: https://wiki.tcl-lang.org/page/Taygete+Scrap+Book
    Best,
    Detlef
    pd schrieb am Samstag, 28. Oktober 2023 um 21:38:12 UTC+2:
    I just don't want to feed a long off topic so just a comment to finish it up ;-)
    El sábado, 28 de octubre de 2023 a las 16:44:12 UTC+2, Alexandru escribió:
    pd schrieb am Samstag, 28. Oktober 2023 um 13:38:32 UTC+2:

    consider to include help files in the distribution package in order to consult them offline, there're pros and cons both for keeping help online or offline, but it may be quite annoying to have to look for something in help docs while not having
    internet access so you cannot do it.
    Yes, I considered this option already an trust me, I would ask here my questions if offline help would be an option.
    Thirdly: Having offline help files would logically mean that the local files will get outdated. Updating those local help files means online connection so here we are back to the point that an internet connection is needed.
    ...
    Thirdly: Having offline help files would logically mean that the local files will get outdated. Updating those local help files means online connection so here we are back to the point that an internet connection is needed.
    The other points are good ones but this one seems contradictory to me, of course help files will get outdated as well as the software itself, saying it's not appropiate to have help offline because of you need to be online to update it is the same as
    saying it's not appropiate to distribute your software for offline use because of updates, it's better to use it online in a web app or cloud. Even having frequent updates you can consult the help offline it you have the files locally and that is an
    advantage.

    But as I have said there's cons and pros for both strategies so it's a decision to make taking into account the environment and target.

    Yes, I will make a fork of shtml.
    But first I would like to have a working code.
    Currently I'm stuck with finding out, where your code handles the anchors found in the HTML content.
    Because the code expects a local file path in the href tag, it's not correctly interpreting my url path.
    It should be easy to add an if/else there but I couldn't find out where in the code this happens.
    Could you give me a hint for this?

    Much appreciated.
    Alexandru

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From D Groth@21:1/5 to Alexandru on Mon Nov 6 13:18:34 2023
    Sorry, I am busy.
    Check the "open" and tjhe "file exists" for instance commands. That would be the place to look.
    For example in proc render:
    set filename [shtmlview::TrimAnchor $url]
    if [catch {open $filename r} infh] {
    puts stderr "Cannot open $filename: $infh"
    } else {
    set html [read $infh]
    close $infh
    }

    Here you would have to switch to check if it is http, https or local file url and then do the appropriate actions.

    Still I think that using vfs::urltype would be much easier.
    See here for an example. https://wiki.tcl-lang.org/page/One%2Dline+web+browser+in+Tcl

    BTW: This is not my code, I just contributed .

    Best,
    Detlef


    Best,
    Detlef


    Alexandru schrieb am Sonntag, 29. Oktober 2023 um 10:11:17 UTC+1:
    D Groth schrieb am Sonntag, 29. Oktober 2023 um 09:50:04 UTC+1:
    Dear Alex,

    I suggest, that you do a fork of shtml to do so. I have no intension to add new features, just like to fix possible bugs.
    My gut feeling tells me that it might be more appropiate for this topic to use one of many binary extensions which can be used to display web pages.
    The most promising is the Tcl webview wrapper: https://www.androwish.org/home/dir?name=undroid/twv
    Although the server seems currently down.

    See as well here: https://wiki.tcl-lang.org/page/Taygete+Scrap+Book
    Best,
    Detlef
    pd schrieb am Samstag, 28. Oktober 2023 um 21:38:12 UTC+2:
    I just don't want to feed a long off topic so just a comment to finish it up ;-)
    El sábado, 28 de octubre de 2023 a las 16:44:12 UTC+2, Alexandru escribió:
    pd schrieb am Samstag, 28. Oktober 2023 um 13:38:32 UTC+2:

    consider to include help files in the distribution package in order to consult them offline, there're pros and cons both for keeping help online or offline, but it may be quite annoying to have to look for something in help docs while not
    having internet access so you cannot do it.
    Yes, I considered this option already an trust me, I would ask here my questions if offline help would be an option.
    Thirdly: Having offline help files would logically mean that the local files will get outdated. Updating those local help files means online connection so here we are back to the point that an internet connection is needed.
    ...
    Thirdly: Having offline help files would logically mean that the local files will get outdated. Updating those local help files means online connection so here we are back to the point that an internet connection is needed.
    The other points are good ones but this one seems contradictory to me, of course help files will get outdated as well as the software itself, saying it's not appropiate to have help offline because of you need to be online to update it is the same
    as saying it's not appropiate to distribute your software for offline use because of updates, it's better to use it online in a web app or cloud. Even having frequent updates you can consult the help offline it you have the files locally and that is an
    advantage.

    But as I have said there's cons and pros for both strategies so it's a decision to make taking into account the environment and target.
    Yes, I will make a fork of shtml.
    But first I would like to have a working code.
    Currently I'm stuck with finding out, where your code handles the anchors found in the HTML content.
    Because the code expects a local file path in the href tag, it's not correctly interpreting my url path.
    It should be easy to add an if/else there but I couldn't find out where in the code this happens.
    Could you give me a hint for this?

    Much appreciated.
    Alexandru

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From alexandru@21:1/5 to All on Mon Jun 10 19:18:51 2024
    I managed to make it work, finally, after a long pause due to other
    priorities.
    https://github.com/mittelmark/shtmlview/pull/8
    It would be nice to see it merged into the main branch.

    Thanks
    Alexandru

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)