From 93a0067c2b6451b27af7824b1e676e769839f372 Mon Sep 17 00:00:00 2001 From: Paul Tan Date: Thu, 5 Jul 2018 22:38:43 +0800 Subject: [PATCH 1/2] docs: port over template from AddressBook-Level4 The following commits implement the documentation template in AddressBook-Level4: 686ec9ac9b9a17e5962c2341c08471e89d452d23..a1b29c20c825312a14ffe6b8242baee056cb5017 For consistency with AddressBook-Level4, port over those commits into this repo. This is done by running the following shell script: git fetch https://github.com/se-edu/addressbook-level4 master && git diff --binary 686ec9ac9b9a17e5962c2341c08471e89d452d23..a1b29c20c825312a14ffe6b8242baee056cb5017 >patch && git apply --3way --include=build.gradle --include='docs/images/*' --include='docs/stylesheets/*' --include='docs/templates/*' patch and fixing the conflicts in build.gradle. --- build.gradle | 12 ++ docs/images/SeEduLogo.png | Bin 0 -> 20233 bytes docs/stylesheets/gh-pages.css | 195 ++++++++++++++++++ docs/templates/LICENSE | 24 +++ docs/templates/_footer.html.slim | 12 ++ docs/templates/_footnotes.html.slim | 7 + docs/templates/_header.html.slim | 76 +++++++ docs/templates/_toc.html.slim | 5 + docs/templates/document.html.slim | 29 +++ docs/templates/helpers.rb | 300 ++++++++++++++++++++++++++++ 10 files changed, 660 insertions(+) create mode 100644 docs/images/SeEduLogo.png create mode 100644 docs/templates/LICENSE create mode 100644 docs/templates/_footer.html.slim create mode 100644 docs/templates/_footnotes.html.slim create mode 100644 docs/templates/_header.html.slim create mode 100644 docs/templates/_toc.html.slim create mode 100644 docs/templates/document.html.slim create mode 100644 docs/templates/helpers.rb diff --git a/build.gradle b/build.gradle index 778e7b716..fe011a20c 100644 --- a/build.gradle +++ b/build.gradle @@ -55,6 +55,10 @@ asciidoctor { sourceDir 'docs' outputDir "${buildDir}/docs" + options = [ + template_dirs: [file("${sourceDir}/templates")], + ] + attributes = [ linkcss: true, stylesheet: 'gh-pages.css', @@ -64,7 +68,15 @@ asciidoctor { sectlinks: true, idprefix: '', // for compatibility with GitHub preview idseparator: '-', + 'site-root': "${sourceDir}", // must be the same as sourceDir, do not modify + 'site-name': 'AddressBook-Level4', + 'site-githuburl': 'https://github.com/se-edu/addressbook-level4', + 'site-seedu': true, // delete this line if your project is not a fork (not a SE-EDU project) ] + + options['template_dirs'].each { + inputs.files fileTree(it) + } } // Copies stylesheets into the directory containing generated HTML files as diff --git a/docs/images/SeEduLogo.png b/docs/images/SeEduLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..31ad50b6f88d4dacb43120f10081c9e9050c4855 GIT binary patch literal 20233 zcmcG0bwCu~7w_yY-3v&Egdix=NQ2Uigp|M%f=WyGE=WmJx_5cwrxeYGXt zfnk(VY1UA+hw!$n;~g4}UTd#g%#6=^egklBIo`RPCr@~Dp71(uw!h!nJ6U3Q`sI1? z!EuLeP0*FA->Ocst$aHUXT66c{WT62rW;*iijB%fwiLxkBJOO3F^MpzyE}Eyg-RGw zCJ;ntOiBCKz7fFOe zzpJ2UQR@VP5+uNSqPRtL(`bfPWxTSCvU|q|I{?PSIc>+s#(q+|8mHxP&8)gIp~s#- zV@d;alXkAO#^r>Yo4Z&FenE_dg(X9~I7z%d9y38()lr&ctEyULq5(Yr{PW?~`5p0K z))BE*=y{{3u>8Wp?%7aX8iH-YWnc`Qo_R-A^(RO_a0NX$IGCdPbuSDijT~5Igf_Z~ z#NTtkyaNMOsTYwDgGLm9%S3gf2t{AC-4UnL!NY=#Gs|)_Xt5UvWx+IAqLz>S^V<9L ziqOLX-|-tgMxjvHMkha+k+FY1R(X(oqc45q1tGekAmQ4?DtESqUhM%mKVC6 zL}R!aG?fezDMP>yThewSxZEBVUYOAca2D*;{5=G$K|ZV&%KLcR3X=ooXZ(eSZYcu$ z(RR`zkl<|Cp*=n(;s0_I;hd%ltZr;niqyAcgtALlgRfhi2`N@m+{85sgJf0O9RZ{grW2FXWrNZ3YWB{}59w!|^*FCJa@_mlO zPR2=KmU%J*~ttT=NuyoA7pa z2l&*GcFoN4Is@x{r+7?rN?uRsdyK}wM%GrC6%D~msa{qIUeEME-Q>R^k@_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)e$6j8)*moy*ee(U6CJkvXW|?E;$yjwy$aXM z5D0+a*m@T=x$E)g)wN#anJF%g@g!*<63vvx?59Z)*sjr7NOP+pc2cV(V3*i7*1+xMxcnG%z3Va}N504A3vp%eJ(x z@vf}d#EviLE)$+Wzgx9VT^(@<8Z|?SRoZCOy*K3Dip*_sHKaW7Jw3g?>WZWz1nmKp zntg>Qu)Cz$rFs#&T2IxKLol!Hh-jr@z$UN-w5TypQ-T*f3{g(Pf{sX7k7^ivH#4Yf zy7#>0ATd&U*}NdT3?>G}AvHCBYC|7)h=1j{(f#DE99x2CDZv*$tb9x9QE@FGLRhM+ ztNbX(bFfTeU8ExhMJRI3%`uf^ms@aT!)pwdR$kE_(ER$Kl(gc^K+r!c^2E)FSHbPl?4!YFsFaJIJ`XM7xO>U{YYm3 literal 0 HcmV?d00001 diff --git a/docs/stylesheets/gh-pages.css b/docs/stylesheets/gh-pages.css index 165471387..121cac388 100644 --- a/docs/stylesheets/gh-pages.css +++ b/docs/stylesheets/gh-pages.css @@ -17,3 +17,198 @@ padding-bottom: 0; padding-top: 0; } + +/* Overrides for asciidoctor.css */ + +a { + color: #0074c7; +} + +h1, +#content h1 > a.link, +h2, +h2 > a.link, +h3, +h3 > a.link, +#toctitle, +#toctitle > a.link, +.sidebarblock > .content > .title, +.sidebarblock > .content > .title > a.link, +h4, +h4 > a.link, +h5, +h5 > a.link, +h6, +h6 > a.link { + color: #e46c0a; +} + +.subheader, +.admonitionblock td.content > .title, +.audioblock > .title, +.exampleblock > .title, +.imageblock > .title, +.listingblock > .title, +.literalblock > .title, +.stemblock > .title, +.openblock > .title, +.paragraph >.title, +.quoteblock > .title, +table.tableblock > .title, +.verseblock > .title, +.videoblock > .title, +.dlist > .title, +.olist > .title, +.ulist > .title, +.qlist > .title, +.hdlist > .title { + color: rgb(197, 90, 17); +} + +@media screen { + #footer { + background-color: #f6f6f6; + border-top: 1px #d2d2d2 solid; + border-bottom: 1px #d2d2d2 solid; + font-family: "Open Sans", "DejaVu Sans", sans-serif; + } + + #footer-text { + color: #595959; + line-height: 1; + } +} + +/* Utilities */ + +.container { + width: 100%; + max-width: 62.5rem; + margin-left: auto; + margin-right: auto; +} + +/* Colors */ + +.bg-light { + background-color: #f8f9fa; +} + +.bg-lighter { + background-color: #fbfbfb; +} + + +/* Navbar */ + +.navbar { + display: flex; + flex-wrap: nowrap; + justify-content: center; + font-family: "Open Sans", "DejaVu Sans", sans-serif; + font-size: 1rem; + padding: 0px 1rem; +} + +.navbar-lg { + font-size: 1.3rem; +} + +.navbar-light { + border-bottom: 1px #d2d2d2 solid; +} + +.navbar a { + text-decoration: none; +} + +.navbar-light a { + color: #595959; +} + +.navbar-light a:hover, +.navbar-light a:focus { + color: #000000; +} + +.navbar a.active, +.navbar a.active:hover, +.navbar a.active:focus { + font-weight: bold; +} + +.navbar-light a.active, +.navbar-light a.active:hover, +.navbar-light a.active:focus { + color: #000000; +} + +.navbar-light .nav-link { + border-bottom: 2px transparent solid; +} + +.navbar-light .nav-link.active { + border-bottom: 2px #e46c0a solid; +} + +.navbar-lg .nav-link.active { + border-bottom: 0; +} + +.navbar > .container { + display: flex; + flex-wrap: wrap; + justify-content: center; +} + +.navbar-brand { + display: inline-block; + margin-right: 1rem; + padding: 0.8125rem 0rem; + padding-left: 0.9375rem; + font-size: 1.25rem; +} + +.navbar-brand img { + height: 1.4rem; + margin: 0rem 0.4rem; + padding: 0; + vertical-align: middle; +} + +.navbar-lg .navbar-brand { + font-size: 1.7rem; +} + +.navbar-lg .navbar-brand img { + height: 2.3rem; +} + +.navbar-nav { + display: flex; + flex-wrap: wrap; + flex-grow: 1; + align-items: center; + margin: 0px; + padding: 0px; + list-style: none; + line-height: inherit; +} + +.nav-link { + display: block; + margin: 0px; + border: 0px; + padding: 1rem 1rem; +} + +/* Do not display site header on print mediums */ +@media print { + #seedu-header { + display: none; + } + + #site-header { + display: none; + } +} diff --git a/docs/templates/LICENSE b/docs/templates/LICENSE new file mode 100644 index 000000000..2073b44de --- /dev/null +++ b/docs/templates/LICENSE @@ -0,0 +1,24 @@ +This directory contains code from the Asciidoctor Project. +(https://asciidoctor.org/) + +MIT License + +Copyright (C) 2012-2018 Dan Allen, Ryan Waldron and the Asciidoctor Project + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/docs/templates/_footer.html.slim b/docs/templates/_footer.html.slim new file mode 100644 index 000000000..938ed7ddc --- /dev/null +++ b/docs/templates/_footer.html.slim @@ -0,0 +1,12 @@ +/ NOTE: You must restart the gradle daemon after modifying any template file for the changes to take effect. +#footer + .container + #footer-text + - if attr? :revnumber + |#{attr 'version-label'} #{attr :revnumber} + - if attr? :revnumber && (attr? 'last-update-label') + br + - if attr? 'last-update-label' + |#{attr 'last-update-label'} #{attr :docdatetime} + - unless (docinfo_content = (docinfo :footer)).empty? + =docinfo_content diff --git a/docs/templates/_footnotes.html.slim b/docs/templates/_footnotes.html.slim new file mode 100644 index 000000000..0cacda3e5 --- /dev/null +++ b/docs/templates/_footnotes.html.slim @@ -0,0 +1,7 @@ +/ NOTE: You must restart the gradle daemon after modifying any template file for the changes to take effect. +#footnotes + hr + - footnotes.each do |fn| + .footnote id=(footnote_id fn.index) + a href="##{footnoteref_id fn.index}" =fn.index + |. #{fn.text} diff --git a/docs/templates/_header.html.slim b/docs/templates/_header.html.slim new file mode 100644 index 000000000..1995d26a1 --- /dev/null +++ b/docs/templates/_header.html.slim @@ -0,0 +1,76 @@ +/ NOTE: You must restart the gradle daemon after modifying any template file for the changes to take effect. +- if !(attr? 'no-site-header') && (attr? 'site-seedu') + #seedu-header + nav.navbar.navbar-lg.navbar-light.bg-lighter + .container + a.navbar-brand href='https://se-edu.github.io/' + img src=(site_url 'images/SeEduLogo.png') alt='SE-EDU' + ul.navbar-nav + li.nav-item + a.nav-link href='https://se-edu.github.io/addressbook-level1' AB-1 + li.nav-item + a.nav-link href='https://se-edu.github.io/addressbook-level2' AB-2 + li.nav-item + a.nav-link href='https://se-edu.github.io/addressbook-level3' AB-3 + li.nav-item + a.nav-link.active href=(site_url 'index.html') AB-4 + li.nav-item + a.nav-link href='https://se-edu.github.io/collate' Collate + li.nav-item + a.nav-link href='https://se-edu.github.io/se-book' Book + li.nav-item + a.nav-link href='https://se-edu.github.io/learningresources' Resources + +- if !(attr? 'no-site-header') + #site-header + nav.navbar.navbar-light.bg-light + .container + - if attr? 'site-name' + a.navbar-brand href=(site_url 'index.html') =(attr 'site-name') + ul.navbar-nav + li.nav-item + =nav_link('UserGuide', 'UserGuide.html', 'User Guide') + li.nav-item + =nav_link('DeveloperGuide', 'DeveloperGuide.html', 'Developer Guide') + - if attr? 'site-seedu' + li.nav-item + =nav_link('LearningOutcomes', 'LearningOutcomes.html', 'LOs') + li.nav-item + =nav_link('AboutUs', 'AboutUs.html', 'About Us') + li.nav-item + =nav_link('ContactUs', 'ContactUs.html', 'Contact Us') + - if attr? 'site-githuburl' + li.navitem + a.nav-link href=(attr 'site-githuburl') + span.fa.fa-github.fa-lg aria-hidden='true' + |  View on GitHub + +/ AsciiDoc leaves an empty header div even if there's no doctitle +#header + - if has_header? + - unless notitle + h1 =header.title + - if [:author, :revnumber, :revdate, :revremark].any? {|a| attr? a } + .details + - if attr? :author + span.author#author =(attr :author) + br + - if attr? :email + span.email#email =sub_macros(attr :email) + br + - if (authorcount = (attr :authorcount).to_i) > 1 + - (2..authorcount).each do |idx| + span.author id="author#{idx}" =(attr "author_#{idx}") + br + - if attr? "email_#{idx}" + span.email id="email#{idx}" =sub_macros(attr "email_#{idx}") + - if attr? :revnumber + span#revnumber #{((attr 'version-label') || '').downcase} #{attr :revnumber}#{',' if attr? :revdate} + ' + - if attr? :revdate + span#revdate =attr :revdate + - if attr? :revremark + br + span#revremark =(attr :revremark) + - if (attr? :toc) && (attr? 'toc-placement', 'auto') + include _toc.html diff --git a/docs/templates/_toc.html.slim b/docs/templates/_toc.html.slim new file mode 100644 index 000000000..f0ad719fe --- /dev/null +++ b/docs/templates/_toc.html.slim @@ -0,0 +1,5 @@ +/ NOTE: You must restart the gradle daemon after modifying any template file for the changes to take effect. +#toc class=(attr 'toc-class', 'toc') + #toctitle =(attr 'toc-title') + / Renders block_outline.html. + = converter.convert document, 'outline' diff --git a/docs/templates/document.html.slim b/docs/templates/document.html.slim new file mode 100644 index 000000000..3e1961d4a --- /dev/null +++ b/docs/templates/document.html.slim @@ -0,0 +1,29 @@ +/ NOTE: You must restart the gradle daemon after modifying any template file for the changes to take effect. +doctype 5 +html lang=(attr :lang, 'en' unless attr? :nolang) + head + meta charset=(attr :encoding, 'UTF-8') + /[if IE] + meta http-equiv="X-UA-Compatible" content="IE=edge" + meta name='viewport' content='width=device-width, initial-scale=1.0' + meta name='generator' content="Asciidoctor #{attr 'asciidoctor-version'}" + = html_meta_if 'application-name', (attr 'app-name') + = html_meta_if 'author', (attr :authors) + = html_meta_if 'copyright', (attr :copyright) + = html_meta_if 'description', (attr :description) + = html_meta_if 'keywords', (attr :keywords) + title=((doctitle sanitize: true) || (attr 'untitled-label')) + = styles_and_scripts + - unless (docinfo_content = docinfo).empty? + =docinfo_content + body( + id=id + class=[(attr :doctype), ("#{attr 'toc-class'} toc-#{attr 'toc-position', 'left'}" if (attr? 'toc-class') && (attr? :toc) && (attr? 'toc-placement', 'auto'))] + style=style_value(max_width: (attr 'max-width'))) + - unless noheader + include _header.html + #content =content + - unless !footnotes? || (attr? :nofootnotes) + include _footnotes.html + - unless nofooter + include _footer.html diff --git a/docs/templates/helpers.rb b/docs/templates/helpers.rb new file mode 100644 index 000000000..7060efe22 --- /dev/null +++ b/docs/templates/helpers.rb @@ -0,0 +1,300 @@ +# NOTE: You must restart the gradle daemon after modifying any template file for the changes to take effect. +require 'asciidoctor' +require 'json' + +if Gem::Version.new(Asciidoctor::VERSION) <= Gem::Version.new('1.5.1') + fail 'asciidoctor: FAILED: HTML5/Slim backend needs Asciidoctor >=1.5.2!' +end + +unless defined? Slim::Include + fail 'asciidoctor: FAILED: HTML5/Slim backend needs Slim >= 2.1.0!' +end + +# Add custom functions to this module that you want to use in your Slim +# templates. Within the template you can invoke them as top-level functions +# just like in Haml. +module Slim::Helpers + + # URIs of external assets. + FONT_AWESOME_URI = '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css' + HIGHLIGHTJS_BASE_URI = '//cdnjs.cloudflare.com/ajax/libs/highlight.js/7.4' + MATHJAX_JS_URI = '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_HTMLorMML' + PRETTIFY_BASE_URI = '//cdnjs.cloudflare.com/ajax/libs/prettify/r298' + + # Defaults + DEFAULT_HIGHLIGHTJS_THEME = 'github' + DEFAULT_PRETTIFY_THEME = 'prettify' + DEFAULT_SECTNUMLEVELS = 3 + DEFAULT_TOCLEVELS = 2 + + # The MathJax configuration. + MATHJAX_CONFIG = { + tex2jax: { + inlineMath: [::Asciidoctor::INLINE_MATH_DELIMITERS[:latexmath]], + displayMath: [::Asciidoctor::BLOCK_MATH_DELIMITERS[:latexmath]], + ignoreClass: 'nostem|nolatexmath' + }, + asciimath2jax: { + delimiters: [::Asciidoctor::BLOCK_MATH_DELIMITERS[:asciimath]], + ignoreClass: 'nostem|noasciimath' + } + }.to_json + + VOID_ELEMENTS = %w(area base br col command embed hr img input keygen link meta param source track wbr) + + + ## + # Creates an HTML tag with the given name and optionally attributes. Can take + # a block that will run between the opening and closing tags. + # + # @param name [#to_s] the name of the tag. + # @param attributes [Hash] + # @param content [#to_s] the content; +nil+ to call the block. + # @yield The block of Slim/HTML code within the tag (optional). + # @return [String] a rendered HTML element. + # + def html_tag(name, attributes = {}, content = nil) + attrs = attributes.reject { |_, v| + v.nil? || (v.respond_to?(:empty?) && v.empty?) + }.map do |k, v| + v = v.compact.join(' ') if v.is_a? Array + v = nil if v == true + v = %("#{v}") if v + [k, v] * '=' + end + attrs_str = attrs.empty? ? '' : attrs.join(' ').prepend(' ') + + if VOID_ELEMENTS.include? name.to_s + %(<#{name}#{attrs_str}>) + else + content ||= yield if block_given? + %(<#{name}#{attrs_str}>#{content}) + end + end + + ## + # Formats the given hash as CSS declarations for an inline style. + # + # @example + # style_value(text_align: 'right', float: 'left') + # => "text-align: right; float: left;" + # + # style_value(text_align: nil, float: 'left') + # => "float: left;" + # + # style_value(width: [90, '%'], height: '50px') + # => "width: 90%; height: 50px;" + # + # style_value(width: ['120px', 'px']) + # => "width: 90px;" + # + # style_value(width: [nil, 'px']) + # => nil + # + # @param declarations [Hash] + # @return [String, nil] + # + def style_value(declarations) + decls = [] + + declarations.each do |prop, value| + next if value.nil? + + if value.is_a? Array + value, unit = value + next if value.nil? + value = value.to_s + unit unless value.end_with? unit + end + prop = prop.to_s.gsub('_', '-') + decls << %(#{prop}: #{value}) + end + + decls.empty? ? nil : decls.join('; ') + ';' + end + + def urlize(*segments) + path = segments * '/' + if path.start_with? '//' + @_uri_scheme ||= document.attr 'asset-uri-scheme', 'https' + path = %(#{@_uri_scheme}:#{path}) unless @_uri_scheme.empty? + end + normalize_web_path path + end + + + ## + # @param index [Integer] the footnote's index. + # @return [String] footnote id to be used in a link. + def footnote_id(index = (attr :index)) + %(_footnote_#{index}) + end + + ## + # @param index (see #footnote_id) + # @return [String] footnoteref id to be used in a link. + def footnoteref_id(index = (attr :index)) + %(_footnoteref_#{index}) + end + + def icons? + document.attr? :icons + end + + def font_icons? + document.attr? :icons, 'font' + end + + def nowrap? + 'nowrap' if !document.attr?(:prewrap) || option?('nowrap') + end + + #-------------------------------------------------------- + # _header + # + + ## + # Constructs a relative path to the target page. + # + # @param href [String] Path to the target page, relative to the site root. + # @return [String] Path to the target page, relative to the current document. + def site_url(href) + path_resolver = (@path_resolver ||= PathResolver.new) + base_dir = path_resolver.posixify(@document.base_dir) + site_root = path_resolver.posixify(@document.attr('site-root', base_dir)) + unless path_resolver.is_root? site_root + raise ::ArgumentError, %(site-root must be an absolute path: #{site_root}) + end + base_dir_to_root = nil + if (base_dir != site_root) && (base_dir.start_with? site_root) + comp, root = path_resolver.partition_path(base_dir.slice(site_root.length + 1, base_dir.length)) + base_dir_to_root = '../' * comp.length + end + path_resolver.web_path(href, base_dir_to_root) + end + + ## + # Constructs a HTML tag representing a link in the navigation bar. + # + # @param section [String] Name of the site section represented by the link. + # This is used to highlight the navigation item if the current document + # sets its site-section attribute to this String, indicating that the + # reader is browsing this section of the site. + # @param href [String] Path to the target page, relative to the site root. + # @param content [String] Link content. This is usually the human-readable name + # of the link target. + # @return [String] The rendered tag. + def nav_link(section, href, content) + attributes = { + :class => ['nav-link'], + :href => site_url(href), + } + attributes[:class].push('active') if (attr 'site-section') == section + html_tag('a', attributes, content) + end + + #-------------------------------------------------------- + # document + # + + ## + # Returns HTML meta tag if the given +content+ is not +nil+. + # + # @param name [#to_s] the name for the metadata. + # @param content [#to_s, nil] the value of the metadata, or +nil+. + # @return [String, nil] the meta tag, or +nil+ if the +content+ is +nil+. + # + def html_meta_if(name, content) + %() if content + end + + # Returns formatted style/link and script tags for header. + def styles_and_scripts + scripts = [] + styles = [] + tags = [] + + stylesheet = attr :stylesheet + stylesdir = attr :stylesdir, '' + default_style = ::Asciidoctor::DEFAULT_STYLESHEET_KEYS.include? stylesheet + linkcss = (attr? :linkcss) || safe >= ::Asciidoctor::SafeMode::SECURE + ss = ::Asciidoctor::Stylesheets.instance + + if linkcss + path = default_style ? ::Asciidoctor::DEFAULT_STYLESHEET_NAME : stylesheet + styles << { href: [stylesdir, path] } + elsif default_style + styles << { text: ss.primary_stylesheet_data } + else + styles << { text: read_asset(normalize_system_path(stylesheet, stylesdir), true) } + end + + if attr? :icons, 'font' + if attr? 'iconfont-remote' + styles << { href: (attr 'iconfont-cdn', FONT_AWESOME_URI) } + else + styles << { href: [stylesdir, %(#{attr 'iconfont-name', 'font-awesome'}.css)] } + end + end + + if attr? 'stem' + scripts << { src: MATHJAX_JS_URI } + scripts << { type: 'text/x-mathjax-config', text: %(MathJax.Hub.Config(#{MATHJAX_CONFIG});) } + end + + case attr 'source-highlighter' + when 'coderay' + if (attr 'coderay-css', 'class') == 'class' + if linkcss + styles << { href: [stylesdir, ss.coderay_stylesheet_name] } + else + styles << { text: ss.coderay_stylesheet_data } + end + end + + when 'pygments' + if (attr 'pygments-css', 'class') == 'class' + if linkcss + styles << { href: [stylesdir, ss.pygments_stylesheet_name(attr 'pygments-style')] } + else + styles << { text: ss.pygments_stylesheet_data(attr 'pygments-style') } + end + end + + when 'highlightjs' + hjs_base = attr :highlightjsdir, HIGHLIGHTJS_BASE_URI + hjs_theme = attr 'highlightjs-theme', DEFAULT_HIGHLIGHTJS_THEME + + scripts << { src: [hjs_base, 'highlight.min.js'] } + scripts << { src: [hjs_base, 'lang/common.min.js'] } + scripts << { text: 'hljs.initHighlightingOnLoad()' } + styles << { href: [hjs_base, %(styles/#{hjs_theme}.min.css)] } + + when 'prettify' + prettify_base = attr :prettifydir, PRETTIFY_BASE_URI + prettify_theme = attr 'prettify-theme', DEFAULT_PRETTIFY_THEME + + scripts << { src: [prettify_base, 'prettify.min.js'] } + scripts << { text: 'document.addEventListener("DOMContentLoaded", prettyPrint)' } + styles << { href: [prettify_base, %(#{prettify_theme}.min.css)] } + end + + styles.each do |item| + if item.key?(:text) + tags << html_tag(:style, {}, item[:text]) + else + tags << html_tag(:link, rel: 'stylesheet', href: urlize(*item[:href])) + end + end + + scripts.each do |item| + if item.key? :text + tags << html_tag(:script, {type: item[:type]}, item[:text]) + else + tags << html_tag(:script, type: item[:type], src: urlize(*item[:src])) + end + end + + tags.join "\n" + end + +end From 5c818add674b86ac39854dddc424a40f62229800 Mon Sep 17 00:00:00 2001 From: Paul Tan Date: Thu, 5 Jul 2018 22:41:03 +0800 Subject: [PATCH 2/2] docs: configure template In the previous commit, we imported the documentation template from AddressBook-Level4. However, the template is still configured for AddressBook-Level4. Let's use our own configuration. --- build.gradle | 4 ++-- docs/DeveloperGuide.adoc | 1 + docs/LearningOutcomes.adoc | 1 + docs/UserGuide.adoc | 1 + docs/templates/_header.html.slim | 8 ++------ 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index fe011a20c..2815873da 100644 --- a/build.gradle +++ b/build.gradle @@ -69,8 +69,8 @@ asciidoctor { idprefix: '', // for compatibility with GitHub preview idseparator: '-', 'site-root': "${sourceDir}", // must be the same as sourceDir, do not modify - 'site-name': 'AddressBook-Level4', - 'site-githuburl': 'https://github.com/se-edu/addressbook-level4', + 'site-name': 'AddressBook-Level3', + 'site-githuburl': 'https://github.com/se-edu/addressbook-level3', 'site-seedu': true, // delete this line if your project is not a fork (not a SE-EDU project) ] diff --git a/docs/DeveloperGuide.adoc b/docs/DeveloperGuide.adoc index 69425f746..e34ed69a1 100644 --- a/docs/DeveloperGuide.adoc +++ b/docs/DeveloperGuide.adoc @@ -1,4 +1,5 @@ = Developer Guide +:site-section: DeveloperGuide :toc: :toc-title: :imagesDir: images diff --git a/docs/LearningOutcomes.adoc b/docs/LearningOutcomes.adoc index 08609acd6..afb9bf211 100644 --- a/docs/LearningOutcomes.adoc +++ b/docs/LearningOutcomes.adoc @@ -1,4 +1,5 @@ = Learning Outcomes +:site-section: LearningOutcomes :toc: macro :toc-title: :toclevels: 1 diff --git a/docs/UserGuide.adoc b/docs/UserGuide.adoc index 5b955c0d0..7e4858342 100644 --- a/docs/UserGuide.adoc +++ b/docs/UserGuide.adoc @@ -1,4 +1,5 @@ = User Guide +:site-section: UserGuide :imagesDir: images :stylesDir: stylesheets ifdef::env-github[] diff --git a/docs/templates/_header.html.slim b/docs/templates/_header.html.slim index 1995d26a1..e2a19efaa 100644 --- a/docs/templates/_header.html.slim +++ b/docs/templates/_header.html.slim @@ -11,9 +11,9 @@ li.nav-item a.nav-link href='https://se-edu.github.io/addressbook-level2' AB-2 li.nav-item - a.nav-link href='https://se-edu.github.io/addressbook-level3' AB-3 + a.nav-link.active href=(site_url 'index.html') AB-3 li.nav-item - a.nav-link.active href=(site_url 'index.html') AB-4 + a.nav-link href='https://se-edu.github.io/addressbook-level4' AB-4 li.nav-item a.nav-link href='https://se-edu.github.io/collate' Collate li.nav-item @@ -35,10 +35,6 @@ - if attr? 'site-seedu' li.nav-item =nav_link('LearningOutcomes', 'LearningOutcomes.html', 'LOs') - li.nav-item - =nav_link('AboutUs', 'AboutUs.html', 'About Us') - li.nav-item - =nav_link('ContactUs', 'ContactUs.html', 'Contact Us') - if attr? 'site-githuburl' li.navitem a.nav-link href=(attr 'site-githuburl')