A2E::Mktdir
Routines for creating hypertext nodes.
An intermediate layer between mktdir5(1) and A2E::Dokfs, does the work of mktdir5, mktdir4 and mktdir0.
A2E::Subdoks(3)
A2E::Mbox2dok(3)
Template(3)
Specify the default subtemplates (--subtmpl) that belong to each template
Document style. By setting this you imply that the document is a top node. Otherwise the style is inherited from the topmost preceding node (topdok).
Obsolete, maybe still used for legacy directories at a2e?
Configuration parameters for the templates used for creation of makefile, navigation file, main document etc.
write language-specific parameter files, named as specified in antefnom
Extra variables to be filled into the template tmpl at time of creation. These variables are also written into the language-neutral --antefnom file, so that they precede any vocabulary definitions at compile-time. The values of these variables can be multilingual, using the syntax indicated above. In this case, by implication, skrib_antefaylz is true.
extra variables to be written into vocubulary file lngfayl.
Unlike the --tmplvars template variables, these are evaluated when the document is compiled, rather than when it is created. This commandline option might not be very useful in practise. It might be more advisable to store the variables in a template-related vocabulary file which is named according to the file naming convention specified by the --tmpllngfnom, --tmpllngfnom0, --doktmpllngfnom, --doktmpllngfnom0 variables of A2E::Dokfs.
Extra variables to be written into language-neutral vocabulary file (unless that already exists). This option is not very useful because the files written to the antefnom (parameter element) file is more important.
All documents that use a certain template may use certain rss channel(s). Specify this as a rule, expressed by a hash, in the same way as for individual channels it is done by the --getkanals option.
All documents that use a certain template may be suitable for insertion into certain news/rss channels. Specify this as a rule, expressed by a hash, in the same way as for individual channels it is done by the --putkanals option.
Variables that can appear a elements in the subopts hash, i.e. those that have special values in the descendant (creatable) document which need to be specified in that descendant's local configuration file (e.g. @dokfs), exist in this hash as keys with a corresponding true value.
This is used by &A2E::Privat::Lnsig::do_mktdir to determine which variables belong to the descendant level.
leaf of directory to be created. normally we only give a sems (semantic features) argument and let the system derive the leaf (--fol) and the document (--dok) based on rules specified in the sems2fol and sems2dok template variables, but we can also override these rules and explicitely name these items.
mktdir.konf
None open at the moment
mktdir0(1)
mktdir5(1)
A2E::Dokfs(3)
Hartmut Pilch
Copyright (c) 2008-9 Hartmut Pilch (phm)
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Names in this program are based on English with International Latin spelling, e.g. 'kopi' for 'copy' and 'meikfayl' for 'makefile', as (to be) explained in
http://a2e.de/alfabet/interlatin
with with occasional Esperanto (such as replacing words such as 'write'/'rait', that become unwieldy in interlatin spelling, with 'skrib')
http://a2e.de/lang/eo
for which the same spelling is used.
Copy a file from $1 to $2. A wrapper around Unix cp.
Find out whether the current directory is a group node, i.e. directory-wise-parallel to its menu-wise parent.
If the directory contains a '@grpdoks' file or is indicated by the --grpdir option this is true.
If the current node is a group node (pwd_get_grpdir_p) and we are not using a dot argument, go to the parent directory.
arg1 : grpdir_p
arg2 : dotdir_p
Turn a directory value as specified on the commandline into an absolute directory
Set the subdirectory argument.
Allow a dot for a default value, expand that.
Currently it can only be a leaf.
DOTDIR: If the leaf is '.', i.e. the current directory, we do not need subadd later, and the template that our created/extended document uses is no longer the one specified by konfig.subtmpl but konfig.tmpl
This should come before 'subadd', which depends on the supdir-related behaviour and uses the dotdir info.
It should come before 'set_dok_varz'; it should not write anything to the database.
Do not confuse with the supdir and supdok functions of A2E::Dokfs; here we take a different path; we create the data that the supdir/supdok functions can later use.
The variable $m->{grpdir_fol} is reset in gdp_set_pwd only if needed. The boolean flag $m->{grpdir_p} is always set to tell us whether we are working from a group node. If so the grpdir_fol must have been set.
Read variables from the vocabulary files of the document type and write them into the template variables hash; omit those that belong to a group of forbidden variables (non_tmplvars). Choose the default language if none was given. Preconditions: suplangs (languages of superior document node) must be known. A second argument indicates whether language-neutral files should be read as well; this is done only the first time.
Find out what kind of a location our leaf is (whether we can write there, whether it is a tree trunk), store some basic configuration values into memory, write others to the database.
The aliases and topdoks must be read into memory in any case.
The database must be edited only if we are creating a new document, i.e. not SAMDOK.
For this to work we must be in the directory from where the leaf is added to the menu.
This may be different from the directory to which the subdirectory is added, aka supdir: some directories are heads of groups (grpdir, containing a @grpdoks file).
DOTDIR: if we are working in the current directory (see DOTDIR), we omit this step, because we assume that we are just adding a new language to an existing document. Don't mind if the document is a top-level document and thus not subordinate to the current document in a strict sense. If $m->{konfig}->force (commandline option --force) is set, go ahead even in the
Once we have identified the directory, document and position in the hierarchy, we are ready to set some more variables and perform some checks.
Derive the url from the directory which we have chosen for our document.
This does not read anything from an existing directory, can therefore come relatively early.
Since the sequence of checking directories against urls is critical, we can not use a hash variable for our dirurls config option!
It must come between set_dir_varz and set_dok_varz.
generate triantapentesimal alphanumeric digit, e.g. for 'K4F' style date
preset date-related template variables based on a given date.
Safely create a directory after moving blocking data out of the way. Refrain from creating if the data indicates that the document node shouldn't be here. Make sure we are svn-wise up to date. Retrieve-store info about languages of any pre-existing dok (oldlangs). This comes before pars_args.
Copy a template from its source to its destination and transform it, using the Template toolkit.
Find out for which languages the present node already contains body documents and store these in @{$m->{oldlangs}}.
This is relevant only for existing documents, i.e. cases where dokdir_p is true or where we are entering into an existing directory in seif_mkdir.
It must be there before we have parsed the commandline arguments i.e. pars_args.
Parse language-version-related arguments.
Take @ARGV as arguments.
Check all arguments and store them into a hash $m->{lngtags}, from which they are later read when they are used.
This way we can detect syntax errors early in the process.
This must come after seif_mkdir, at end of setup.
set default values for title, subtitle etc unless we have a template available.
Write stubs for the main document (@dok_*) and its auxiliary files.
First evaluate all the commandline parameters, start writing only if they are OK.
Copy templates that are needed for top nodes of microsites, i.e. topdoks.
Arg1 is the filename suffix. The rest of the filename is determined by other factors: the tmplsupdir and topsty config variables.
If template variables are present in arg 2 then use transkopi for the transformations, using the Template toolkit with the star style.
Try with more or less specific directory and base names. Die if no suitable default file is found.
Install all the topdok templates using the Template toolkit with star style.
NO_TOPSTY: stop unless we are in a top level document.
This does not yet involve any templates that depend on the vocabulary database.
If a text building block file already exists, store any variable assignements found therein in their raw original form as whole lines in a hash %vars, but identify the variable and use it as hash index. Return %vars.
This is used by skrib_antefayl0, skrib_antefayl, skrib_postfayl and skrib_postfayl0
If a vocabulary file exists, store any variable assignments found therein in their raw original form as whole lines in the hash %vars, but identify the variable and use it as hash index. then overwrite these variables with any newer values that we might have and produce an ordered list of whole lines without the hash index.
arg1 : vocabulary file, e.g. '@pre.abc.de.txt' arg2 : vocabulary definition format, e.g. '%s := %s' arg3 : hashref of values that have already been set and take precedence over anything found in the file arg4ff : keys of hashref that we actually will use, all if untrue
Write a file from a template
$arg1 : template file $arg2 : output file %args3ff : settings of some file variables for emacs local variables header+footer, mostly C<dokl> and C<mode>
Read a lingual text from the command line. Return input value and whether it is old, i.e. the input just confirmed what was already in the template.
Write a postfayl '@lng.*.??.txt' from scratch based on configuration variables and preset variables.
$arg1 : string : filepath
$arg2 : string : lang
$arg3 : hashref : text chunks
$arg4 : hashref : whether text chunks are old
Write language dependent tags from object variable lngtags into a lng_fayl and add that to the repository. If a file exists, reuse variables found therein. If a template exists, use that, otherwise write from memory based on configuration and preexisting variables.
Write out language neutral vocabulary file unless it already exists.
Write language-specific parameter file.
Write out language neutral vocabulary file if it does not already exist.
Return full pathname for basename arg1, obtained by searching through the template directories.
The returned pathname has been found to exist.
arg2ff is a list of options containing the boolean option insist which switches off search in parent directories.
If the insist option is true and nothing is found, die.
find the appropriate template file, as specified by a naming config option from A2E::Dokfs(3), by seeking it in a series of directories specified in A2E::Tmplkonf(3), from the lowest (most specific) to the highest (most generic) possible template.
Set some template variables that are needed both in skrib_mldok and skrib_antefayl0.
Set up the text elements (read vocabulary dbm files), write out the main document bodies, first language-dependent parts with different dbm files as basis, then language-independent parts with original of topdok as basis.
Write out the @langs file.
This comes after writing the main document(s) but after set_oldlangs
Write out information from configuration variables to configuration file (e.g. '@dokfs').
Write out a @dokfs file, either based on a template that could be found in the topdok directory, or based on configuration variable settings. EKZISTS: Do so only if no such file ekzists yet, i.e. dont do so if we are only adding another language version to a document.
Add accumulated files and some further ones to Subversion repository. Write metadata to the database. Set up a link to an mbox if found.
Enlist some remaining files that were not (as would be preferrable) enlisted upon creation. Then add all candidates to the svn repository.
Final steps of the mktdir5 procedure.
always write language-specific parameter files if we are at top document level.
transfer multilingual values of variable settings such as
-V thema=Italia,de:Italien,en:Italy,fr:Italie
from $m->{konfig}->tmplvars into $m->{lang_tmplvars}
Overload the postkonfig part of the new_ready method from A2E::Prog(3).
The bulk of the mktdir5/mktdir4/mktdir0 program, starting right after parsing of commandline options.