Discussion Board

Results 1 to 5 of 5

Thread: cshlp/rtf

  1. #1
    Registered User davidmaxwaterman's Avatar
    Join Date
    Sep 2006
    Location
    Beijing, China
    Posts
    386
    Hi,

    I need to preprocess my help files. They're currently done as rtf, which I think is standard practice. Unfortunately, the rtf format seems to be somewhat difficult to preprocess.

    I'd like to put in macros such as 'VERSION' and 'APPNAME'.

    I could do this if it were html, so I'm wondering if I can have my help files as html instead of rtf.

    Wouldn't html be better anyway? rtf seems like a curious choice of format (better than doc, I suppose).

    Max.

  2. #2
    Registered User davidmaxwaterman's Avatar
    Join Date
    Sep 2006
    Location
    Beijing, China
    Posts
    386
    does no one have any suggestions?

    does everyone just end up editing the files manually in the several places that need editing to change the number? it seems like a nightmare to maintain with all the different places that need changing.

    any pearls of wisdom?

    Max.

  3. #3
    Super Contributor Paul.Todd's Avatar
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644
    The easiest is to ditch the rtf format and use xml - well that is what I have done. The RTF format it too error prone

    http://www3.symbian.com/faq.nsf/AllB...B?OpenDocument

  4. #4
    Registered User davidmaxwaterman's Avatar
    Join Date
    Sep 2006
    Location
    Beijing, China
    Posts
    386
    Quote Originally Posted by Paul.Todd
    The easiest is to ditch the rtf format and use xml - well that is what I have done. The RTF format it too error prone

    http://www3.symbian.com/faq.nsf/AllB...B?OpenDocument
    Wow! Great tip. That's just what I'm after. IMO they should use html/css anyway, but XML is just as easy to preprocess, I suppose :D

    However, how do I edit an xml file. Regular ASCII is easy enough, but what about Chinese characters and such, which appear as :

    Code:
    & # 25773 ;
    (spaces added, since otherwise this tool actually converts it into the correct character :) )

    If I open the file with Firefox, I get an error :

    Code:
    XML Parsing Error: not well-formed
    Location: file:///C:/....asptml.xml
    Line Number 3, Column 6:<?xml:stylesheet href="file:///C:/Symbian/8.0a/S60_2nd_FP2/epoc32/tools/cshlpcmp/xsl/asptml.xsl" title="asptml" type="text/xsl"?>
    -----^
    (it actually points to the ':' in 'xml:stylesheet')

    I can open it with something called 'XML Editor' but it just opens MS Internet Explorer to display the file - which is useful enough, since the characters are actually rendered correctly.

    How should one edit an XML file? I don't care about the formating, since that doesn't carry over to the phone anyway, but being able to enter and edit characters in non-hex is important ;)

    Max.

    BTW, I see in the article :

    "...but no fix is available at time of writing"

    I find that just editing the rtf manually to remove '{...013f...}' makes MS Word 2003 rtf files compile correctly. Maybe that'll help someone...

  5. #5
    Registered User davidmaxwaterman's Avatar
    Join Date
    Sep 2006
    Location
    Beijing, China
    Posts
    386
    I've managed to convert the escaped Chinese characters into unescaped ones using this script (in case it helps anyone else) :

    Code:
    #! /c/Perl/bin/perl
    
    use utf8;
    use CGI;
    
    @lines = <>;
    
    $all = join( '', @lines );
    
    while ( $all =~ /(&#[^;]+;)/s )
    {
            my $this = $1;
            my $new;
            #if ( $this =~ /&ndash;/ )
            #{
            #$new = chr( 8211 );
            #}
            #elsif ( $this =~ /&break;/ )
            #{
            #$new = "<br/>";
            #}
            #elsif ( $this =~ /&tab;/ )
            #{
            #$new = "\t";
            #}
            #else
            {
                    $new = CGI::unescapeHTML( $this );
            }
    
            $all =~ s/$this/$new/s;
    }
    
    print $all;
    As you can tell, I've been having trouble with a few of the tags, but at least the Chinese text is readable.

    It'd still be great if there were a wysiwyg editor...OpenOffice is supposed to be able to edit this stuff, but it just looks like plain text to me.

    In the manual, I notice this :

    Code:
    Check the XML proofing copy on a web browser. The style-sheet /epoc32/tools/cshlpcmp/xsl/csptml.xsl allows the output to be viewed as though produced using the default customisation options.
    It isn't very explicit on how I should use this csptml.xsl file, in order to view it in a browser. How exactly should it be used and how does it help me?

    Max.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved