Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs into the repo #756

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Add docs into the repo #756

wants to merge 14 commits into from

Commits on May 21, 2023

  1. editorconfig: Use tabs for HTML again

    This was changed in simplepie#745
    but without any rationale. The only HTML file is in tests and that should not be manually edited at all.
    jtojnar committed May 21, 2023
    Configuration menu
    Copy the full SHA
    a26ac22 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4d230c7 View commit details
    Browse the repository at this point in the history
  3. docs: Prepare directory tree

    Ran the following within `nix-shell -I 'nixpkgs=channel:nixos-unstable' -p zola`
    to create the website tree:
    
        zola init docs
    
    Filled in the website URL and disabled everything for now.
    
    Then created templates based on the successive commits.
    jtojnar committed May 21, 2023
    Configuration menu
    Copy the full SHA
    30f38bb View commit details
    Browse the repository at this point in the history
  4. editorconfig: Fix indentation for markdown

    There are only two markdown files and both use 2 spaces.
    jtojnar committed May 21, 2023
    Configuration menu
    Copy the full SHA
    c6394b7 View commit details
    Browse the repository at this point in the history
  5. docs: Convert website into a static site

    Ran the following within `nix-shell -I 'nixpkgs=channel:nixos-unstable' -p wget2 yq-go dos2unix 'python3.withPackages (ps: with ps; [ beautifulsoup4 pypandoc ])' nodePackages.prettier`
    
    ```sh
    # Download the website contents from the web, and the pages that fail with error 500 from Internet Archive.
    wget2 --user-agent 'Mozilla/5.0 (X11; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0' --mirror --force-directories --no-robots --retry-on-http-error=403 --http2-request-window=1 --random-wait --exclude-directories=/wiki/lib/exe/ http://simplepie.org
    rm simplepie.org/blog/2006/03/06/forums-powered-by-punbb/index.html
    wget2 https://web.archive.org/web/20190404091911/simplepie.org/blog/2006/03/06/forums-powered-by-punbb/ --directory-prefix=simplepie.org/blog/2006/03/06/forums-powered-by-punbb
    rm simplepie.org/blog/2012/10/30/simplepie-1-3-1-is-now-available/index.html
    sed -i 's/\xbb//' docs/content/blog/2006-03-06-forums-powered-by-punbb.html # fix encoding
    wget2 https://web.archive.org/web/20210812123158/https://simplepie.org/blog/2012/10/30/simplepie-1-3-1-is-now-available/ --directory-prefix=simplepie.org/blog/2012/10/30/simplepie-1-3-1-is-now-available
    
    # Copy the downloaded contents into the website tree.
    cp -r simplepie.org/* docs/content
    mkdir -p docs/static
    mv docs/content/{scripts,favicon.ico,images,css,robots.txt} docs/static
    
    # Standardize line endings.
    dos2unix docs/**
    
    # Drop API docs, we will generate them later.
    rm -r docs/content/api
    
    # Drop mint (analytics), it is abandoned.
    rm -r docs/content/mint
    
    # Drop dynamically generated demo pages.
    rm -r docs/content/demo/newsblocks
    
    # Drop downloads – we will just link GitHub.
    rm docs/content/downloads/*\?* docs/content/downloads/*.zip
    
    # Drop ancient scripts, no more font replacement using flash, or tricks to make PNGs transparent in IE (Sleight).
    rm -r docs/static/css/sIFR-* docs/static/scripts/
    
    # Download headers explicitly since they are currently rotated by PHP
    # and wget was not able to find them.
    rm docs/static/images/headers/rotate-old.php
    wget http://simplepie.org/images/headers/rotate-xspf.xml --directory-prefix docs/static/images/headers/
    cat docs/static/images/headers/rotate-xspf.xml | yq -p=xml '"http://simplepie.org" + .playlist.trackList.track[].location' | xargs wget --directory-prefix docs/static/images/headers/
    
    # Drop Wordpress plug-in clutter.
    rm -r docs/content/blog/wp-{content,includes,json}
    
    # Drop feeds.
    rm docs/content/blog/**/feed/index.html
    rmdir docs/content/blog/**/feed
    
    # Drop wiki noise.
    rm docs/content/wiki/lib/exe/css.php?*
    mv docs/content/wiki/lib/tpl/simplepie/wikistyles.css docs/static/css/
    mv docs/content/wiki/lib/images/smileys/icon_exclaim.gif docs/static/images/
    rm -r docs/content/wiki/lib
    rm docs/content/wiki/feed.php*
    rm -r docs/content/wiki/{_detail,_export}
    find docs/content/wiki/ -name '*\?idx=*' -exec rm '{}' \;
    find docs/content/wiki/ -name '*\?do=*' -exec rm '{}' \;
    rm docs/content/wiki/_media/wiki/dokuwiki-128.png docs/content/wiki/wiki/dokuwiki
    rmdir docs/content/wiki/wiki
    mv 'docs/content/wiki/_media/tutorial/update_simplepie_cache.jpg?cache=' 'docs/content/wiki/_media/tutorial/update_simplepie_cache.jpg'
    rm docs/content/wiki/_media/tutorial/update_simplepie_cache.jpg\?*
    
    # Add extension to wiki pages.
    find docs/content/wiki -type f ! -name '*.jpg' ! -name '*.html' -print0 | xargs -0 -I '{}' mv '{}' '{}.html'
    
    # Remove duplicate wiki page
    rm docs/content/wiki/faq/Supported_Character_Encodings.html
    echo /wiki/faq/Supported_Character_Encodings /wiki/faq/supported_character_encodings >> docs/static/_redirects
    rm docs/content/wiki/plugins/wordpress/simplepie_plugin_for_wordpress.1.html
    # Rename start files (used as directory index in DokuWiki) to _index.html used by Zola.
    find docs/content/wiki/ -name start.html | sed -E 's#(docs/content/(.*))/start.html#mv "\0" "\1/_index.html"; echo "/\2/start /\2/" >> docs/static/_redirects#g' | sh -
    
    # Simplify blog structure.
    rm -r docs/content/blog/page docs/content/blog/index.html
    find docs/content/blog/2* -name index.html | sed -E 's#docs/content/blog/(....)/(..)/(..)/(.*)/index.html#mv "\0" "docs/content/blog/\1-\2-\3-\4.html"#g' | sh -
    rmdir docs/content/blog/*/*/*/*
    rmdir docs/content/blog/*/*/*
    rmdir docs/content/blog/*/*
    rmdir docs/content/blog/????
    ls docs/content/blog/*.html | sed -E 's#docs/content/blog/(....)-(..)-(..)-(.+)\.html#/blog/\1/\2/\3/\4/ /blog/\4/#g' >> docs/static/_redirects
    
    # Prepare redirects for Apache
    sed -i 's/^/Redirect 302 /' docs/static/_redirects
    mv docs/static/{_redirects,.htaccess}
    
    # Manually extracted main template into templates/.
    ```
    jtojnar committed May 21, 2023
    Configuration menu
    Copy the full SHA
    9365a15 View commit details
    Browse the repository at this point in the history
  6. Add converted markdown files

    Produced by markdownify.py
    jtojnar committed May 21, 2023
    Configuration menu
    Copy the full SHA
    b23f28b View commit details
    Browse the repository at this point in the history
  7. docs: Add API toolchain

    jtojnar committed May 21, 2023
    Configuration menu
    Copy the full SHA
    8b53ef5 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    8e373f7 View commit details
    Browse the repository at this point in the history
  9. docs: Add breadcrumbs to wiki

    jtojnar committed May 21, 2023
    Configuration menu
    Copy the full SHA
    d2724ff View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    2f9ad46 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    15cca4a View commit details
    Browse the repository at this point in the history
  12. docs: Remove extraneous headers

    They are big and many are outdated.
    jtojnar committed May 21, 2023
    Configuration menu
    Copy the full SHA
    bb1df1f View commit details
    Browse the repository at this point in the history

Commits on May 22, 2023

  1. docs: Unmarkdown wiki links

    So that Zola does not complain about being broken once we remove the wiki.
    jtojnar committed May 22, 2023
    Configuration menu
    Copy the full SHA
    d9090bb View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e134c9f View commit details
    Browse the repository at this point in the history