Ecotrust / ocs-wp

Worpress Implementation of ODFW's Oregon Conservation Strategy
Other
1 stars 0 forks source link

.PDF Export Prototype ready for ODFW Review #118

Closed rhodges closed 5 years ago

rhodges commented 5 years ago

Have an example of PDF export for ODFW to use as shared language to tell us what they ACTUALLY want (in detail).

pollardld commented 5 years ago

Areas of current PDFs, example, that will not be replicable in generated PDFs

Content within a single text area

When content differs (pdf vs web) within a single text area. For example:

Ecoregions - PDF version has map included between what falls within a single text area in web version

PDF Web
Screen Shot 2019-06-05 at 5 21 19 PM Screen Shot 2019-06-05 at 5 36 30 PM

Posts do not include data for footer

example:

Oregon Conservation Strategy 2016: Ecoregions-86


~Strategy species on Ecoregion posts~

~strategy species are not referenced in ecoregion posts, so there is no way to know which species need to be included in each ecoregion~

~- Referenced in strategy species posts~

~Possible solutions:~

SOLVED

Step 1:

Step 2:

Step 3:


~ ### Conservation opportunity areas on Ecoregion posts~
~COAs are not referenced in ecoregion posts, so there is no way to know which COAs need to be included in each ecoregion~

~- Referenced in strategy species posts~

~Possible solutions:~

SOLVED


~### Limiting factors and recommended approaches~
~1. Where is content coming from?~ ~2. If content coming from post type, would need to know the maximum number a post could have. We have no way to loop through a list and need to be explicit for each factor and approach. The maximum number will work because there is no error thrown for missing factors and approaches~

~Solution~

SOLVED

Step 1:

Step 3:


~### Any brackets are outputted as a string~
~For any meta box that uses brackets ("[ ]"), which is handy for pulling wordpress content into a post, anything between the brackets will get outputted as a string~

PARTIALLY SOLVED
Added a preg_replace function that matches for [caption] brackets and replaces those with an empty string if found. Full function:

if (preg_match('/\[caption[^\]]*\]/', $str, $output)) {
    //remove all captions surrounding images and whatnot since tcpdf can't interpret them (but leave the images in place)
    $str = preg_replace('/\[caption[^\]]*\]/', '', $str);//replace all instances of the opening caption tag
    $str = preg_replace('/\[\/caption\]/', '', $str);//replace all instances of the closing caption tag
  }

Will need a new similar function for each shortcode we find. This is because shortcodes are named by the developer.


pollardld commented 5 years ago

Ready for review: ecoregions.pdf

pollardld commented 5 years ago

Review Feedback

Todo: