From 5c7bfc04dc3d2cd60e84c80229804fdcd615709e Mon Sep 17 00:00:00 2001 From: Shulhan Date: Mon, 21 Nov 2022 01:20:03 +0700 Subject: all: implement inline macro for passthrough ("pass:") The inline passthrough "pass:" can be used to control the substitutions applied to a run of text. Ref: https://docs.asciidoctor.org/asciidoc/latest/pass/pass-macro/ --- testdata/inline_parser/macro_pass_a_test.txt | 13 ++++++++++ testdata/inline_parser/macro_pass_c_test.txt | 16 +++++++++++++ testdata/inline_parser/macro_pass_m_test.txt | 32 +++++++++++++++++++++++++ testdata/inline_parser/macro_pass_none_test.txt | 29 ++++++++++++++++++++++ testdata/inline_parser/macro_pass_q_test.txt | 15 ++++++++++++ testdata/inline_parser/macro_pass_r_test.txt | 18 ++++++++++++++ 6 files changed, 123 insertions(+) create mode 100644 testdata/inline_parser/macro_pass_a_test.txt create mode 100644 testdata/inline_parser/macro_pass_c_test.txt create mode 100644 testdata/inline_parser/macro_pass_m_test.txt create mode 100644 testdata/inline_parser/macro_pass_none_test.txt create mode 100644 testdata/inline_parser/macro_pass_q_test.txt create mode 100644 testdata/inline_parser/macro_pass_r_test.txt (limited to 'testdata/inline_parser') diff --git a/testdata/inline_parser/macro_pass_a_test.txt b/testdata/inline_parser/macro_pass_a_test.txt new file mode 100644 index 0000000..3c4dd8c --- /dev/null +++ b/testdata/inline_parser/macro_pass_a_test.txt @@ -0,0 +1,13 @@ +Test macro pass with attribute substitutions only. + +>>> pass_a.adoc +:meta-a: meta A +:meta-b: meta B + +pass:a[attributes: {meta-A}, {meta-b}, and {meta-not_exist}]. + +<<< pass_a.html + +
+

attributes: meta A, meta B, and {meta-not_exist}.

+
diff --git a/testdata/inline_parser/macro_pass_c_test.txt b/testdata/inline_parser/macro_pass_c_test.txt new file mode 100644 index 0000000..c5682fe --- /dev/null +++ b/testdata/inline_parser/macro_pass_c_test.txt @@ -0,0 +1,16 @@ +Test macro pass with special character substitutions only. + +>>> pass_c.adoc + +pass:c[char: < > &]. + +pass:c[replacement: (C) (R) (TM) -- ... -> => <- <= user's input]. + +<<< pass_c.html + +
+

char: < > &.

+
+
+

replacement: (C) (R) (TM) -- ... -> => <- <= user's input.

+
diff --git a/testdata/inline_parser/macro_pass_m_test.txt b/testdata/inline_parser/macro_pass_m_test.txt new file mode 100644 index 0000000..248680e --- /dev/null +++ b/testdata/inline_parser/macro_pass_m_test.txt @@ -0,0 +1,32 @@ +Test macro pass with macro only. + +>>> pass_m.adoc + +pass:m[Text with footnote:id[footnote]]. + +pass:m[Text with http://127.0.0.1[HTTP URL]]. + +pass:m[Text with image:test.jpg[image]]. + +pass:m[Text with pass:[_none_] and pass:c[<_char_>]]. + +<<< pass_m.html + +
+

Text with [1].

+
+
+

Text with HTTP URL.

+
+
+

Text with image.

+
+
+

Text with pass:[_none_] and pass:c[<_char_>].

+
+
+
+
+1. footnote +
+
diff --git a/testdata/inline_parser/macro_pass_none_test.txt b/testdata/inline_parser/macro_pass_none_test.txt new file mode 100644 index 0000000..e4c1013 --- /dev/null +++ b/testdata/inline_parser/macro_pass_none_test.txt @@ -0,0 +1,29 @@ + +>>> pass_none.adoc + +pass:[char: < > &]. + +pass:[quote: _emphasis_, *strong*], +pass:[`monospace`, ^superscript^, ~subscript~], +pass:["`double curved quotes`", and '`single curved quotes`']. + +pass:[attributes: {meta-A}, {meta-b}, and {meta-not_exist}]. + +pass:[replacement: (C) (R) (TM) -- ... -> => <- <= user's input]. + +<<< pass_none.html + +
+

char: < > &.

+
+
+

quote: _emphasis_, *strong*, +`monospace`, ^superscript^, ~subscript~, +"`double curved quotes`", and '`single curved quotes`'.

+
+
+

attributes: {meta-A}, {meta-b}, and {meta-not_exist}.

+
+
+

replacement: (C) (R) (TM) -- ... -> => <- <= user's input.

+
diff --git a/testdata/inline_parser/macro_pass_q_test.txt b/testdata/inline_parser/macro_pass_q_test.txt new file mode 100644 index 0000000..067ce43 --- /dev/null +++ b/testdata/inline_parser/macro_pass_q_test.txt @@ -0,0 +1,15 @@ +Test macro pass with inline markup substitutions only. + +>>> pass_q.adoc + +pass:q[quote: _emphasis_, *strong*], +pass:q[`monospace`, ^superscript^, ~subscript~], +pass:q["`double curved quotes`", and '`single curved quotes`']. + +<<< pass_q.html + +
+

quote: emphasis, strong, +monospace, superscript, subscript, +“double curved quotes”, and ‘single curved quotes’.

+
diff --git a/testdata/inline_parser/macro_pass_r_test.txt b/testdata/inline_parser/macro_pass_r_test.txt new file mode 100644 index 0000000..e777b73 --- /dev/null +++ b/testdata/inline_parser/macro_pass_r_test.txt @@ -0,0 +1,18 @@ +Test macro pass with special replacements only. + +>>> pass_r.adoc + +pass:r[char: < > &]. + +pass:r[replacement: (C) (R) (TM) -- ...] +pass:r[-> => <- <= user's input]. + +<<< pass_r.html + +
+

char: < > &.

+
+
+

replacement: © ® ™ — … +→ ⇒ ← ⇐ user’s input.

+
-- cgit v1.3