@@ -26,32 +26,48 @@ type Html struct {
2626}
2727
2828func (r * Html ) Emit (dir string ) error {
29+ if err := r .emitFile (dir , r .BeforeFile ); err != nil {
30+ return err
31+ }
32+ r .BeforeFile = filepath .Base (r .BeforeFile )
33+
34+ if err := r .emitFile (dir , r .AfterFile ); err != nil {
35+ return err
36+ }
37+ r .AfterFile = filepath .Base (r .AfterFile )
38+
2939 for _ , action := range r .Before .Actions {
3040 if err := r .emitAction (dir , action ); err != nil {
3141 return err
3242 }
3343 }
44+
3445 for _ , action := range r .After .Actions {
3546 if err := r .emitAction (dir , action ); err != nil {
3647 return err
3748 }
3849 }
50+
3951 for _ , pair := range r .Equal {
4052 if err := r .emitOutputPairDiff (dir , pair ); err != nil {
4153 return err
4254 }
4355 }
56+
4457 for _ , pair := range r .NonEqual {
4558 if err := r .emitOutputPairDiff (dir , pair ); err != nil {
4659 return err
4760 }
4861 }
62+
4963 if err := r .emitIndexHtml (dir ); err != nil {
5064 return err
5165 }
66+
5267 if err := r .emitStyleCss (dir ); err != nil {
5368 return err
5469 }
70+
5571 return nil
5672}
5773
@@ -65,6 +81,15 @@ func (r *Html) emitAction(dir string, action *dipb.Action) error {
6581 return nil
6682}
6783
84+ func (r * Html ) emitFile (dir string , original string ) error {
85+ filename := filepath .Join (dir , filepath .Base (original ))
86+ basedir := filepath .Dir (filename )
87+ if err := os .MkdirAll (basedir , os .ModePerm ); err != nil {
88+ return err
89+ }
90+ return copyFile (original , filename )
91+ }
92+
6893func (r * Html ) emitActionJson (dir string , action * dipb.Action ) error {
6994 filename := filepath .Join (dir , action .Id + ".json" )
7095 basedir := filepath .Dir (filename )
0 commit comments