Added cite-ics.html shortcode
This commit is contained in:
@@ -0,0 +1,24 @@
|
|||||||
|
{{- $author := .author -}}
|
||||||
|
{{- $chapter := .chapter -}}
|
||||||
|
{{- $title := .title -}}
|
||||||
|
{{- $editor := .editor -}}
|
||||||
|
{{- $edition := .edition -}}
|
||||||
|
{{- $publisher := .publisher -}}
|
||||||
|
{{- $year := .year -}}
|
||||||
|
{{- $page := .page -}}
|
||||||
|
{{- $pageEnd := .pageEnd -}}
|
||||||
|
{{- $isbn := .isbn -}}
|
||||||
|
{{- $url := .url -}}
|
||||||
|
{{- $urlArchived := .urlArchived -}}
|
||||||
|
{{- $urlArchivedDate := .urlArchivedDate -}}
|
||||||
|
|
||||||
|
{{- if $author }}{{ $author }}, {{ end -}}
|
||||||
|
{{- if $chapter }}"{{ $chapter }}" in {{ end -}}
|
||||||
|
{{- if $title }}<em>{{ $title }}</em>{{ end -}}
|
||||||
|
{{- if $editor }}, ed. {{ $editor }}{{ end -}}
|
||||||
|
{{- if $edition }}, {{ $edition }} {{ if $editor }}edn.{{ else }}ed.{{ end }}{{ end -}}
|
||||||
|
{{- if or $publisher $year }} ({{ $publisher }}{{ if and $publisher $year }}, {{ end }}{{ $year }}){{ end -}}
|
||||||
|
{{- if $page }}, {{ if $pageEnd }}pp. {{ $page }}-{{ $pageEnd }}{{ else }}p. {{ $page }}{{ end }}{{ end -}}
|
||||||
|
{{- if $isbn }}. <a href="https://en.wikipedia.org/wiki/Special:BookSources/{{ $isbn }}" target="_blank">ISBN {{ $isbn }}</a>{{ end -}}
|
||||||
|
{{- if $url }}. <a href="{{ $url }}" target="_blank">Link</a>{{ end -}}
|
||||||
|
{{- if $urlArchived }} (<a href="{{ $urlArchived }}" target="_blank">Archived{{ with $urlArchivedDate }} on {{ . }}{{ end }}</a>){{ end -}}
|
||||||
@@ -28,34 +28,25 @@ author and title.
|
|||||||
year="2001"
|
year="2001"
|
||||||
page="429"
|
page="429"
|
||||||
page-end="449"
|
page-end="449"
|
||||||
isbn="0072376902"
|
isbn="978-0072376906"
|
||||||
url="http://www.mhhe.com/patt"
|
url="http://www.mhhe.com/patt"
|
||||||
url-archived="https://web.archive.org/web/20170615060857/http://www.mhhe.com/engcs/compsci/patt/"
|
url-archived="https://web.archive.org/web/20170615060857/http://www.mhhe.com/engcs/compsci/patt/"
|
||||||
url-archived-date="June 15, 2017"
|
url-archived-date="June 15, 2017"
|
||||||
>}}
|
>}}
|
||||||
*/ -}}
|
*/ -}}
|
||||||
|
|
||||||
{{- $author := .Get "author" -}}
|
{{ partial "cite-book.html" (dict
|
||||||
{{- $chapter := .Get "chapter" -}}
|
"author" (.Get "author")
|
||||||
{{- $title := .Get "title" -}}
|
"chapter" (.Get "chapter")
|
||||||
{{- $editor := .Get "editor" -}}
|
"title" (.Get "title")
|
||||||
{{- $edition := .Get "edition" -}}
|
"editor" (.Get "editor")
|
||||||
{{- $publisher := .Get "publisher" -}}
|
"edition" (.Get "edition")
|
||||||
{{- $year := .Get "year" -}}
|
"publisher" (.Get "publisher")
|
||||||
{{- $page := .Get "page" -}}
|
"year" (.Get "year")
|
||||||
{{- $pageEnd := .Get "page-end" -}}
|
"page" (.Get "page")
|
||||||
{{- $isbn := .Get "isbn" -}}
|
"pageEnd" (.Get "page-end")
|
||||||
{{- $url := .Get "url" -}}
|
"isbn" (.Get "isbn")
|
||||||
{{- $urlArchived := .Get "url-archived" -}}
|
"url" (.Get "url")
|
||||||
{{- $urlArchivedDate := .Get "url-archived-date" -}}
|
"urlArchived" (.Get "url-archived")
|
||||||
|
"urlArchivedDate" (.Get "url-archived-date")
|
||||||
{{- if $author }}{{ $author }}, {{ end -}}
|
) }}
|
||||||
{{- if $chapter }}"{{ $chapter }}" in {{ end -}}
|
|
||||||
{{- if $title }}<em>{{ $title }}</em>{{ end -}}
|
|
||||||
{{- if $editor }}, ed. {{ $editor }}{{ end -}}
|
|
||||||
{{- if $edition }}, {{ $edition }} {{ if $editor }}edn.{{ else }}ed.{{ end }}{{ end -}}
|
|
||||||
{{- if or $publisher $year }} ({{ $publisher }}{{ if and $publisher $year }}, {{ end }}{{ $year }}){{ end -}}
|
|
||||||
{{- if $page }}, {{ if $pageEnd }}pp. {{ $page }}-{{ $pageEnd }}{{ else }}p. {{ $page }}{{ end }}{{ end -}}
|
|
||||||
{{- if $isbn }}. <a href="https://en.wikipedia.org/wiki/Special:BookSources/{{ $isbn }}" target="_blank">ISBN {{ $isbn }}</a>{{ end -}}
|
|
||||||
{{- if $url }}. <a href="{{ $url }}" target="_blank">Link</a>{{ end -}}
|
|
||||||
{{- if $urlArchived }} (<a href="{{ $urlArchived }}" target="_blank">Archived{{ with $urlArchivedDate }} on {{ . }}{{ end }}</a>){{ end -}}
|
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
{{- /*
|
||||||
|
cite-ics - Shortcode for citing Introduction to Computing Systems by Patt & Patel.
|
||||||
|
Pre-fills author, title, publisher, year, ISBN, and URLs based on the edition.
|
||||||
|
|
||||||
|
@param {string} edition Edition of the book ("1", "2", or "3").
|
||||||
|
@param {string} chapter Chapter title.
|
||||||
|
@param {string} page Page number (single) or start of range.
|
||||||
|
@param {string} page-end End of page range (if citing multiple pages).
|
||||||
|
|
||||||
|
@example {{< cite-ics edition="1" chapter="Appendix A: The LC-2 ISA" page="429" page-end="449" >}}
|
||||||
|
*/ -}}
|
||||||
|
|
||||||
|
{{- $edition := .Get "edition" -}}
|
||||||
|
{{- $chapter := .Get "chapter" -}}
|
||||||
|
{{- $page := .Get "page" -}}
|
||||||
|
{{- $pageEnd := .Get "page-end" -}}
|
||||||
|
|
||||||
|
{{- $author := "Patt, Yale N. and Patel, Sanjay J." -}}
|
||||||
|
{{- $publisher := "McGraw-Hill" -}}
|
||||||
|
|
||||||
|
{{- $editionString := "" -}}
|
||||||
|
{{- $title := "" -}}
|
||||||
|
{{- $year := "" -}}
|
||||||
|
{{- $isbn := "" -}}
|
||||||
|
{{- $url := "" -}}
|
||||||
|
{{- $urlArchived := "" -}}
|
||||||
|
{{- $urlArchivedDate := "" -}}
|
||||||
|
|
||||||
|
{{- if eq $edition "1" -}}
|
||||||
|
{{- $editionString = "1st" -}}
|
||||||
|
|
||||||
|
{{- $title = "Introduction to Computing Systems: from Bits and Gates to C and Beyond" -}}
|
||||||
|
{{- $year = "2001" -}}
|
||||||
|
{{- $isbn = "978-0072376906" -}}
|
||||||
|
{{- $url = "http://www.mhhe.com/patt" -}}
|
||||||
|
{{- $urlArchived = "https://web.archive.org/web/20170615060857/http://www.mhhe.com/engcs/compsci/patt/" -}}
|
||||||
|
{{- $urlArchivedDate = "June 15, 2017" -}}
|
||||||
|
{{- else if eq $edition "2" -}}
|
||||||
|
{{- $editionString = "2nd" -}}
|
||||||
|
|
||||||
|
{{- /* https://icourse.club/uploads/files/647434676ec33b68392bf82c3a014751e8e2345a.pdf */ -}}
|
||||||
|
|
||||||
|
{{- $title = "Introduction to Computing Systems: from Bits and Gates to C and Beyond" -}}
|
||||||
|
{{- $year = "2004" -}}
|
||||||
|
{{- $isbn = "978-0071245012" -}}
|
||||||
|
{{- $url = "http://www.mhhe.com/patt2" -}}
|
||||||
|
{{- else if eq $edition "3" -}}
|
||||||
|
{{- $editionString = "3rd" -}}
|
||||||
|
|
||||||
|
{{- /* https://icourse.club/uploads/files/96a2b94d4be48285f2605d843a1e6db37da9a944.pdf */ -}}
|
||||||
|
|
||||||
|
{{- $title = "Introduction to Computing Systems: from Bits and Gates to C/C++ and Beyond" -}}
|
||||||
|
{{- $year = "2020" -}}
|
||||||
|
{{- $isbn = "978-1260150537" -}}
|
||||||
|
{{- $url = "http://www.mhhe.com/patt3" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{ errorf "cite-ics: edition must be 1, 2, or 3, got '%s'" $edition }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{ partial "cite-book.html" (dict
|
||||||
|
"author" $author
|
||||||
|
"title" $title
|
||||||
|
"chapter" $chapter
|
||||||
|
"edition" $editionString
|
||||||
|
"publisher" $publisher
|
||||||
|
"year" $year
|
||||||
|
"page" $page
|
||||||
|
"pageEnd" $pageEnd
|
||||||
|
"isbn" $isbn
|
||||||
|
"url" $url
|
||||||
|
"urlArchived" $urlArchived
|
||||||
|
"urlArchivedDate" $urlArchivedDate
|
||||||
|
) }}
|
||||||
Reference in New Issue
Block a user