From 09a7bcbdef237c1443bbbfc29010e7106cffd739 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Sat, 21 Jan 2017 13:08:29 +0800 Subject: [PATCH 1/2] Refactor templates and rearrange its path --- public/views/error.ejs | 6 +- public/views/hackmd.ejs | 12 +- public/views/{ => hackmd}/body.ejs | 8 +- public/views/{ => hackmd}/foot.ejs | 4 +- public/views/{ => hackmd}/footer.ejs | 0 public/views/{ => hackmd}/head.ejs | 6 +- public/views/{ => hackmd}/header.ejs | 0 public/views/index.ejs | 216 +------------------ public/views/index/body.ejs | 175 +++++++++++++++ public/views/index/foot.ejs | 13 ++ public/views/index/footer.ejs | 0 public/views/index/head.ejs | 22 ++ public/views/index/header.ejs | 0 public/views/pretty.ejs | 14 +- public/views/{ => shared}/disqus.ejs | 0 public/views/{ => shared}/ga.ejs | 0 public/views/{ => shared}/help-modal.ejs | 0 public/views/{ => shared}/polyfill.ejs | 0 public/views/{ => shared}/refresh-modal.ejs | 0 public/views/{ => shared}/revision-modal.ejs | 0 public/views/{ => shared}/signin-modal.ejs | 0 public/views/slide.ejs | 14 +- 22 files changed, 247 insertions(+), 243 deletions(-) rename public/views/{ => hackmd}/body.ejs (99%) rename public/views/{ => hackmd}/foot.ejs (97%) rename public/views/{ => hackmd}/footer.ejs (100%) rename public/views/{ => hackmd}/head.ejs (93%) rename public/views/{ => hackmd}/header.ejs (100%) create mode 100644 public/views/index/body.ejs create mode 100644 public/views/index/foot.ejs create mode 100644 public/views/index/footer.ejs create mode 100644 public/views/index/head.ejs create mode 100644 public/views/index/header.ejs rename public/views/{ => shared}/disqus.ejs (100%) rename public/views/{ => shared}/ga.ejs (100%) rename public/views/{ => shared}/help-modal.ejs (100%) rename public/views/{ => shared}/polyfill.ejs (100%) rename public/views/{ => shared}/refresh-modal.ejs (100%) rename public/views/{ => shared}/revision-modal.ejs (100%) rename public/views/{ => shared}/signin-modal.ejs (100%) diff --git a/public/views/error.ejs b/public/views/error.ejs index 402b5eb0c..a40ed39c7 100644 --- a/public/views/error.ejs +++ b/public/views/error.ejs @@ -2,18 +2,18 @@ - <%- include head %> + <%- include hackmd/head %> - <%- include header %> + <%- include hackmd/header %>

<%- code %> <%- detail %> <%- msg %>

