From 0b30289d9f3520144bb37caa009d8953cde0e3d6 Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Mon, 22 Apr 2019 19:17:39 +0200 Subject: [PATCH] #43, Update tree menu rendering to support multiple sections --- README.md | 4 +- assets/_markdown.scss | 11 +-- assets/book.scss | 13 ++++ exampleSite/config.yml | 2 +- exampleSite/content/docs/_index.md | 4 + .../content/docs/fida-abluere/_index.md | 42 ++++++++++ .../content/docs/fida-abluere/ego-numen.md | 60 ++++++++++++++ .../content/docs/fida-abluere/natusque.md | 48 ++++++++++++ ...s_48b060fe05b0a273d182ef83c0605941.content | 2 +- ...scss_48b060fe05b0a273d182ef83c0605941.json | 2 +- layouts/home.html | 4 +- layouts/partials/docs/git-footer.html | 2 +- layouts/partials/docs/menu-bundle.html | 5 +- layouts/partials/docs/menu-filetree.html | 78 +++++++++++-------- layouts/partials/docs/menu.html | 6 +- layouts/partials/docs/shared.html | 25 +++--- layouts/posts/list.html | 6 +- layouts/posts/single.html | 4 +- 18 files changed, 249 insertions(+), 69 deletions(-) create mode 100644 exampleSite/content/docs/_index.md create mode 100644 exampleSite/content/docs/fida-abluere/_index.md create mode 100644 exampleSite/content/docs/fida-abluere/ego-numen.md create mode 100644 exampleSite/content/docs/fida-abluere/natusque.md diff --git a/README.md b/README.md index 0949434..f619100 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ git submodule add https://github.com/alex-shpak/hugo-book themes/book Then run hugo (or set `theme: book` in configuration file) ``` -hugo server --theme book +hugo server --minify --theme book ``` ### Creating site from scratch @@ -38,7 +38,7 @@ git submodule add https://github.com/alex-shpak/hugo-book themes/book cp -R themes/book/exampleSite/content . ``` ```sh -hugo server --theme book +hugo server --minify --theme book ``` ## Menu diff --git a/assets/_markdown.scss b/assets/_markdown.scss index fc8119c..8c4a1fa 100644 --- a/assets/_markdown.scss +++ b/assets/_markdown.scss @@ -5,14 +5,15 @@ $block-border-radius: 0.15rem; .markdown { line-height: 1.7; - > :first-child { - margin-top: 0; - line-height: 1em; - } - h1, h2, h3, h4, h5 { font-weight: 400; line-height: 1.25; + + // remove padding at the beginning of page + &:first-child { + margin-top: 0; + line-height: 1em; + } } b, optgroup, strong { diff --git a/assets/book.scss b/assets/book.scss index 7ba2bfa..83728a0 100644 --- a/assets/book.scss +++ b/assets/book.scss @@ -106,6 +106,18 @@ ul.pagination { @include dark-links; } +.book-section-flat { + margin-bottom: $padding-16 * 2; + + > a, > span { + font-weight: 600 + } + + > ul { + padding-left: 0; + } +} + .book-page { min-width: $body-min-width; flex-grow: 1; @@ -213,6 +225,7 @@ aside nav, // Extra space for big screens @media screen and (min-width: $container-max-width) { .book-page, + .book-posts, .book-menu nav, .book-toc nav { padding: $padding-16 * 2 $padding-16; diff --git a/exampleSite/config.yml b/exampleSite/config.yml index da11e14..b4f1b3c 100644 --- a/exampleSite/config.yml +++ b/exampleSite/config.yml @@ -1,4 +1,4 @@ -# hugo server --themesDir ... --baseURL=http://0.0.0.0:1313/example +# hugo server --minify --themesDir ... --baseURL=http://0.0.0.0:1313/example baseURL: https://example.com/ title: Hugo Book diff --git a/exampleSite/content/docs/_index.md b/exampleSite/content/docs/_index.md new file mode 100644 index 0000000..cb314c0 --- /dev/null +++ b/exampleSite/content/docs/_index.md @@ -0,0 +1,4 @@ +--- +weight: 1 +bookFlatSection: true +--- diff --git a/exampleSite/content/docs/fida-abluere/_index.md b/exampleSite/content/docs/fida-abluere/_index.md new file mode 100644 index 0000000..0255f6d --- /dev/null +++ b/exampleSite/content/docs/fida-abluere/_index.md @@ -0,0 +1,42 @@ +# Fida abluere audiat moram ferarum terram virgae + +## Facere fluidove ab naides ut sic cornu + +Lorem markdownum Lucifer est, ire tangit inposito terram. Ore et pes lavet nuper +longam, longa sub, erat nec Lemnicolae, in. +[Et](http://sumparvi.org/ossaquerecludit) nec tantaque sollicitive cognovi et ut +videbar verso **passis**, Epimethida tutos. Dedecus Desine morae. + +Fervens esse et tenet cinisque per: et vir equus formaque superorum tollit, +vires meae magnum; Latona. Fundamine potitur genialis: imagine gaudet et herba +rura vates horrendum, laborum quis: potero aureus habitantque illos nox? E +factorum breve ad in verum Euboea templis volitat pompa aureus pallebant +videres, replet inque color? Capit et bipennem Finis sonuere magno nec pennis +exhortatur tenebat, ait. + +## Gurgite caede Hippocoon auxilio furit + +Freta amatos. [Saxum](http://horas-pericula.net/inprudens.php) vocanti Iovem sui +quicquam viro linguae minus, ara nec tu ipsa ars miserae, quam tetigit vacet +inque. Fuistis Deucalion, populi invidiae *indicat texere est* Helicon simul. + +1. Hominum quantaque membra duos +2. Domum tela +3. Totus penna +4. Charaxi cogitis Hoc caelo est removit Anubis +5. Simulacra Delo posset insula +6. Infelix et nox fixa adhuc + +## Trabes per coercet mittere toro + +Cerae movit: patria quid, Alpheias **magicaeque** puer! Cum venit quidem, sors +erigor coniunctis sparsa carpe periuria in vultu temperat gradibus. Tutus +fecimus, caput; flamma mentis retia fuit Pallas. + +> Arbore et agitasse partes patrem dumque ab, nec infans, sollemnia summis +> resque, de malles ille? Ultor fugaverat nemus, quaerenti nolle coniugis +> manibus contraque pace. Fuit verba ipse ignavi vulnus. Nam illud *inferius* +> iuvenale iuncta tandem. + +Deus hostia Peneidas ad passu in venerat postes +[nymphae](http://ullo-herbae.org/). Sagittis tabo sibi marmoreum. \ No newline at end of file diff --git a/exampleSite/content/docs/fida-abluere/ego-numen.md b/exampleSite/content/docs/fida-abluere/ego-numen.md new file mode 100644 index 0000000..a56cee0 --- /dev/null +++ b/exampleSite/content/docs/fida-abluere/ego-numen.md @@ -0,0 +1,60 @@ +# Ego numen obest + +## Mors curru Iove pedibus curva humano salutem + +Lorem markdownum, mole, profugus. Madida ne quantus, pars verba lacrimis +memorique longius cupidi ipse attrahit et. Vota liberiore rector suos fallit +videor iustissimus barbara quod habet. Tantum patriaeque *omnia spectes* inimica +mari nec spemque ululare: nuper quodque, sic, quo. + + var php_wireless = 4; + siteWinsock.switch_inbox += so_control_logic; + if (target_website.bugCopyrightIcs.cms_digital_method(mca_active) > + cloneScrollHttps) { + https_drop_hard(97, sshPayload + autoresponder_bmp_file); + hypertextCommercialBookmark = optical_impact; + } + architecture = userRate.unfriend(petabyteFile(irc, wave, + logic_tag.impact.cookie_favorites(5, 83)), listserv, malware_cad( + disk)); + +Populi annum deprendere suae recumbis in sedem starent! Super non accedat +percepitque negare inconcessisque habitare: puerum: picta. Haec natamque, in +rubentem auctore quantas oetaeas **certamine** levatae sollicitumque mecum vultu +obstructaque. Limina subtemen qui trepidare virgine! Enim rumor paenituit haec +**crimine Melampus** sidus. + +## Partem robora herbae ilice hic exspectatus tepidique + +Heu fugit carne, illo ex Iunonis ut tempora sacrata, adhaesi. Fallunt eque +amnes! + +1. Vile ille res sidera gaudebat felicia auxilium +2. Sacra curam adfusique vasti progenitore omnia nutantem +3. Quod notum spesque extentam fores in voces +4. In qualia aequo +5. Auro commoda +6. Mearum huic volucres locorum formosus + +## Invidiae fidemque cogamque esset potentia Minos + +Sub silicem, semesaque nec, pone pariterque tendentem, in pactae suarum recurvas +et contra tu minister via. Subducere tangeris neque coniunxque utque. Virga +altam, mortemque: **ubi** procul, et vidi committit. Et +[Alpheos](http://nivea-pavens.io/ferroclara.html)! Perfide age magna per aequor +abstulerat, Boeotia sentit succincta ad linquit confugisse certae, de dignatur +et! + +> Sic nacta saxo *crura*, iustis rorantia premens tempora lecte sumpsisse +> nusquam ulvam, apta! Sed sub plumas consueta quae; tibi mihi nec committi +> mundi? + +Ipsa dea serpentum illic; aspicit reticere Aeaciden mitto; est novis exul. +Invidit senior vela, cava sed plumae vident ille ipse domo litus ac fallere +lumina, nisi famem cycno. + +Nunc miserata admisitque [nata](http://mollibus.net/secessitnostrique), cum +loco, **iacerent**, te medullas matres. Fraude tamen, prorumpit puerum primo +polus regalia pampineis iungunt nec, aderis replent carituraque cervus. +Primusque lapides ad inpia pedibus; non fare praeterit penetralia in pedum uror. +Rapitur vivis lacrimis, vena et *dixit*. \ No newline at end of file diff --git a/exampleSite/content/docs/fida-abluere/natusque.md b/exampleSite/content/docs/fida-abluere/natusque.md new file mode 100644 index 0000000..1416586 --- /dev/null +++ b/exampleSite/content/docs/fida-abluere/natusque.md @@ -0,0 +1,48 @@ +# Natusque putat tu vero + +## Scylaceaque neve coepisse + +Lorem markdownum hostem et addit arbusta iacuit laetissimus medio, quae quoque +faciente. Belli et fuerant fuerat, curas Abas equos sacerdos iactasque videndo +tanto, sub. Et simulasse caedis, est nec acre addiderat, manet Phrygiae +quisquam, ater, aura sua **deique cornua**. Bacchi *dixi* cum tollit, ad +sinistra mirum, non se dis fraudare in decimo vocet. Ducunt **Acrisio sine +ratem**: enim illas venti, ferit nam ora. + +> Crescente cernis ritusque et vertice potui, fugam conferat enim, quin te Iuno, +> Calydonia! Cursum est suo lassant quam cutis virgo urbe illa auras, finem. +> [Trabem est](http://www.tutus.io/) secedere Bybli laudant quercus tribuitque +> relinque et cornua ora, et quoniam maledicere viscera caelobracchia omne hoc. +> Metaque Arcas patet *intraverat tenet*. + +Silvisque primae tulisset sive sonuere, incola visa veniat temptantes spernimur +et dictis se. Sub gerunt. Aqua [tantum templi](http://www.dextra.net/) +peregrinis ut *aevo cuique* falsi, ibat avidae transitus. + +## Modo auctor imbres est + +Clanis cernere monstravit illic quoque, in ignis male una deme? Alta sonanti +relatus Pindo: nisi Pico edidit data tamen rurigenae avoque. Quotiens vela petis +inposuit et parte utque, tempus pars contendere facturus tumidus. Flores +culpavit fera retinens, vita puer publica ferebat positas. + + if (mashupTopologyMnemonic(70) >= domain_correction_schema) { + romTeraflops = log_android; + mms_vrml_alignment(keyboard, oop, computerCodec); + } + retina_samba_arp *= desktop_itunes_mainframe(leopard, 511935) * 88 / + direct_excel(-3, infringement_bespoke_apache, cmyk); + drivePowerPlay.registryAix += dma; + text_data.upsOdbc = error(user(processor_token_forum) * art_ajax_ldap); + +Patriaque volvitur scire Naryciusque iuvenem dixit adfusique bicorni cupido. +Tecumque corpore sublato, mox hostibus et muneris, non. Draconum noscit dapibus +scopulis spondere lupum diro, illo ille victoque cibis; umentia spes. + +Alumno est postquam gracili adnuimusque ore est praemia, ulla patitur: te disce +erat cruribus prosunt. Arboris illis neque, et erubuit Gallicus: iam remisit +adimuntque adsuerat nolit attonitus! Torvamque sensi ut fecundo fortuna bracchia +fuerant, semper de manet inseris. + +Ictibus in cursus in, in isque Polyxena et Solis oris pressa exclamat *in tori* +lactente. [Locoque](http://est.net/et.html) iam fata Stygia lege transire. \ No newline at end of file diff --git a/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.content b/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.content index bb69581..6a1f689 100644 --- a/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.content +++ b/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.content @@ -1 +1 @@ -.markdown{line-height:1.7}.markdown>:first-child{margin-top:0;line-height:1em}.markdown h1,.markdown h2,.markdown h3,.markdown h4,.markdown h5{font-weight:400;line-height:1.25}.markdown b,.markdown optgroup,.markdown strong{font-weight:700}.markdown a{text-decoration:none}.markdown a:hover{text-decoration:underline}.markdown code{font-family:oxygen mono,monospace;padding:0 .25rem;background:#f8f9fa;border-radius:.15rem}.markdown pre{padding:1rem;background:#f8f9fa;border-radius:.15rem;font-size:.875rem;overflow-x:auto}.markdown blockquote{border-left:2px solid #dee2e6;margin:0;padding:1px 1rem}.markdown blockquote :first-child{margin-top:0}.markdown blockquote :last-child{margin-bottom:0}.markdown table{border-spacing:0;border-collapse:collapse}.markdown table tr th,.markdown table tr td{padding:.5rem 1rem;line-height:1;border:1px solid #e9ecef}.markdown table tr:nth-child(2n){background:#f8f9fa}.flex{display:flex}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.align-center{align-items:center}.mx-auto{margin:0 auto}.mr-auto{margin-right:auto}.hide{display:none}html{font-size:16px;letter-spacing:.33px;scroll-behavior:smooth}html,body{min-width:20rem;overflow-x:hidden}body{color:#343a40;background:#fff;font-family:oxygen,sans-serif;font-weight:400;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}body *{box-sizing:inherit}h1,h2,h3,h4,h5{font-weight:400}a{text-decoration:none;color:#004ed0}a:visited{color:#8440f1}img{vertical-align:middle}aside nav ul{padding:0;margin:0;list-style:none}aside nav ul li{margin:1em 0}aside nav ul a{display:block}aside nav ul a:hover{opacity:.5}aside nav ul ul{padding-left:1rem}ul.pagination{display:flex;justify-content:center}ul.pagination .page-item a{padding:1rem}.container{max-width:80rem;margin:0 auto}.book-brand{margin-top:0}.book-menu{flex:0 0 16rem;font-size:.875rem}.book-menu nav{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-menu a{color:#343a40}.book-menu a.active{color:#004ed0}.book-page{min-width:20rem;flex-grow:1;padding:1rem}.book-header{margin-bottom:1rem;display:none}.book-toc{flex:0 0 14rem;font-size:.75rem}.book-toc nav{width:14rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-toc nav>ul>li{margin:0}.book-git-footer{display:flex;margin-top:1rem;font-size:.875rem;align-items:baseline}.book-git-footer img{width:.875rem;vertical-align:bottom}.book-footer{display:flex;margin-top:1rem;font-size:.875rem;align-items:baseline}.book-footer img{width:.875rem;vertical-align:bottom}.book-posts{min-width:20rem;max-width:41rem;flex-grow:1;padding:1rem}.book-posts article{padding-bottom:1rem}aside nav,.book-page,.book-posts,.markdown{transition:.2s ease-in-out;transition-property:transform,margin-left,opacity;will-change:transform,margin-left}@media screen and (max-width:55rem){.book-toc{display:none}}@media screen and (max-width:41rem){.book-menu{margin-left:-16rem}.book-header{display:flex}#menu-control:checked+main .book-menu nav,#menu-control:checked+main .book-page,#menu-control:checked+main .book-posts{transform:translateX(16rem)}#menu-control:checked+main .book-header label{transform:rotate(90deg)}#menu-control:checked+main .markdown{opacity:.25}}@media screen and (min-width:80rem){.book-page,.book-menu nav,.book-toc nav{padding:2rem 1rem}} \ No newline at end of file +.markdown{line-height:1.7}.markdown h1,.markdown h2,.markdown h3,.markdown h4,.markdown h5{font-weight:400;line-height:1.25}.markdown h1:first-child,.markdown h2:first-child,.markdown h3:first-child,.markdown h4:first-child,.markdown h5:first-child{margin-top:0;line-height:1em}.markdown b,.markdown optgroup,.markdown strong{font-weight:700}.markdown a{text-decoration:none}.markdown a:hover{text-decoration:underline}.markdown code{font-family:oxygen mono,monospace;padding:0 .25rem;background:#f8f9fa;border-radius:.15rem}.markdown pre{padding:1rem;background:#f8f9fa;border-radius:.15rem;font-size:.875rem;overflow-x:auto}.markdown blockquote{border-left:2px solid #dee2e6;margin:0;padding:1px 1rem}.markdown blockquote :first-child{margin-top:0}.markdown blockquote :last-child{margin-bottom:0}.markdown table{border-spacing:0;border-collapse:collapse}.markdown table tr th,.markdown table tr td{padding:.5rem 1rem;line-height:1;border:1px solid #e9ecef}.markdown table tr:nth-child(2n){background:#f8f9fa}.flex{display:flex}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.align-center{align-items:center}.mx-auto{margin:0 auto}.mr-auto{margin-right:auto}.hide{display:none}html{font-size:16px;letter-spacing:.33px;scroll-behavior:smooth}html,body{min-width:20rem;overflow-x:hidden}body{color:#343a40;background:#fff;font-family:oxygen,sans-serif;font-weight:400;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}body *{box-sizing:inherit}h1,h2,h3,h4,h5{font-weight:400}a{text-decoration:none;color:#004ed0}a:visited{color:#8440f1}img{vertical-align:middle}aside nav ul{padding:0;margin:0;list-style:none}aside nav ul li{margin:1em 0}aside nav ul a{display:block}aside nav ul a:hover{opacity:.5}aside nav ul ul{padding-left:1rem}ul.pagination{display:flex;justify-content:center}ul.pagination .page-item a{padding:1rem}.container{max-width:80rem;margin:0 auto}.book-brand{margin-top:0}.book-menu{flex:0 0 16rem;font-size:.875rem}.book-menu nav{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-menu a{color:#343a40}.book-menu a.active{color:#004ed0}.book-section-flat{margin-bottom:2rem}.book-section-flat>a,.book-section-flat>span{font-weight:600}.book-section-flat>ul{padding-left:0}.book-page{min-width:20rem;flex-grow:1;padding:1rem}.book-header{margin-bottom:1rem;display:none}.book-toc{flex:0 0 14rem;font-size:.75rem}.book-toc nav{width:14rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-toc nav>ul>li{margin:0}.book-git-footer{display:flex;margin-top:1rem;font-size:.875rem;align-items:baseline}.book-git-footer img{width:.875rem;vertical-align:bottom}.book-footer{display:flex;margin-top:1rem;font-size:.875rem;align-items:baseline}.book-footer img{width:.875rem;vertical-align:bottom}.book-posts{min-width:20rem;max-width:41rem;flex-grow:1;padding:1rem}.book-posts article{padding-bottom:1rem}aside nav,.book-page,.book-posts,.markdown{transition:.2s ease-in-out;transition-property:transform,margin-left,opacity;will-change:transform,margin-left}@media screen and (max-width:55rem){.book-toc{display:none}}@media screen and (max-width:41rem){.book-menu{margin-left:-16rem}.book-header{display:flex}#menu-control:checked+main .book-menu nav,#menu-control:checked+main .book-page,#menu-control:checked+main .book-posts{transform:translateX(16rem)}#menu-control:checked+main .book-header label{transform:rotate(90deg)}#menu-control:checked+main .markdown{opacity:.25}}@media screen and (min-width:80rem){.book-page,.book-posts,.book-menu nav,.book-toc nav{padding:2rem 1rem}} \ No newline at end of file diff --git a/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.json b/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.json index 5b94fca..ebd93db 100644 --- a/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.json +++ b/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.json @@ -1 +1 @@ -{"Target":"book.min.10fb0ad8a0ad8e88648d3207b12be2833cd3df8a6e3b0955cbe49dc7fba8541c.css","MediaType":"text/css","Data":{"Integrity":"sha256-EPsK2KCtjohkjTIHsSvigzzT34puOwlVy+Sdx/uoVBw="}} \ No newline at end of file +{"Target":"book.min.fc91edf4e8d8e3b37416a60d5c7b6dea3f9f8385de9de634d1e8b44e9a1eece1.css","MediaType":"text/css","Data":{"Integrity":"sha256-/JHt9OjY47N0FqYNXHtt6j+fg4XeneY00ei0Tpoe7OE="}} \ No newline at end of file diff --git a/layouts/home.html b/layouts/home.html index d2db819..bf76fc7 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -6,7 +6,7 @@ {{ partial "docs/html-head" . }} {{ partial "docs/inject/head" . }} -{{- $content := ` +{{ $content := ` # Hugo Book Theme This is a placeholder for home page. @@ -14,7 +14,7 @@ You can override this page in: - `/content/_index.md` - `/layouts/home.html` -` -}} +` }}
diff --git a/layouts/partials/docs/git-footer.html b/layouts/partials/docs/git-footer.html index 4b2f44d..001c9ff 100644 --- a/layouts/partials/docs/git-footer.html +++ b/layouts/partials/docs/git-footer.html @@ -2,7 +2,7 @@