> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kasoftware.com/llms.txt
> Use this file to discover all available pages before exploring further.

# arc:render

> 使用 arc:render 計算並渲染範本，範本可以來自檔案或記憶體中的範本字串。

export const siteNameShort = "知行之橋";

`arc:render` 關鍵字用於渲染範本。

## 參數

* **template**：要計算的 .rst 檔案。
* **templateData**：要計算的記憶體範本。
* **in\[put]**：要傳遞到範本的物件清單，以逗號分隔。
* **out\[put]**：生成的物件或物件集。
* **to**：要將結果推送到的屬性。
  <Note>也可以使用多行 [arc:set](./op-arc-set) 包裝 `arc:render` 語句來儲存結果。</Note>
* **onerror**：在範本中遇到錯誤時要執行的操作。將此參數設定為 `clear`，即可僅在沒有例外時呼叫並渲染範本。

## 控制屬性

無

## 範例

捕獲例外，這樣主範本就可以繼續渲染其餘內容：

```xml theme={null}
<table border="1">
  <tr>
  <td>
    <arc:render template="error.rst">
      <arc:catch code="*">
        <a name="caught">
        A problem was encountered with the template
        </a>
      </arc:catch>
    </arc:render>
    <!-- Ensure that tags are closed -->
  </td>
  </tr>
</table>
```

渲染記憶體範本：

```xml theme={null}
<arc:setc attr="a.t" value="this is [name]."/>
<arc:set attr="i.name" value="a test" />
<arc:set item="r" />
<arc:render templateData="[a.t]" in="i" to="r.text" />
[r.text]
```

## 另請參閱

* [arc:catch](./op-arc-catch)：在 ArcScript 中處理例外。
* [arc:finally](./op-arc-finally)：確保格式化完成。
