Merge branch 'exercise' of https://github.com/ROOMrepair/website into exercise

This commit is contained in:
ROOMrepair 2024-10-31 12:59:21 +08:00
commit 064e929cf0
4 changed files with 0 additions and 227 deletions

View File

@ -156,13 +156,6 @@
{{ end }}
</div>
</div>
<<<<<<< HEAD
<<<<<<< HEAD
=======
=======
<!-- DEBUG {{ partial "page_navigate" (dict "context" . "prev" true)}} -->
>>>>>>> 701c81afc (尝试修复上下页跳转混乱和 hover 文档错误)
{{ if .IsPage }}
<!-- <div class="page-div common-flex-layout"> -->
@ -172,10 +165,6 @@
{{ end }}
<div></div>
<<<<<<< HEAD
>>>>>>> b5c946198 (fix: try to fix page navigation)
=======
>>>>>>> 701c81afc (尝试修复上下页跳转混乱和 hover 文档错误)
</div>
{{ if .IsPage }}
<div class="aside">

View File

@ -156,17 +156,6 @@
<p class="msg-thank">{{ i18n "Msg-Thank" }}</p>
</div>
</div>
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> b5c946198 (fix: try to fix page navigation)
{{ if .IsPage }}
=======
>>>>>>> 701c81afc (尝试修复上下页跳转混乱和 hover 文档错误)
<!-- DEBUG {{ partial "page_navigate" (dict "context" . "prev" true)}} -->
{{ if .IsPage }}
<!-- <div class="page-div common-flex-layout"> -->

View File

@ -1,4 +1,3 @@
<<<<<<< HEAD
{{ $current := .context }}
<!-- choose different bottom up step -->
@ -19,240 +18,56 @@
{{ if .prev }}
{{ $first := index $p_section 0}}
<!-- if is first section,we need to bottom up -->
{{ if $current.InSection $first.CurrentSection }}
=======
<!-- !!! todo combine the logic of check ispage and isindex , too many duplicate codes !!! -->
{{ $current := .context }}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: blue;">gcurrent {{ $current }}</div> -->
<!-- is page -->
{{ if $current.IsPage}}
{{ $g_parent := $current.Parent.Parent }}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: blue;">
{{ $g_parent}}--{{$g_parent.FirstSection }}
{{ $g_parent.InSection $g_parent.FirstSection }}
</div> -->
<!-- important! here we need call .Pages to include both pure page and _index -->
{{ $p_section := $g_parent.Pages.ByWeight }}
{{ $length := len $p_section }}
<!-- page prev -->
{{ if .prev }}
{{ $first := index $p_section 0}}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
first {{ $first }} <br>
first section {{ $first.CurrentSection }} <br>
current section {{ $current.CurrentSection }}
</div> -->
<!-- check if is already the first section (为第二级目录的第一个 section) -->
<!-- if is first section,we need to bottom up -->
{{ if $current.InSection $first.CurrentSection }}
<!--DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
prev true
</div> -->
>>>>>>> 701c81afc (尝试修复上下页跳转混乱和 hover 文档错误)
<!-- bottom up -->
{{ partial "page_navigate" (dict "context" $g_parent "prev" true)}}
<!--if not the first section just go to pre section last page (last page of pre section of p_section)-->
{{else}}
<<<<<<< HEAD
=======
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
prev false
</div> -->
>>>>>>> 701c81afc (尝试修复上下页跳转混乱和 hover 文档错误)
<!-- find current page's section position -->
{{ $curIndex := 0 }}
{{ range $i, $p_sec := $p_section}}
<<<<<<< HEAD
=======
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: green;">
gparent_section {{ . }}
</div> -->
>>>>>>> 701c81afc (尝试修复上下页跳转混乱和 hover 文档错误)
{{ if eq $p_sec $current.CurrentSection}}
{{ $curIndex = $i }}
{{ end }}
{{ end }}
<<<<<<< HEAD
=======
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: pink;">
{{ $curIndex }}
</div> -->
>>>>>>> 701c81afc (尝试修复上下页跳转混乱和 hover 文档错误)
{{ $prevPage := index $p_section (sub $curIndex 1) }}
{{ partial "findLastInSection" $prevPage}}
{{ end }} <!-- close of check page prev bottom up -->
<<<<<<< HEAD
<!-- SECTION1 -->
=======
>>>>>>> 701c81afc (尝试修复上下页跳转混乱和 hover 文档错误)
<!-- page next -->
{{ else }}
<<<<<<< HEAD
<!-- SECTION2 -->
{{ $last := index $p_section (sub $length 1)}}
<!-- if is last section,we need to bottom up -->
{{ if $current.InSection $last.CurrentSection }}
=======
{{ $last := index $p_section (sub $length 1)}}
<!--DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
last {{ $last }} <br>
last section {{ $last.CurrentSection }} <br>
current section {{ $current.CurrentSection }}
</div> -->
<!-- if is last section,we need to bottom up -->
{{ if $current.InSection $last.CurrentSection }}
<!--DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
next true
</div> -->
>>>>>>> 701c81afc (尝试修复上下页跳转混乱和 hover 文档错误)
<!-- bottom up -->
{{ partial "page_navigate" (dict "context" $g_parent "prev" false)}}
<!--if not the last section just go to next section -->
{{ else }}
<<<<<<< HEAD
{{ $curIndex := 0 }}
{{ range $i, $p_sec := $p_section}}
=======
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
next false
</div> -->
{{ $curIndex := 0 }}
{{ range $i, $p_sec := $p_section}}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: green;">
gparent_section {{ . }}
</div> -->
>>>>>>> 701c81afc (尝试修复上下页跳转混乱和 hover 文档错误)
{{ if eq $p_sec $current.CurrentSection}}
{{ $curIndex = $i }}
{{ end }}
{{ end }}
<<<<<<< HEAD
=======
<!--DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: pink;">
{{ $curIndex }}
</div> -->
>>>>>>> 701c81afc (尝试修复上下页跳转混乱和 hover 文档错误)
{{ $nextPage := index $p_section (add $curIndex 1) }}
{{ partial "findFirstInSection" $nextPage}}
<<<<<<< HEAD
{{ end }} <!-- close of check next bottom up -->
<!-- SECTION2 -->
{{ end }}
=======
{{ end }} <!-- close of check page next bottom up -->
{{ end }} <!-- close of page prev next-->
<!-------------------------------------------------------------------->
<!-- is Index -->
{{ else }}
{{ $g_parent := $current.Parent}}
{{ $p_section := $g_parent.Pages.ByWeight }}
{{ $length := len $p_section }}
<!-- index prev -->
{{ if .prev}}
{{ $first := index $p_section 0}}
<!--DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: blue;">
{{ $g_parent}}--{{$g_parent.FirstSection }}
index {{ $g_parent.InSection $g_parent.FirstSection }} <br>
index first {{ $first}}
</div> -->
<!-- keep bottom up -->
{{ if $current.InSection $first.CurrentSection }}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
index true
</div> -->
{{ partial "page_navigate" (dict "context" $g_parent "prev" true)}}
<!-- find current index's section position -->
{{ else }}
{{ $curIndex := 0 }}
{{ range $i, $p_sec := $p_section}}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: green;">
gparent_section {{ . }}
</div> -->
{{ if eq $p_sec $current.CurrentSection}}
{{ $curIndex = $i }}
{{ end }}
{{ end }}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: pink;">
{{ $curIndex }}
</div> -->
{{ $prevPage := index $p_section (sub $curIndex 1) }}
{{ partial "findLastInSection" $prevPage}}
{{ end }} <!-- close of check index prev bottom up -->
<!-- index next -->
{{ else }}
{{ $last := index $p_section (sub $length 1)}}
<!-- if is last section,we need to bottom up -->
{{ if $current.InSection $last.CurrentSection }}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
next true
</div> -->
<!-- bottom up -->
{{ partial "page_navigate" (dict "context" $g_parent "prev" false)}}
<!--if not the last section just go to next section -->
{{ else }}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
next false
</div> -->
{{ $curIndex := 0 }}
{{ range $i, $p_sec := $p_section}}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: green;">
gparent_section {{ . }}
</div> -->
{{ if eq $p_sec $current.CurrentSection}}
{{ $curIndex = $i }}
{{ end }}
{{ end }}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: pink;">
{{ $curIndex }}
</div> -->
{{ $nextPage := index $p_section (add $curIndex 1) }}
{{ partial "findFirstInSection" $nextPage}}
{{ end }} <!-- close of check index next bottom up -->
{{ end }} <!-- close of index prev next-->
{{ end }}
>>>>>>> 701c81afc (尝试修复上下页跳转混乱和 hover 文档错误)

View File

@ -1,8 +1,3 @@
<<<<<<< HEAD
=======
<!-- {{ partial "page_navigate" (dict "context" . "prev" false)}} -->
>>>>>>> 701c81afc (尝试修复上下页跳转混乱和 hover 文档错误)
<div class="page-div common-flex-layout">
<!-- if not each page in a section is pure page we can't simply use prev/nextInsection -->
{{ $current := .}}
@ -13,26 +8,11 @@
<!-- find current page's section position -->
{{ $curIndex := 0 }}
{{ range $i, $p_sec := $p}}
<<<<<<< HEAD
=======
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: darkblue;">
gparent_section {{ $p_sec }}
</div> -->
>>>>>>> 701c81afc (尝试修复上下页跳转混乱和 hover 文档错误)
{{ if eq $p_sec $current}}
{{ $curIndex = $i }}
{{ end }}
{{ end }}
<<<<<<< HEAD
=======
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: pink;">
cur {{ $current }}
{{ $curIndex }}
</div> -->
>>>>>>> 701c81afc (尝试修复上下页跳转混乱和 hover 文档错误)
<!-- prev -->
{{ if gt $curIndex 0}}