2011-01-05 5 views
1

의 몸을 받고 :개찰구 -이 보이는 마크 업이 가정 태그 요소

<span wicket:id="text">Some text that I'd like to read</span> 

어딘가에 태그의 본문의 내용을 얻기 위해, 또는 그것을 돌이킬 수 개찰구에 의해 제거되는 수 있습니까?

편집 : 제 의도는 간단한 CMS를 구현하는 것입니다. 사용자는 tex>a^2</tex> 형태로 LaTeX 수식을 입력 할 수 있어야합니다. 그런 다음 RenderedDynamicImageResource로 렌더링합니다. 다른 태그도 비슷한 방식으로 해석되어야합니다. 나는이 같은 Panel 두 단계로 그것을 할 구상 : 나는 그래서 어쩌면 내가 잘못된 방향으로 찾고 있어요, 잠시 동안이 문제를 고민 했어요

public class LightweightMarkupPanel extends Panel implements IComponentResolver { 
    public LightweightMarkupPanel (String id) { 
     super(id); 
    } 

    @Override 
    public MarkupStream getAssociatedMarkupStream(boolean throwException) { 
     // Get the lightweight markup and convert it to wicket markup 
     ... 
    } 

    @Override 
    public boolean resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag) { 
     // AutoAdd components as needed 
     ... 
    } 
} 

.

+0

콘텐츠 가져 오기? "읽고 싶은 일부 텍스트"를 유지 하시겠습니까? – jzd

답변

4

구성 요소의 MarkupStream 개체에는 원시 HTML 본문이 포함되어 있습니다. 다음과 같이 markupStream.get(). toString() 메서드를 사용하여 검색 할 수 있습니다.

// <span wicket:id="message">message will be here</span> 
add(new Label("message", "If you see this message ..."){ 
    @Override 
    protected void onComponentTagBody(
     MarkupStream markupStream, ComponentTag openTag) { 
     markupStream.get(); // "message will be here" 
     super.onComponentTagBody(markupStream, openTag); 
    } 
}); 
관련 문제