- <%- include footer %> + <%- include hackmd/footer %> \ No newline at end of file diff --git a/public/views/hackmd.ejs b/public/views/hackmd.ejs index c5778fc9d..49084a635 100644 --- a/public/views/hackmd.ejs +++ b/public/views/hackmd.ejs @@ -2,14 +2,14 @@ - <%- include head %> + <%- include hackmd/head %> - <%- include header %> - <%- include body %> - <%- include footer %> - <%- include foot %> + <%- include hackmd/header %> + <%- include hackmd/body %> + <%- include hackmd/footer %> + <%- include hackmd/foot %> - \ No newline at end of file + diff --git a/public/views/body.ejs b/public/views/hackmd/body.ejs similarity index 99% rename from public/views/body.ejs rename to public/views/hackmd/body.ejs index 5ad1733e3..d8a3f108e 100644 --- a/public/views/body.ejs +++ b/public/views/hackmd/body.ejs @@ -244,7 +244,7 @@ -<%- include refresh-modal %> -<%- include signin-modal %> -<%- include help-modal %> -<%- include revision-modal %> +<%- include ../shared/refresh-modal %> +<%- include ../shared/signin-modal %> +<%- include ../shared/help-modal %> +<%- include ../shared/revision-modal %> diff --git a/public/views/foot.ejs b/public/views/hackmd/foot.ejs similarity index 97% rename from public/views/foot.ejs rename to public/views/hackmd/foot.ejs index c1df65c24..178b55043 100644 --- a/public/views/foot.ejs +++ b/public/views/hackmd/foot.ejs @@ -20,9 +20,9 @@ -<%- include build/index-scripts %> +<%- include ../build/index-scripts %> <% } else { %> -<%- include build/index-pack-scripts %> +<%- include ../build/index-pack-scripts %> <% } %> diff --git a/public/views/footer.ejs b/public/views/hackmd/footer.ejs similarity index 100% rename from public/views/footer.ejs rename to public/views/hackmd/footer.ejs diff --git a/public/views/head.ejs b/public/views/hackmd/head.ejs similarity index 93% rename from public/views/head.ejs rename to public/views/hackmd/head.ejs index 218847f73..d06639931 100644 --- a/public/views/head.ejs +++ b/public/views/hackmd/head.ejs @@ -14,9 +14,9 @@ -<%- include build/index-header %> +<%- include ../build/index-header %> <% } else { %> -<%- include build/index-pack-header %> +<%- include ../build/index-pack-header %> <% } %> -<%- include polyfill %> \ No newline at end of file +<%- include ../shared/polyfill %> \ No newline at end of file diff --git a/public/views/header.ejs b/public/views/hackmd/header.ejs similarity index 100% rename from public/views/header.ejs rename to public/views/hackmd/header.ejs diff --git a/public/views/index.ejs b/public/views/index.ejs index 4bcea0eb2..5732db4a3 100644 --- a/public/views/index.ejs +++ b/public/views/index.ejs @@ -2,220 +2,14 @@ - - - - - - - - - HackMD - <%= __('Collaborative markdown notes') %> - - - <% if(useCDN) { %> - - - - - - <%- include build/cover-header %> - <% } else { %> - <%- include build/cover-pack-header %> - <% } %> - <%- include polyfill %> + <%- include index/head %> -
-
-
- -
-
-

- -
-
- -
style="display:none;"<% } %>> -
-

HackMD

-

- <%= __('Best way to write and share your knowledge in markdown.') %> -

- <% if (infoMessage && infoMessage.length > 0) { %> -
<%= infoMessage %>
- <% } %> - <% if (errorMessage && errorMessage.length > 0) { %> -
<%= errorMessage %>
- <% } %> - <% if(facebook || twitter || github || gitlab || dropbox || google || ldap || email) { %> - - <%= __('or') %> - <% } %> - - -
-
- -
style="display:none;"<% } %>> - -
-
-
- -
-
- -
- - <%= __('Title') %> - - - <%= __('Time') %> - - - -
- - -
    -
-
    -
    - -
    -
    - -

    - © 2017 HackMD | <%= __('Releases') %> -

    - -
    -
    -
    -
    -
    - - - <%- include signin-modal %> - - <% if(useCDN) { %> - - - - - - - - - <%- include build/cover-scripts %> - <% } else { %> - <%- include build/cover-pack-scripts %> - <% } %> + <%- include index/header %> + <%- include index/body %> + <%- include index/footer %> + <%- include index/foot %> diff --git a/public/views/index/body.ejs b/public/views/index/body.ejs new file mode 100644 index 000000000..b80724501 --- /dev/null +++ b/public/views/index/body.ejs @@ -0,0 +1,175 @@ +
    +
    +
    + +
    +
    +

    + +
    +
    + +
    style="display:none;"<% } %>> +
    +

    HackMD

    +

    + <%= __('Best way to write and share your knowledge in markdown.') %> +

    + <% if (infoMessage && infoMessage.length > 0) { %> +
    <%= infoMessage %>
    + <% } %> + <% if (errorMessage && errorMessage.length > 0) { %> +
    <%= errorMessage %>
    + <% } %> + <% if(facebook || twitter || github || gitlab || dropbox || google || ldap || email) { %> + + <%= __('or') %> + <% } %> + + +
    +
    + +
    style="display:none;"<% } %>> + +
    +
    +
    + +
    +
    + +
    + + <%= __('Title') %> + + + <%= __('Time') %> + + + +
    + + +
      +
    +
      +
      + +
      +
      + +

      + © 2017 HackMD | <%= __('Releases') %> +

      + +
      +
      +
      +
      +
      + + +<%- include ../shared/signin-modal %> \ No newline at end of file diff --git a/public/views/index/foot.ejs b/public/views/index/foot.ejs new file mode 100644 index 000000000..293c66986 --- /dev/null +++ b/public/views/index/foot.ejs @@ -0,0 +1,13 @@ +<% if(useCDN) { %> + + + + + + + + +<%- include ../build/cover-scripts %> +<% } else { %> +<%- include ../build/cover-pack-scripts %> +<% } %> \ No newline at end of file diff --git a/public/views/index/footer.ejs b/public/views/index/footer.ejs new file mode 100644 index 000000000..e69de29bb diff --git a/public/views/index/head.ejs b/public/views/index/head.ejs new file mode 100644 index 000000000..bbd145678 --- /dev/null +++ b/public/views/index/head.ejs @@ -0,0 +1,22 @@ + + + + + + + + +HackMD - <%= __('Collaborative markdown notes') %> + + +<% if(useCDN) { %> + + + + + +<%- include ../build/cover-header %> +<% } else { %> +<%- include ../build/cover-pack-header %> +<% } %> +<%- include ../shared/polyfill %> \ No newline at end of file diff --git a/public/views/index/header.ejs b/public/views/index/header.ejs new file mode 100644 index 000000000..e69de29bb diff --git a/public/views/pretty.ejs b/public/views/pretty.ejs index ced65ed8a..de5b8ad39 100644 --- a/public/views/pretty.ejs +++ b/public/views/pretty.ejs @@ -23,12 +23,12 @@ - <%- include build/pretty-header %> + <%- include ../build/pretty-header %> <% } else { %> - <%- include build/pretty-pack-header %> + <%- include ../build/pretty-pack-header %> <% } %> - <%- include polyfill %> + <%- include ../shared/polyfill %> @@ -66,7 +66,7 @@ <% if(typeof disqus !== 'undefined' && disqus) { %>
      - <%- include disqus %> + <%- include ../shared/disqus %>
      <% } %> @@ -90,10 +90,10 @@ -<%- include build/pretty-scripts %> +<%- include ../build/pretty-scripts %> <% } else { %> -<%- include build/pretty-pack-scripts %> +<%- include ../build/pretty-pack-scripts %> <% } %> -<%- include ga %> +<%- include ../shared/ga %> diff --git a/public/views/disqus.ejs b/public/views/shared/disqus.ejs similarity index 100% rename from public/views/disqus.ejs rename to public/views/shared/disqus.ejs diff --git a/public/views/ga.ejs b/public/views/shared/ga.ejs similarity index 100% rename from public/views/ga.ejs rename to public/views/shared/ga.ejs diff --git a/public/views/help-modal.ejs b/public/views/shared/help-modal.ejs similarity index 100% rename from public/views/help-modal.ejs rename to public/views/shared/help-modal.ejs diff --git a/public/views/polyfill.ejs b/public/views/shared/polyfill.ejs similarity index 100% rename from public/views/polyfill.ejs rename to public/views/shared/polyfill.ejs diff --git a/public/views/refresh-modal.ejs b/public/views/shared/refresh-modal.ejs similarity index 100% rename from public/views/refresh-modal.ejs rename to public/views/shared/refresh-modal.ejs diff --git a/public/views/revision-modal.ejs b/public/views/shared/revision-modal.ejs similarity index 100% rename from public/views/revision-modal.ejs rename to public/views/shared/revision-modal.ejs diff --git a/public/views/signin-modal.ejs b/public/views/shared/signin-modal.ejs similarity index 100% rename from public/views/signin-modal.ejs rename to public/views/shared/signin-modal.ejs diff --git a/public/views/slide.ejs b/public/views/slide.ejs index b0323a0e4..eb1453f8b 100644 --- a/public/views/slide.ejs +++ b/public/views/slide.ejs @@ -23,10 +23,10 @@ - <%- include build/slide-header %> + <%- include ../build/slide-header %> <% } else { %> - <%- include build/slide-pack-header %> + <%- include ../build/slide-pack-header %> <% } %> @@ -45,7 +45,7 @@ document.getElementsByTagName( 'head' )[0].appendChild( link ); - <%- include polyfill %> + <%- include ../shared/polyfill %>
      @@ -79,7 +79,7 @@
      <% if(typeof disqus !== 'undefined' && disqus) { %>
      - <%- include disqus %> + <%- include ../shared/disqus %>
      <% } %> @@ -104,13 +104,13 @@ - <%- include build/slide-scripts %> + <%- include ../build/slide-scripts %> <% } else { %> - <%- include build/slide-pack-scripts %> + <%- include ../build/slide-pack-scripts %> <% } %> -<%- include ga %> +<%- include ../shared/ga %> From a669c201beb3755703e87984268cbd08145e9ac6 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Sat, 21 Jan 2017 13:40:08 +0800 Subject: [PATCH 2/2] Fix template partial path --- public/views/pretty.ejs | 14 +++++++------- public/views/slide.ejs | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/public/views/pretty.ejs b/public/views/pretty.ejs index de5b8ad39..a6913f6cd 100644 --- a/public/views/pretty.ejs +++ b/public/views/pretty.ejs @@ -23,12 +23,12 @@ - <%- include ../build/pretty-header %> + <%- include build/pretty-header %> <% } else { %> - <%- include ../build/pretty-pack-header %> + <%- include build/pretty-pack-header %> <% } %> - <%- include ../shared/polyfill %> + <%- include shared/polyfill %> @@ -66,7 +66,7 @@ <% if(typeof disqus !== 'undefined' && disqus) { %>
      - <%- include ../shared/disqus %> + <%- include shared/disqus %>
      <% } %> @@ -90,10 +90,10 @@ -<%- include ../build/pretty-scripts %> +<%- include build/pretty-scripts %> <% } else { %> -<%- include ../build/pretty-pack-scripts %> +<%- include build/pretty-pack-scripts %> <% } %> -<%- include ../shared/ga %> +<%- include shared/ga %> diff --git a/public/views/slide.ejs b/public/views/slide.ejs index eb1453f8b..ffbfdce6d 100644 --- a/public/views/slide.ejs +++ b/public/views/slide.ejs @@ -23,10 +23,10 @@ - <%- include ../build/slide-header %> + <%- include build/slide-header %> <% } else { %> - <%- include ../build/slide-pack-header %> + <%- include build/slide-pack-header %> <% } %> @@ -45,7 +45,7 @@ document.getElementsByTagName( 'head' )[0].appendChild( link ); - <%- include ../shared/polyfill %> + <%- include shared/polyfill %>
      @@ -79,7 +79,7 @@
      <% if(typeof disqus !== 'undefined' && disqus) { %>
      - <%- include ../shared/disqus %> + <%- include shared/disqus %>
      <% } %> @@ -104,13 +104,13 @@ - <%- include ../build/slide-scripts %> + <%- include build/slide-scripts %> <% } else { %> - <%- include ../build/slide-pack-scripts %> + <%- include build/slide-pack-scripts %> <% } %> -<%- include ../shared/ga %> +<%- include shared/ga %>