Skip to content

Commit

Permalink
Merge pull request #4 from filips123/fix-slim-4
Browse files Browse the repository at this point in the history
Add support for Slim 4
  • Loading branch information
pfefferle authored Sep 1, 2019
2 parents 0604b02 + 5b5aba8 commit fdbdaa6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ deploy:
file: "Slim_Framework.tgz"
skip_cleanup: true
on:
condition: $TRAVIS_EVENT_TYPE = cron
condition: ($TRAVIS_EVENT_TYPE = api) || ($TRAVIS_EVENT_TYPE = cron)
12 changes: 9 additions & 3 deletions rebuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from bs4 import BeautifulSoup, NavigableString, Tag

DOCUMENTS_DIR = os.path.join('Slim_Framework.docset', 'Contents', 'Resources', 'Documents')
HTML_DIR = os.path.join('www.slimframework.com/docs')
HTML_DIR = os.path.join('www.slimframework.com/docs/v4')

db = sqlite3.connect('Slim_Framework.docset/Contents/Resources/docSet.dsidx')
cur = db.cursor()
Expand Down Expand Up @@ -91,6 +91,12 @@
if "href" in a.attrs and test.match(a["href"].strip()):
a.extract()

for a in soup.find_all("a"):
test = re.compile("^https?.*cdn.jsdelivr.*", re.IGNORECASE)

if "href" in a.attrs and test.match(a["href"].strip()):
a.extract()

# remove header navbar with blog link
try:
soup.find('nav', class_='navbar-fixed-top').decompose()
Expand All @@ -111,10 +117,10 @@
soup.find('button', class_='dropdown-toggle').parent.decompose()
except AttributeError:
pass
# remove link to v2 docs
# remove link to v3 docs
try:
for alert in soup.find_all('div', class_='alert-info'):
if 'Slim 2 Docs' in str(alert):
if 'Slim 3 Docs' in str(alert):
alert.decompose()
except (AttributeError, TypeError):
pass
Expand Down
5 changes: 2 additions & 3 deletions sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

rm -rf Slim_Framework.docset/Contents/Resources

httrack http://www.slimframework.com/docs/ \
httrack https://www.slimframework.com/docs/v4 \
-O Slim_Framework.docset/Contents/Resources/Documents,cache -I0 \
--display=2 --timeout=60 --retries=99 --sockets=7 \
--connection-per-second=5 --max-rate=250000 \
--keep-alive --depth=5 --mirror --clean --robots=0 \
--user-agent '$(httrack --version); dash-slimframework ()' \
"-*" "+www.slimframework.com/docs" \
"+www.slimframework.com/docs/v3" "+www.slimframework.com/docs/v3/*" \
"-www.slimframework.com/docs/v2" "-www.slimframework.com/docs/v3" \
"+www.slimframework.com/assets/*" "+maxcdn.bootstrapcdn.com/font-awesome/*"

0 comments on commit fdbdaa6

Please sign in to comment.