1
$\begingroup$

For various reasons, I'm placing data before and after notebook's source code, by means of a plain text editor, in this way:

(*
Author: An author
Subject: A subject
*)

(* Content-type: application/vnd.wolfram.mathematica *)
...
(* End of internal cache information *)

(* more data *)

Are there conceivable situations in which these data can be lost or damaged, during the normal Mathematica's activity ? If any, can, please, you suggest a safer way to embed the above mentioned data in a notebook, keeping them simple ?

A similar question has been debated in: How to programmatically comment out multiple source files? where reads "As the comments of Szabolcs and acl tell you: read in the file contents as text, put the comment characters before-after the text and save it again as text. Packages are stored as plain text files without any front-end dependent cache information, so this method is robust and foolproof.", but the this time the focus is on notebook, not packages.

What explained in Is there a way to embed a data set in a notebook? seems IMHO not pertinent, just because the minimalistic formattation is inescapably required.

$\endgroup$
  • $\begingroup$ You can use TaggingRules. $\endgroup$ – Kuba Feb 17 '16 at 21:52
  • $\begingroup$ Thanks for yor lightning reply ! I don't trust TaggingRules, at the aim we are talnking about, because it does "something" potentially alterable by Mathematica's code unexpected side effects. Am I missing something ? $\endgroup$ – mitochondrial Feb 17 '16 at 22:04
  • 1
    $\begingroup$ It should be OK. It's essentially the same method that Mathematica's package development template uses to embed meta-date into .m files. $\endgroup$ – m_goldberg Feb 18 '16 at 8:23
  • $\begingroup$ It's no strictly relevant but readers interested in this topic may find useful this: mathematica.stackexchange.com/questions/695/… $\endgroup$ – mitochondrial Feb 25 '16 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.