DPWiki:Magic tags

From DPWiki
Jump to navigation Jump to search

Yes, magic tags is a silly name. It's certainly more descriptive than the real name of these things, though, which is "extensions". Source code for the extensions currently in use can be found here.

See also Linking to DP content housed outside DP Wiki for other such links.

DP project info

Summary table

<projectinfo id="projectID42e3f694f2f5f" summary="yes" />

will produce this table:


Note: The appearance of the summary table might change


Substitution

The parts of that summary table can also be inserted individually. For instance, this markup:

 <projectinfo id="projectID42e3f694f2f5f">%title%, by %author%
 is now in %state%.</projectinfo>

will produce:

A Manual of Pronunciation, by Otis Ashmore is now in Completed and Posted to Project Gutenberg.

Using %link% produces a link to the project page, with the title as the link text.

 <projectinfo id="projectID42e3f694f2f5f">%link%, by %author%
 is now in %state%</projectinfo>.

produces

A Manual of Pronunciation, by Otis Ashmore is now in Completed and Posted to Project Gutenberg.

You can also show the project ID, PM, PPer, and available and total pages:

Tag:               Result:          
%projectid% projectID42e3f694f2f5f
%title% A Manual of Pronunciation
%link% A Manual of Pronunciation
%author% Otis Ashmore
%state% Completed and Posted to Project Gutenberg
%username%   (PM) greentea
%checkedoutby%  (PPer) shabam
%n_available_pages% 0
%n_pages% 77
%n_completed_pages% 77
%difficulty% hard
%genre% Linguistics
%language% English
%postednum% 21783
%short_state%
%raw_state%   (Real state name) proj_submit_pgposted
%url%   (URL of project on DP) https://www.pgdp.net/c/project.php?id=projectID42e3f694f2f5f&expected_state=proj_submit_pgposted

There are also a few aliases: uri for url, nameofwork for title, authorsname for author. NOTE: The code for showing completed pages includes pages in the "out" and "temp" state as well as those saved.

Limitations

  • You cannot pass the projectID into a template in order to use the <projectinfo ...> tag inside the template -- template parameters inside tags do not get expanded
  • You cannot get around this problem by calling a template inside the projectinfo tags like this:
<projectinfo id="projectID42e3f694f2f5f">{{ProjectInfoTemplate}}</projectinfo>

It just does not work.

Except now, it does. After a long and winding trip through the arcana of how wiki extensions, templates and parsers work and interact with each other, and three lines of changes to the DP extension code, you can now put wiki-isms such as templates in between the <projectinfo></projectinfo> tags and they should be parsed transparently. Enjoy. The summary function behavior remains unchanged. The usual wiki caveats about unintended interactions of nested stuff almost certainly still apply.--donovan 19:50, 21 June 2010 (PDT)

Note: The first limitation above still applies. You cannot specify a template parameter, e.g., {{{1}}} between the <projectinfo></projectinfo> tags.--wfarrell, 18 March 2017.

PG e-text formats

Listing form

<pg_formats etext="12345">The fun book, Marcellus Smith</pg_formats>

will produce:

The fun book, Marcellus Smith -- [EPUB; HTML; Mobipocket; RDF; Text; Text (us-ascii)]

Formats-only form

<pg_formats etext="1235" />

will produce:

[EPUB; HTML; HTML (utf-8); Mobipocket; RDF; Text (utf-8)]