View Single Post
Old 03-31-2012, 10:20 AM   #3583
Mark Nord
2B || !2B
Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.
 
Posts: 854
Karma: 327896
Join Date: Feb 2010
Location: Austria
Device: Sony PRS505/650/T1/tolino vision 5
Hi Analogus,

easiest would be to utilize the the fact, that JavaScripts accepts both, single and double-quotes.

So while using double-quotes "" to define a string, you can use single-quotes within.

Core.shell.exec("whatever command 'text' whatever command")

Or why not do it with higher-level code

like:
Code:
var mycontent, cssPath;
mycontent = "sometext " + "'some quoted text'" + "some other text";
cssPath = "/Data/database/system/PRSPlus/epub/style.css";
Core.io.setFileContent (cssPath, mycontent);
One can also think of using some templates with placeholders like #fontSize# aso

then

Code:
var mycontent, cssPath, fontSize;
cssPath = "/Data/database/system/PRSPlus/epub/";
mycontent = Core.io.getFileContent(cssPath+"template.css");
fontSize = someOptionValue ? someOptionValue+"%" : someDefaultValue;
mycontent.replace(/#fontSize#/g, fontSize);
...
Core.io.setFileContent (cssPath+"style.css", mycontent);

Last edited by Mark Nord; 03-31-2012 at 03:25 PM. Reason: replaced backslash with slash
Mark Nord is offline   Reply With Quote