Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

달력 draw를 for문 형태로 바꾸어보기. #139

Open
khw7096 opened this issue Jan 1, 2020 · 2 comments
Open

달력 draw를 for문 형태로 바꾸어보기. #139

khw7096 opened this issue Jan 1, 2020 · 2 comments

Comments

@khw7096
Copy link
Collaborator

khw7096 commented Jan 1, 2020

No description provided.

@khw7096
Copy link
Collaborator Author

khw7096 commented Jan 1, 2020

실행시켜보지는 않았지만 아래처럼 수정할 수 있지 않을까요?

{{range $i, $d := .Dates}}
    <div id="{{$i}}" value="{{$d}}" class="col cell cell-top-left">{{onlyDate $d}}</div>
{{end}}

오 이렇게도 쓸 수 있겠네요..
근데 7번에 한 번씩 줄을 바꿔줘야하는데 그걸 어떻게 해야할지 감이 잘 안와요

@khw7096
Copy link
Collaborator Author

khw7096 commented Jan 1, 2020

mod라는 함수 생성하고 템플릿에서는 아래처럼 쓰면 될 것 같아요.

{{if eq (mod $i 7) 6}}<br>{{end}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant