[WordPress] 外掛分享: File Inliner

首頁外掛目錄 › File Inliner
10+
安裝啟用
尚無評分
6152 天前
最後更新
問題解決
WordPress 2.0+ v1.2.0 上架:2008-06-08

內容簡介

這個外掛可以在文章中顯示檔案的內容,該檔案的內容(稱為「片段」)會預設以 <pre></pre> 標籤區塊的形式呈現。

這個外掛相較於自行貼上檔案內容,具有以下優勢:

當檔案修改後,不需要修改與其相關的文章
預設保留縮排(有利於展示程式碼片段)
可以選擇性提供檔案連結(無需複製貼上片段)

如果有需要(參閱 preserveformat 參數),檔案的內容會以 <div></div> 標籤區塊呈現,每行文字(由換行符號區隔)會分別置於一個 <p></p> 區塊中。

使用方法

語法: [file lang="某語言" start="某行號" end="某行號" link="開或關" style="某樣式屬性" preserveformat="開或關"]路徑/至/您的/檔案[/file]

注意:屬性的順序是必要的!

範例:內嵌檔案

只需在文章中寫下 [file]路徑/至/您的/檔案[/file] 即可。

範例:使用語法突顯外掛

如果您寫下了 [file lang="cpp"]path/to/your/file[/file](例如),
且如果您所使用的語法突顯外掛支援 <pre lang="*"></pre> 語法(大多數都支援),那麼您的檔案內容將如往常一樣由語法突顯外掛進行處理。

範例:提供檔案連結

如果您寫下了 [file link="on"]path/to/your/file[/file],會在文字區域的左上方自動添加一個連結。

範例:內嵌檔案的子集

如果您寫下了 [file start="10" end="20"]path/to/your/file[/file],
只會顯示檔案的第 10 至 20 行。如果您需要,可以省略開頭(即「從開頭至第 20 行」)或結尾設定(即「從第 10 行至檔案結尾」)。

範例:將文字的顏色設定為紅色

只需在文章中寫下 [file style="color: #FF0000;"]path/to/your/file[/file]。

範例:停用外掛處理 [file][/file] 區塊

只需寫下 [file off]您的內容[/file] 即可。

注意:「off」屬性必須排在其他屬性之前。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.2.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「File Inliner」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This plugin displays the content of a file in a post. The content of the file
(called a “snippet”) is put in a


block by default.
It has the following advantages over pasting the content of the file in your post
yourself:

When the file is modified, no need to modify the posts referring to it
Indentation is preserved by default (useful to show code snippets)
Can optionally provide a link to the file (no need to copy-paste your snippet)

If requested (see the preserveformat parameter), the content of the file
is put in a

block, with each line (delimited by
the carriage return) in its own

block.
Usage
Syntax: [file lang="some_lang" start="a_line_number" end="a_line_number" link="on_or_off" style="some_style_properties" preserveformat="on_or_off"]path/to/your/file[/file]
Note: The order of the attributes is mandatory!
Example: Inlining of a file
In your post, write [file]path/to/your/file[/file]. That’s it!
Example: Using a syntax highlighter plugin
If you write [file lang="cpp"]path/to/your/file[/file] (for instance),
and if the syntax highlighter plugin you use supports
the


syntax (most does), then the content
of your file will be processed by the syntax highlighter plugin as usual.
Example: Provide a link to the file
If you write [file link="on"]path/to/your/file[/file], a link will
be automatically added to the top left of the text area.
Example: Inline a subset of a file
If you write [file start="10" end="20"]path/to/your/file[/file],
only the lines 10 to 20 of the file will be displayed. You can omit the start
(ie. “from beginning to line 20”) or the end (ie. “from line 10 to the end of
the file”) if you want.
Example: Set the color of the text to red
In your post, write [file style="color: #FF0000;"]path/to/your/file[/file].
Example: Prevent the plugin to process a [file][/file] block
Just write [file off]your content[/file].
Note: The ‘off’ attribute must come BEFORE any other ones.

延伸相關外掛

文章
Filter
Mastodon