-í àH=cs_dZdZ dZ&dkZ'dkZ(dkZ)dkZ*dkZ0eii ddƒ2dk Z 3dk Z 9eii ddƒ;dk T<dk T=dkT>dkTGdZHd ZId ZJd ZOd ZPd ZQdZVdZWdZÝdfd„ƒYZd„ZLd„Zad„Zud„Z›d„ZÄeƒi eƒÅeƒi!deefƒÍeƒZ"Úeƒãt i#i$e"i%e"i&ƒZ'ìeƒi(ƒZ)íeƒi!de)ƒîe)djoïeƒi*dƒnõe"i+oöeƒnúeƒi!dee't i,fƒdS(sˆpystyler.py: A Web style generator program. Author: John W. Shipman (john@nmt.edu), Applications Specialist, New Mexico Tech Computer Center, Socorro, NM 87801 Written: July 1999 $Revision: 1.25 $ $Date: 2002/08/01 07:17:35 $ Revision history: 2.03 2002-08-01: Previously, PyStyler did not allow hyphens to be used in attribute names. However, when XSLT generates a file, it always includes a tag like ", so clearly hyphens *should* be allowed. 2.02 2001-01-16: Fixed a bug found by Hedges. If a page links to an anchor elsewhere in itself, such as in page foo.g, the result link had href=".html#anch" instead of href="foo.html#anch". 2.01 2000-06-06: - Added "-u" option to check that all page titles are unique. - Force page rewrite if Plan file is newer than .html file. - Report number of pages rewritten. 2.00 Complete rewrite in Python, May 2000 1.00 Original version in Icon, Oct.--Nov. 1995 s2.03sPyStylerNis/u/john/tcc/python/libs/u/john/projects/pystyler(s*sfsuswsnsPathMapsPlans webstyler.logiisArgscs ÝtZdZõ÷d„ZRS(sRepresents the command line arguments. Exports: Args ( ): [ if sys.argv describes a valid set of command line arguments for this program -> return a new Args object representing those arguments else -> Log() +:= error message stop execution ] .force: [ if self includes the force option -> 1 else -> 0 ] .unique: [ if self includes the unique-title option -> 1 else -> 0 ] .outRoot: [ if self includes the output root directory option -> that directory as a string else -> None ] .nav: [ if self includes the navigation shock report flag -> 1 else -> 0 ] cs ÷ùÿtitttdtgdƒ}titi d|ƒ\}} d|_  d|_ t|_ d|_x—|D]Œ\}}|djo||_na|djod|_ nA|djod|_n!|djod|_nq‰Wd S( s(Constructor for the Args object s:siis-ws-fs-us-nN(sstringsjoins FORCE_ARGs UNIQUE_ARGs WRITE_ARGsNAV_ARGsswitchessgetoptssyssargvs switchPairssargListsselfsforcesuniquesNonesoutRootsnavsswitchsvalue(sselfsvaluesswitchessswitchs switchPairssargList((s pystyler.pys__init__÷s$ "     (s__name__s __module__s__doc__s__init__(((s pystyler.pysArgsÝscsâ$%-y.ttƒaWn//tj o }0tƒidtƒnX8y9tttdt i ƒa Wn/:tj o };tƒidtƒnXDt i t ƒ}F|t joGtƒidƒndS(s*Read primary input files: PathMap, Plan, Template [ if (PATH_MAP_NAME names a readable, valid PathMap file) and (PLAN_NAME names a readable, valid Plan file) and (plan's default template file is valid) -> pathMap := a PathMap object representing PATH_MAP_NAME plan := a Plan object representing PLAN_NAME, with the default template as the sole entry in its template stack else -> Log() +:= error message(s) stop execution ] s(Terminated due to errors in the %s file.suniques.Terminated due to errors in the template file.N(sPathMaps PATH_MAP_NAMEspathMapsIOErrorsdetailsLogsfatalsPlans PLAN_NAMEsargssuniquesplanslookupTemplatesNonestemplate(sdetailstemplate((s pystyler.pysreadPlans  csL[\ttiƒdS(sProduce the `navigational shock report' [ +:= navigational shock report from plan ] Output format: ---------------------------------------------------------------- root-title (root-shortname) [root-variants] 1. first-child-title (first-child-shortname) [first-child-variants] 1.1 ... ---------------------------------------------------------------- where variants are shown as: `link-text' (ref-short-name lineno) N(s navSubtreesplansroot(((s pystyler.pys navReportLscsYagjt|ƒnx<t|iƒƒDn]%}o|i|ƒ}pt|ƒq)WdS(sÚGenerate navigational shock report for subtree rooted at topic [ if topic is a Topic object -> +:= navigational shock report for the subtree rooted at (topic) ] N(snavTopicstopicsranges nChildrenschildxsnthChilds childTopics navSubtree(stopics childTopicschildx((s pystyler.pys navSubtreeas   csÝuz}dt|i}„|iƒ}…x2tt|ƒƒD…]}†||d|| +:= navigational shock report for (topic) ] s is.is%s (%s)s %s%s %s (%s)N(sINDENT_PER_DEPTHstopicsdepthsindentsfullPathspathNossrangeslensisstringsjoinsmapsstrssectNosstitles shortNames navVariants(stopicsindentsispathNosssectNos((s pystyler.pysnavTopicus cs]›Ÿ£dt|it}­x5|iD­]'}®d||i|i|i fGHq+WdS(sDisplay report of link text variants for topic, if any [ +:= list of all text variants for topic, if any ] s s%s`%s' (%s %d)N( sINDENT_PER_DEPTHstopicsdepths VAR_INDENTsindents linkVarListsvarstexts shortNameslineNo(stopicsindentsvar((s pystyler.pys navVariants›s  s==== %s %s ====s==== Error count: %ds'Terminated due to error in input files.s'==== %s complete, wrote %d of %d pages.(-s__doc__sEXTERNAL_VERSIONs PROGRAM_NAMEssyssgetoptsstringsossstatspathsinsertslogspathinfospathmapsplanstemplatesbodys FORCE_ARGs UNIQUE_ARGs WRITE_ARGsNAV_ARGs PATH_MAP_NAMEs PLAN_NAMEsLOG_NAMEsINDENT_PER_DEPTHs VAR_INDENTsArgssreadPlans navReports navSubtreesnavTopics navVariantssLogs addLogFileswritesargssroots expandTreesforcesoutRootsnChangedscountserrCountsfatalsnavsnTopics(sstatsnavTopicsstrings UNIQUE_ARGsargss navSubtreessyss PROGRAM_NAMEs navReportsLOG_NAMEslogsINDENT_PER_DEPTHspathinfoserrCountsArgssEXTERNAL_VERSIONs WRITE_ARGsossnChangedsreadPlans FORCE_ARGsgetopts VAR_INDENTs PLAN_NAMEsNAV_ARGs navVariantss PATH_MAP_NAME((s pystyler.pys?sT                      †: 5   & )