diff --git a/org/document.go b/org/document.go index 7357fda..8dba04f 100644 --- a/org/document.go +++ b/org/document.go @@ -241,7 +241,7 @@ func (d *Document) parseOne(i int, stop stopFn) (consumed int, node Node) { if consumed != 0 { return consumed, node } - d.Log.Printf("Could not parse token %#v: Falling back to treating it as plain text.", d.tokens[i]) + d.Log.Printf("Could not parse token %#v in file %s: Falling back to treating it as plain text.", d.tokens[i], d.Path) m := plainTextRegexp.FindStringSubmatch(d.tokens[i].matches[0]) d.tokens[i] = token{"text", len(m[1]), m[2], m} return d.parseOne(i, stop) diff --git a/org/html_writer.go b/org/html_writer.go index a12d4bf..ca9ffb2 100644 --- a/org/html_writer.go +++ b/org/html_writer.go @@ -152,6 +152,10 @@ func (w *HTMLWriter) WriteBlock(b Block) { if params[":exports"] == "results" || params[":exports"] == "none" { break } + if params[":noweb"] == "strip-export" { + stripNoweb := regexp.MustCompile(`<<[^>]+>>`) + content = stripNoweb.ReplaceAllString(content, "") + } lang := "text" if len(b.Parameters) >= 1 { lang = strings.ToLower(b.Parameters[0]) diff --git a/org/org_writer_test.go b/org/org_writer_test.go index 539ef8c..14f5834 100644 --- a/org/org_writer_test.go +++ b/org/org_writer_test.go @@ -45,7 +45,7 @@ func testWriter(t *testing.T, newWriter func() Writer, ext string) { if err != nil { t.Fatalf("%s\n got error: %s", path, err) } else if actual != expected { - t.Fatalf("%s:\n%s'", path, "") + t.Fatalf("%s:\n%s'", path, diff(actual, expected)) } }) } diff --git a/org/testdata/blocks.html b/org/testdata/blocks.html index e55c978..3febfdd 100644 --- a/org/testdata/blocks.html +++ b/org/testdata/blocks.html @@ -195,3 +195,10 @@ Snow covers Emacs

+
+
+
+describe <a b c>;
+
+
+
diff --git a/org/testdata/blocks.org b/org/testdata/blocks.org index d9ff6e5..ad0cbfa 100644 --- a/org/testdata/blocks.org +++ b/org/testdata/blocks.org @@ -176,3 +176,7 @@ this unindented line is outside of the list item ---AlexSchroeder #+END_VERSE + +#+BEGIN_SRC raku :results output :noweb strip-export :exports both +<>describe ; +#+END_SRC diff --git a/org/testdata/blocks.pretty_org b/org/testdata/blocks.pretty_org index 4ae5b0c..e0719ae 100644 --- a/org/testdata/blocks.pretty_org +++ b/org/testdata/blocks.pretty_org @@ -176,3 +176,7 @@ this unindented line is outside of the list item ---AlexSchroeder #+END_VERSE + +#+BEGIN_SRC raku :results output :noweb strip-export :exports both +<>describe ; +#+END_SRC