menu and submenu
This commit is contained in:
parent
20c4adb3cf
commit
5059a15826
@ -56,6 +56,7 @@ class WPMenu:
|
||||
## Get from URL
|
||||
|
||||
def fromUrl(self, canalblog):
|
||||
self._canalblog = canalblog
|
||||
try:
|
||||
o = urlparse(canalblog)
|
||||
o = o._replace(scheme=self._protocol_canalblog)
|
||||
@ -105,11 +106,12 @@ class WPMenu:
|
||||
for anchor in ul.find_all("li"):
|
||||
|
||||
parent = anchor.find("a").get_text().replace(" \xa0", "")
|
||||
href = anchor.find("a").get("href")
|
||||
if href == "{0}://{1}/".format(self._protocol_canalblog, self._canalblog):
|
||||
parent = "home"
|
||||
itemMenu = {"id":"", "type":"", "title": parent, "children":list()}
|
||||
|
||||
href = anchor.find("a").get("href")
|
||||
if href == self._wordpress:
|
||||
parent = "home"
|
||||
|
||||
#menu = self._child(parent, parent)
|
||||
if href == "#":
|
||||
li = anchor.find("ul").find_all("li")
|
||||
@ -131,4 +133,4 @@ class WPMenu:
|
||||
menu[j]["children"].append({"id":"", "title":children[i]["title"], "parent": children[i]["parent"]})
|
||||
|
||||
for i in menu:
|
||||
self._logger.info("{0} : Menu {1}".format(self._name))
|
||||
self._logger.info("{0} : Menu {1} {2}".format(self._name, i["title"], len(i["children"])))
|
Loading…
x
Reference in New Issue
Block a user