Demo new lang script for test

49 views
Skip to first unread message

Greg Griffiths

unread,
Mar 29, 2017, 4:59:55 PM3/29/17
to js-code-prettifier
I'm trying to check that I have my new lang setup correctly, but when I run it in a demo file, its not highlighting, is there a way to do this without building the entire project ?

<html>
    <head>
        <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?lang=css&lang=oscript"></script>
        <script src="https://rawgit.com/google/code-prettify/master/src/lang-css.js"></script>
        <script src="lang-oscript.js"></script>
    </head>
    <body onload="PR.prettyPrint()">
        <pre class="prettyprint lang-html lang-oscript linenums">
            // declare a cache id - in real life we would have this from somewhere else
            Integer cacheID=1234
            // load the data from the cache to begin with into the Assoc
            Assoc myDataFromCache = $LLIAPI.CacheUtil.Load (prgCtx,cacheID).ObjectValue

            // update the values
            myDataFromCache.newValue="abc"

            // Save the updated Assoc back to the cache
            Assoc updateCacheResult=$LLIApi.CacheUtil.Update(prgCtx, cacheID, myDataFromCache )

            // if the cache update failed
            if (!updateCacheResult.OK)
            &nbsp;&nbsp;&nbsp;&nbsp;// write out to the log the value of errMsg if provided, otherwise apiError if provided, otherwise a default error message
            &nbsp;&nbsp;&nbsp;&nbsp;(isDefined(updateCacheResult.errMsg))
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo(updateCacheResult.errMsg)
            &nbsp;&nbsp;&nbsp;&nbsp;elseif ((isDefined(updateCacheResult.apiError)))
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo(updateCacheResult.apiError)
            &nbsp;&nbsp;&nbsp;&nbsp;else
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo("error deleting cache"))
            &nbsp;&nbsp;&nbsp;&nbsp;end
            end

            &lt;!doctype html&gt;
            &lt;html&gt;
            &lt;head&gt;
            &lt;title&gt;HTML Test&lt;/title&gt;
        </pre>
    </body>
</html>

Mike Samuel

unread,
Mar 29, 2017, 6:01:33 PM3/29/17
to js-code-prettifier


On Mar 29, 2017 4:59 PM, "Greg Griffiths" <goo...@greggriffiths.org> wrote:
I'm trying to check that I have my new lang setup correctly, but when I run it in a demo file, its not highlighting, is there a way to do this without building the entire project ?

<html>
    <head>
        <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?lang=css&lang=oscript"></script>
        <script src="https://rawgit.com/google/code-prettify/master/src/lang-css.js"></script>
        <script src="lang-oscript.js"></script>
    </head>
    <body onload="PR.prettyPrint()">
        <pre class="prettyprint lang-html lang-oscript linenums">

Why are there two lang- classes here?  Could it be ignoring your oscript hint?

--
You received this message because you are subscribed to the Google Groups "js-code-prettifier" group.
To unsubscribe from this group and stop receiving emails from it, send an email to js-code-prettifier+unsub...@googlegroups.com.
To post to this group, send email to js-code-prettifier@googlegroups.com.
Visit this group at https://groups.google.com/group/js-code-prettifier.
For more options, visit https://groups.google.com/d/optout.

Amro

unread,
Mar 30, 2017, 1:05:41 PM3/30/17
to js-code-prettifier
Some remarks:
- the autoloader run_prettify.js only works for the provided languages, it won't find your custom language handler "?lang=oscript"
- If you're manually loading JS/CSS scripts and calling PR.prettyPrint(), don't use the autoloader, load prettify.js instead and any other lang-*.js wanted
- as Mike mentioned, you can only set one language hint: <pre class="prettyprint lang-oscript">

Mike Samuel

unread,
Mar 30, 2017, 1:06:28 PM3/30/17
to js-code-prettifier
On Thu, Mar 30, 2017 at 12:55 PM, Amro <amroam...@gmail.com> wrote:
> Some remarks:
> - the autoloader run_prettify.js only works for the provided languages, it
> won't find your custom language handler "?lang=oscript"

Quite right.
> --
> You received this message because you are subscribed to the Google Groups
> "js-code-prettifier" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to js-code-prettif...@googlegroups.com.
> To post to this group, send email to js-code-p...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages