0. spring rest docs 설정 (maven or gradle)
1. 테스트 코드(org.springframework.restdocs..... 사용) 작성 후 실행
- > 테스트 성공하면 설정한 위치에 snippets 파일들 ( .adoc) 생성됨
2. pdf문서로 만들 api_list.adoc 파일 작성
3. api_list.adoc 파일에서 asciidoc plugin을 이용해서 pdf로 변환
-> 한글이 네모로 깨져서 변환된다.
4. 참고로 DOCS, HTML로 변환 시에는 한글이 깨지지 않았음
5. intellij - asciidocs을 이용해서 Show Privew(그림표시) 했을 때에는 한글도 잘 출력됨
6. 해결방법
- ruby를 이용해 asciidoc-pdf를 설치해 사용
1) ruby 설치
https://rubyinstaller.org/downloads/
- 명령 프롬프트에서 enter 입력
2) cmd창에서 버전 확인
ruby -v
gem -v
3) jekyll bundler 설치 및 버전 확인
gem install jekyll bundler
jekyll -v
4) asciidoctor-pdf 설치 및 환경 변수 설정, 버전 확인
gem install asciidoctor-pdf
C:\Ruby31\bin
C:\Users\tester\.local\share\gem\ruby\3.1.0\gems\asciidoctor-pdf-2.3.9\bin
5) asciidoc - pdf 폰트 변환
5-1) fonts 폴더에 폴트 파일 넣기
C:\Users\jjj\.local\share\gem\ruby\3.1.0\gems\asciidoctor-pdf-2.3.9\data\fonts
5-2) 폰트 설정
C:\Users\jjj\.local\share\gem\ruby\3.1.0\gems\asciidoctor-pdf-2.3.9\data\themes
default-theme.yml 파일의 Noto Serif, M+ 1mn에 아래 처럼 한글 파일 설정
font:
catalog:
# Noto Serif supports Latin, Latin-1 Supplement, Latin Extended-A, Greek, Cyrillic, Vietnamese & an assortment of symbols
Noto Serif:
normal: GEM_FONTS_DIR/KaiGenGothicKR-Regular.ttf
bold: GEM_FONTS_DIR/KaiGenGothicKR-Bold.ttf
italic: GEM_FONTS_DIR/KaiGenGothicKR-Regular-Italic.ttf
bold_italic: GEM_FONTS_DIR/KaiGenGothicKR-Bold-Italic.ttf
# M+ 1mn supports ASCII and the circled numbers used for conums
M+ 1mn:
normal: GEM_FONTS_DIR/KaiGenGothicKR-Regular.ttf
bold: GEM_FONTS_DIR/KaiGenGothicKR-Bold.ttf
italic: GEM_FONTS_DIR/KaiGenGothicKR-Regular-Italic.ttf
bold_italic: GEM_FONTS_DIR/KaiGenGothicKR-Bold-Italic.ttf
page:
참고용 원본
font:
catalog:
# Noto Serif supports Latin, Latin-1 Supplement, Latin Extended-A, Greek, Cyrillic, Vietnamese & an assortment of symbols
Noto Serif:
normal: GEM_FONTS_DIR/notoserif-regular-subset.ttf
bold: GEM_FONTS_DIR/notoserif-bold-subset.ttf
italic: GEM_FONTS_DIR/notoserif-italic-subset.ttf
bold_italic: GEM_FONTS_DIR/notoserif-bold_italic-subset.ttf
# M+ 1mn supports ASCII and the circled numbers used for conums
M+ 1mn:
normal: GEM_FONTS_DIR/mplus1mn-regular-subset.ttf
bold: GEM_FONTS_DIR/mplus1mn-bold-subset.ttf
italic: GEM_FONTS_DIR/mplus1mn-italic-subset.ttf
bold_italic: GEM_FONTS_DIR/mplus1mn-bold_italic-subset.ttf
page:
6) pdf 변환
.adoc파일 위치로 가서 pdf 변환. 시간좀 걸리고 에러 뜨긴 하는데 변환은 됨
asciidoctor-pdf ./index.adoc -o ./publisher.pdf
C:\workspace\TProject\src\main\asciidoc>asciidoctor-pdf ./API_Docs.adoc -o ./test6.pdf
asciidoctor: ERROR: could not locate or load the pdf theme `ko_KR' in {asciidoctorconfigdir}/.asciidoctor
/themesbecause of Errno::ENOENT No such file or directory @ rb_sysopen
- C:/workspace/TProject/src/main/asciidoc/{asciidoctorconfigdir}/.asciidoctor/themes/ko_KR-theme.yml; reverting to default theme
참고
ruby 설치 : https://jujeonghwan.github.io/jekyll/how-to-install-ruby-and-jekyll-on-windows-10-kr/
asciidoctor-pdf 설치 및 pdf 변환
- https://tbmaster.tistory.com/158
- https://wiznxt.tistory.com/857
한글 파일
- https://github.com/ihoneymon/asciidoc-book-template
- https://www.dropbox.com/s/wn68fkdt93kkkw6/asciidoctor-pdf-font.tar?dl=0
'개발환경, 도구 > 유틸' 카테고리의 다른 글
Ngrok - 외부에서 내 로컬로 접속하는 방법 (0) | 2024.04.08 |
---|---|
c 드라이브 부족으로 d 드라이브에서 가져오기 (0) | 2023.09.07 |
윈도우 cmd 에서 포트에서 사용중인 프로세스 번호를 확인하여 중단 (0) | 2023.08.03 |
정규식 (0) | 2022.12.27 |