Opened 3 years ago

Closed 3 years ago

#4293 closed change (fixed)

Migrate blog away from the Anwiki

Reported by: saroyanm Assignee: trev
Priority: P3 Milestone:
Module: Websites Keywords:
Cc: trev, juliandoucette Blocked By: #4481
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29355234/

Description (last modified by trev)

Background

Currently our blog is using styles and scripts from the Anwiki repository (the old CMS that was used for adblockplus.org), we have migrated adblockplus.org away from the anwiki, but the blog is still using same CSS and JS files.

What to change

Use header and footer from adblockplus.org website rather than Anwiki for our blog.

Change History (11)

comment:1 Changed 3 years ago by saroyanm

@Wladimir just would like to align with you if you think it's fine if we just link to the existing files from the web.adblockplus.org repository ? I think the only disadvantage will be with the cache, but I think it's still better than having duplication for style and script files that was meant to be used by both (adblockplus.org and blog).
Currently we have couple of tickets that require changes in the styles and Scripts. one approach will be update anwiki files, but I think initially the idea was that the blog and website should share same styles.

comment:2 follow-up: Changed 3 years ago by trev

Yes, this is definitely something to do - we simply didn't get there so far. I wonder however whether the files from the repo will do or whether we need to process these in Python first. For reference, the current Textpattern plugin code is the following:

$anwiki_data = FALSE;

function get_anwiki_template_path()
{
  global $prefs;
  return $prefs['tempdir'].DS.'anwiki_template';
}

function read_anwiki_data()
{
  global $anwiki_data;

  $data = file_get_contents(get_anwiki_template_path());

  $header = preg_replace('/<\\/header>.*/s', '</header>', $data);
  $header = preg_replace('/<ul id="language-selector">.*?<\\/ul>/s', '', $header);
  $header = preg_replace('/<li id="language">.*?<\\/li>/s', '', $header);
  $header = preg_replace('/ (itemscope|itemtype)="[^"]*"/', '', $header);
  $header = preg_replace('/<script\b[^<>]*>[^<>]+<\\/script>/s', '', $header);
  $header = preg_replace('/<title>.*?<\\/title>/s', '', $header);

  $footer = preg_replace('/.*<footer\b/s', '<footer', $data);
  $footer = preg_replace('/<section id="anwiki-admin">.*?<\\/section>/s', '', $footer);

  $anwiki_data = array($header, $footer);
}

function abp_header($attrs, $contents)
{
  global $anwiki_data;
  if (!$anwiki_data)
    read_anwiki_data();

  $header = preg_replace('/<\\/head>/s', parse($contents) . '</head>', $anwiki_data[0]);
  global $anwiki_file;
  global $prefs;
  return $header;
}

function abp_footer()
{
  global $anwiki_data;
  if (!$anwiki_data)
    read_anwiki_data();

  return $anwiki_data[1];
}

comment:3 in reply to: ↑ 2 Changed 3 years ago by saroyanm

Replying to trev:

Yes, this is definitely something to do - we simply didn't get there so far. I wonder however whether the files from the repo will do or whether we need to process these in Python first.

No there is Jinja and CMS related data/syntax, so we need to process first.
What about just hardcoding the header and footer into the textpatterns template ? This will require us to update the blog's template every-time we change header or footer, but I think we don't need to do that too often.

comment:4 Changed 3 years ago by trev

  • Description modified (diff)

comment:5 Changed 3 years ago by saroyanm

  • Priority changed from Unknown to P3
  • Ready set

comment:6 Changed 3 years ago by saroyanm

  • Owner set to trev
  • Review URL(s) modified (diff)

comment:7 Changed 3 years ago by saroyanm

  • Status changed from new to reviewing

comment:8 Changed 3 years ago by trev

  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:9 Changed 3 years ago by trev

  • Blocked By 4481 added

comment:10 Changed 3 years ago by trev

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening, it seems that the hamburger menu shouldn't be removed after all.

comment:11 Changed 3 years ago by trev

  • Resolution set to fixed
  • Status changed from reopened to closed

Resolving again.

Note: See TracTickets for help on using tickets.