Ok, if state-2-css is only one line it works as expected.

\define state-2-css()
@media (min-width: 770px) { .story-river { margin: 0 auto; }
.sidebar-header { left: 50%; right: 0; padding-left: 413px; } }
\end

--Arlen


On Wed, Mar 19, 2014 at 5:16 PM, Arlen Beiler <[email protected]> wrote:

> Hi everyone,
> Where does this newline character come from? I get an error when I try to
> parse a JSON string containing a string defined in a multiline macro. It's
> that character that appears after "770px) {".
> Thanks --Arlen
>
> '{ "text": "@media (min-width: 770px) {↵ .story-river { margin: 0 auto; }↵
> .sidebar-header { left: 50%; right: 0; padding-left: 413px; } ↵}" , "tags":
> "$:/tags/stylesheet" }'
>
> Comes from:
>
> \define createStateTiddler()
> { "text": "$(default)$" , "tags": "$:/tags/stylesheet" }
> \end
>
> \define state-2-css()
> @media (min-width: 770px) {
>  .story-river { margin: 0 auto; }
>  .sidebar-header { left: 50%; right: 0; padding-left: 413px; }
> }
> \end
> <$set name="default" value=<<state-2-css>> >
> <$fieldmangler tiddler="$:/temp/toggle-centered"
> create=<<createStateTiddler>>>
> ...
>
> In fieldmangler.js:execute()
>
>
> this.mangleTitle = ... ;
> this.createText  = this.getAttribute("create",false);
> if(typeof(this.createText) === "string") {  try{ this.createText = 
> JSON.parse(this.createText); }  catch (e) { console.error(e); } //message: 
> "Unexpected token ↵"
> }
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to