• Support for spaces in page titles

    By Julian Woodward 2 decades ago

    A suggestion for a small change to better support spaces in page titles …



    There seems to be some inconsistency in the way spaces are treated, in that the square brackets syntax replaces spaces with underscores, but the rest of the system doesn't. So this suggestion is to always replace spaces with underscores, which involves two small changes:



    a) Changing the createBlankPage JavaScript function as follows:

    function createBlankPage()

    {

    var pg = prompt(&quot;Please provide a title for your page&quot;, &quot;&quot;);<br/>
    


    if((pg==&quot;&quot;) || (pg==null)) <br/>
    {<br/>
        return;<br/>
    }<br/>
    else<br/>
    {<br/>
        pg = pg.replace(//g, &quot;_&quot;);<br/>
        document.location = &quot;/dev/testwiki.nsf/wiki?openform&amp;page=&quot; + pg;<br/>
    }<br/>
    

    }

    (The new line is the pg = … line)



    b) in the Web\Page header subform, making the computed title strip out underscores and replace them with spaces e.g.

    @ReplaceSubstring(Subject; "_"; " ")



    This way, internally underscores are always used, but the user never actually has to enter them, and never actually sees them either. So they can create a page as "my test page", and link to it using double brackets of [[my test page]], and it all 'just works'.



    For completeness, the href links in the web-facing views could also be updated to replace the underscores with spaces too.

    • Thanks Julian!

      By Benedict R Poole 2 decades ago

      As discussed in our mails, I think this is a good approach to the issue, and will look into integrating this in 1.1.



      I always like feature requests WITH CODE :o)

      • category view has still underscores in subjects

        By Markus Koller 2 decades ago

        could you please also add the @ReplaceSubstring(Subject; "_"; " ") code to the category listing views? For example "Web\Pages by category"