For my work I need to import the notebook and get all the contents from the code cell. For this task I chose ToString/@NotebookImport[file,"Input"->"HoldExpression"].
"Input"->"HoldExpression"
is very useful combination because it converts all the code into a single view, converting some infix function notations into a single view.
There is one problem: division and exponentiation operations produce incorrect results.
Example below:input notebook code cells content:
Total[m]/na^2/3Flatten@{a}
output strings:
{" Total[m]\\nHoldComplete[--------]\\n \n", " 2\n a\nHoldComplete[--]\n \3", "HoldComplete[Flatten[{a}]]"}
How can I solve this problem while maintaining all functionality?