Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Convert ¶
Example ¶
package main import ( "fmt" "github.com/shiyou0130011/p2mfmt" ) func main() { puki := `* Title #navi(Example) ** Main List - list 1 - list 2 - list 3 -- Sub List(( This is a reference )) ** Table |~Name|~Age|~Sex| | Anny | 16 | F | | John | 27 | M | | Mike | 19 |~|` mediawiki, category := p2mfmt.Convert(puki) fmt.Printf("Mediawiki: \n%s\n\n", mediawiki) fmt.Printf("Categories: %v", category) }
Output: Mediawiki: = Title= == Main List== * list 1 * list 2 * list 3 :* Sub List<ref> This is a reference </ref> == Table== {| class="wikitable" style="margin: 0 auto;" |- ! Name !! Age !! Sex |- | Anny || 16 || F |- | John || 27 || rowspan = "2" | M |- | Mike || 19 |} == 備註 == <references/> Categories: [Example]
func ConvertFirstOfLine ¶
Pukiwiki 可以每行或每個儲存格的最開始加上下面幾項,為整行或整個儲存格設置樣式
LEFT:
CENTER:
RIGHT:
BGCOLOR(色):
COLOR(色):
SIZE(サイズ):
此 function 是將之轉換成 CSS style map
Types ¶
type Table ¶
type Table struct {
Cells [][]tableCell
}
表格
Example ¶
package main import ( "fmt" "github.com/shiyou0130011/p2mfmt" ) func main() { table := p2mfmt.Table{} table.ParseRow(`|~Name|~Age|~Sex|`) table.ParseRow(`| John | 27 | M |`) table.ParseRow(`| Anny | 16 | F |`) table.ParseRow(`| Mike | 19 | M |`) fmt.Print(table) }
Output: {| class="wikitable" style="margin: 0 auto;" |- ! Name !! Age !! Sex |- | John || 27 || M |- | Anny || 16 || F |- | Mike || 19 || M |}
Click to show internal directories.
Click to hide internal directories.