Ver código fonte

publications: Support classic citation format (#235)

* Breaking Change: boolean `detailed_list` has changed to
  integer `list_format` parameter - refer to latest exampleSite
George Cushen 7 anos atrás
pai
commit
8168053656

+ 6 - 3
exampleSite/content/home/publications.md

@@ -2,7 +2,7 @@
 # Recent Publications widget.
 # This widget displays recent publications from `content/publication/`.
 
-date = "2016-04-20T00:00:00"
+date = 2016-04-20
 draft = false
 
 title = "Recent Publications"
@@ -15,8 +15,11 @@ weight = 20
 # Number of publications to list.
 count = 10
 
-# Show publication details (such as abstract)? (true/false)
-detailed_list = false
+# List format.
+#   0 = Simple
+#   1 = Classic
+#   2 = Detailed
+list_format = 0
 
 +++
 

+ 6 - 3
exampleSite/content/home/publications_selected.md

@@ -3,7 +3,7 @@
 # This widget displays publications from `content/publication/` which have
 # `selected = true` in their `+++` front matter.
 
-date = "2016-04-20T00:00:00"
+date = 2016-04-20
 draft = false
 
 title = "Selected Publications"
@@ -13,8 +13,11 @@ widget = "publications_selected"
 # Order that this section will appear in.
 weight = 10
 
-# Show publication details (such as abstract)? (true/false)
-detailed_list = true
+# List format.
+#   0 = Simple
+#   1 = Classic
+#   2 = Detailed
+list_format = 2
 
 +++
 

+ 1 - 1
exampleSite/content/post/getting-started.md

@@ -133,7 +133,7 @@ To edit the interface text, copy `themes/academic/i18n/en.yaml` to `i18n/en.yaml
 
 To translate the interface text to another language, follow the above instructions, but name the new file in the form `i18n/X.yaml` where `X` is the appropriate [ISO/RFC5646 language identifier](http://www.w3schools.com/tags/ref_language_codes.asp) for the translation. Then follow the brief instructions in the *Language* section at the bottom of your `config.toml`. To change the default language used by Academic, set `defaultContentLanguage` to the desired language identifier in your configuration file.
 
-To translate the navigation bar, you can edit the default `[[menu.main]]` instances in `config.toml`. However, for a multilingual site, you will need to duplicate all of the `[[menu.main]]` instances and rename the new instances from `[[menu.main]]` to `[[languages.X.menu.main]]`, where `X` is the language identifier (e.g. `[[languages.zh.menu.main]]` for Simplified Chinese). Thus, the navigation bar can be displayed in multiple languages.
+To translate the navigation bar, you can edit the default `[[menu.main]]` instances in `config.toml`. However, for a multilingual site, you will need to duplicate all of the `[[menu.main]]` instances and rename the new instances from `[[menu.main]]` to `[[Languages.X.menu.main]]`, where `X` is the language identifier (e.g. `[[Languages.zh.menu.main]]` for Simplified Chinese). Thus, the navigation bar can be displayed in multiple languages.
 
 To translate a content file in your `content/` folder into another language, copy the file to `filename.X.md` where `filename` is your existing filename and `X` is the appropriate [ISO/RFC5646 language identifier](http://www.w3schools.com/tags/ref_language_codes.asp) for the translation. Then translate the content in the new file to the specified language.
 

+ 1 - 1
exampleSite/content/post/widgets.md

@@ -26,7 +26,7 @@ The example site that you copied to create your site uses all the different type
 The parameters for each widget vary. They can be found in the preamble/frontmatter (between the pair of `+++`) for each widget installed in the `content/home/` folder.
 
 {{% alert note %}}
-By default, publications will be displayed in a simple list. If you prefer a more detailed list with abstract and image, you can enable the detailed publication list on the homepage by setting `detailed_list = true` in `content/home/publications.md`.
+By default, publications will be displayed in a simple list. If you prefer a more detailed list with abstract and image, you can enable the detailed publication list on the homepage by setting `list_format = 2` in `content/home/publications.md`.
 {{% /alert %}}
 
 ## Add a widget to the homepage

+ 6 - 1
exampleSite/content/publication/_index.md

@@ -3,7 +3,12 @@ title = "Publications"
 date = "2017-01-01T00:00:00Z"
 math = false
 highlight = false
-detailed_list = false
+
+# List format.
+#   0 = Simple
+#   1 = Classic
+#   2 = Detailed
+list_format = 0
 
 # Optional featured image (relative to `static/img/` folder).
 [header]

+ 1 - 1
exampleSite/content/publication/person-re-identification.md

@@ -7,7 +7,7 @@ image_preview = ""
 math = true
 publication_types = ["2"]
 publication = "In *Signal Image Technology & Internet Systems (SITIS)*, IEEE."
-publication_short = ""
+publication_short = "In *SITIS*"
 selected = false
 title = "A Person Re-Identification System For Mobile Devices"
 url_code = ""

+ 16 - 0
layouts/partials/publication_li_classic.html

@@ -0,0 +1,16 @@
+<div class="pub-list-item" style="margin-bottom: 1rem" itemscope itemtype="http://schema.org/CreativeWork">
+  <i class="fa fa-file-text-o pub-icon" aria-hidden="true"></i>
+  <span itemprop="author">
+    {{ with .Params.authors }}
+      {{- delimit . ", " | markdownify -}}
+    {{- end -}}
+  </span>.
+  <span itemprop="name">{{ .Title }}</span>.
+  {{ if .Params.publication_short }}
+    {{- .Params.publication_short | markdownify -}}
+  {{ else }}
+    {{- .Params.publication | markdownify -}}
+  {{ end }},&nbsp;
+  {{- .Date.Format "2006" -}}.
+  <p>{{ partial "publication_links" (dict "content" . "is_list" 1) }}</p>
+</div>

+ 5 - 4
layouts/partials/publication_li_detailed.html

@@ -46,14 +46,15 @@
 
       <div class="pub-publication">
         {{ if .Params.publication_short }}
-        {{ .Params.publication_short | markdownify }}
+        {{- .Params.publication_short | markdownify -}}
         {{ else }}
-        {{ .Params.publication | markdownify }}
-        {{ end }}
+        {{- .Params.publication | markdownify -}}
+        {{- end -}},&nbsp;
+        {{- .Date.Format "2006" -}}.
       </div>
 
       <div class="pub-links">
-        {{ partial "publication_links" (dict "content" . "is_list" 1) }}
+        {{ partial "publication_links" (dict "content" . "is_list" 0) }}
       </div>
 
     </div>

+ 3 - 3
layouts/partials/publication_li_simple.html

@@ -1,5 +1,5 @@
-<li itemscope itemtype="http://schema.org/CreativeWork">
-  <i class="fa-li fa fa-file-text-o pub-icon" aria-hidden="true"></i>
+<div class="pub-list-item" style="margin-bottom: 1rem" itemscope itemtype="http://schema.org/CreativeWork">
+  <i class="fa fa-file-text-o pub-icon" aria-hidden="true"></i>
   <span itemprop="name">{{ .Title }}</span>
   <p>{{ partial "publication_links" (dict "content" . "is_list" 1) }}</p>
-</li>
+</div>

+ 0 - 5
layouts/partials/publication_li_simple_div.html

@@ -1,5 +0,0 @@
-<div class="pub-list-item" style="margin-bottom: 1rem" itemscope itemtype="http://schema.org/CreativeWork">
-  <i class="fa fa-file-text-o pub-icon" aria-hidden="true"></i>
-  <span itemprop="name">{{ .Title }}</span>
-  <p>{{ partial "publication_links" (dict "content" . "is_list" 1) }}</p>
-</div>

+ 6 - 8
layouts/partials/widgets/publications.html

@@ -19,16 +19,14 @@
   <div class="col-xs-12 col-md-8">
     {{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }}
 
-    {{ if $page.Params.detailed_list }}
     {{ range first $page.Params.count (where $.Data.Pages "Type" "publication") }}
-    {{ partial "publication_li_detailed" . }}
-    {{ end }}
-    {{ else }}
-    <ul class="fa-ul">
-      {{ range first $page.Params.count (where $.Data.Pages "Type" "publication") }}
-      {{ partial "publication_li_simple" . }}
+      {{ if eq $page.Params.list_format 1 }}
+        {{ partial "publication_li_classic" . }}
+      {{ else if eq $page.Params.list_format 2 }}
+        {{ partial "publication_li_detailed" . }}
+      {{ else }}
+        {{ partial "publication_li_simple" . }}
       {{ end }}
-    </ul>
     {{ end }}
 
   </div>

+ 6 - 8
layouts/partials/widgets/publications_selected.html

@@ -10,16 +10,14 @@
   <div class="col-xs-12 col-md-8">
     {{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }}
 
-    {{ if $page.Params.detailed_list }}
     {{ range (where (where $.Data.Pages "Type" "publication") ".Params.selected" true) }}
-    {{ partial "publication_li_detailed" . }}
-    {{ end }}
-    {{ else }}
-    <ul class="fa-ul">
-      {{ range (where (where $.Data.Pages "Type" "publication") ".Params.selected" true) }}
-      {{ partial "publication_li_simple" . }}
+      {{ if eq $page.Params.list_format 1 }}
+        {{ partial "publication_li_classic" . }}
+      {{ else if eq $page.Params.list_format 2 }}
+        {{ partial "publication_li_detailed" . }}
+      {{ else }}
+          {{ partial "publication_li_simple" . }}
       {{ end }}
-    </ul>
     {{ end }}
 
   </div>

+ 4 - 2
layouts/section/publication.html

@@ -34,10 +34,12 @@
         {{ end }}
 
         <div class="grid-sizer col-md-12 isotope-item pubtype-{{ $.Scratch.Get "pubtype" }}">
-          {{ if $.Params.detailed_list }}
+          {{ if eq $.Params.list_format 1 }}
+            {{ partial "publication_li_classic" . }}
+          {{ else if eq $.Params.list_format 2 }}
             {{ partial "publication_li_detailed" . }}
           {{ else }}
-            {{ partial "publication_li_simple_div" . }}
+            {{ partial "publication_li_simple" . }}
           {{ end }}
         </div>