Skip to contents

Create a table of parsed URLs from a single Episode object.

Usage

make_link_table(yrn)

Arguments

yrn

an Episode class object

Value

a data frame containing the following columns:

  • scheme The scheme for the URL (http, https, mailto, ftp, etc...)

  • server The first part of the URL (e.g. doi.org or github.com)

  • port the port number if it exists (note: liquid tags produce weird ports)

  • user associated with port, usually blank

  • path path to the page in question

  • query anything after a "?" in a URL

  • fragment navigation within a page; anything after "#" in a URL

  • orig the original, unparsed URL

  • text the text associated with the URL (stripped of markup)

  • title the title (if any) of the URL

  • type the type of URL (image or link)

  • rel if it's a relative URL, the name of the anchor, otherwise NA.

  • anchor logical if the URL is an anchor

  • sourcepos the source position in the file

Examples

loop <- fs::path(lesson_fragment(), "_episodes", "14-looping-data-sets.md")
make_link_table(Episode$new(loop))
#>    scheme            server      port user
#> 1   https   docs.python.org        NA     
#> 2   https   docs.python.org        NA     
#> 3   https   docs.python.org        NA     
#> 4   https pandas.pydata.org        NA     
#> 5   https   docs.python.org        NA     
#> 9   https   carpentries.org        NA     
#> 10                                 NA     
#> 11  https   carpentries.org        NA     
#> 12                                 NA     
#> 6                               21982     
#> 7                           245287720     
#> 8                               21982     
#> 13                                  0     
#>                                                             path query
#> 1                                           /3/library/glob.html      
#> 2                                           /3/library/glob.html      
#> 3                                           /3/library/glob.html      
#> 4  /pandas-docs/stable/reference/api/pandas.DataFrame.shape.html      
#> 5                                       /3/library/stdtypes.html      
#> 9                                 /assets/img/TheCarpentries.svg      
#> 10                                              ../no-workie.svg      
#> 11                                /assets/img/TheCarpentries.svg      
#> 12                                              ../no-workie.svg      
#> 6                                                                     
#> 7                                                                     
#> 8                                                                     
#> 13                                                                    
#>     fragment
#> 1  glob.glob
#> 2           
#> 3           
#> 4           
#> 5  str.split
#> 9           
#> 10          
#> 11          
#> 12          
#> 6           
#> 7           
#> 8           
#> 13          
#>                                                                                      orig
#> 1                                   https://docs.python.org/3/library/glob.html#glob.glob
#> 2                                             https://docs.python.org/3/library/glob.html
#> 3                                             https://docs.python.org/3/library/glob.html
#> 4  https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.shape.html
#> 5                               https://docs.python.org/3/library/stdtypes.html#str.split
#> 9                                   https://carpentries.org/assets/img/TheCarpentries.svg
#> 10                                                                       ../no-workie.svg
#> 11                                  https://carpentries.org/assets/img/TheCarpentries.svg
#> 12                                                                       ../no-workie.svg
#> 6                                                              {{ page.root }}/index.html
#> 7                                                       {{ site.swc_pages }}/shell-novice
#> 8                                                                  {{ page.root }}{% link
#> 13                                                          {{ page.root }}/no-workie.svg
#>                                              text            alt title  type
#> 1                                       glob.glob           <NA>        link
#> 2                                            glob           <NA>        link
#> 3                                            glob           <NA>        link
#> 4                                    shape method           <NA>        link
#> 5                                           split           <NA>        link
#> 9                                                 books as clubs  <NA>   img
#> 10                                                books as clubs  <NA>   img
#> 11                               Carpentries logo           <NA>       image
#> 12                              Non-working image           <NA>       image
#> 6                                            Home           <NA>  <NA>  link
#> 7                                           shell           <NA>  <NA>  link
#> 8  link that isn't parsed correctly by commonmark           <NA>  <NA>  link
#> 13           Non-working image with jekyll syntax           <NA>  <NA> image
#>     rel anchor sourcepos                          filepath         node
#> 1  <NA>  FALSE        51 _episodes/14-looping-data-sets.md <link so....
#> 2  <NA>  FALSE        57 _episodes/14-looping-data-sets.md <link so....
#> 3  <NA>  FALSE        58 _episodes/14-looping-data-sets.md <link so....
#> 4  <NA>  FALSE       140 _episodes/14-looping-data-sets.md <link so....
#> 5  <NA>  FALSE       163 _episodes/14-looping-data-sets.md <link so....
#> 9  <NA>  FALSE       189 _episodes/14-looping-data-sets.md <img src....
#> 10 <NA>  FALSE       191 _episodes/14-looping-data-sets.md <img src....
#> 11 <NA>  FALSE       195 _episodes/14-looping-data-sets.md <image s....
#> 12 <NA>  FALSE       197 _episodes/14-looping-data-sets.md <image s....
#> 6  <NA>  FALSE        NA _episodes/14-looping-data-sets.md <link xm....
#> 7  <NA>  FALSE        NA _episodes/14-looping-data-sets.md <link xm....
#> 8  <NA>  FALSE        NA _episodes/14-looping-data-sets.md <link xm....
#> 13 <NA>  FALSE        NA _episodes/14-looping-data-sets.md <image x....