summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustav Eek <gustav.eek@fripost.org>2019-12-09 19:51:03 +0100
committerGustav Eek <gustav.eek@fripost.org>2020-01-06 13:31:44 +0100
commit68534afeffad17c37337cb350fd10998da973def (patch)
tree521852a1525765aff000e7831f7f1d7ef0125c4a
parent82016f6624dae1e61cf3cacba6a32540b1e3fa4e (diff)
Further debug work with quite some progress
Read the last line in *notes*. Document *notes* added with some notes. Files *nonempty.tmpl* and *arg-for-fripost.mdwn* are uppdated with more template variable things. In *pandoc.pm*: * Debug dumps from subroutine *pagetemplate* improved * Some extra meta things are tried out
-rwxr-xr-x.ikiwiki/IkiWiki/Plugin/pandoc.pm22
-rw-r--r--events/2013/arg-for-fripost.mdwn9
-rw-r--r--notes78
-rw-r--r--templates/nonempty.tmpl9
4 files changed, 105 insertions, 13 deletions
diff --git a/.ikiwiki/IkiWiki/Plugin/pandoc.pm b/.ikiwiki/IkiWiki/Plugin/pandoc.pm
index a8b1649..b208b9a 100755
--- a/.ikiwiki/IkiWiki/Plugin/pandoc.pm
+++ b/.ikiwiki/IkiWiki/Plugin/pandoc.pm
@@ -608,6 +608,10 @@ sub htmlize ($@) {
$pagestate{$page}{meta}{pandoc_primary_author} = $scalar_meta{primary_author}
}
+ # DEBUG
+ $pagestate{$page}{meta}{fripost_debug_label_1} = 'fripost debug value';
+ # END
+
# The bibliography may be set in a Meta block in the page or in the .setup file.
# If both are present, the Meta block has precedence.
for my $bibl ($scalar_meta{bibliography}, $config{pandoc_bibliography}) {
@@ -710,7 +714,7 @@ sub htmlize ($@) {
# DEBUG Print pagestate again
$fnm = sprintf "%s.%.1d.%s", $fnm_pfx, $m++, "return-pagestate";
open($fh, '>>', $fnm);
- my %pagestate_dumper = (
+ %pagestate_dumper = (
$page => $pagestate{$page},
);
print $fh Data::Dumper->Dump([\%pagestate_dumper], [qw("pagestate")]), "\n";
@@ -736,23 +740,29 @@ sub pagetemplate (@) {
my %params = @_;
my $page = $params{page};
+ my $template = $params{template};
+
# DEBUG
- print "D: Run pagetemplate for $page\n";
+ my $filename = $template->{'options'}{'filename'};
+ $filename =~ /^.*\/([a-z]*).tmpl$/;
+ my $filenamebase = $1;
+ print "D: Run pagetemplate for $page and $filenamebase \n";
# END
- my $template = $params{template};
foreach my $k (keys %{$pagestate{$page}{meta}}) {
- next unless $k =~ /^pandoc_/;
+ next unless $k =~ /^(pandoc_|fripost_)/;
$template->param($k => $pagestate{$page}{meta}{$k});
}
+ $template->param('date' => $pagestate{$page}{meta}{date});
# DEBUG Print pagetemplate data
my $fnm_pfx = debug_get_filename_prefix ("pagetemplate", $page);
my $m = 0;
- my $fnm = sprintf "%s.%.1d.%s", $fnm_pfx, $m++, "data";
+ my $fnm = sprintf "%s.%s.%.1d.%s", $fnm_pfx, $filenamebase, $m++, "data";
open($fh, '>', $fnm) or die "Could not";
- print $fh Data::Dumper->Dump([%params], [qw(params)]), "\n";
+ my @keys = keys $template->%*;
print $fh Data::Dumper->Dump([$template], [qw(teplate)]), "\n";
+ # print $fh Data::Dumper->Dump([%params], [qw(params)]), "\n";
close $fh;
# END
diff --git a/events/2013/arg-for-fripost.mdwn b/events/2013/arg-for-fripost.mdwn
index 338946a..1a53c31 100644
--- a/events/2013/arg-for-fripost.mdwn
+++ b/events/2013/arg-for-fripost.mdwn
@@ -3,9 +3,9 @@ title: Argumentera för Fripost
author:
- Fripost genom arrangörer
- Fler
-date: 20 februari 2013
-tag: done
-titlesort: 2013-02-20
+date: 20 feb 2013
+tag: hejduglade
+titlesort: hejsansvejsan
abstract: |
gräv ner dig
ta en spade
@@ -17,8 +17,7 @@ tags:
[[!tag /events/done]]
[[!meta title="_" sortas=2013-02-20]]
-[[!meta date="Datum"]]
-
+[[!meta date=2019-08-15]]
Tid och plats
diff --git a/notes b/notes
new file mode 100644
index 0000000..49f2edd
--- /dev/null
+++ b/notes
@@ -0,0 +1,78 @@
+<!-- -*- mode: markdown -*- -->
+
+Somwhere thers a transition pandoc meta -> general meta, for some meta
+
+# Pagestate data
+
+This is for *arg-for-fripost*
+
+* 002 1 early
+ * Meta according to wiki tags: title, titlesort
+ * No tags seen at all
+
+* 002 4 return
+ * most 'pandoc_*' available
+ * meta 'tag' and 'pandoc_tag' set according to pandoc meta
+ * meta 'abstract' and 'pandoc_abstract' empty
+ * meta 'num_author' is 2, 'author' content as string,
+ 'pandoc_author' content as list
+
+* 007 1 early
+ * Meta overwritten according to wiki tags: title, titlesort
+ * Otherwise unchanged from 002 4
+
+* 007 4 return
+ * Back to 002 4
+
+* 013 1 early
+ * Back to 007 1
+
+* 013 4--027 4 continues
+
+# Working template variables
+
+The sytanx is e.g. `<TMPL_VAR TITLE>`. Compare template
+*nonempty.tmpl* with resulting HTML:
+
+ * TITLE -- pandoc meta
+ * DATE -- fallback to default `<TMPL_VAR DATE DEFAULT="1970-01-01">`
+ * TITLESORT -- nothing
+ * AUTHOR -- pandoc meta, 002 4, content as string
+ * ABSTRACT -- noting
+ * PANDOC_DATE -- pandoc meta
+ * PANDOC_PRIMARY_AUTHOR -- pandoc meta
+ * NUM_AUTHORS -- nothing
+ * TAG -- nothing
+ * PANDOC_TAG -- pandoc meta
+ * PANDOC_TITLESORT -- pandoc meta
+ * PANDOC_ABSTRACT -- nothing
+ * PANDOC_TITLE -- pandoc meta
+ * tags again with loop: ikiwiki meta
+
+tags again with loop:
+
+```
+<TMPL_IF TAGS>
+ |
+ <TMPL_LOOP TAGS>
+ <TMPL_VAR LINK>|
+ </TMPL_LOOP>
+ </TMPL_IF>
+<BR/>
+```
+# Page template data
+
+This is for *arg-for-fripost*
+
+ * identifies
+
+There is a need to also put things in subroutine *pagetemplate* to make
+them available as variables:
+
+```
+foreach my $k (keys %{$pagestate{$page}{meta}}) {
+ next unless $k =~ /^(pandoc_|fripost_)/;
+ $template->param($k => $pagestate{$page}{meta}{$k});
+}
+$template->param('date' => $pagestate{$page}{meta}{date});
+```
diff --git a/templates/nonempty.tmpl b/templates/nonempty.tmpl
index 319a79d..d54ea3d 100644
--- a/templates/nonempty.tmpl
+++ b/templates/nonempty.tmpl
@@ -1,7 +1,8 @@
<h2><TMPL_VAR TITLE></h2>
-title: |<TMPL_VAR TITLE>|<br/>
-date: |<TMPL_VAR DATE DEFAULT="1970-01-01">|<br/>
+title: |<TMPL_VAR TITLE DEFAULT="Defaulttitle hej">|<br/>
+date: |<TMPL_VAR DATE>|<br/>
+pubdate: |<TMPL_VAR PUBDATE>|<br/>
titlesort: |<TMPL_VAR TITLESORT>|<br/>
author: |<TMPL_VAR AUTHOR>|<BR/>
abstract: |<TMPL_VAR ABSTRACT>|<BR/>
@@ -13,6 +14,10 @@ pandoc_tag: |<TMPL_VAR PANDOC_TAG>|<BR/>
pandoc_titlesort: |<TMPL_VAR PANDOC_TITLESORT>|<BR/>
pandoc_abstract: |<TMPL_VAR PANDOC_ABSTRACT>|<BR/>
pandoc_title: |<TMPL_VAR PANDOC_TITLE>|<BR/>
+pageurl: |<TMPL_VAR PAGEURL>|<BR/>
+ctime: |<TMPL_VAR CTIME>|<BR/>
+mtime: |<TMPL_VAR MTIME>|<BR/>
+fripost_debug_label_1: |<TMPL_VAR FRIPOST_DEBUG_LABEL_1>|<BR/>
<br/>
tags again:
<TMPL_IF TAGS>