2016-12-28 15 views

답변

1

이 같은 ifdef directive을 사용할 수 있습니다 : 당신이 간단하고 작은 솔루션을 필요로하는 경우

Some text for all outputs. 

ifdef::backend-pdf[] 
This is only displayed in the PDF document, you can use image: 
image::mypict.png[] 
endif::[] 
1

, 나는 Jminis 응답을 선호하는 것이다.

차별화가 더 필요한 경우 명령 줄 호출에서 매개 변수로 정의 할 수있는 출력 유형별로 고유 한 필터 매개 변수를 정의 할 수 있습니다. 예를 들어 다음과 같이 콘텐츠를 필터링 할 수 있습니다. 당신이 다른 관객들 사이에서도 다른 것을 원한다면. 다음과 같이

Some text for all outputs. 

ifeval::["{myfilter1}"=="pdf"] 
    This content is pdf-only! 

    ifeval::["{myfilter2}"=="adminpdf"] 
    This content is admin-pdf-only! 
    endif::[] 
endif::[] 

당신은 명령 줄 호출의 매개 변수를 추가 할 수 있습니다

--attribute myfilter1='pdf' 

명령의 정확한 표현은 시스템에 따라 달라집니다. 다음 구문을 사용할 수 있습니다 (현재 asciidoc-setup이없는 경우 테스트 할 수 없습니다).

OS X의 asciidoc ->의 DocBook :

SCRIPT=${...path to asciidoc installation...}/asciidoc.py 
INPUT=myAsciidocInput.ad 
OUTPUT=MyDocBookOutput.xml 
MYFILTER="--attribute myfilter1='pdf' --attribute myfilter2='adminpdf'" 
python "$SCRIPT" -o "$OUTPUT" "$MYFILTER "$INPUT" 

윈 asciidoc ->의 DocBook :

set SCRIPT=%{...path to asciidoc installation...}%\asciidoc.py 
set INPUT=myAsciidocInput.ad 
set OUTPUT=MyDocBookOutput.xml 
set MYFILTER=--attribute myfilter1='pdf' --attribute myfilter2='adminpdf' 
python "%SCRIPT%" -o "%OUTPUT%" 
+0

내가 자바/메이븐을 통해 asciidoc를 사용하지만 어쨌든 재미있다! :-) – seinecle

+0

짧은 시도에서 AsciiDoctor는 중첩 된 조건을 지원하지 않습니다. (. 아니면 내가 - D는 직접 실행할 수 있도록 너무 noobish했다) 다음 예제 받는다는와 AsciiDoctor에 나를 위해 작동 : 'MySourceFile.ad' : ifeval : [{myfilter1} == PDF] 을 이 내용은 pdf 전용입니다! endif :: [] ifeval :: [{myfilter2} == adminpdf] 이 내용은 admin-pdf-only입니다! ENDIF : [] 'pom.xml' : <구성> PDF ... PDF - adminpdf 죄송합니다. 형식이 잘못되었습니다. / –