How can I use NotebookImport for grabbing "ExampleSection" cells?
nb = NotebookOpen["paclet:ref/RandomPrime"];
NotebookImport[nb, "ExampleSection"->"Text"]
(* {} *)
How can I use NotebookImport for grabbing "ExampleSection" cells?
nb = NotebookOpen["paclet:ref/RandomPrime"];
NotebookImport[nb, "ExampleSection"->"Text"]
(* {} *)
Because of reasons those cells have multiple styles, or rather a duplicated style:
NotebookImport has issues with such cells: NotebookImport ignoring multiple style cells
So you can import them with:
NotebookImport[nb, {"ExampleSection", "ExampleSection"} -> "Text"]
But it contains string representation of boxes with the cell opener etc.
You can play around with NotebookImport but this seems to do the job:
(
NotebookRead /@ Cells[nb, CellStyle -> "ExampleSection"]
)[[
All, (*every cell*)
1, (*TextData*)
1, (*TextData arg is list*)
3 (*our string is after the opener and a spacer*)
]]
{"Basic Examples", "Scope", "Applications", "Properties & Relations", "Possible Issues"}
Though I did not test it on every page.