From 2ea3a2fce2e3aa7d2f2d36db893ce88220948d30 Mon Sep 17 00:00:00 2001 From: openorclose Date: Fri, 21 Feb 2020 15:09:45 +0800 Subject: [PATCH 1/5] Render plugins on dynamic resources --- docs/demo.puml | 10 ++++++++++ docs/includepuml.md | 1 + docs/index.md | 22 ++++++++++++++++++++++ src/Page.js | 4 ++++ 4 files changed, 37 insertions(+) create mode 100644 docs/demo.puml create mode 100644 docs/includepuml.md diff --git a/docs/demo.puml b/docs/demo.puml new file mode 100644 index 0000000000..b2320371ec --- /dev/null +++ b/docs/demo.puml @@ -0,0 +1,10 @@ +@startuml +alice -> bob ++ : hello +bob -> bob ++ : self call +bob -> bib ++ #005500 : hello +bob -> george ** : create +return done +return rc +bob -> george !! : delete +return success +@enduml \ No newline at end of file diff --git a/docs/includepuml.md b/docs/includepuml.md new file mode 100644 index 0000000000..a68f9b0d68 --- /dev/null +++ b/docs/includepuml.md @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 31a2b0b05a..5a087435b3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,6 +8,28 @@

**MarkBind**

+PLUGIN DEMO + +```html + +``` +Output below: + + + +Output above^ + +```html + +``` +Output below: + + + +Output above^ + +END PLUGIN DEMO + **Generate _more dynamic_ websites from Markdown text.** diff --git a/src/Page.js b/src/Page.js index 7dc91c9a70..9fae93b5de 100644 --- a/src/Page.js +++ b/src/Page.js @@ -1035,6 +1035,8 @@ class Page { cwf: file, }) .then(result => Page.removeFrontMatter(result)) + .then(result => this.collectPluginSources(result)) + .then(result => this.preRender(result)) .then(result => markbinder.resolveBaseUrl(result, { baseUrlMap: this.baseUrlMap, rootPath: this.rootPath, @@ -1047,6 +1049,8 @@ class Page { rootPath: this.rootPath, headerIdMap: {}, })) + .then(result => this.postRender(result)) + .then(result => this.collectPluginsAssets(result)) .then(result => markbinder.processDynamicResources(file, result)) .then((result) => { // resolve the site base url here From ea048e25e068360aead422a8076090d63e92215f Mon Sep 17 00:00:00 2001 From: openorclose Date: Wed, 26 Feb 2020 21:48:21 +0800 Subject: [PATCH 2/5] Update and add tests --- .../requirements/SpecifyingRequirements._include_.html | 6 +++--- .../expected/requirements/notInside._include_.html | 2 +- test/functional/test_site/expected/siteData.json | 9 +++++++++ .../test_site/expected/sub_site/index._include_.html | 2 +- .../expected/testImportVariables._include_.html | 4 ++-- .../expected/testPanels/NestedPanel._include_.html | 2 +- .../testPanels/NormalPanelContent._include_.html | 2 +- .../expected/testPanels/PanelNormalSource._include_.html | 2 +- .../testPanels/PanelSourceContainsSegment._include_.html | 4 ++-- .../expected/testPanels/boilerTestPanel._include_.html | 2 +- .../expected/testPanels/notInside._include_.html | 2 +- test/functional/test_site/needsrenderedplugin.md | 1 + test/functional/test_site/site.json | 4 ++++ test/functional/test_site/testIncludePluginsRendered.md | 7 +++++++ 14 files changed, 35 insertions(+), 14 deletions(-) create mode 100644 test/functional/test_site/needsrenderedplugin.md create mode 100644 test/functional/test_site/testIncludePluginsRendered.md diff --git a/test/functional/test_site/expected/requirements/SpecifyingRequirements._include_.html b/test/functional/test_site/expected/requirements/SpecifyingRequirements._include_.html index f09190e433..352bb5ca51 100644 --- a/test/functional/test_site/expected/requirements/SpecifyingRequirements._include_.html +++ b/test/functional/test_site/expected/requirements/SpecifyingRequirements._include_.html @@ -1,13 +1,13 @@ -

Specifying requirements

+

Specifying requirements

As we establish requirements, they should be recorded in some way for future reference, usually called a requirement specification. Furthermore, it is advisable to show these requirements to stakeholders, and refine requirements based on their feedback. The next phase is to convert requirements into a product specification that specifies how the product will address the requirements.

Given next are some tools and techniques that can be used to specify requirements. Note that they can also be used for establishing requirements too.

-

Textual descriptions (unstructured prose)

+

Textual descriptions (unstructured prose)

This is the most straight forward way of describing requirements. A textual description can be used to give a quick overview of the domain/system that is understandable to both the users and the development team. Textual descriptions are especially useful when describing the vision of a product. However, lengthy textual descriptions are hard to follow.

-

Feature list

+

Feature list

It is a list of features (or functionalities) grouped according to some criteria such as priority (e.g. must-have, nice-to-have, etc. ), order of delivery, object or process related (e.g. order-related, invoice-related, etc.). Here is a sample feature list from Minesweeper (only a brief description has been provided to save space).

    diff --git a/test/functional/test_site/expected/requirements/notInside._include_.html b/test/functional/test_site/expected/requirements/notInside._include_.html index 3f9e278036..497ba31377 100644 --- a/test/functional/test_site/expected/requirements/notInside._include_.html +++ b/test/functional/test_site/expected/requirements/notInside._include_.html @@ -1,4 +1,4 @@ -

    Path within the boilerplate folder is separately specified

    +

    Path within the boilerplate folder is separately specified

    This is dynamically included.

    Like static include, pages within the site should be able to use files located in folders within boilerplate.

    Also, the boilerplate file name (e.g. inside.md) and the file that it is supposed to act as (notInside.md) can be different.

    diff --git a/test/functional/test_site/expected/siteData.json b/test/functional/test_site/expected/siteData.json index fe78f78d93..f701445b80 100644 --- a/test/functional/test_site/expected/siteData.json +++ b/test/functional/test_site/expected/siteData.json @@ -257,6 +257,15 @@ "globalAndFrontMatterOverrideProperty": "Overridden by global override", "headings": {}, "headingKeywords": {} + }, + { + "src": "testIncludePluginsRendered.md", + "title": "Included files should have plugins rendered on them", + "layout": "default", + "globalOverrideProperty": "Overridden by global override", + "globalAndFrontMatterOverrideProperty": "Overridden by global override", + "headings": {}, + "headingKeywords": {} } ] } diff --git a/test/functional/test_site/expected/sub_site/index._include_.html b/test/functional/test_site/expected/sub_site/index._include_.html index 4f089ec675..da17da8813 100644 --- a/test/functional/test_site/expected/sub_site/index._include_.html +++ b/test/functional/test_site/expected/sub_site/index._include_.html @@ -1,5 +1,5 @@

    This is a page from another Markbind site.

    -

    Feature list

    +

    Feature list

    It is a list of features (or functionalities) grouped according to some criteria such as priority (e.g. must-have, nice-to-have, etc. ), order of delivery, object or process related (e.g. order-related, invoice-related, etc.). Here is a sample feature list from Minesweeper (only a brief description has been provided to save space).

      diff --git a/test/functional/test_site/expected/testImportVariables._include_.html b/test/functional/test_site/expected/testImportVariables._include_.html index 3b8cff9686..49f93149f8 100644 --- a/test/functional/test_site/expected/testImportVariables._include_.html +++ b/test/functional/test_site/expected/testImportVariables._include_.html @@ -3,11 +3,11 @@

      Test import variables from src specified via variable: This variable comes from variablesToImport.md

      Test import variables that itself imports other variables:

      -

      Trying to access a page variable:

      +

      Trying to access a page variable:

      There should be something red below:

      This is a page variable from variablestoimport.md
      Something should have appeared above in red. -

      Trying to access an imported variable via namespace:

      +

      Trying to access an imported variable via namespace:

      There should be something blue below:

      This is a deeply imported variable
      Something should have appeared above in blue. \ No newline at end of file diff --git a/test/functional/test_site/expected/testPanels/NestedPanel._include_.html b/test/functional/test_site/expected/testPanels/NestedPanel._include_.html index a4b5b4139a..abd9590c4c 100644 --- a/test/functional/test_site/expected/testPanels/NestedPanel._include_.html +++ b/test/functional/test_site/expected/testPanels/NestedPanel._include_.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/test/functional/test_site/expected/testPanels/NormalPanelContent._include_.html b/test/functional/test_site/expected/testPanels/NormalPanelContent._include_.html index 4da1693276..a82ad044a5 100644 --- a/test/functional/test_site/expected/testPanels/NormalPanelContent._include_.html +++ b/test/functional/test_site/expected/testPanels/NormalPanelContent._include_.html @@ -1 +1 @@ -

      Normal panel content heading

      \ No newline at end of file +

      Normal panel content heading

      \ No newline at end of file diff --git a/test/functional/test_site/expected/testPanels/PanelNormalSource._include_.html b/test/functional/test_site/expected/testPanels/PanelNormalSource._include_.html index fcce7c140a..e80b7a53c8 100644 --- a/test/functional/test_site/expected/testPanels/PanelNormalSource._include_.html +++ b/test/functional/test_site/expected/testPanels/PanelNormalSource._include_.html @@ -1 +1 @@ -

      Panel normal source content headings

      \ No newline at end of file +

      Panel normal source content headings

      \ No newline at end of file diff --git a/test/functional/test_site/expected/testPanels/PanelSourceContainsSegment._include_.html b/test/functional/test_site/expected/testPanels/PanelSourceContainsSegment._include_.html index ebc62d08a9..3f76bbdf60 100644 --- a/test/functional/test_site/expected/testPanels/PanelSourceContainsSegment._include_.html +++ b/test/functional/test_site/expected/testPanels/PanelSourceContainsSegment._include_.html @@ -1,4 +1,4 @@
      -

      Panel source segment content headings

      +

      Panel source segment content headings

      -

      This heading is not src of any panel, so it should not be in the search data

      \ No newline at end of file +

      This heading is not src of any panel, so it should not be in the search data

      \ No newline at end of file diff --git a/test/functional/test_site/expected/testPanels/boilerTestPanel._include_.html b/test/functional/test_site/expected/testPanels/boilerTestPanel._include_.html index 34701a2b3b..cd49919927 100644 --- a/test/functional/test_site/expected/testPanels/boilerTestPanel._include_.html +++ b/test/functional/test_site/expected/testPanels/boilerTestPanel._include_.html @@ -1 +1 @@ -

      boilerplate test for panel heading

      \ No newline at end of file +

      boilerplate test for panel heading

      \ No newline at end of file diff --git a/test/functional/test_site/expected/testPanels/notInside._include_.html b/test/functional/test_site/expected/testPanels/notInside._include_.html index 6756ecc64d..bacd089bd9 100644 --- a/test/functional/test_site/expected/testPanels/notInside._include_.html +++ b/test/functional/test_site/expected/testPanels/notInside._include_.html @@ -1 +1 @@ -

      heading in panel boilerplate

      \ No newline at end of file +

      heading in panel boilerplate

      \ No newline at end of file diff --git a/test/functional/test_site/needsrenderedplugin.md b/test/functional/test_site/needsrenderedplugin.md new file mode 100644 index 0000000000..c59ef97855 --- /dev/null +++ b/test/functional/test_site/needsrenderedplugin.md @@ -0,0 +1 @@ +header Content of panel \ No newline at end of file diff --git a/test/functional/test_site/site.json b/test/functional/test_site/site.json index 2f0fcb6a6a..912e82f39d 100644 --- a/test/functional/test_site/site.json +++ b/test/functional/test_site/site.json @@ -71,6 +71,10 @@ { "src": "testPanelsWithImportedVariables.md", "title": "Panels with Imported Variables Test" + }, + { + "src": "testIncludePluginsRendered.md", + "title": "Included files should have plugins rendered on them" } ], "ignore": [ diff --git a/test/functional/test_site/testIncludePluginsRendered.md b/test/functional/test_site/testIncludePluginsRendered.md new file mode 100644 index 0000000000..5f99d413ba --- /dev/null +++ b/test/functional/test_site/testIncludePluginsRendered.md @@ -0,0 +1,7 @@ +The contents of these two panels should be exactly the same. + + + + +header Content of panel + \ No newline at end of file From db157bfadc081fd937fafa5b68b552c78c7c0243 Mon Sep 17 00:00:00 2001 From: openorclose Date: Wed, 26 Feb 2020 21:49:45 +0800 Subject: [PATCH 3/5] Update and add tests --- docs/index.md | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/docs/index.md b/docs/index.md index 5a087435b3..31a2b0b05a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,28 +8,6 @@

      **MarkBind**

      -PLUGIN DEMO - -```html - -``` -Output below: - - - -Output above^ - -```html - -``` -Output below: - - - -Output above^ - -END PLUGIN DEMO - **Generate _more dynamic_ websites from Markdown text.** From aa3873c7370d0fddca02f00befb41d7488d57990 Mon Sep 17 00:00:00 2001 From: openorclose Date: Wed, 26 Feb 2020 21:54:09 +0800 Subject: [PATCH 4/5] Update tests --- .../needsrenderedplugin._include_.html | 3 + .../expected/testIncludePluginsRendered.html | 73 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 test/functional/test_site/expected/needsrenderedplugin._include_.html create mode 100644 test/functional/test_site/expected/testIncludePluginsRendered.html diff --git a/test/functional/test_site/expected/needsrenderedplugin._include_.html b/test/functional/test_site/expected/needsrenderedplugin._include_.html new file mode 100644 index 0000000000..d0f1f344d4 --- /dev/null +++ b/test/functional/test_site/expected/needsrenderedplugin._include_.html @@ -0,0 +1,3 @@ +

      + header Content of panel +

      \ No newline at end of file diff --git a/test/functional/test_site/expected/testIncludePluginsRendered.html b/test/functional/test_site/expected/testIncludePluginsRendered.html new file mode 100644 index 0000000000..75e52afa3e --- /dev/null +++ b/test/functional/test_site/expected/testIncludePluginsRendered.html @@ -0,0 +1,73 @@ + + + + + + + + + + Included files should have plugins rendered on them + + + + + + + + + + + + + + +
      +
      +
      +

      The contents of these two panels should be exactly the same.

      +

      + +

      + + header Content of panel + +
      +
      +
      +
      + Default footer +
      +
      +
      + + + + + + + + + + + + + + + + + \ No newline at end of file From 20f86623d92c0728432e6137a0469248fb2d6694 Mon Sep 17 00:00:00 2001 From: openorclose Date: Wed, 26 Feb 2020 22:20:00 +0800 Subject: [PATCH 5/5] Delete demo --- docs/demo.puml | 10 ---------- docs/includepuml.md | 1 - 2 files changed, 11 deletions(-) delete mode 100644 docs/demo.puml delete mode 100644 docs/includepuml.md diff --git a/docs/demo.puml b/docs/demo.puml deleted file mode 100644 index b2320371ec..0000000000 --- a/docs/demo.puml +++ /dev/null @@ -1,10 +0,0 @@ -@startuml -alice -> bob ++ : hello -bob -> bob ++ : self call -bob -> bib ++ #005500 : hello -bob -> george ** : create -return done -return rc -bob -> george !! : delete -return success -@enduml \ No newline at end of file diff --git a/docs/includepuml.md b/docs/includepuml.md deleted file mode 100644 index a68f9b0d68..0000000000 --- a/docs/includepuml.md +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file