
import sys
from pprint import pprint
from lxml import etree
import html2text

from wp_parser import WordpressXMLParser
from hugo_printer import HugoPrinter


def main():
    wp_xml_parser = WordpressXMLParser(sys.argv[1])

    meta = wp_xml_parser.get_meta()
    cats = wp_xml_parser.get_categories()
    tags = wp_xml_parser.get_tags()
    posts = wp_xml_parser.get_public_posts()
    drafts = wp_xml_parser.get_drafts()

    pprint(posts[-1])

if __name__ == '__main__':
    main()



import sys
from pprint import pprint
from lxml import etree
import html2text

from wp_parser import WordpressXMLParser
from hugo_printer import HugoPrinter


def main():
    wp_xml_parser = WordpressXMLParser(sys.argv[1])

    wp_site_info = {
        "meta": wp_xml_parser.get_meta(),
        "cats": wp_xml_parser.get_categories(),
        "tags": wp_xml_parser.get_tags(),
        "posts": wp_xml_parser.get_public_posts(),
        "drafts": wp_xml_parser.get_drafts(),
    }

    hugo_printer = HugoPrinter(**wp_site_info)
    hugo_printer.gen_config()

if __name__ == '__main__':
    main()


Call HugoPrinter to save config file
Call HugoPrinter to save config file

  
  import sys
  from pprint import pprint
  from lxml import etree
  import html2text
  
  from wp_parser import WordpressXMLParser
  from hugo_printer import HugoPrinter
  
  
  def main():
      wp_xml_parser = WordpressXMLParser(sys.argv[1])
  
+     wp_site_info = {
-     meta = wp_xml_parser.get_meta()
+         "meta": wp_xml_parser.get_meta(),
-     cats = wp_xml_parser.get_categories()
+         "cats": wp_xml_parser.get_categories(),
-     tags = wp_xml_parser.get_tags()
+         "tags": wp_xml_parser.get_tags(),
-     posts = wp_xml_parser.get_public_posts()
+         "posts": wp_xml_parser.get_public_posts(),
-     drafts = wp_xml_parser.get_drafts()
+         "drafts": wp_xml_parser.get_drafts(),
+     }
  
-     pprint(posts[-1])
+     hugo_printer = HugoPrinter(**wp_site_info)
+     hugo_printer.gen_config()
  
  if __name__ == '__main__':
      main()
  
  
Call HugoPrinter to save config file
## Code Before:

import sys
from pprint import pprint
from lxml import etree
import html2text

from wp_parser import WordpressXMLParser
from hugo_printer import HugoPrinter


def main():
    wp_xml_parser = WordpressXMLParser(sys.argv[1])

    meta = wp_xml_parser.get_meta()
    cats = wp_xml_parser.get_categories()
    tags = wp_xml_parser.get_tags()
    posts = wp_xml_parser.get_public_posts()
    drafts = wp_xml_parser.get_drafts()

    pprint(posts[-1])

if __name__ == '__main__':
    main()


## Instruction:
Call HugoPrinter to save config file
## Code After:

import sys
from pprint import pprint
from lxml import etree
import html2text

from wp_parser import WordpressXMLParser
from hugo_printer import HugoPrinter


def main():
    wp_xml_parser = WordpressXMLParser(sys.argv[1])

    wp_site_info = {
        "meta": wp_xml_parser.get_meta(),
        "cats": wp_xml_parser.get_categories(),
        "tags": wp_xml_parser.get_tags(),
        "posts": wp_xml_parser.get_public_posts(),
        "drafts": wp_xml_parser.get_drafts(),
    }

    hugo_printer = HugoPrinter(**wp_site_info)
    hugo_printer.gen_config()

if __name__ == '__main__':
    main()

