최근 바뀜
도구
업로드
도움말
길라잡이
위키 문법
특수 문서
문의·신고
디스코드
IP 사용자
216.73.216.63
로그인
모듈:Dictionary 문서 원본 보기
←
모듈:Dictionary
편집
토론
역사
새로고침
주시
역링크
정보
문서 편집 권한이 없습니다. 다음 이유를 확인해주세요:
요청한 명령은 다음 권한을 가진 사용자에게 제한됩니다:
사용자
.
문서의 원본을 보거나 복사할 수 있습니다.
-- Module:Dictionary (전체 교체) local p, data = {}, mw.loadData('Module:Dictionary/data') local frame = mw.getCurrentFrame() -- 위키텍스트 → HTML → plain-text 를 얻기 위한 헬퍼 local function toPlain(html) -- strip strip-markers ⇒ 태그 ⇒ decode 엔티티 local txt = mw.text.killMarkers(html):gsub('<[^>]+>', '') return mw.text.decode(txt) end function p.render() local dict = {} -- { plainLower → HTML 카드 } for term, defi in pairs(data) do local termHTML = frame:preprocess(term) local defHTML = frame:preprocess(defi) -- 보기 좋은 카드형 HTML (style 은 JS 쪽 CSS 로) local card = '<div class="dict-card"><div class="term">' .. termHTML .. '</div> <div class="def">' .. defHTML .. '</div></div>' dict[toPlain(termHTML):lower()] = card end -- 숨은 JSON 삽입 return '<script type="application/json" id="dictionary-json">' .. mw.text.encode(mw.text.jsonEncode(dict)) .. '</script>' end return p
이 문서에 포함된 문서:
모듈:Dictionary/설명문서
(
원본 보기
)
모듈:Dictionary
문서로 돌아갑니다.