• Updated code for DominoWiki (proposed)

    By John Smart/RCS 2 decades ago

    Ben,



    I've changed/added to the DominoWiki code that I'm hoping will get added into the main code stream. Here's what I've done:



    (See attached file: WikiQuerySave Initialize.lss)

    Fixed a bug where the Links field used for back-link indexing didn't remove outdated links.



    (See attached file: WikiPage.class - JSmart updates.lss)

    Performance increase - Added saveNeeded property, used by wikiFormat & updateLinks so that doc is not saved repeatedly (instead of saving once per internal wiki link)



    Changed convertSingleBracket to allow links with "notes:", "mailto:" or "email:"



    Changed allowSafeHTML to allow ul, ol, and li tags



    Changed ParseLineFeeds to remove extra <br> tags near ul, ol, and li tags



    All links are now classed so that they can be individually styled using CSS. (wiki-filelink, wiki-httplink, wiki-httpslink, wiki-mailtolink, wiki-inavlidlink, wiki-pagelink… wiki-newpagelink already existed) This way you can style external links vs internal ones, etc.



    Added read-write public property "document" for use by scripts that might run docs other than session.DocumentContext



    Links to new pages are now the whole link title instead of straight text with a linked question mark at the end. I left the old code there, commented, for others who like the old style, but it's outdated, IMO. Unfortunately the new way is ugly with the old CSS. To do something like wikipedia where new page links are dark red, change the .css from

    .wiki-newpagelink

    {

        background-color:        #ffff00; <br/>
    

    }

    to

    a.wiki-newpagelink / note: the “a” is necessary to give it a high enough priority vs competing rules. /

    {

        color:        #990000; <br/>
    

    }

    and replace mentions of new page links being question marks to new page links being dark red.


    (See attached file: WikiPageCollection.class.lss)

    New script library that extends WikiPage class to accept a NotesDocumentCollection and includes GetFirst, GetNext, GetPrev, GetLast, and a method called RecomputeLinks that clears and rebuilds all existing backlinks.



    (See attached file: My Reset Links agent.lss)

    New agent, meant to be named "Reset Links", Notes only, run on selected documents, simple selection to only include wiki pages. Bascially does:

    Set wpc = New WikiPageCollection(session.CurrentDatabase.UnprocessedDocuments)

    call wpc.RecomputeLinks



    Send an email to me at greyduck.com if you have any questions!

    • Excellent!

      By Benedict R Poole 2 decades ago

      This is very cool John - espcially like the new class, that could be useful for all kinds of things. Many

      thanks!

    • Updates!

      By John Smart/RCS 2 decades ago

      Hi Ben!



      I've updated what I've done. This should replace the previous document




      Better documentation, otherwise the same as previously submitted (See attached file: WikiPageCollection.class.lss)






      Ignore the changes to the WikiQuerySave I mentioned earlier, I changed WikiPage to handle this instead.






      Added a QuerySave to immediately populate backlinks(See attached file: 01. Wiki page - Form.lss)






      Deprecated arrayToString function with the ND6 LotusScript primitive "Join"

      Added isArrayEqv function

      Added updateFieldIfNeeded function



      (See attached file: GeneralFunctions.lss)




      updated tips.html to reflect changes made

      (See attached file: tips.html)




      Links to new pages are now the whole link title instead of straight text with a linked question mark at the end.

      Changed convertSingleBracket to allow links with "notes:", "mailto:" or "email:"

      Changed allowSafeHTML to allow ul, ol, li, dl, dt, dd tags

      Changed ParseLineFeeds to remove extra <br> tags near above tags.

      All links are now classed so that they can be individually styled using CSS.

      (wiki-filelink, wiki-httplink, wiki-httpslink, wiki-mailtolink, wiki-inavlidlink, wiki-pagelink, wiki-newpagelink)

      Added read-write public property "document" for use by scripts that might run docs other than session.DocumentContext (e.g. from Notes-side wiki form's querysave event)

      Improved performance, removed updateLinks method in favor of building an array of adding new "links" string array property , building it in memory, and comparing the against field data at the end of wikiFormat, and only saving if different

      Also added functionality to start tracking missing links (i.e. new page links) as well. (NOTE: At this time, the missing links field on other pages is not yet automatically updated when someone creates a new page.)

      Added saveDisabled property for debugging and for calling wikiFormat from Notes-side wiki form's querysave event

      (See attached file: WikiPage.class.lss)




      For the css, in addition to changing the the wiki-newpagelink class, also add the following:
      dl

      {

      margin: 0ex;<br/>
      

      }



      dt

      {

      font-weight: bold;<br/>
      

      }



      dd

      {

      margin-bottom: 1ex;<br/>
      

      }




      In DominoWiki acitons…\01. Update pages & versions:

      Replace "arraytoString" with LotusScript primitive "Join"

  • Wow

    By Benedict R Poole 2 decades ago

    John, thanks very much, really comprehensive. I will be working on DW in the next few days God-willing,

    and will give all this a look-see. You've addressed quite a few of the things I wanted to look at in either

    1.2 or 1.3, so that's excellent!