|
|
@ -125,9 +125,7 @@ func (g *ASTTransformer) Transform(node *ast.Document, reader text.Reader, pc pa |
|
|
|
} |
|
|
|
} |
|
|
|
v.Destination = link |
|
|
|
v.Destination = link |
|
|
|
case *ast.List: |
|
|
|
case *ast.List: |
|
|
|
if v.HasChildren() && v.FirstChild().HasChildren() && v.FirstChild().FirstChild().HasChildren() { |
|
|
|
if v.HasChildren() { |
|
|
|
if _, ok := v.FirstChild().FirstChild().FirstChild().(*east.TaskCheckBox); ok { |
|
|
|
|
|
|
|
v.SetAttributeString("class", []byte("task-list")) |
|
|
|
|
|
|
|
children := make([]ast.Node, 0, v.ChildCount()) |
|
|
|
children := make([]ast.Node, 0, v.ChildCount()) |
|
|
|
child := v.FirstChild() |
|
|
|
child := v.FirstChild() |
|
|
|
for child != nil { |
|
|
|
for child != nil { |
|
|
@ -138,14 +136,22 @@ func (g *ASTTransformer) Transform(node *ast.Document, reader text.Reader, pc pa |
|
|
|
|
|
|
|
|
|
|
|
for _, child := range children { |
|
|
|
for _, child := range children { |
|
|
|
listItem := child.(*ast.ListItem) |
|
|
|
listItem := child.(*ast.ListItem) |
|
|
|
|
|
|
|
if !child.HasChildren() || !child.FirstChild().HasChildren() { |
|
|
|
|
|
|
|
v.AppendChild(v, child) |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
taskCheckBox, ok := child.FirstChild().FirstChild().(*east.TaskCheckBox) |
|
|
|
|
|
|
|
if !ok { |
|
|
|
|
|
|
|
v.AppendChild(v, child) |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
newChild := NewTaskCheckBoxListItem(listItem) |
|
|
|
newChild := NewTaskCheckBoxListItem(listItem) |
|
|
|
taskCheckBox := child.FirstChild().FirstChild().(*east.TaskCheckBox) |
|
|
|
|
|
|
|
newChild.IsChecked = taskCheckBox.IsChecked |
|
|
|
newChild.IsChecked = taskCheckBox.IsChecked |
|
|
|
|
|
|
|
newChild.SetAttributeString("class", []byte("task-list-item")) |
|
|
|
v.AppendChild(v, newChild) |
|
|
|
v.AppendChild(v, newChild) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return ast.WalkContinue, nil |
|
|
|
return ast.WalkContinue, nil |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|