[TW5] How does TW if a tiddler file is bad formatted?

73 views
Skip to first unread message

Danielo Rodríguez

unread,
Sep 29, 2015, 6:46:44 PM9/29/15
to TiddlyWikiDev
Hello,

I am wondering how the hell does tiddliwiki know that a .tid file is not correctly formatted.
I have a tiddler, which does not have the correct tiddler format, but if I throw it's contents to the $tw.wiki.deserializeTiddlers function it parses it someway. Why? How can I make sure that the tiddlers imported using the deserializer are correctly formatted?

Many thanks

Tobias Beer

unread,
Sep 30, 2015, 4:42:20 AM9/30/15
to tiddly...@googlegroups.com
Hi Danielo,
 
How can I make sure that the tiddlers imported using the deserializer are correctly formatted?

By adhering to its simple rules.

While parsing the fields-section,
a basic sanity check may be good,
e.g. "invalid field-name on line x"...
whereas omitting a newline
between the fields and the tiddler text
throws this error, too.

Best wishes,

— tb 

Danielo Rodríguez

unread,
Sep 30, 2015, 2:07:26 PM9/30/15
to TiddlyWikiDev
By adhering to its simple rules.

While parsing the fields-section,
a basic sanity check may be good,
e.g. "invalid field-name on line x"...
whereas omitting a newline
between the fields and the tiddler text
throws this error, too.

Hello Tobias. My question was more focused about if there is a mechanism implemented already rather than asking for guidelines. Basically I wanted to avoid building something that exists already (if it does). But your "answer" is also correct and valid, so thank you. 

Tobias Beer

unread,
Sep 30, 2015, 2:58:35 PM9/30/15
to tiddly...@googlegroups.com
Hi Danielo,
 
Hello Tobias. My question was more focused about if there is a mechanism implemented already rather than asking for guidelines. Basically I wanted to avoid building something that exists already (if it does). But your "answer" is also correct and valid, so thank you.

Was just a mental exercise as to what constitutes an invalid tid format and so that was the only thing I could imagine.
I'd guess, If you didn't get such an error, it's possibly because it isn't implemented.
But then maybe there is something purely on the node.js side of things already, don't know.

Best wishes,

— tb

PMario

unread,
Sep 30, 2015, 4:19:43 PM9/30/15
to tiddly...@googlegroups.com
On Wednesday, September 30, 2015 at 12:46:44 AM UTC+2, Danielo Rodríguez wrote:
I am wondering how the hell does tiddliwiki know that a .tid file is not correctly formatted.
I have a tiddler, which does not have the correct tiddler format, but if I throw it's contents to the $tw.wiki.deserializeTiddlers function it parses it someway. Why? How can I make sure that the tiddlers imported using the deserializer are correctly formatted?

IMO there is no built in implementation, since there is no formal description of a valid .tid file atm.

The minimal requirement for a .tid file imo is:

 - there must be a title field.

The rest is in the open. .. eg:

 - field names must be all lower case without spaces. ... There is no written rule. It just doesn't work if you do it wrong or there will be weird errors.
 - field content has to be a single line.
 ...
and several more. But they are not formalized at the moment. eg: allowed characters for field names ...

-m

Tobias Beer

unread,
Sep 30, 2015, 4:49:44 PM9/30/15
to tiddly...@googlegroups.com
Hi Mario,
 
 - there must be a title field

Yes, that should definitely throw an error.

So, in terms of errors that need throwing upon .tid field validation, there are...
    • invalid field-name on line x
      • entails "field definitions need to be on a single line"
      • also covers "tiddler text needs to be separated by a newline from field definitions"
    • missing "title" field
    and maybe also...
    • invalid date format for created / modified field
      • having to be either YYYY0MM0DD or YYY0MM0DD0hh0mm0ss (,or ?!?)
    Anyone see any other formal errors that a validator might throw?
      Best wishes,

      — tb

      Jeremy Ruston

      unread,
      Oct 4, 2015, 5:50:02 PM10/4/15
      to tiddly...@googlegroups.com
      Hi Danielo

      At the moment, the philosophy of the various tiddler deserialisers, including the one for .tid files, is to ignore errors. Have a look at the code involved:


      If we really wanted to raise errors, then we’d have to take care to catch those errors and do something useful with them in each of the situations in which deserialisers are used.

      Best wishes

      Jeremy.



      --
      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 tiddlywikide...@googlegroups.com.
      To post to this group, send email to tiddly...@googlegroups.com.
      Visit this group at http://groups.google.com/group/tiddlywikidev.
      To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/386933f1-6f5a-4b9c-aa82-f8d66fb280e9%40googlegroups.com.
      For more options, visit https://groups.google.com/d/optout.

      yahoo

      unread,
      Oct 4, 2015, 8:20:46 PM10/4/15
      to Jeremy Ruston


      Sent from my BlackBerry 10 smartphone on the Verizon Wireless 4G LTE network.
      From: Jeremy Ruston
      Sent: Sunday, October 4, 2015 3:50 PM
      Subject: Re: [twdev] [TW5] How does TW if a tiddler file is bad formatted?

      Reply all
      Reply to author
      Forward
      0 new messages