asciidoc.asciidoc 218 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040
  1. AsciiDoc User Guide
  2. ===================
  3. Stuart Rackham <srackham@gmail.com>
  4. :Author Initials: SJR
  5. :toc:
  6. :icons:
  7. :numbered:
  8. :website: http://www.methods.co.nz/asciidoc/
  9. AsciiDoc is a text document format for writing notes, documentation,
  10. articles, books, ebooks, slideshows, web pages, blogs and UNIX man
  11. pages. AsciiDoc files can be translated to many formats including
  12. HTML, PDF, EPUB, man page. AsciiDoc is highly configurable: both the
  13. AsciiDoc source file syntax and the backend output markups (which can
  14. be almost any type of SGML/XML markup) can be customized and extended
  15. by the user.
  16. .This document
  17. **********************************************************************
  18. This is an overly large document, it probably needs to be refactored
  19. into a Tutorial, Quick Reference and Formal Reference.
  20. If you're new to AsciiDoc read this section and the <<X6,Getting
  21. Started>> section and take a look at the example AsciiDoc (`*.txt`)
  22. source files in the distribution `doc` directory.
  23. **********************************************************************
  24. Introduction
  25. ------------
  26. AsciiDoc is a plain text human readable/writable document format that
  27. can be translated to DocBook or HTML using the asciidoc(1) command.
  28. You can then either use asciidoc(1) generated HTML directly or run
  29. asciidoc(1) DocBook output through your favorite DocBook toolchain or
  30. use the AsciiDoc a2x(1) toolchain wrapper to produce PDF, EPUB, DVI,
  31. LaTeX, PostScript, man page, HTML and text formats.
  32. The AsciiDoc format is a useful presentation format in its own right:
  33. AsciiDoc markup is simple, intuitive and as such is easily proofed and
  34. edited.
  35. AsciiDoc is light weight: it consists of a single Python script and a
  36. bunch of configuration files. Apart from asciidoc(1) and a Python
  37. interpreter, no other programs are required to convert AsciiDoc text
  38. files to DocBook or HTML. See <<X11,Example AsciiDoc Documents>>
  39. below.
  40. Text markup conventions tend to be a matter of (often strong) personal
  41. preference: if the default syntax is not to your liking you can define
  42. your own by editing the text based asciidoc(1) configuration files.
  43. You can also create configuration files to translate AsciiDoc
  44. documents to almost any SGML/XML markup.
  45. asciidoc(1) comes with a set of configuration files to translate
  46. AsciiDoc articles, books and man pages to HTML or DocBook backend
  47. formats.
  48. .My AsciiDoc Itch
  49. **********************************************************************
  50. DocBook has emerged as the de facto standard Open Source documentation
  51. format. But DocBook is a complex language, the markup is difficult to
  52. read and even more difficult to write directly -- I found I was
  53. spending more time typing markup tags, consulting reference manuals
  54. and fixing syntax errors, than I was writing the documentation.
  55. **********************************************************************
  56. [[X6]]
  57. Getting Started
  58. ---------------
  59. Installing AsciiDoc
  60. ~~~~~~~~~~~~~~~~~~~
  61. See the `README` and `INSTALL` files for install prerequisites and
  62. procedures. Packagers take a look at <<X38,Packager Notes>>.
  63. [[X11]]
  64. Example AsciiDoc Documents
  65. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  66. The best way to quickly get a feel for AsciiDoc is to view the
  67. AsciiDoc web site and/or distributed examples:
  68. - Take a look at the linked examples on the AsciiDoc web site home
  69. page {website}. Press the 'Page Source' sidebar menu item to view
  70. corresponding AsciiDoc source.
  71. - Read the `*.txt` source files in the distribution `./doc` directory
  72. along with the corresponding HTML and DocBook XML files.
  73. AsciiDoc Document Types
  74. -----------------------
  75. There are three types of AsciiDoc documents: article, book and
  76. manpage. All document types share the same AsciiDoc format with some
  77. minor variations. If you are familiar with DocBook you will have
  78. noticed that AsciiDoc document types correspond to the same-named
  79. DocBook document types.
  80. Use the asciidoc(1) `-d` (`--doctype`) option to specify the AsciiDoc
  81. document type -- the default document type is 'article'.
  82. By convention the `.txt` file extension is used for AsciiDoc document
  83. source files.
  84. article
  85. ~~~~~~~
  86. Used for short documents, articles and general documentation. See the
  87. AsciiDoc distribution `./doc/article.txt` example.
  88. AsciiDoc defines standard DocBook article frontmatter and backmatter
  89. <<X93,section markup templates>> (appendix, abstract, bibliography,
  90. glossary, index).
  91. book
  92. ~~~~
  93. Books share the same format as articles, with the following
  94. differences:
  95. - The part titles in multi-part books are <<X17,top level titles>>
  96. (same level as book title).
  97. - Some sections are book specific e.g. preface and colophon.
  98. Book documents will normally be used to produce DocBook output since
  99. DocBook processors can automatically generate footnotes, table of
  100. contents, list of tables, list of figures, list of examples and
  101. indexes.
  102. AsciiDoc defines standard DocBook book frontmatter and backmatter
  103. <<X93,section markup templates>> (appendix, dedication, preface,
  104. bibliography, glossary, index, colophon).
  105. .Example book documents
  106. Book::
  107. The `./doc/book.txt` file in the AsciiDoc distribution.
  108. Multi-part book::
  109. The `./doc/book-multi.txt` file in the AsciiDoc distribution.
  110. manpage
  111. ~~~~~~~
  112. Used to generate roff format UNIX manual pages. AsciiDoc manpage
  113. documents observe special header title and section naming conventions
  114. -- see the <<X1,Manpage Documents>> section for details.
  115. AsciiDoc defines the 'synopsis' <<X93,section markup template>> to
  116. generate the DocBook `refsynopsisdiv` section.
  117. See also the asciidoc(1) man page source (`./doc/asciidoc.1.txt`) from
  118. the AsciiDoc distribution.
  119. [[X5]]
  120. AsciiDoc Backends
  121. -----------------
  122. The asciidoc(1) command translates an AsciiDoc formatted file to the
  123. backend format specified by the `-b` (`--backend`) command-line
  124. option. asciidoc(1) itself has little intrinsic knowledge of backend
  125. formats, all translation rules are contained in customizable cascading
  126. configuration files. Backend specific attributes are listed in the
  127. <<X88,Backend Attributes>> section.
  128. docbook45::
  129. Outputs DocBook XML 4.5 markup.
  130. html4::
  131. This backend generates plain HTML 4.01 Transitional markup.
  132. xhtml11::
  133. This backend generates XHTML 1.1 markup styled with CSS2. Output
  134. files have an `.html` extension.
  135. html5::
  136. This backend generates HTML 5 markup, apart from the inclusion of
  137. <<X98,audio and video block macros>> it is functionally identical to
  138. the 'xhtml11' backend.
  139. slidy::
  140. Use this backend to generate self-contained
  141. http://www.w3.org/Talks/Tools/Slidy2/[Slidy] HTML slideshows for
  142. your web browser from AsciiDoc documents. The Slidy backend is
  143. documented in the distribution `doc/slidy.txt` file and
  144. {website}slidy.html[online].
  145. wordpress::
  146. A minor variant of the 'html4' backend to support
  147. http://srackham.wordpress.com/blogpost1/[blogpost].
  148. latex::
  149. Experimental LaTeX backend.
  150. Backend Aliases
  151. ~~~~~~~~~~~~~~~
  152. Backend aliases are alternative names for AsciiDoc backends. AsciiDoc
  153. comes with two backend aliases: 'html' (aliased to 'xhtml11') and
  154. 'docbook' (aliased to 'docbook45').
  155. You can assign (or reassign) backend aliases by setting an AsciiDoc
  156. attribute named like `backend-alias-<alias>` to an AsciiDoc backend
  157. name. For example, the following backend alias attribute definitions
  158. appear in the `[attributes]` section of the global `asciidoc.conf`
  159. configuration file:
  160. backend-alias-html=xhtml11
  161. backend-alias-docbook=docbook45
  162. [[X100]]
  163. Backend Plugins
  164. ~~~~~~~~~~~~~~~
  165. The asciidoc(1) `--backend` option is also used to install and manage
  166. backend <<X101,plugins>>.
  167. - A backend plugin is used just like the built-in backends.
  168. - Backend plugins <<X27,take precedence>> over built-in backends with
  169. the same name.
  170. - You can use the `{asciidoc-confdir}` <<X60, intrinsic attribute>> to
  171. refer to the built-in backend configuration file location from
  172. backend plugin configuration files.
  173. - You can use the `{backend-confdir}` <<X60, intrinsic attribute>> to
  174. refer to the backend plugin configuration file location.
  175. - By default backends plugins are installed in
  176. `$HOME/.asciidoc/backends/<backend>` where `<backend>` is the
  177. backend name.
  178. DocBook
  179. -------
  180. AsciiDoc generates 'article', 'book' and 'refentry'
  181. http://www.docbook.org/[DocBook] documents (corresponding to the
  182. AsciiDoc 'article', 'book' and 'manpage' document types).
  183. Most Linux distributions come with conversion tools (collectively
  184. called a toolchain) for <<X12,converting DocBook files>> to
  185. presentation formats such as Postscript, HTML, PDF, EPUB, DVI,
  186. PostScript, LaTeX, roff (the native man page format), HTMLHelp,
  187. JavaHelp and text. There are also programs that allow you to view
  188. DocBook files directly, for example http://live.gnome.org/Yelp[Yelp]
  189. (the GNOME help viewer).
  190. [[X12]]
  191. Converting DocBook to other file formats
  192. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  193. DocBook files are validated, parsed and translated various
  194. presentation file formats using a combination of applications
  195. collectively called a DocBook 'tool chain'. The function of a tool
  196. chain is to read the DocBook markup (produced by AsciiDoc) and
  197. transform it to a presentation format (for example HTML, PDF, HTML
  198. Help, EPUB, DVI, PostScript, LaTeX).
  199. A wide range of user output format requirements coupled with a choice
  200. of available tools and stylesheets results in many valid tool chain
  201. combinations.
  202. [[X43]]
  203. a2x Toolchain Wrapper
  204. ~~~~~~~~~~~~~~~~~~~~~
  205. One of the biggest hurdles for new users is installing, configuring
  206. and using a DocBook XML toolchain. `a2x(1)` can help -- it's a
  207. toolchain wrapper command that will generate XHTML (chunked and
  208. unchunked), PDF, EPUB, DVI, PS, LaTeX, man page, HTML Help and text
  209. file outputs from an AsciiDoc text file. `a2x(1)` does all the grunt
  210. work associated with generating and sequencing the toolchain commands
  211. and managing intermediate and output files. `a2x(1)` also optionally
  212. deploys admonition and navigation icons and a CSS stylesheet. See the
  213. `a2x(1)` man page for more details. In addition to `asciidoc(1)` you
  214. also need <<X40,xsltproc(1)>>, <<X13,DocBook XSL Stylesheets>> and
  215. optionally: <<X31,dblatex>> or <<X14,FOP>> (to generate PDF);
  216. `w3m(1)` or `lynx(1)` (to generate text).
  217. The following examples generate `doc/source-highlight-filter.pdf` from
  218. the AsciiDoc `doc/source-highlight-filter.txt` source file. The first
  219. example uses `dblatex(1)` (the default PDF generator) the second
  220. example forces FOP to be used:
  221. $ a2x -f pdf doc/source-highlight-filter.txt
  222. $ a2x -f pdf --fop doc/source-highlight-filter.txt
  223. See the `a2x(1)` man page for details.
  224. TIP: Use the `--verbose` command-line option to view executed
  225. toolchain commands.
  226. HTML generation
  227. ~~~~~~~~~~~~~~~
  228. AsciiDoc produces nicely styled HTML directly without requiring a
  229. DocBook toolchain but there are also advantages in going the DocBook
  230. route:
  231. - HTML from DocBook can optionally include automatically generated
  232. indexes, tables of contents, footnotes, lists of figures and tables.
  233. - DocBook toolchains can also (optionally) generate separate (chunked)
  234. linked HTML pages for each document section.
  235. - Toolchain processing performs link and document validity checks.
  236. - If the DocBook 'lang' attribute is set then things like table of
  237. contents, figure and table captions and admonition captions will be
  238. output in the specified language (setting the AsciiDoc 'lang'
  239. attribute sets the DocBook 'lang' attribute).
  240. On the other hand, HTML output directly from AsciiDoc is much faster,
  241. is easily customized and can be used in situations where there is no
  242. suitable DocBook toolchain (for example, see the {website}[AsciiDoc
  243. website]).
  244. PDF generation
  245. ~~~~~~~~~~~~~~
  246. There are two commonly used tools to generate PDFs from DocBook,
  247. <<X31,dblatex>> and <<X14,FOP>>.
  248. .dblatex or FOP?
  249. - 'dblatex' is easier to install, there's zero configuration
  250. required and no Java VM to install -- it just works out of the box.
  251. - 'dblatex' source code highlighting and numbering is superb.
  252. - 'dblatex' is easier to use as it converts DocBook directly to PDF
  253. whereas before using 'FOP' you have to convert DocBook to XML-FO
  254. using <<X13,DocBook XSL Stylesheets>>.
  255. - 'FOP' is more feature complete (for example, callouts are processed
  256. inside literal layouts) and arguably produces nicer looking output.
  257. HTML Help generation
  258. ~~~~~~~~~~~~~~~~~~~~
  259. . Convert DocBook XML documents to HTML Help compiler source files
  260. using <<X13,DocBook XSL Stylesheets>> and <<X40,xsltproc(1)>>.
  261. . Convert the HTML Help source (`.hhp` and `.html`) files to HTML Help
  262. (`.chm`) files using the <<X67,Microsoft HTML Help Compiler>>.
  263. Toolchain components summary
  264. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  265. AsciiDoc::
  266. Converts AsciiDoc (`.txt`) files to DocBook XML (`.xml`) files.
  267. [[X13]]http://docbook.sourceforge.net/projects/xsl/[DocBook XSL Stylesheets]::
  268. These are a set of XSL stylesheets containing rules for converting
  269. DocBook XML documents to HTML, XSL-FO, manpage and HTML Help files.
  270. The stylesheets are used in conjunction with an XML parser such as
  271. <<X40,xsltproc(1)>>.
  272. [[X40]]http://www.xmlsoft.org[xsltproc]::
  273. An XML parser for applying XSLT stylesheets (in our case the
  274. <<X13,DocBook XSL Stylesheets>>) to XML documents.
  275. [[X31]]http://dblatex.sourceforge.net/[dblatex]::
  276. Generates PDF, DVI, PostScript and LaTeX formats directly from
  277. DocBook source via the intermediate LaTeX typesetting language --
  278. uses <<X13,DocBook XSL Stylesheets>>, <<X40,xsltproc(1)>> and
  279. `latex(1)`.
  280. [[X14]]http://xml.apache.org/fop/[FOP]::
  281. The Apache Formatting Objects Processor converts XSL-FO (`.fo`)
  282. files to PDF files. The XSL-FO files are generated from DocBook
  283. source files using <<X13,DocBook XSL Stylesheets>> and
  284. <<X40,xsltproc(1)>>.
  285. [[X67]]Microsoft Help Compiler::
  286. The Microsoft HTML Help Compiler (`hhc.exe`) is a command-line tool
  287. that converts HTML Help source files to a single HTML Help (`.chm`)
  288. file. It runs on MS Windows platforms and can be downloaded from
  289. http://www.microsoft.com.
  290. AsciiDoc dblatex configuration files
  291. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  292. The AsciiDoc distribution `./dblatex` directory contains
  293. `asciidoc-dblatex.xsl` (customized XSL parameter settings) and
  294. `asciidoc-dblatex.sty` (customized LaTeX settings). These are examples
  295. of optional <<X31,dblatex>> output customization and are used by
  296. <<X43,a2x(1)>>.
  297. AsciiDoc DocBook XSL Stylesheets drivers
  298. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  299. You will have noticed that the distributed HTML and HTML Help
  300. documentation files (for example `./doc/asciidoc.html`) are not the
  301. plain outputs produced using the default 'DocBook XSL Stylesheets'
  302. configuration. This is because they have been processed using
  303. customized DocBook XSL Stylesheets along with (in the case of HTML
  304. outputs) the custom `./stylesheets/docbook-xsl.css` CSS stylesheet.
  305. You'll find the customized DocBook XSL drivers along with additional
  306. documentation in the distribution `./docbook-xsl` directory. The
  307. examples that follow are executed from the distribution documentation
  308. (`./doc`) directory. These drivers are also used by <<X43,a2x(1)>>.
  309. `common.xsl`::
  310. Shared driver parameters. This file is not used directly but is
  311. included in all the following drivers.
  312. `chunked.xsl`::
  313. Generate chunked XHTML (separate HTML pages for each document
  314. section) in the `./doc/chunked` directory. For example:
  315. $ python ../asciidoc.py -b docbook asciidoc.txt
  316. $ xsltproc --nonet ../docbook-xsl/chunked.xsl asciidoc.xml
  317. `epub.xsl`::
  318. Used by <<X43,a2x(1)>> to generate EPUB formatted documents.
  319. `fo.xsl`::
  320. Generate XSL Formatting Object (`.fo`) files for subsequent PDF
  321. file generation using FOP. For example:
  322. $ python ../asciidoc.py -b docbook article.txt
  323. $ xsltproc --nonet ../docbook-xsl/fo.xsl article.xml > article.fo
  324. $ fop article.fo article.pdf
  325. `htmlhelp.xsl`::
  326. Generate Microsoft HTML Help source files for the MS HTML Help
  327. Compiler in the `./doc/htmlhelp` directory. This example is run on
  328. MS Windows from a Cygwin shell prompt:
  329. $ python ../asciidoc.py -b docbook asciidoc.txt
  330. $ xsltproc --nonet ../docbook-xsl/htmlhelp.xsl asciidoc.xml
  331. $ c:/Program\ Files/HTML\ Help\ Workshop/hhc.exe htmlhelp.hhp
  332. `manpage.xsl`::
  333. Generate a `roff(1)` format UNIX man page from a DocBook XML
  334. 'refentry' document. This example generates an `asciidoc.1` man
  335. page file:
  336. $ python ../asciidoc.py -d manpage -b docbook asciidoc.1.txt
  337. $ xsltproc --nonet ../docbook-xsl/manpage.xsl asciidoc.1.xml
  338. `xhtml.xsl`::
  339. Convert a DocBook XML file to a single XHTML file. For example:
  340. $ python ../asciidoc.py -b docbook asciidoc.txt
  341. $ xsltproc --nonet ../docbook-xsl/xhtml.xsl asciidoc.xml > asciidoc.html
  342. If you want to see how the complete documentation set is processed
  343. take a look at the A-A-P script `./doc/main.aap`.
  344. Generating Plain Text Files
  345. ---------------------------
  346. AsciiDoc does not have a text backend (for most purposes AsciiDoc
  347. source text is fine), however you can convert AsciiDoc text files to
  348. formatted text using the AsciiDoc <<X43,a2x(1)>> toolchain wrapper
  349. utility.
  350. [[X35]]
  351. HTML5 and XHTML 1.1
  352. -------------------
  353. The 'xhtml11' and 'html5' backends embed or link CSS and JavaScript
  354. files in their outputs, there is also a <<X99,themes>> plugin
  355. framework.
  356. - If the AsciiDoc 'linkcss' attribute is defined then CSS and
  357. JavaScript files are linked to the output document, otherwise they
  358. are embedded (the default behavior).
  359. - The default locations for CSS and JavaScript files can be changed by
  360. setting the AsciiDoc 'stylesdir' and 'scriptsdir' attributes
  361. respectively.
  362. - The default locations for embedded and linked files differ and are
  363. calculated at different times -- embedded files are loaded when
  364. asciidoc(1) generates the output document, linked files are loaded
  365. by the browser when the user views the output document.
  366. - Embedded files are automatically inserted in the output files but
  367. you need to manually copy linked CSS and Javascript files from
  368. AsciiDoc <<X27,configuration directories>> to the correct location
  369. relative to the output document.
  370. .Stylesheet file locations
  371. [cols="3*",frame="topbot",options="header"]
  372. |====================================================================
  373. |'stylesdir' attribute
  374. |Linked location ('linkcss' attribute defined)
  375. |Embedded location ('linkcss' attribute undefined)
  376. |Undefined (default).
  377. |Same directory as the output document.
  378. |`stylesheets` subdirectory in the AsciiDoc configuration directory
  379. (the directory containing the backend conf file).
  380. |Absolute or relative directory name.
  381. |Absolute or relative to the output document.
  382. |Absolute or relative to the AsciiDoc configuration directory (the
  383. directory containing the backend conf file).
  384. |====================================================================
  385. .JavaScript file locations
  386. [cols="3*",frame="topbot",options="header"]
  387. |====================================================================
  388. |'scriptsdir' attribute
  389. |Linked location ('linkcss' attribute defined)
  390. |Embedded location ('linkcss' attribute undefined)
  391. |Undefined (default).
  392. |Same directory as the output document.
  393. |`javascripts` subdirectory in the AsciiDoc configuration directory
  394. (the directory containing the backend conf file).
  395. |Absolute or relative directory name.
  396. |Absolute or relative to the output document.
  397. |Absolute or relative to the AsciiDoc configuration directory (the
  398. directory containing the backend conf file).
  399. |====================================================================
  400. [[X99]]
  401. Themes
  402. ~~~~~~
  403. The AsciiDoc 'theme' attribute is used to select an alternative CSS
  404. stylesheet and to optionally include additional JavaScript code.
  405. - Theme files reside in an AsciiDoc <<X27,configuration directory>>
  406. named `themes/<theme>/` (where `<theme>` is the the theme name set
  407. by the 'theme' attribute). asciidoc(1) sets the 'themedir' attribute
  408. to the theme directory path name.
  409. - The 'theme' attribute can also be set using the asciidoc(1)
  410. `--theme` option, the `--theme` option can also be used to manage
  411. theme <<X101,plugins>>.
  412. - AsciiDoc ships with two themes: 'flask' and 'volnitsky'.
  413. - The `<theme>.css` file replaces the default `asciidoc.css` CSS file.
  414. - The `<theme>.js` file is included in addition to the default
  415. `asciidoc.js` JavaScript file.
  416. - If the <<X66,data-uri>> attribute is defined then icons are loaded
  417. from the theme `icons` sub-directory if it exists (i.e. the
  418. 'iconsdir' attribute is set to theme `icons` sub-directory path).
  419. - Embedded theme files are automatically inserted in the output files
  420. but you need to manually copy linked CSS and Javascript files to the
  421. location of the output documents.
  422. - Linked CSS and JavaScript theme files are linked to the same linked
  423. locations as <<X35,other CSS and JavaScript files>>.
  424. For example, the command-line option `--theme foo` (or `--attribute
  425. theme=foo`) will cause asciidoc(1) to search <<"X27","configuration
  426. file locations 1, 2 and 3">> for a sub-directory called `themes/foo`
  427. containing the stylesheet `foo.css` and optionally a JavaScript file
  428. name `foo.js`.
  429. Document Structure
  430. ------------------
  431. An AsciiDoc document consists of a series of <<X8,block elements>>
  432. starting with an optional document Header, followed by an optional
  433. Preamble, followed by zero or more document Sections.
  434. Almost any combination of zero or more elements constitutes a valid
  435. AsciiDoc document: documents can range from a single sentence to a
  436. multi-part book.
  437. Block Elements
  438. ~~~~~~~~~~~~~~
  439. Block elements consist of one or more lines of text and may contain
  440. other block elements.
  441. The AsciiDoc block structure can be informally summarized as follows
  442. footnote:[This is a rough structural guide, not a rigorous syntax
  443. definition]:
  444. Document ::= (Header?,Preamble?,Section*)
  445. Header ::= (Title,(AuthorInfo,RevisionInfo?)?)
  446. AuthorInfo ::= (FirstName,(MiddleName?,LastName)?,EmailAddress?)
  447. RevisionInfo ::= (RevisionNumber?,RevisionDate,RevisionRemark?)
  448. Preamble ::= (SectionBody)
  449. Section ::= (Title,SectionBody?,(Section)*)
  450. SectionBody ::= ((BlockTitle?,Block)|BlockMacro)+
  451. Block ::= (Paragraph|DelimitedBlock|List|Table)
  452. List ::= (BulletedList|NumberedList|LabeledList|CalloutList)
  453. BulletedList ::= (ListItem)+
  454. NumberedList ::= (ListItem)+
  455. CalloutList ::= (ListItem)+
  456. LabeledList ::= (ListEntry)+
  457. ListEntry ::= (ListLabel,ListItem)
  458. ListLabel ::= (ListTerm+)
  459. ListItem ::= (ItemText,(List|ListParagraph|ListContinuation)*)
  460. Where:
  461. - '?' implies zero or one occurrence, '+' implies one or more
  462. occurrences, '*' implies zero or more occurrences.
  463. - All block elements are separated by line boundaries.
  464. - `BlockId`, `AttributeEntry` and `AttributeList` block elements (not
  465. shown) can occur almost anywhere.
  466. - There are a number of document type and backend specific
  467. restrictions imposed on the block syntax.
  468. - The following elements cannot contain blank lines: Header, Title,
  469. Paragraph, ItemText.
  470. - A ListParagraph is a Paragraph with its 'listelement' option set.
  471. - A ListContinuation is a <<X15,list continuation element>>.
  472. [[X95]]
  473. Header
  474. ~~~~~~
  475. The Header contains document meta-data, typically title plus optional
  476. authorship and revision information:
  477. - The Header is optional, but if it is used it must start with a
  478. document <<X17,title>>.
  479. - Optional Author and Revision information immediately follows the
  480. header title.
  481. - The document header must be separated from the remainder of the
  482. document by one or more blank lines and cannot contain blank lines.
  483. - The header can include comments.
  484. - The header can include <<X18,attribute entries>>, typically
  485. 'doctype', 'lang', 'encoding', 'icons', 'data-uri', 'toc',
  486. 'numbered'.
  487. - Header attributes are overridden by command-line attributes.
  488. - If the header contains non-UTF-8 characters then the 'encoding' must
  489. precede the header (either in the document or on the command-line).
  490. Here's an example AsciiDoc document header:
  491. Writing Documentation using AsciiDoc
  492. ====================================
  493. Joe Bloggs <jbloggs@mymail.com>
  494. v2.0, February 2003:
  495. Rewritten for version 2 release.
  496. The author information line contains the author's name optionally
  497. followed by the author's email address. The author's name is formatted
  498. like:
  499. firstname[ [middlename ]lastname][ <email>]]
  500. i.e. a first name followed by optional middle and last names followed
  501. by an email address in that order. Multi-word first, middle and last
  502. names can be entered using the underscore as a word separator. The
  503. email address comes last and must be enclosed in angle <> brackets.
  504. Here a some examples of author information lines:
  505. Joe Bloggs <jbloggs@mymail.com>
  506. Joe Bloggs
  507. Vincent Willem van_Gogh
  508. If the author line does not match the above specification then the
  509. entire author line is treated as the first name.
  510. The optional revision information line follows the author information
  511. line. The revision information can be one of two formats:
  512. . An optional document revision number followed by an optional
  513. revision date followed by an optional revision remark:
  514. +
  515. --
  516. * If the revision number is specified it must be followed by a
  517. comma.
  518. * The revision number must contain at least one numeric character.
  519. * Any non-numeric characters preceding the first numeric character
  520. will be dropped.
  521. * If a revision remark is specified it must be preceded by a colon.
  522. The revision remark extends from the colon up to the next blank
  523. line, attribute entry or comment and is subject to normal text
  524. substitutions.
  525. * If a revision number or remark has been set but the revision date
  526. has not been set then the revision date is set to the value of the
  527. 'docdate' attribute.
  528. Examples:
  529. v2.0, February 2003
  530. February 2003
  531. v2.0,
  532. v2.0, February 2003: Rewritten for version 2 release.
  533. February 2003: Rewritten for version 2 release.
  534. v2.0,: Rewritten for version 2 release.
  535. :Rewritten for version 2 release.
  536. --
  537. . The revision information line can also be an RCS/CVS/SVN $Id$
  538. marker:
  539. +
  540. --
  541. * AsciiDoc extracts the 'revnumber', 'revdate', and 'author'
  542. attributes from the $Id$ revision marker and displays them in the
  543. document header.
  544. * If an $Id$ revision marker is used the header author line can be
  545. omitted.
  546. Example:
  547. $Id: mydoc.txt,v 1.5 2009/05/17 17:58:44 jbloggs Exp $
  548. --
  549. You can override or set header parameters by passing 'revnumber',
  550. 'revremark', 'revdate', 'email', 'author', 'authorinitials',
  551. 'firstname' and 'lastname' attributes using the asciidoc(1) `-a`
  552. (`--attribute`) command-line option. For example:
  553. $ asciidoc -a revdate=2004/07/27 article.txt
  554. Attribute entries can also be added to the header for substitution in
  555. the header template with <<X18,Attribute Entry>> elements.
  556. The 'title' element in HTML outputs is set to the AsciiDoc document
  557. title, you can set it to a different value by including a 'title'
  558. attribute entry in the document header.
  559. [[X87]]
  560. Additional document header information
  561. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  562. AsciiDoc has two mechanisms for optionally including additional
  563. meta-data in the header of the output document:
  564. 'docinfo' configuration file sections::
  565. If a <<X7,configuration file>> section named 'docinfo' has been loaded
  566. then it will be included in the document header. Typically the
  567. 'docinfo' section name will be prefixed with a '+' character so that it
  568. is appended to (rather than replace) other 'docinfo' sections.
  569. 'docinfo' files::
  570. Two docinfo files are recognized: one named `docinfo` and a second
  571. named like the AsciiDoc source file with a `-docinfo` suffix. For
  572. example, if the source document is called `mydoc.txt` then the
  573. document information files would be `docinfo.xml` and
  574. `mydoc-docinfo.xml` (for DocBook outputs) and `docinfo.html` and
  575. `mydoc-docinfo.html` (for HTML outputs). The <<X97,docinfo, docinfo1
  576. and docinfo2>> attributes control which docinfo files are included in
  577. the output files.
  578. The contents docinfo templates and files is dependent on the type of
  579. output:
  580. HTML::
  581. Valid 'head' child elements. Typically 'style' and 'script' elements
  582. for CSS and JavaScript inclusion.
  583. DocBook::
  584. Valid 'articleinfo' or 'bookinfo' child elements. DocBook defines
  585. numerous elements for document meta-data, for example: copyrights,
  586. document history and authorship information. See the DocBook
  587. `./doc/article-docinfo.xml` example that comes with the AsciiDoc
  588. distribution. The rendering of meta-data elements (or not) is
  589. DocBook processor dependent.
  590. [[X86]]
  591. Preamble
  592. ~~~~~~~~
  593. The Preamble is an optional untitled section body between the document
  594. Header and the first Section title.
  595. Sections
  596. ~~~~~~~~
  597. In addition to the document title (level 0), AsciiDoc supports four
  598. section levels: 1 (top) to 4 (bottom). Section levels are delimited
  599. by section <<X17,titles>>. Sections are translated using
  600. configuration file <<X93,section markup templates>>. AsciiDoc
  601. generates the following <<X60,intrinsic attributes>> specifically for
  602. use in section markup templates:
  603. level::
  604. The `level` attribute is the section level number, it is normally just
  605. the <<X17,title>> level number (1..4). However, if the `leveloffset`
  606. attribute is defined it will be added to the `level` attribute. The
  607. `leveloffset` attribute is useful for <<X90,combining documents>>.
  608. sectnum::
  609. The `-n` (`--section-numbers`) command-line option generates the
  610. `sectnum` (section number) attribute. The `sectnum` attribute is used
  611. for section numbers in HTML outputs (DocBook section numbering are
  612. handled automatically by the DocBook toolchain commands).
  613. [[X93]]
  614. Section markup templates
  615. ^^^^^^^^^^^^^^^^^^^^^^^^
  616. Section markup templates specify output markup and are defined in
  617. AsciiDoc configuration files. Section markup template names are
  618. derived as follows (in order of precedence):
  619. 1. From the title's first positional attribute or 'template'
  620. attribute. For example, the following three section titles are
  621. functionally equivalent:
  622. +
  623. .....................................................................
  624. [[terms]]
  625. [glossary]
  626. List of Terms
  627. -------------
  628. ["glossary",id="terms"]
  629. List of Terms
  630. -------------
  631. [template="glossary",id="terms"]
  632. List of Terms
  633. -------------
  634. .....................................................................
  635. 2. When the title text matches a configuration file
  636. <<X16,`[specialsections]`>> entry.
  637. 3. If neither of the above the default `sect<level>` template is used
  638. (where `<level>` is a number from 1 to 4).
  639. In addition to the normal section template names ('sect1', 'sect2',
  640. 'sect3', 'sect4') AsciiDoc has the following templates for
  641. frontmatter, backmatter and other special sections: 'abstract',
  642. 'preface', 'colophon', 'dedication', 'glossary', 'bibliography',
  643. 'synopsis', 'appendix', 'index'. These special section templates
  644. generate the corresponding Docbook elements; for HTML outputs they
  645. default to the 'sect1' section template.
  646. Section IDs
  647. ^^^^^^^^^^^
  648. If no explicit section ID is specified an ID will be synthesised from
  649. the section title. The primary purpose of this feature is to ensure
  650. persistence of table of contents links (permalinks): the missing
  651. section IDs are generated dynamically by the JavaScript TOC generator
  652. *after* the page is loaded. If you link to a dynamically generated TOC
  653. address the page will load but the browser will ignore the (as yet
  654. ungenerated) section ID.
  655. The IDs are generated by the following algorithm:
  656. - Replace all non-alphanumeric title characters with underscores.
  657. - Strip leading or trailing underscores.
  658. - Convert to lowercase.
  659. - Prepend the `idprefix` attribute (so there's no possibility of name
  660. clashes with existing document IDs). Prepend an underscore if the
  661. `idprefix` attribute is not defined.
  662. - A numbered suffix (`_2`, `_3` ...) is added if a same named
  663. auto-generated section ID exists.
  664. - If the `ascii-ids` attribute is defined then non-ASCII characters
  665. are replaced with ASCII equivalents. This attribute may be
  666. deprecated in future releases and *should be avoided*, it's sole
  667. purpose is to accommodate deficient downstream applications that
  668. cannot process non-ASCII ID attributes.
  669. Example: the title 'Jim's House' would generate the ID `_jim_s_house`.
  670. Section ID synthesis can be disabled by undefining the `sectids`
  671. attribute.
  672. [[X16]]
  673. Special Section Titles
  674. ^^^^^^^^^^^^^^^^^^^^^^
  675. AsciiDoc has a mechanism for mapping predefined section titles
  676. auto-magically to specific markup templates. For example a title
  677. 'Appendix A: Code Reference' will automatically use the 'appendix'
  678. <<X93,section markup template>>. The mappings from title to template
  679. name are specified in `[specialsections]` sections in the Asciidoc
  680. language configuration files (`lang-*.conf`). Section entries are
  681. formatted like:
  682. <title>=<template>
  683. `<title>` is a Python regular expression and `<template>` is the name
  684. of a configuration file markup template section. If the `<title>`
  685. matches an AsciiDoc document section title then the backend output is
  686. marked up using the `<template>` markup template (instead of the
  687. default `sect<level>` section template). The `{title}` attribute value
  688. is set to the value of the matched regular expression group named
  689. 'title', if there is no 'title' group `{title}` defaults to the whole
  690. of the AsciiDoc section title. If `<template>` is blank then any
  691. existing entry with the same `<title>` will be deleted.
  692. .Special section titles vs. explicit template names
  693. *********************************************************************
  694. AsciiDoc has two mechanisms for specifying non-default section markup
  695. templates: you can specify the template name explicitly (using the
  696. 'template' attribute) or indirectly (using 'special section titles').
  697. Specifying a <<X93,section template>> attribute explicitly is
  698. preferred. Auto-magical 'special section titles' have the following
  699. drawbacks:
  700. - They are non-obvious, you have to know the exact matching
  701. title for each special section on a language by language basis.
  702. - Section titles are predefined and can only be customised with a
  703. configuration change.
  704. - The implementation is complicated by multiple languages: every
  705. special section title has to be defined for each language (in each
  706. of the `lang-*.conf` files).
  707. Specifying special section template names explicitly does add more
  708. noise to the source document (the 'template' attribute declaration),
  709. but the intention is obvious and the syntax is consistent with other
  710. AsciiDoc elements c.f. bibliographic, Q&A and glossary lists.
  711. Special section titles have been deprecated but are retained for
  712. backward compatibility.
  713. *********************************************************************
  714. Inline Elements
  715. ~~~~~~~~~~~~~~~
  716. <<X34,Inline document elements>> are used to format text and to
  717. perform various types of text substitution. Inline elements and inline
  718. element syntax is defined in the asciidoc(1) configuration files.
  719. Here is a list of AsciiDoc inline elements in the (default) order in
  720. which they are processed:
  721. Special characters::
  722. These character sequences escape special characters used by
  723. the backend markup (typically `<`, `>`, and `&` characters).
  724. See `[specialcharacters]` configuration file sections.
  725. Quotes::
  726. Elements that markup words and phrases; usually for character
  727. formatting. See `[quotes]` configuration file sections.
  728. Special Words::
  729. Word or word phrase patterns singled out for markup without
  730. the need for further annotation. See `[specialwords]`
  731. configuration file sections.
  732. Replacements::
  733. Each replacement defines a word or word phrase pattern to
  734. search for along with corresponding replacement text. See
  735. `[replacements]` configuration file sections.
  736. Attribute references::
  737. Document attribute names enclosed in braces are replaced by
  738. the corresponding attribute value.
  739. Inline Macros::
  740. Inline macros are replaced by the contents of parametrized
  741. configuration file sections.
  742. Document Processing
  743. -------------------
  744. The AsciiDoc source document is read and processed as follows:
  745. 1. The document 'Header' is parsed, header parameter values are
  746. substituted into the configuration file `[header]` template section
  747. which is then written to the output file.
  748. 2. Each document 'Section' is processed and its constituent elements
  749. translated to the output file.
  750. 3. The configuration file `[footer]` template section is substituted
  751. and written to the output file.
  752. When a block element is encountered asciidoc(1) determines the type of
  753. block by checking in the following order (first to last): (section)
  754. Titles, BlockMacros, Lists, DelimitedBlocks, Tables, AttributeEntrys,
  755. AttributeLists, BlockTitles, Paragraphs.
  756. The default paragraph definition `[paradef-default]` is last element
  757. to be checked.
  758. Knowing the parsing order will help you devise unambiguous macro, list
  759. and block syntax rules.
  760. Inline substitutions within block elements are performed in the
  761. following default order:
  762. 1. Special characters
  763. 2. Quotes
  764. 3. Special words
  765. 4. Replacements
  766. 5. Attributes
  767. 6. Inline Macros
  768. 7. Replacements2
  769. The substitutions and substitution order performed on
  770. Title, Paragraph and DelimitedBlock elements is determined by
  771. configuration file parameters.
  772. Text Formatting
  773. ---------------
  774. [[X51]]
  775. Quoted Text
  776. ~~~~~~~~~~~
  777. Words and phrases can be formatted by enclosing inline text with
  778. quote characters:
  779. _Emphasized text_::
  780. Word phrases \'enclosed in single quote characters' (acute
  781. accents) or \_underline characters_ are emphasized.
  782. *Strong text*::
  783. Word phrases \*enclosed in asterisk characters* are rendered
  784. in a strong font (usually bold).
  785. [[X81]]+Monospaced text+::
  786. Word phrases \+enclosed in plus characters+ are rendered in a
  787. monospaced font. Word phrases \`enclosed in backtick
  788. characters` (grave accents) are also rendered in a monospaced
  789. font but in this case the enclosed text is rendered literally
  790. and is not subject to further expansion (see <<X80,inline
  791. literal passthrough>>).
  792. `Single quoted text'::
  793. Phrases enclosed with a \`single grave accent to the left and
  794. a single acute accent to the right' are rendered in single
  795. quotation marks.
  796. ``Double quoted text''::
  797. Phrases enclosed with \\``two grave accents to the left and
  798. two acute accents to the right'' are rendered in quotation
  799. marks.
  800. #Unquoted text#::
  801. Placing \#hashes around text# does nothing, it is a mechanism
  802. to allow inline attributes to be applied to otherwise
  803. unformatted text.
  804. New quote types can be defined by editing asciidoc(1) configuration
  805. files. See the <<X7,Configuration Files>> section for details.
  806. .Quoted text behavior
  807. - Quoting cannot be overlapped.
  808. - Different quoting types can be nested.
  809. - To suppress quoted text formatting place a backslash character
  810. immediately in front of the leading quote character(s). In the case
  811. of ambiguity between escaped and non-escaped text you will need to
  812. escape both leading and trailing quotes, in the case of
  813. multi-character quotes you may even need to escape individual
  814. characters.
  815. [[X96]]
  816. Quoted text attributes
  817. ^^^^^^^^^^^^^^^^^^^^^^
  818. Quoted text can be prefixed with an <<X21,attribute list>>. The first
  819. positional attribute ('role' attribute) is translated by AsciiDoc to
  820. an HTML 'span' element 'class' attribute or a DocBook 'phrase' element
  821. 'role' attribute.
  822. DocBook XSL Stylesheets translate DocBook 'phrase' elements with
  823. 'role' attributes to corresponding HTML 'span' elements with the same
  824. 'class' attributes; CSS can then be used
  825. http://www.sagehill.net/docbookxsl/UsingCSS.html[to style the
  826. generated HTML]. Thus CSS styling can be applied to both DocBook and
  827. AsciiDoc generated HTML outputs. You can also specify multiple class
  828. names separated by spaces.
  829. CSS rules for text color, text background color, text size and text
  830. decorators are included in the distributed AsciiDoc CSS files and are
  831. used in conjunction with AsciiDoc 'xhtml11', 'html5' and 'docbook'
  832. outputs. The CSS class names are:
  833. - '<color>' (text foreground color).
  834. - '<color>-background' (text background color).
  835. - 'big' and 'small' (text size).
  836. - 'underline', 'overline' and 'line-through' (strike through) text
  837. decorators.
  838. Where '<color>' can be any of the
  839. http://en.wikipedia.org/wiki/Web_colors#HTML_color_names[sixteen HTML
  840. color names]. Examples:
  841. [red]#Obvious# and [big red yellow-background]*very obvious*.
  842. [underline]#Underline text#, [overline]#overline text# and
  843. [blue line-through]*bold blue and line-through*.
  844. is rendered as:
  845. [red]#Obvious# and [big red yellow-background]*very obvious*.
  846. [underline]#Underline text#, [overline]#overline text# and
  847. [bold blue line-through]*bold blue and line-through*.
  848. NOTE: Color and text decorator attributes are rendered for XHTML and
  849. HTML 5 outputs using CSS stylesheets. The mechanism to implement
  850. color and text decorator attributes is provided for DocBook toolchains
  851. via the DocBook 'phrase' element 'role' attribute, but the actual
  852. rendering is toolchain specific and is not part of the AsciiDoc
  853. distribution.
  854. [[X52]]
  855. Constrained and Unconstrained Quotes
  856. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  857. There are actually two types of quotes:
  858. Constrained quotes
  859. ++++++++++++++++++
  860. Quoted must be bounded by white space or commonly adjoining
  861. punctuation characters. These are the most commonly used type of
  862. quote.
  863. Unconstrained quotes
  864. ++++++++++++++++++++
  865. Unconstrained quotes have no boundary constraints and can be placed
  866. anywhere within inline text. For consistency and to make them easier
  867. to remember unconstrained quotes are double-ups of the `_`, `*`, `+`
  868. and `#` constrained quotes:
  869. __unconstrained emphasized text__
  870. **unconstrained strong text**
  871. ++unconstrained monospaced text++
  872. ##unconstrained unquoted text##
  873. The following example emboldens the letter F:
  874. **F**ile Open...
  875. Superscripts and Subscripts
  876. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  877. Put \^carets on either^ side of the text to be superscripted, put
  878. \~tildes on either side~ of text to be subscripted. For example, the
  879. following line:
  880. e^&#960;i^+1 = 0. H~2~O and x^10^. Some ^super text^
  881. and ~some sub text~
  882. Is rendered like:
  883. e^&#960;i^+1 = 0. H~2~O and x^10^. Some ^super text^
  884. and ~some sub text~
  885. Superscripts and subscripts are implemented as <<X52,unconstrained
  886. quotes>> and they can be escaped with a leading backslash and prefixed
  887. with with an attribute list.
  888. Line Breaks
  889. ~~~~~~~~~~~
  890. A plus character preceded by at least one space character at the end
  891. of a non-blank line forces a line break. It generates a line break
  892. (`br`) tag for HTML outputs and a custom XML `asciidoc-br` processing
  893. instruction for DocBook outputs. The `asciidoc-br` processing
  894. instruction is handled by <<X43,a2x(1)>>.
  895. Page Breaks
  896. ~~~~~~~~~~~
  897. A line of three or more less-than (`<<<`) characters will generate a
  898. hard page break in DocBook and printed HTML outputs. It uses the CSS
  899. `page-break-after` property for HTML outputs and a custom XML
  900. `asciidoc-pagebreak` processing instruction for DocBook outputs. The
  901. `asciidoc-pagebreak` processing instruction is handled by
  902. <<X43,a2x(1)>>. Hard page breaks are sometimes handy but as a general
  903. rule you should let your page processor generate page breaks for you.
  904. Rulers
  905. ~~~~~~
  906. A line of three or more apostrophe characters will generate a ruler
  907. line. It generates a ruler (`hr`) tag for HTML outputs and a custom
  908. XML `asciidoc-hr` processing instruction for DocBook outputs. The
  909. `asciidoc-hr` processing instruction is handled by <<X43,a2x(1)>>.
  910. Tabs
  911. ~~~~
  912. By default tab characters input files will translated to 8 spaces. Tab
  913. expansion is set with the 'tabsize' entry in the configuration file
  914. `[miscellaneous]` section and can be overridden in included files by
  915. setting a 'tabsize' attribute in the `include` macro's attribute list.
  916. For example:
  917. include::addendum.txt[tabsize=2]
  918. The tab size can also be set using the attribute command-line option,
  919. for example `--attribute tabsize=4`
  920. Replacements
  921. ~~~~~~~~~~~~
  922. The following replacements are defined in the default AsciiDoc
  923. configuration:
  924. (C) copyright, (TM) trademark, (R) registered trademark,
  925. -- em dash, ... ellipsis, -> right arrow, <- left arrow, => right
  926. double arrow, <= left double arrow.
  927. Which are rendered as:
  928. (C) copyright, (TM) trademark, (R) registered trademark,
  929. -- em dash, ... ellipsis, -> right arrow, <- left arrow, => right
  930. double arrow, <= left double arrow.
  931. You can also include arbitrary entity references in the AsciiDoc
  932. source. Examples:
  933. &#x278a; &#182;
  934. renders:
  935. &#x278a; &#182;
  936. To render a replacement literally escape it with a leading back-slash.
  937. The <<X7,Configuration Files>> section explains how to configure your
  938. own replacements.
  939. Special Words
  940. ~~~~~~~~~~~~~
  941. Words defined in `[specialwords]` configuration file sections are
  942. automatically marked up without having to be explicitly notated.
  943. The <<X7,Configuration Files>> section explains how to add and replace
  944. special words.
  945. [[X17]]
  946. Titles
  947. ------
  948. Document and section titles can be in either of two formats:
  949. Two line titles
  950. ~~~~~~~~~~~~~~~
  951. A two line title consists of a title line, starting hard against the
  952. left margin, and an underline. Section underlines consist a repeated
  953. character pairs spanning the width of the preceding title (give or
  954. take up to two characters):
  955. The default title underlines for each of the document levels are:
  956. Level 0 (top level): ======================
  957. Level 1: ----------------------
  958. Level 2: ~~~~~~~~~~~~~~~~~~~~~~
  959. Level 3: ^^^^^^^^^^^^^^^^^^^^^^
  960. Level 4 (bottom level): ++++++++++++++++++++++
  961. Examples:
  962. Level One Section Title
  963. -----------------------
  964. Level 2 Subsection Title
  965. ~~~~~~~~~~~~~~~~~~~~~~~~
  966. [[X46]]
  967. One line titles
  968. ~~~~~~~~~~~~~~~
  969. One line titles consist of a single line delimited on either side by
  970. one or more equals characters (the number of equals characters
  971. corresponds to the section level minus one). Here are some examples:
  972. = Document Title (level 0) =
  973. == Section title (level 1) ==
  974. === Section title (level 2) ===
  975. ==== Section title (level 3) ====
  976. ===== Section title (level 4) =====
  977. [NOTE]
  978. =====================================================================
  979. - One or more spaces must fall between the title and the delimiters.
  980. - The trailing title delimiter is optional.
  981. - The one-line title syntax can be changed by editing the
  982. configuration file `[titles]` section `sect0`...`sect4` entries.
  983. =====================================================================
  984. Floating titles
  985. ~~~~~~~~~~~~~~~
  986. Setting the title's first positional attribute or 'style' attribute to
  987. 'float' generates a free-floating title. A free-floating title is
  988. rendered just like a normal section title but is not formally
  989. associated with a text body and is not part of the regular section
  990. hierarchy so the normal ordering rules do not apply. Floating titles
  991. can also be used in contexts where section titles are illegal: for
  992. example sidebar and admonition blocks. Example:
  993. [float]
  994. The second day
  995. ~~~~~~~~~~~~~~
  996. Floating titles do not appear in a document's table of contents.
  997. [[X42]]
  998. Block Titles
  999. ------------
  1000. A 'BlockTitle' element is a single line beginning with a period
  1001. followed by the title text. A BlockTitle is applied to the immediately
  1002. following Paragraph, DelimitedBlock, List, Table or BlockMacro. For
  1003. example:
  1004. ........................
  1005. .Notes
  1006. - Note 1.
  1007. - Note 2.
  1008. ........................
  1009. is rendered as:
  1010. .Notes
  1011. - Note 1.
  1012. - Note 2.
  1013. [[X41]]
  1014. BlockId Element
  1015. ---------------
  1016. A 'BlockId' is a single line block element containing a unique
  1017. identifier enclosed in double square brackets. It is used to assign an
  1018. identifier to the ensuing block element. For example:
  1019. [[chapter-titles]]
  1020. Chapter titles can be ...
  1021. The preceding example identifies the ensuing paragraph so it can be
  1022. referenced from other locations, for example with
  1023. `<<chapter-titles,chapter titles>>`.
  1024. 'BlockId' elements can be applied to Title, Paragraph, List,
  1025. DelimitedBlock, Table and BlockMacro elements. The BlockId element
  1026. sets the `{id}` attribute for substitution in the subsequent block's
  1027. markup template. If a second positional argument is supplied it sets
  1028. the `{reftext}` attribute which is used to set the DocBook `xreflabel`
  1029. attribute.
  1030. The 'BlockId' element has the same syntax and serves the same function
  1031. to the <<X30,anchor inline macro>>.
  1032. [[X79]]
  1033. AttributeList Element
  1034. ---------------------
  1035. An 'AttributeList' block element is an <<X21,attribute list>> on a
  1036. line by itself:
  1037. - 'AttributeList' attributes are only applied to the immediately
  1038. following block element -- the attributes are made available to the
  1039. block's markup template.
  1040. - Multiple contiguous 'AttributeList' elements are additively combined
  1041. in the order they appear..
  1042. - The first positional attribute in the list is often used to specify
  1043. the ensuing element's <<X23,style>>.
  1044. Attribute value substitution
  1045. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1046. By default, only substitutions that take place inside attribute list
  1047. values are attribute references, this is because not all attributes
  1048. are destined to be marked up and rendered as text (for example the
  1049. table 'cols' attribute). To perform normal inline text substitutions
  1050. (special characters, quotes, macros, replacements) on an attribute
  1051. value you need to enclose it in single quotes. In the following quote
  1052. block the second attribute value in the AttributeList is quoted to
  1053. ensure the 'http' macro is expanded to a hyperlink.
  1054. ---------------------------------------------------------------------
  1055. [quote,'http://en.wikipedia.org/wiki/Samuel_Johnson[Samuel Johnson]']
  1056. _____________________________________________________________________
  1057. Sir, a woman's preaching is like a dog's walking on his hind legs. It
  1058. is not done well; but you are surprised to find it done at all.
  1059. _____________________________________________________________________
  1060. ---------------------------------------------------------------------
  1061. Common attributes
  1062. ~~~~~~~~~~~~~~~~~
  1063. Most block elements support the following attributes:
  1064. [cols="1e,1,5a",frame="topbot",options="header"]
  1065. |====================================================================
  1066. |Name |Backends |Description
  1067. |id |html4, html5, xhtml11, docbook |
  1068. Unique identifier typically serve as link targets.
  1069. Can also be set by the 'BlockId' element.
  1070. |role |html4, html5, xhtml11, docbook |
  1071. Role contains a string used to classify or subclassify an element and
  1072. can be applied to AsciiDoc block elements. The AsciiDoc 'role'
  1073. attribute is translated to the 'role' attribute in DocBook outputs and
  1074. is included in the 'class' attribute in HTML outputs, in this respect
  1075. it behaves like the <<X96,quoted text role attribute>>.
  1076. DocBook XSL Stylesheets translate DocBook 'role' attributes to HTML
  1077. 'class' attributes; CSS can then be used
  1078. http://www.sagehill.net/docbookxsl/UsingCSS.html[to style the
  1079. generated HTML].
  1080. |reftext |docbook |
  1081. 'reftext' is used to set the DocBook 'xreflabel' attribute.
  1082. The 'reftext' attribute can an also be set by the 'BlockId' element.
  1083. |====================================================================
  1084. Paragraphs
  1085. ----------
  1086. Paragraphs are blocks of text terminated by a blank line, the end of
  1087. file, or the start of a delimited block or a list. There are three
  1088. paragraph syntaxes: normal, indented (literal) and admonition which
  1089. are rendered, by default, with the corresponding paragraph style.
  1090. Each syntax has a default style, but you can explicitly apply any
  1091. paragraph style to any paragraph syntax. You can also apply
  1092. <<X104,delimited block>> styles to single paragraphs.
  1093. The built-in paragraph styles are: 'normal', 'literal', 'verse',
  1094. 'quote', 'listing', 'TIP', 'NOTE', 'IMPORTANT', 'WARNING', 'CAUTION',
  1095. 'abstract', 'partintro', 'comment', 'example', 'sidebar', 'source',
  1096. 'music', 'latex', 'graphviz'.
  1097. normal paragraph syntax
  1098. ~~~~~~~~~~~~~~~~~~~~~~~
  1099. Normal paragraph syntax consists of one or more non-blank lines of
  1100. text. The first line must start hard against the left margin (no
  1101. intervening white space). The default processing expectation is that
  1102. of a normal paragraph of text.
  1103. [[X85]]
  1104. literal paragraph syntax
  1105. ~~~~~~~~~~~~~~~~~~~~~~~~
  1106. Literal paragraphs are rendered verbatim in a monospaced font without
  1107. any distinguishing background or border. By default there is no text
  1108. formatting or substitutions within Literal paragraphs apart from
  1109. Special Characters and Callouts.
  1110. The 'literal' style is applied implicitly to indented paragraphs i.e.
  1111. where the first line of the paragraph is indented by one or more space
  1112. or tab characters. For example:
  1113. ---------------------------------------------------------------------
  1114. Consul *necessitatibus* per id,
  1115. consetetur, eu pro everti postulant
  1116. homero verear ea mea, qui.
  1117. ---------------------------------------------------------------------
  1118. Renders:
  1119. Consul *necessitatibus* per id,
  1120. consetetur, eu pro everti postulant
  1121. homero verear ea mea, qui.
  1122. NOTE: Because <<X64,lists>> can be indented it's possible for your
  1123. indented paragraph to be misinterpreted as a list -- in situations
  1124. like this apply the 'literal' style to a normal paragraph.
  1125. Instead of using a paragraph indent you could apply the 'literal'
  1126. style explicitly, for example:
  1127. ---------------------------------------------------------------------
  1128. [literal]
  1129. Consul *necessitatibus* per id,
  1130. consetetur, eu pro everti postulant
  1131. homero verear ea mea, qui.
  1132. ---------------------------------------------------------------------
  1133. Renders:
  1134. [literal]
  1135. Consul *necessitatibus* per id,
  1136. consetetur, eu pro everti postulant
  1137. homero verear ea mea, qui.
  1138. [[X94]]
  1139. quote and verse paragraph styles
  1140. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1141. The optional 'attribution' and 'citetitle' attributes (positional
  1142. attributes 2 and 3) specify the author and source respectively.
  1143. The 'verse' style retains the line breaks, for example:
  1144. ---------------------------------------------------------------------
  1145. [verse, William Blake, from Auguries of Innocence]
  1146. To see a world in a grain of sand,
  1147. And a heaven in a wild flower,
  1148. Hold infinity in the palm of your hand,
  1149. And eternity in an hour.
  1150. ---------------------------------------------------------------------
  1151. Which is rendered as:
  1152. [verse, William Blake, from Auguries of Innocence]
  1153. To see a world in a grain of sand,
  1154. And a heaven in a wild flower,
  1155. Hold infinity in the palm of your hand,
  1156. And eternity in an hour.
  1157. The 'quote' style flows the text at left and right margins, for
  1158. example:
  1159. ---------------------------------------------------------------------
  1160. [quote, Bertrand Russell, The World of Mathematics (1956)]
  1161. A good notation has subtlety and suggestiveness which at times makes
  1162. it almost seem like a live teacher.
  1163. ---------------------------------------------------------------------
  1164. Which is rendered as:
  1165. [quote, Bertrand Russell, The World of Mathematics (1956)]
  1166. A good notation has subtlety and suggestiveness which at times makes
  1167. it almost seem like a live teacher.
  1168. [[X28]]
  1169. Admonition Paragraphs
  1170. ~~~~~~~~~~~~~~~~~~~~~
  1171. 'TIP', 'NOTE', 'IMPORTANT', 'WARNING' and 'CAUTION' admonishment
  1172. paragraph styles are generated by placing `NOTE:`, `TIP:`,
  1173. `IMPORTANT:`, `WARNING:` or `CAUTION:` as the first word of the
  1174. paragraph. For example:
  1175. NOTE: This is an example note.
  1176. Alternatively, you can specify the paragraph admonition style
  1177. explicitly using an <<X79,AttributeList element>>. For example:
  1178. [NOTE]
  1179. This is an example note.
  1180. Renders:
  1181. NOTE: This is an example note.
  1182. TIP: If your admonition requires more than a single paragraph use an
  1183. <<X22,admonition block>> instead.
  1184. [[X47]]
  1185. Admonition Icons and Captions
  1186. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1187. NOTE: Admonition customization with `icons`, `iconsdir`, `icon` and
  1188. `caption` attributes does not apply when generating DocBook output. If
  1189. you are going the DocBook route then the <<X43,a2x(1)>> `--no-icons`
  1190. and `--icons-dir` options can be used to set the appropriate XSL
  1191. Stylesheets parameters.
  1192. By default the asciidoc(1) HTML backends generate text captions
  1193. instead of admonition icon image links. To generate links to icon
  1194. images define the <<X45,`icons`>> attribute, for example using the `-a
  1195. icons` command-line option.
  1196. The <<X44,`iconsdir`>> attribute sets the location of linked icon
  1197. images.
  1198. You can override the default icon image using the `icon` attribute to
  1199. specify the path of the linked image. For example:
  1200. [icon="./images/icons/wink.png"]
  1201. NOTE: What lovely war.
  1202. Use the `caption` attribute to customize the admonition captions (not
  1203. applicable to `docbook` backend). The following example suppresses the
  1204. icon image and customizes the caption of a 'NOTE' admonition
  1205. (undefining the `icons` attribute with `icons=None` is only necessary
  1206. if <<X45,admonition icons>> have been enabled):
  1207. [icons=None, caption="My Special Note"]
  1208. NOTE: This is my special note.
  1209. This subsection also applies to <<X22,Admonition Blocks>>.
  1210. [[X104]]
  1211. Delimited Blocks
  1212. ----------------
  1213. Delimited blocks are blocks of text enveloped by leading and trailing
  1214. delimiter lines (normally a series of four or more repeated
  1215. characters). The behavior of Delimited Blocks is specified by entries
  1216. in configuration file `[blockdef-*]` sections.
  1217. Predefined Delimited Blocks
  1218. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1219. AsciiDoc ships with a number of predefined DelimitedBlocks (see the
  1220. `asciidoc.conf` configuration file in the asciidoc(1) program
  1221. directory):
  1222. Predefined delimited block underlines:
  1223. CommentBlock: //////////////////////////
  1224. PassthroughBlock: ++++++++++++++++++++++++++
  1225. ListingBlock: --------------------------
  1226. LiteralBlock: ..........................
  1227. SidebarBlock: **************************
  1228. QuoteBlock: __________________________
  1229. ExampleBlock: ==========================
  1230. OpenBlock: --
  1231. .Default DelimitedBlock substitutions
  1232. [cols="2e,7*^",frame="topbot",options="header,autowidth"]
  1233. |=====================================================
  1234. | |Attributes |Callouts |Macros | Quotes |Replacements
  1235. |Special chars |Special words
  1236. |PassthroughBlock |Yes |No |Yes |No |No |No |No
  1237. |ListingBlock |No |Yes |No |No |No |Yes |No
  1238. |LiteralBlock |No |Yes |No |No |No |Yes |No
  1239. |SidebarBlock |Yes |No |Yes |Yes |Yes |Yes |Yes
  1240. |QuoteBlock |Yes |No |Yes |Yes |Yes |Yes |Yes
  1241. |ExampleBlock |Yes |No |Yes |Yes |Yes |Yes |Yes
  1242. |OpenBlock |Yes |No |Yes |Yes |Yes |Yes |Yes
  1243. |=====================================================
  1244. Listing Blocks
  1245. ~~~~~~~~~~~~~~
  1246. 'ListingBlocks' are rendered verbatim in a monospaced font, they
  1247. retain line and whitespace formatting and are often distinguished by a
  1248. background or border. There is no text formatting or substitutions
  1249. within Listing blocks apart from Special Characters and Callouts.
  1250. Listing blocks are often used for computer output and file listings.
  1251. Here's an example:
  1252. [listing]
  1253. ......................................
  1254. --------------------------------------
  1255. #include <stdio.h>
  1256. int main() {
  1257. printf("Hello World!\n");
  1258. exit(0);
  1259. }
  1260. --------------------------------------
  1261. ......................................
  1262. Which will be rendered like:
  1263. --------------------------------------
  1264. #include <stdio.h>
  1265. int main() {
  1266. printf("Hello World!\n");
  1267. exit(0);
  1268. }
  1269. --------------------------------------
  1270. By convention <<X59,filter blocks>> use the listing block syntax and
  1271. are implemented as distinct listing block styles.
  1272. [[X65]]
  1273. Literal Blocks
  1274. ~~~~~~~~~~~~~~
  1275. 'LiteralBlocks' are rendered just like <<X85,literal paragraphs>>.
  1276. Example:
  1277. ---------------------------------------------------------------------
  1278. ...................................
  1279. Consul *necessitatibus* per id,
  1280. consetetur, eu pro everti postulant
  1281. homero verear ea mea, qui.
  1282. ...................................
  1283. ---------------------------------------------------------------------
  1284. Renders:
  1285. ...................................
  1286. Consul *necessitatibus* per id,
  1287. consetetur, eu pro everti postulant
  1288. homero verear ea mea, qui.
  1289. ...................................
  1290. If the 'listing' style is applied to a LiteralBlock it will be
  1291. rendered as a ListingBlock (this is handy if you have a listing
  1292. containing a ListingBlock).
  1293. Sidebar Blocks
  1294. ~~~~~~~~~~~~~~
  1295. A sidebar is a short piece of text presented outside the narrative
  1296. flow of the main text. The sidebar is normally presented inside a
  1297. bordered box to set it apart from the main text.
  1298. The sidebar body is treated like a normal section body.
  1299. Here's an example:
  1300. ---------------------------------------------------------------------
  1301. .An Example Sidebar
  1302. ************************************************
  1303. Any AsciiDoc SectionBody element (apart from
  1304. SidebarBlocks) can be placed inside a sidebar.
  1305. ************************************************
  1306. ---------------------------------------------------------------------
  1307. Which will be rendered like:
  1308. .An Example Sidebar
  1309. ************************************************
  1310. Any AsciiDoc SectionBody element (apart from
  1311. SidebarBlocks) can be placed inside a sidebar.
  1312. ************************************************
  1313. [[X26]]
  1314. Comment Blocks
  1315. ~~~~~~~~~~~~~~
  1316. The contents of 'CommentBlocks' are not processed; they are useful for
  1317. annotations and for excluding new or outdated content that you don't
  1318. want displayed. CommentBlocks are never written to output files.
  1319. Example:
  1320. ---------------------------------------------------------------------
  1321. //////////////////////////////////////////
  1322. CommentBlock contents are not processed by
  1323. asciidoc(1).
  1324. //////////////////////////////////////////
  1325. ---------------------------------------------------------------------
  1326. See also <<X25,Comment Lines>>.
  1327. NOTE: System macros are executed inside comment blocks.
  1328. [[X76]]
  1329. Passthrough Blocks
  1330. ~~~~~~~~~~~~~~~~~~
  1331. By default the block contents is subject only to 'attributes' and
  1332. 'macros' substitutions (use an explicit 'subs' attribute to apply
  1333. different substitutions). PassthroughBlock content will often be
  1334. backend specific. Here's an example:
  1335. ---------------------------------------------------------------------
  1336. [subs="quotes"]
  1337. ++++++++++++++++++++++++++++++++++++++
  1338. <table border="1"><tr>
  1339. <td>*Cell 1*</td>
  1340. <td>*Cell 2*</td>
  1341. </tr></table>
  1342. ++++++++++++++++++++++++++++++++++++++
  1343. ---------------------------------------------------------------------
  1344. The following styles can be applied to passthrough blocks:
  1345. pass::
  1346. No substitutions are performed. This is equivalent to `subs="none"`.
  1347. asciimath, latexmath::
  1348. By default no substitutions are performed, the contents are rendered
  1349. as <<X78,mathematical formulas>>.
  1350. Quote Blocks
  1351. ~~~~~~~~~~~~
  1352. 'QuoteBlocks' are used for quoted passages of text. There are two
  1353. styles: 'quote' and 'verse'. The style behavior is identical to
  1354. <<X94,quote and verse paragraphs>> except that blocks can contain
  1355. multiple paragraphs and, in the case of the 'quote' style, other
  1356. section elements. The first positional attribute sets the style, if
  1357. no attributes are specified the 'quote' style is used. The optional
  1358. 'attribution' and 'citetitle' attributes (positional attributes 2 and
  1359. 3) specify the quote's author and source. For example:
  1360. ---------------------------------------------------------------------
  1361. [quote, Sir Arthur Conan Doyle, The Adventures of Sherlock Holmes]
  1362. ____________________________________________________________________
  1363. As he spoke there was the sharp sound of horses' hoofs and
  1364. grating wheels against the curb, followed by a sharp pull at the
  1365. bell. Holmes whistled.
  1366. "A pair, by the sound," said he. "Yes," he continued, glancing
  1367. out of the window. "A nice little brougham and a pair of
  1368. beauties. A hundred and fifty guineas apiece. There's money in
  1369. this case, Watson, if there is nothing else."
  1370. ____________________________________________________________________
  1371. ---------------------------------------------------------------------
  1372. Which is rendered as:
  1373. [quote, Sir Arthur Conan Doyle, The Adventures of Sherlock Holmes]
  1374. ____________________________________________________________________
  1375. As he spoke there was the sharp sound of horses' hoofs and
  1376. grating wheels against the curb, followed by a sharp pull at the
  1377. bell. Holmes whistled.
  1378. "A pair, by the sound," said he. "Yes," he continued, glancing
  1379. out of the window. "A nice little brougham and a pair of
  1380. beauties. A hundred and fifty guineas apiece. There's money in
  1381. this case, Watson, if there is nothing else."
  1382. ____________________________________________________________________
  1383. [[X48]]
  1384. Example Blocks
  1385. ~~~~~~~~~~~~~~
  1386. 'ExampleBlocks' encapsulate the DocBook Example element and are used
  1387. for, well, examples. Example blocks can be titled by preceding them
  1388. with a 'BlockTitle'. DocBook toolchains will normally automatically
  1389. number examples and generate a 'List of Examples' backmatter section.
  1390. Example blocks are delimited by lines of equals characters and can
  1391. contain any block elements apart from Titles, BlockTitles and
  1392. Sidebars) inside an example block. For example:
  1393. ---------------------------------------------------------------------
  1394. .An example
  1395. =====================================================================
  1396. Qui in magna commodo, est labitur dolorum an. Est ne magna primis
  1397. adolescens.
  1398. =====================================================================
  1399. ---------------------------------------------------------------------
  1400. Renders:
  1401. .An example
  1402. =====================================================================
  1403. Qui in magna commodo, est labitur dolorum an. Est ne magna primis
  1404. adolescens.
  1405. =====================================================================
  1406. A title prefix that can be inserted with the `caption` attribute
  1407. (HTML backends). For example:
  1408. ---------------------------------------------------------------------
  1409. [caption="Example 1: "]
  1410. .An example with a custom caption
  1411. =====================================================================
  1412. Qui in magna commodo, est labitur dolorum an. Est ne magna primis
  1413. adolescens.
  1414. =====================================================================
  1415. ---------------------------------------------------------------------
  1416. [[X22]]
  1417. Admonition Blocks
  1418. ~~~~~~~~~~~~~~~~~
  1419. The 'ExampleBlock' definition includes a set of admonition
  1420. <<X23,styles>> ('NOTE', 'TIP', 'IMPORTANT', 'WARNING', 'CAUTION') for
  1421. generating admonition blocks (admonitions containing more than a
  1422. <<X28,single paragraph>>). Just precede the 'ExampleBlock' with an
  1423. attribute list specifying the admonition style name. For example:
  1424. ---------------------------------------------------------------------
  1425. [NOTE]
  1426. .A NOTE admonition block
  1427. =====================================================================
  1428. Qui in magna commodo, est labitur dolorum an. Est ne magna primis
  1429. adolescens.
  1430. . Fusce euismod commodo velit.
  1431. . Vivamus fringilla mi eu lacus.
  1432. .. Fusce euismod commodo velit.
  1433. .. Vivamus fringilla mi eu lacus.
  1434. . Donec eget arcu bibendum
  1435. nunc consequat lobortis.
  1436. =====================================================================
  1437. ---------------------------------------------------------------------
  1438. Renders:
  1439. [NOTE]
  1440. .A NOTE admonition block
  1441. =====================================================================
  1442. Qui in magna commodo, est labitur dolorum an. Est ne magna primis
  1443. adolescens.
  1444. . Fusce euismod commodo velit.
  1445. . Vivamus fringilla mi eu lacus.
  1446. .. Fusce euismod commodo velit.
  1447. .. Vivamus fringilla mi eu lacus.
  1448. . Donec eget arcu bibendum
  1449. nunc consequat lobortis.
  1450. =====================================================================
  1451. See also <<X47,Admonition Icons and Captions>>.
  1452. [[X29]]
  1453. Open Blocks
  1454. ~~~~~~~~~~~
  1455. Open blocks are special:
  1456. - The open block delimiter is line containing two hyphen characters
  1457. (instead of four or more repeated characters).
  1458. - They can be used to group block elements for <<X15,List item
  1459. continuation>>.
  1460. - Open blocks can be styled to behave like any other type of delimited
  1461. block. The following built-in styles can be applied to open
  1462. blocks: 'literal', 'verse', 'quote', 'listing', 'TIP', 'NOTE',
  1463. 'IMPORTANT', 'WARNING', 'CAUTION', 'abstract', 'partintro',
  1464. 'comment', 'example', 'sidebar', 'source', 'music', 'latex',
  1465. 'graphviz'. For example, the following open block and listing block
  1466. are functionally identical:
  1467. [listing]
  1468. --
  1469. Lorum ipsum ...
  1470. --
  1471. ---------------
  1472. Lorum ipsum ...
  1473. ---------------
  1474. - An unstyled open block groups section elements but otherwise does
  1475. nothing.
  1476. Open blocks are used to generate document abstracts and book part
  1477. introductions:
  1478. - Apply the 'abstract' style to generate an abstract, for example:
  1479. [abstract]
  1480. --
  1481. In this paper we will ...
  1482. --
  1483. . Apply the 'partintro' style to generate a book part introduction for
  1484. a multi-part book, for example:
  1485. [partintro]
  1486. .Optional part introduction title
  1487. --
  1488. Optional part introduction goes here.
  1489. --
  1490. [[X64]]
  1491. Lists
  1492. -----
  1493. .List types
  1494. - Bulleted lists. Also known as itemized or unordered lists.
  1495. - Numbered lists. Also called ordered lists.
  1496. - Labeled lists. Sometimes called variable or definition lists.
  1497. - Callout lists (a list of callout annotations).
  1498. .List behavior
  1499. - List item indentation is optional and does not determine nesting,
  1500. indentation does however make the source more readable.
  1501. - Another list or a literal paragraph immediately following a list
  1502. item will be implicitly included in the list item; use <<X15, list
  1503. item continuation>> to explicitly append other block elements to a
  1504. list item.
  1505. - A comment block or a comment line block macro element will terminate
  1506. a list -- use inline comment lines to put comments inside lists.
  1507. - The `listindex` <<X60,intrinsic attribute>> is the current list item
  1508. index (1..). If this attribute is used outside a list then it's value
  1509. is the number of items in the most recently closed list. Useful for
  1510. displaying the number of items in a list.
  1511. Bulleted Lists
  1512. ~~~~~~~~~~~~~~
  1513. Bulleted list items start with a single dash or one to five asterisks
  1514. followed by some white space then some text. Bulleted list syntaxes
  1515. are:
  1516. ...................
  1517. - List item.
  1518. * List item.
  1519. ** List item.
  1520. *** List item.
  1521. **** List item.
  1522. ***** List item.
  1523. ...................
  1524. Numbered Lists
  1525. ~~~~~~~~~~~~~~
  1526. List item numbers are explicit or implicit.
  1527. .Explicit numbering
  1528. List items begin with a number followed by some white space then the
  1529. item text. The numbers can be decimal (arabic), roman (upper or lower
  1530. case) or alpha (upper or lower case). Decimal and alpha numbers are
  1531. terminated with a period, roman numbers are terminated with a closing
  1532. parenthesis. The different terminators are necessary to ensure 'i',
  1533. 'v' and 'x' roman numbers are are distinguishable from 'x', 'v' and
  1534. 'x' alpha numbers. Examples:
  1535. .....................................................................
  1536. 1. Arabic (decimal) numbered list item.
  1537. a. Lower case alpha (letter) numbered list item.
  1538. F. Upper case alpha (letter) numbered list item.
  1539. iii) Lower case roman numbered list item.
  1540. IX) Upper case roman numbered list item.
  1541. .....................................................................
  1542. .Implicit numbering
  1543. List items begin one to five period characters, followed by some white
  1544. space then the item text. Examples:
  1545. .....................................................................
  1546. . Arabic (decimal) numbered list item.
  1547. .. Lower case alpha (letter) numbered list item.
  1548. ... Lower case roman numbered list item.
  1549. .... Upper case alpha (letter) numbered list item.
  1550. ..... Upper case roman numbered list item.
  1551. .....................................................................
  1552. You can use the 'style' attribute (also the first positional
  1553. attribute) to specify an alternative numbering style. The numbered
  1554. list style can be one of the following values: 'arabic', 'loweralpha',
  1555. 'upperalpha', 'lowerroman', 'upperroman'.
  1556. Here are some examples of bulleted and numbered lists:
  1557. ---------------------------------------------------------------------
  1558. - Praesent eget purus quis magna eleifend eleifend.
  1559. 1. Fusce euismod commodo velit.
  1560. a. Fusce euismod commodo velit.
  1561. b. Vivamus fringilla mi eu lacus.
  1562. c. Donec eget arcu bibendum nunc consequat lobortis.
  1563. 2. Vivamus fringilla mi eu lacus.
  1564. i) Fusce euismod commodo velit.
  1565. ii) Vivamus fringilla mi eu lacus.
  1566. 3. Donec eget arcu bibendum nunc consequat lobortis.
  1567. 4. Nam fermentum mattis ante.
  1568. - Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
  1569. * Fusce euismod commodo velit.
  1570. ** Qui in magna commodo, est labitur dolorum an. Est ne magna primis
  1571. adolescens. Sit munere ponderum dignissim et. Minim luptatum et
  1572. vel.
  1573. ** Vivamus fringilla mi eu lacus.
  1574. * Donec eget arcu bibendum nunc consequat lobortis.
  1575. - Nulla porttitor vulputate libero.
  1576. . Fusce euismod commodo velit.
  1577. . Vivamus fringilla mi eu lacus.
  1578. [upperroman]
  1579. .. Fusce euismod commodo velit.
  1580. .. Vivamus fringilla mi eu lacus.
  1581. . Donec eget arcu bibendum nunc consequat lobortis.
  1582. ---------------------------------------------------------------------
  1583. Which render as:
  1584. - Praesent eget purus quis magna eleifend eleifend.
  1585. 1. Fusce euismod commodo velit.
  1586. a. Fusce euismod commodo velit.
  1587. b. Vivamus fringilla mi eu lacus.
  1588. c. Donec eget arcu bibendum nunc consequat lobortis.
  1589. 2. Vivamus fringilla mi eu lacus.
  1590. i) Fusce euismod commodo velit.
  1591. ii) Vivamus fringilla mi eu lacus.
  1592. 3. Donec eget arcu bibendum nunc consequat lobortis.
  1593. 4. Nam fermentum mattis ante.
  1594. - Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
  1595. * Fusce euismod commodo velit.
  1596. ** Qui in magna commodo, est labitur dolorum an. Est ne magna primis
  1597. adolescens. Sit munere ponderum dignissim et. Minim luptatum et
  1598. vel.
  1599. ** Vivamus fringilla mi eu lacus.
  1600. * Donec eget arcu bibendum nunc consequat lobortis.
  1601. - Nulla porttitor vulputate libero.
  1602. . Fusce euismod commodo velit.
  1603. . Vivamus fringilla mi eu lacus.
  1604. [upperroman]
  1605. .. Fusce euismod commodo velit.
  1606. .. Vivamus fringilla mi eu lacus.
  1607. . Donec eget arcu bibendum nunc consequat lobortis.
  1608. A predefined 'compact' option is available to bulleted and numbered
  1609. lists -- this translates to the DocBook 'spacing="compact"' lists
  1610. attribute which may or may not be processed by the DocBook toolchain.
  1611. Example:
  1612. [options="compact"]
  1613. - Compact list item.
  1614. - Another compact list item.
  1615. TIP: To apply the 'compact' option globally define a document-wide
  1616. 'compact-option' attribute, e.g. using the `-a compact-option`
  1617. command-line option.
  1618. You can set the list start number using the 'start' attribute (works
  1619. for HTML outputs and DocBook outputs processed by DocBook XSL
  1620. Stylesheets). Example:
  1621. [start=7]
  1622. . List item 7.
  1623. . List item 8.
  1624. Labeled Lists
  1625. ~~~~~~~~~~~~~
  1626. Labeled list items consist of one or more text labels followed by the
  1627. text of the list item.
  1628. An item label begins a line with an alphanumeric character hard
  1629. against the left margin and ends with two, three or four colons or two
  1630. semi-colons. A list item can have multiple labels, one per line.
  1631. The list item text consists of one or more lines of text starting
  1632. after the last label (either on the same line or a new line) and can
  1633. be followed by nested List or ListParagraph elements. Item text can be
  1634. optionally indented.
  1635. Here are some examples:
  1636. ---------------------------------------------------------------------
  1637. In::
  1638. Lorem::
  1639. Fusce euismod commodo velit.
  1640. Fusce euismod commodo velit.
  1641. Ipsum:: Vivamus fringilla mi eu lacus.
  1642. * Vivamus fringilla mi eu lacus.
  1643. * Donec eget arcu bibendum nunc consequat lobortis.
  1644. Dolor::
  1645. Donec eget arcu bibendum nunc consequat lobortis.
  1646. Suspendisse;;
  1647. A massa id sem aliquam auctor.
  1648. Morbi;;
  1649. Pretium nulla vel lorem.
  1650. In;;
  1651. Dictum mauris in urna.
  1652. Vivamus::: Fringilla mi eu lacus.
  1653. Donec::: Eget arcu bibendum nunc consequat lobortis.
  1654. ---------------------------------------------------------------------
  1655. Which render as:
  1656. In::
  1657. Lorem::
  1658. Fusce euismod commodo velit.
  1659. Fusce euismod commodo velit.
  1660. Ipsum:: Vivamus fringilla mi eu lacus.
  1661. * Vivamus fringilla mi eu lacus.
  1662. * Donec eget arcu bibendum nunc consequat lobortis.
  1663. Dolor::
  1664. Donec eget arcu bibendum nunc consequat lobortis.
  1665. Suspendisse;;
  1666. A massa id sem aliquam auctor.
  1667. Morbi;;
  1668. Pretium nulla vel lorem.
  1669. In;;
  1670. Dictum mauris in urna.
  1671. Vivamus::: Fringilla mi eu lacus.
  1672. Donec::: Eget arcu bibendum nunc consequat lobortis.
  1673. Horizontal labeled list style
  1674. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1675. The 'horizontal' labeled list style (also the first positional
  1676. attribute) places the list text side-by-side with the label instead of
  1677. under the label. Here is an example:
  1678. ---------------------------------------------------------------------
  1679. [horizontal]
  1680. *Lorem*:: Fusce euismod commodo velit. Qui in magna commodo, est
  1681. labitur dolorum an. Est ne magna primis adolescens.
  1682. Fusce euismod commodo velit.
  1683. *Ipsum*:: Vivamus fringilla mi eu lacus.
  1684. - Vivamus fringilla mi eu lacus.
  1685. - Donec eget arcu bibendum nunc consequat lobortis.
  1686. *Dolor*::
  1687. - Vivamus fringilla mi eu lacus.
  1688. - Donec eget arcu bibendum nunc consequat lobortis.
  1689. ---------------------------------------------------------------------
  1690. Which render as:
  1691. [horizontal]
  1692. *Lorem*:: Fusce euismod commodo velit. Qui in magna commodo, est
  1693. labitur dolorum an. Est ne magna primis adolescens.
  1694. Fusce euismod commodo velit.
  1695. *Ipsum*:: Vivamus fringilla mi eu lacus.
  1696. - Vivamus fringilla mi eu lacus.
  1697. - Donec eget arcu bibendum nunc consequat lobortis.
  1698. *Dolor*::
  1699. - Vivamus fringilla mi eu lacus.
  1700. - Donec eget arcu bibendum nunc consequat lobortis.
  1701. [NOTE]
  1702. =====================================================================
  1703. - Current PDF toolchains do not make a good job of determining
  1704. the relative column widths for horizontal labeled lists.
  1705. - Nested horizontal labeled lists will generate DocBook validation
  1706. errors because the 'DocBook XML V4.2' DTD does not permit nested
  1707. informal tables (although <<X13,DocBook XSL Stylesheets>> and
  1708. <<X31,dblatex>> process them correctly).
  1709. - The label width can be set as a percentage of the total width by
  1710. setting the 'width' attribute e.g. `width="10%"`
  1711. =====================================================================
  1712. Question and Answer Lists
  1713. ~~~~~~~~~~~~~~~~~~~~~~~~~
  1714. AsciiDoc comes pre-configured with a 'qanda' style labeled list for generating
  1715. DocBook question and answer (Q&A) lists. Example:
  1716. ---------------------------------------------------------------------
  1717. [qanda]
  1718. Question one::
  1719. Answer one.
  1720. Question two::
  1721. Answer two.
  1722. ---------------------------------------------------------------------
  1723. Renders:
  1724. [qanda]
  1725. Question one::
  1726. Answer one.
  1727. Question two::
  1728. Answer two.
  1729. Glossary Lists
  1730. ~~~~~~~~~~~~~~
  1731. AsciiDoc comes pre-configured with a 'glossary' style labeled list for
  1732. generating DocBook glossary lists. Example:
  1733. ---------------------------------------------------------------------
  1734. [glossary]
  1735. A glossary term::
  1736. The corresponding definition.
  1737. A second glossary term::
  1738. The corresponding definition.
  1739. ---------------------------------------------------------------------
  1740. For working examples see the `article.txt` and `book.txt` documents in
  1741. the AsciiDoc `./doc` distribution directory.
  1742. NOTE: To generate valid DocBook output glossary lists must be located
  1743. in a section that uses the 'glossary' <<X93,section markup template>>.
  1744. Bibliography Lists
  1745. ~~~~~~~~~~~~~~~~~~
  1746. AsciiDoc comes with a predefined 'bibliography' bulleted list style
  1747. generating DocBook bibliography entries. Example:
  1748. ---------------------------------------------------------------------
  1749. [bibliography]
  1750. .Optional list title
  1751. - [[[taoup]]] Eric Steven Raymond. 'The Art of UNIX
  1752. Programming'. Addison-Wesley. ISBN 0-13-142901-9.
  1753. - [[[walsh-muellner]]] Norman Walsh & Leonard Muellner.
  1754. 'DocBook - The Definitive Guide'. O'Reilly & Associates.
  1755. 1999. ISBN 1-56592-580-7.
  1756. ---------------------------------------------------------------------
  1757. The `[[[<reference>]]]` syntax is a bibliography entry anchor, it
  1758. generates an anchor named `<reference>` and additionally displays
  1759. `[<reference>]` at the anchor position. For example `[[[taoup]]]`
  1760. generates an anchor named `taoup` that displays `[taoup]` at the
  1761. anchor position. Cite the reference from elsewhere your document using
  1762. `<<taoup>>`, this displays a hyperlink (`[taoup]`) to the
  1763. corresponding bibliography entry anchor.
  1764. For working examples see the `article.txt` and `book.txt` documents in
  1765. the AsciiDoc `./doc` distribution directory.
  1766. NOTE: To generate valid DocBook output bibliography lists must be
  1767. located in a <<X93,bibliography section>>.
  1768. [[X15]]
  1769. List Item Continuation
  1770. ~~~~~~~~~~~~~~~~~~~~~~
  1771. Another list or a literal paragraph immediately following a list item
  1772. is implicitly appended to the list item; to append other block
  1773. elements to a list item you need to explicitly join them to the list
  1774. item with a 'list continuation' (a separator line containing a single
  1775. plus character). Multiple block elements can be appended to a list
  1776. item using list continuations (provided they are legal list item
  1777. children in the backend markup).
  1778. Here are some examples of list item continuations: list item one
  1779. contains multiple continuations; list item two is continued with an
  1780. <<X29,OpenBlock>> containing multiple elements:
  1781. ---------------------------------------------------------------------
  1782. 1. List item one.
  1783. +
  1784. List item one continued with a second paragraph followed by an
  1785. Indented block.
  1786. +
  1787. .................
  1788. $ ls *.sh
  1789. $ mv *.sh ~/tmp
  1790. .................
  1791. +
  1792. List item continued with a third paragraph.
  1793. 2. List item two continued with an open block.
  1794. +
  1795. --
  1796. This paragraph is part of the preceding list item.
  1797. a. This list is nested and does not require explicit item continuation.
  1798. +
  1799. This paragraph is part of the preceding list item.
  1800. b. List item b.
  1801. This paragraph belongs to item two of the outer list.
  1802. --
  1803. ---------------------------------------------------------------------
  1804. Renders:
  1805. 1. List item one.
  1806. +
  1807. List item one continued with a second paragraph followed by an
  1808. Indented block.
  1809. +
  1810. .................
  1811. $ ls *.sh
  1812. $ mv *.sh ~/tmp
  1813. .................
  1814. +
  1815. List item continued with a third paragraph.
  1816. 2. List item two continued with an open block.
  1817. +
  1818. --
  1819. This paragraph is part of the preceding list item.
  1820. a. This list is nested and does not require explicit item continuation.
  1821. +
  1822. This paragraph is part of the preceding list item.
  1823. b. List item b.
  1824. This paragraph belongs to item two of the outer list.
  1825. --
  1826. [[X92]]
  1827. Footnotes
  1828. ---------
  1829. The shipped AsciiDoc configuration includes three footnote inline
  1830. macros:
  1831. `footnote:[<text>]`::
  1832. Generates a footnote with text `<text>`.
  1833. `footnoteref:[<id>,<text>]`::
  1834. Generates a footnote with a reference ID `<id>` and text `<text>`.
  1835. `footnoteref:[<id>]`::
  1836. Generates a reference to the footnote with ID `<id>`.
  1837. The footnote text can span multiple lines.
  1838. The 'xhtml11' and 'html5' backends render footnotes dynamically using
  1839. JavaScript; 'html4' outputs do not use JavaScript and leave the
  1840. footnotes inline; 'docbook' footnotes are processed by the downstream
  1841. DocBook toolchain.
  1842. Example footnotes:
  1843. A footnote footnote:[An example footnote.];
  1844. a second footnote with a reference ID footnoteref:[note2,Second footnote.];
  1845. finally a reference to the second footnote footnoteref:[note2].
  1846. Renders:
  1847. A footnote footnote:[An example footnote.];
  1848. a second footnote with a reference ID footnoteref:[note2,Second footnote.];
  1849. finally a reference to the second footnote footnoteref:[note2].
  1850. Indexes
  1851. -------
  1852. The shipped AsciiDoc configuration includes the inline macros for
  1853. generating DocBook index entries.
  1854. `indexterm:[<primary>,<secondary>,<tertiary>]`::
  1855. `(((<primary>,<secondary>,<tertiary>)))`::
  1856. This inline macro generates an index term (the `<secondary>` and
  1857. `<tertiary>` positional attributes are optional). Example:
  1858. `indexterm:[Tigers,Big cats]` (or, using the alternative syntax
  1859. `(((Tigers,Big cats)))`. Index terms that have secondary and
  1860. tertiary entries also generate separate index terms for the
  1861. secondary and tertiary entries. The index terms appear in the
  1862. index, not the primary text flow.
  1863. `indexterm2:[<primary>]`::
  1864. `((<primary>))`::
  1865. This inline macro generates an index term that appears in both the
  1866. index and the primary text flow. The `<primary>` should not be
  1867. padded to the left or right with white space characters.
  1868. For working examples see the `article.txt` and `book.txt` documents in
  1869. the AsciiDoc `./doc` distribution directory.
  1870. NOTE: Index entries only really make sense if you are generating
  1871. DocBook markup -- DocBook conversion programs automatically generate
  1872. an index at the point an 'Index' section appears in source document.
  1873. [[X105]]
  1874. Callouts
  1875. --------
  1876. Callouts are a mechanism for annotating verbatim text (for example:
  1877. source code, computer output and user input). Callout markers are
  1878. placed inside the annotated text while the actual annotations are
  1879. presented in a callout list after the annotated text. Here's an
  1880. example:
  1881. ---------------------------------------------------------------------
  1882. .MS-DOS directory listing
  1883. -----------------------------------------------------
  1884. 10/17/97 9:04 <DIR> bin
  1885. 10/16/97 14:11 <DIR> DOS \<1>
  1886. 10/16/97 14:40 <DIR> Program Files
  1887. 10/16/97 14:46 <DIR> TEMP
  1888. 10/17/97 9:04 <DIR> tmp
  1889. 10/16/97 14:37 <DIR> WINNT
  1890. 10/16/97 14:25 119 AUTOEXEC.BAT \<2>
  1891. 2/13/94 6:21 54,619 COMMAND.COM \<2>
  1892. 10/16/97 14:25 115 CONFIG.SYS \<2>
  1893. 11/16/97 17:17 61,865,984 pagefile.sys
  1894. 2/13/94 6:21 9,349 WINA20.386 \<3>
  1895. -----------------------------------------------------
  1896. \<1> This directory holds MS-DOS.
  1897. \<2> System startup code for DOS.
  1898. \<3> Some sort of Windows 3.1 hack.
  1899. ---------------------------------------------------------------------
  1900. Which renders:
  1901. .MS-DOS directory listing
  1902. -----------------------------------------------------
  1903. 10/17/97 9:04 <DIR> bin
  1904. 10/16/97 14:11 <DIR> DOS <1>
  1905. 10/16/97 14:40 <DIR> Program Files
  1906. 10/16/97 14:46 <DIR> TEMP
  1907. 10/17/97 9:04 <DIR> tmp
  1908. 10/16/97 14:37 <DIR> WINNT
  1909. 10/16/97 14:25 119 AUTOEXEC.BAT <2>
  1910. 2/13/94 6:21 54,619 COMMAND.COM <2>
  1911. 10/16/97 14:25 115 CONFIG.SYS <2>
  1912. 11/16/97 17:17 61,865,984 pagefile.sys
  1913. 2/13/94 6:21 9,349 WINA20.386 <3>
  1914. -----------------------------------------------------
  1915. <1> This directory holds MS-DOS.
  1916. <2> System startup code for DOS.
  1917. <3> Some sort of Windows 3.1 hack.
  1918. .Explanation
  1919. - The callout marks are whole numbers enclosed in angle brackets --
  1920. they refer to the correspondingly numbered item in the following
  1921. callout list.
  1922. - By default callout marks are confined to 'LiteralParagraphs',
  1923. 'LiteralBlocks' and 'ListingBlocks' (although this is a
  1924. configuration file option and can be changed).
  1925. - Callout list item numbering is fairly relaxed -- list items can
  1926. start with `<n>`, `n>` or `>` where `n` is the optional list item
  1927. number (in the latter case list items starting with a single `>`
  1928. character are implicitly numbered starting at one).
  1929. - Callout lists should not be nested.
  1930. - Callout lists start list items hard against the left margin.
  1931. - If you want to present a number inside angle brackets you'll need to
  1932. escape it with a backslash to prevent it being interpreted as a
  1933. callout mark.
  1934. NOTE: Define the AsciiDoc 'icons' attribute (for example using the `-a
  1935. icons` command-line option) to display callout icons.
  1936. Implementation Notes
  1937. ~~~~~~~~~~~~~~~~~~~~
  1938. Callout marks are generated by the 'callout' inline macro while
  1939. callout lists are generated using the 'callout' list definition. The
  1940. 'callout' macro and 'callout' list are special in that they work
  1941. together. The 'callout' inline macro is not enabled by the normal
  1942. 'macros' substitutions option, instead it has its own 'callouts'
  1943. substitution option.
  1944. The following attributes are available during inline callout macro
  1945. substitution:
  1946. `{index}`::
  1947. The callout list item index inside the angle brackets.
  1948. `{coid}`::
  1949. An identifier formatted like `CO<listnumber>-<index>` that
  1950. uniquely identifies the callout mark. For example `CO2-4`
  1951. identifies the fourth callout mark in the second set of callout
  1952. marks.
  1953. The `{coids}` attribute can be used during callout list item
  1954. substitution -- it is a space delimited list of callout IDs that refer
  1955. to the explanatory list item.
  1956. Including callouts in included code
  1957. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1958. You can annotate working code examples with callouts -- just remember
  1959. to put the callouts inside source code comments. This example displays
  1960. the `test.py` source file (containing a single callout) using the
  1961. 'source' (code highlighter) filter:
  1962. .AsciiDoc source
  1963. ---------------------------------------------------------------------
  1964. [source,python]
  1965. -------------------------------------------
  1966. \include::test.py[]
  1967. -------------------------------------------
  1968. \<1> Print statement.
  1969. ---------------------------------------------------------------------
  1970. .Included `test.py` source
  1971. ---------------------------------------------------------------------
  1972. print 'Hello World!' # \<1>
  1973. ---------------------------------------------------------------------
  1974. Macros
  1975. ------
  1976. Macros are a mechanism for substituting parametrized text into output
  1977. documents.
  1978. Macros have a 'name', a single 'target' argument and an 'attribute
  1979. list'. The usual syntax is `<name>:<target>[<attrlist>]` (for
  1980. inline macros) and `<name>::<target>[<attrlist>]` (for block
  1981. macros). Here are some examples:
  1982. http://www.docbook.org/[DocBook.org]
  1983. include::chapt1.txt[tabsize=2]
  1984. mailto:srackham@gmail.com[]
  1985. .Macro behavior
  1986. - `<name>` is the macro name. It can only contain letters, digits or
  1987. dash characters and cannot start with a dash.
  1988. - The optional `<target>` cannot contain white space characters.
  1989. - `<attrlist>` is a <<X21,list of attributes>> enclosed in square
  1990. brackets.
  1991. - `]` characters inside attribute lists must be escaped with a
  1992. backslash.
  1993. - Expansion of macro references can normally be escaped by prefixing a
  1994. backslash character (see the AsciiDoc 'FAQ' for examples of
  1995. exceptions to this rule).
  1996. - Attribute references in block macros are expanded.
  1997. - The substitutions performed prior to Inline macro macro expansion
  1998. are determined by the inline context.
  1999. - Macros are processed in the order they appear in the configuration
  2000. file(s).
  2001. - Calls to inline macros can be nested inside different inline macros
  2002. (an inline macro call cannot contain a nested call to itself).
  2003. - In addition to `<name>`, `<target>` and `<attrlist>` the
  2004. `<passtext>` and `<subslist>` named groups are available to
  2005. <<X77,passthrough macros>>. A macro is a passthrough macro if the
  2006. definition includes a `<passtext>` named group.
  2007. Inline Macros
  2008. ~~~~~~~~~~~~~
  2009. Inline Macros occur in an inline element context. Predefined Inline
  2010. macros include 'URLs', 'image' and 'link' macros.
  2011. URLs
  2012. ^^^^
  2013. 'http', 'https', 'ftp', 'file', 'mailto' and 'callto' URLs are
  2014. rendered using predefined inline macros.
  2015. - If you don't need a custom link caption you can enter the 'http',
  2016. 'https', 'ftp', 'file' URLs and email addresses without any special
  2017. macro syntax.
  2018. - If the `<attrlist>` is empty the URL is displayed.
  2019. Here are some examples:
  2020. http://www.docbook.org/[DocBook.org]
  2021. http://www.docbook.org/
  2022. mailto:joe.bloggs@foobar.com[email Joe Bloggs]
  2023. joe.bloggs@foobar.com
  2024. Which are rendered:
  2025. http://www.docbook.org/[DocBook.org]
  2026. http://www.docbook.org/
  2027. mailto:joe.bloggs@foobar.com[email Joe Bloggs]
  2028. joe.bloggs@foobar.com
  2029. If the `<target>` necessitates space characters use `%20`, for example
  2030. `large%20image.png`.
  2031. Internal Cross References
  2032. ^^^^^^^^^^^^^^^^^^^^^^^^^
  2033. Two AsciiDoc inline macros are provided for creating hypertext links
  2034. within an AsciiDoc document. You can use either the standard macro
  2035. syntax or the (preferred) alternative.
  2036. [[X30]]
  2037. anchor
  2038. ++++++
  2039. Used to specify hypertext link targets:
  2040. [[<id>,<xreflabel>]]
  2041. anchor:<id>[<xreflabel>]
  2042. The `<id>` is a unique string that conforms to the output markup's
  2043. anchor syntax. The optional `<xreflabel>` is the text to be displayed
  2044. by captionless 'xref' macros that refer to this anchor. The optional
  2045. `<xreflabel>` is only really useful when generating DocBook output.
  2046. Example anchor:
  2047. [[X1]]
  2048. You may have noticed that the syntax of this inline element is the
  2049. same as that of the <<X41,BlockId block element>>, this is no
  2050. coincidence since they are functionally equivalent.
  2051. xref
  2052. ++++
  2053. Creates a hypertext link to a document anchor.
  2054. <<<id>,<caption>>>
  2055. xref:<id>[<caption>]
  2056. The `<id>` refers to an anchor ID. The optional `<caption>` is the
  2057. link's displayed text. Example:
  2058. <<X21,attribute lists>>
  2059. If `<caption>` is not specified then the displayed text is
  2060. auto-generated:
  2061. - The AsciiDoc 'xhtml11' and 'html5' backends display the `<id>`
  2062. enclosed in square brackets.
  2063. - If DocBook is produced the DocBook toolchain is responsible for the
  2064. displayed text which will normally be the referenced figure, table
  2065. or section title number followed by the element's title text.
  2066. Here is an example:
  2067. ---------------------------------------------------------------------
  2068. [[tiger_image]]
  2069. .Tyger tyger
  2070. image::tiger.png[]
  2071. This can be seen in <<tiger_image>>.
  2072. ---------------------------------------------------------------------
  2073. Linking to Local Documents
  2074. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  2075. Hypertext links to files on the local file system are specified using
  2076. the 'link' inline macro.
  2077. link:<target>[<caption>]
  2078. The 'link' macro generates relative URLs. The link macro `<target>` is
  2079. the target file name (relative to the file system location of the
  2080. referring document). The optional `<caption>` is the link's displayed
  2081. text. If `<caption>` is not specified then `<target>` is displayed.
  2082. Example:
  2083. link:downloads/foo.zip[download foo.zip]
  2084. You can use the `<filename>#<id>` syntax to refer to an anchor within
  2085. a target document but this usually only makes sense when targeting
  2086. HTML documents.
  2087. [[X9]]
  2088. Images
  2089. ^^^^^^
  2090. Inline images are inserted into the output document using the 'image'
  2091. macro. The inline syntax is:
  2092. image:<target>[<attributes>]
  2093. The contents of the image file `<target>` is displayed. To display the
  2094. image its file format must be supported by the target backend
  2095. application. HTML and DocBook applications normally support PNG or JPG
  2096. files.
  2097. `<target>` file name paths are relative to the location of the
  2098. referring document.
  2099. [[X55]]
  2100. .Image macro attributes
  2101. - The optional 'alt' attribute is also the first positional attribute,
  2102. it specifies alternative text which is displayed if the output
  2103. application is unable to display the image file (see also
  2104. http://htmlhelp.com/feature/art3.htm[Use of ALT texts in IMGs]). For
  2105. example:
  2106. image:images/logo.png[Company Logo]
  2107. - The optional 'title' attribute provides a title for the image. The
  2108. <<X49,block image macro>> renders the title alongside the image.
  2109. The inline image macro displays the title as a popup ``tooltip'' in
  2110. visual browsers (AsciiDoc HTML outputs only).
  2111. - The optional `width` and `height` attributes scale the image size
  2112. and can be used in any combination. The units are pixels. The
  2113. following example scales the previous example to a height of 32
  2114. pixels:
  2115. image:images/logo.png["Company Logo",height=32]
  2116. - The optional `link` attribute is used to link the image to an
  2117. external document. The following example links a screenshot
  2118. thumbnail to a full size version:
  2119. image:screen-thumbnail.png[height=32,link="screen.png"]
  2120. - The optional `scaledwidth` attribute is only used in DocBook block
  2121. images (specifically for PDF documents). The following example
  2122. scales the images to 75% of the available print width:
  2123. image::images/logo.png[scaledwidth="75%",alt="Company Logo"]
  2124. - The image `scale` attribute sets the DocBook `imagedata` element
  2125. `scale` attribute.
  2126. - The optional `align` attribute is used for horizontal image
  2127. alignment. Allowed values are `center`, `left` and `right`. For
  2128. example:
  2129. image::images/tiger.png["Tiger image",align="left"]
  2130. - The optional `float` attribute floats the image `left` or `right` on
  2131. the page (works with HTML outputs only, has no effect on DocBook
  2132. outputs). `float` and `align` attributes are mutually exclusive.
  2133. Use the `unfloat::[]` block macro to stop floating.
  2134. Comment Lines
  2135. ^^^^^^^^^^^^^
  2136. See <<X25,comment block macro>>.
  2137. Block Macros
  2138. ~~~~~~~~~~~~
  2139. A Block macro reference must be contained in a single line separated
  2140. either side by a blank line or a block delimiter.
  2141. Block macros behave just like Inline macros, with the following
  2142. differences:
  2143. - They occur in a block context.
  2144. - The default syntax is `<name>::<target>[<attrlist>]` (two
  2145. colons, not one).
  2146. - Markup template section names end in `-blockmacro` instead of
  2147. `-inlinemacro`.
  2148. Block Identifier
  2149. ^^^^^^^^^^^^^^^^
  2150. The Block Identifier macro sets the `id` attribute and has the same
  2151. syntax as the <<X30,anchor inline macro>> since it performs
  2152. essentially the same function -- block templates use the `id`
  2153. attribute as a block element ID. For example:
  2154. [[X30]]
  2155. This is equivalent to the `[id="X30"]` <<X79,AttributeList element>>).
  2156. [[X49]]
  2157. Images
  2158. ^^^^^^
  2159. The 'image' block macro is used to display images in a block context.
  2160. The syntax is:
  2161. image::<target>[<attributes>]
  2162. The block `image` macro has the same <<X55,macro attributes>> as it's
  2163. <<X9,inline image macro>> counterpart.
  2164. Block images can be titled by preceding the 'image' macro with a
  2165. 'BlockTitle'. DocBook toolchains normally number titled block images
  2166. and optionally list them in an automatically generated 'List of
  2167. Figures' backmatter section.
  2168. This example:
  2169. .Main circuit board
  2170. image::images/layout.png[J14P main circuit board]
  2171. is equivalent to:
  2172. image::images/layout.png["J14P main circuit board",
  2173. title="Main circuit board"]
  2174. A title prefix that can be inserted with the `caption` attribute
  2175. (HTML backends). For example:
  2176. .Main circuit board
  2177. [caption="Figure 2: "]
  2178. image::images/layout.png[J14P main circuit board]
  2179. [[X66]]
  2180. .Embedding images in XHTML documents
  2181. *********************************************************************
  2182. If you define the `data-uri` attribute then images will be embedded in
  2183. XHTML outputs using the
  2184. http://en.wikipedia.org/wiki/Data:_URI_scheme[data URI scheme]. You
  2185. can use the 'data-uri' attribute with the 'xhtml11' and 'html5'
  2186. backends to produce single-file XHTML documents with embedded images
  2187. and CSS, for example:
  2188. $ asciidoc -a data-uri mydocument.txt
  2189. [NOTE]
  2190. ======
  2191. - All current popular browsers support data URIs, although versions
  2192. of Internet Explorer prior to version 8 do not.
  2193. - Some browsers limit the size of data URIs.
  2194. ======
  2195. *********************************************************************
  2196. [[X25]]
  2197. Comment Lines
  2198. ^^^^^^^^^^^^^
  2199. Single lines starting with two forward slashes hard up against the
  2200. left margin are treated as comments. Comment lines do not appear in
  2201. the output unless the 'showcomments' attribute is defined. Comment
  2202. lines have been implemented as both block and inline macros so a
  2203. comment line can appear as a stand-alone block or within block elements
  2204. that support inline macro expansion. Example comment line:
  2205. // This is a comment.
  2206. If the 'showcomments' attribute is defined comment lines are written
  2207. to the output:
  2208. - In DocBook the comment lines are enclosed by the 'remark' element
  2209. (which may or may not be rendered by your toolchain).
  2210. - The 'showcomments' attribute does not expose <<X26,Comment Blocks>>.
  2211. Comment Blocks are never passed to the output.
  2212. System Macros
  2213. ~~~~~~~~~~~~~
  2214. System macros are block macros that perform a predefined task and are
  2215. hardwired into the asciidoc(1) program.
  2216. - You can escape system macros with a leading backslash character
  2217. (as you can with other macros).
  2218. - The syntax and tasks performed by system macros is built into
  2219. asciidoc(1) so they don't appear in configuration files. You can
  2220. however customize the syntax by adding entries to a configuration
  2221. file `[macros]` section.
  2222. [[X63]]
  2223. Include Macros
  2224. ^^^^^^^^^^^^^^
  2225. The `include` and `include1` system macros to include the contents of
  2226. a named file into the source document.
  2227. The `include` macro includes a file as if it were part of the parent
  2228. document -- tabs are expanded and system macros processed. The
  2229. contents of `include1` files are not subject to tab expansion or
  2230. system macro processing nor are attribute or lower priority
  2231. substitutions performed. The `include1` macro's intended use is to
  2232. include verbatim embedded CSS or scripts into configuration file
  2233. headers. Example:
  2234. ------------------------------------
  2235. \include::chapter1.txt[tabsize=4]
  2236. ------------------------------------
  2237. .Include macro behavior
  2238. - If the included file name is specified with a relative path then the
  2239. path is relative to the location of the referring document.
  2240. - Include macros can appear inside configuration files.
  2241. - Files included from within 'DelimitedBlocks' are read to completion
  2242. to avoid false end-of-block underline termination.
  2243. - Attribute references are expanded inside the include 'target'; if an
  2244. attribute is undefined then the included file is silently skipped.
  2245. - The 'tabsize' macro attribute sets the number of space characters to
  2246. be used for tab expansion in the included file (not applicable to
  2247. `include1` macro).
  2248. - The 'depth' macro attribute sets the maximum permitted number of
  2249. subsequent nested includes (not applicable to `include1` macro which
  2250. does not process nested includes). Setting 'depth' to '1' disables
  2251. nesting inside the included file. By default, nesting is limited to
  2252. a depth of ten.
  2253. - If the he 'warnings' attribute is set to 'False' (or any other
  2254. Python literal that evaluates to boolean false) then no warning
  2255. message is printed if the included file does not exist. By default
  2256. 'warnings' are enabled.
  2257. - Internally the `include1` macro is translated to the `include1`
  2258. system attribute which means it must be evaluated in a region where
  2259. attribute substitution is enabled. To inhibit nested substitution in
  2260. included files it is preferable to use the `include` macro and set
  2261. the attribute `depth=1`.
  2262. Conditional Inclusion Macros
  2263. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2264. Lines of text in the source document can be selectively included or
  2265. excluded from processing based on the existence (or not) of a document
  2266. attribute.
  2267. Document text between the `ifdef` and `endif` macros is included if a
  2268. document attribute is defined:
  2269. ifdef::<attribute>[]
  2270. :
  2271. endif::<attribute>[]
  2272. Document text between the `ifndef` and `endif` macros is not included
  2273. if a document attribute is defined:
  2274. ifndef::<attribute>[]
  2275. :
  2276. endif::<attribute>[]
  2277. `<attribute>` is an attribute name which is optional in the trailing
  2278. `endif` macro.
  2279. If you only want to process a single line of text then the text can be
  2280. put inside the square brackets and the `endif` macro omitted, for
  2281. example:
  2282. ifdef::revnumber[Version number 42]
  2283. Is equivalent to:
  2284. ifdef::revnumber[]
  2285. Version number 42
  2286. endif::revnumber[]
  2287. 'ifdef' and 'ifndef' macros also accept multiple attribute names:
  2288. - Multiple ',' separated attribute names evaluate to defined if one
  2289. or more of the attributes is defined, otherwise it's value is
  2290. undefined.
  2291. - Multiple '+' separated attribute names evaluate to defined if all
  2292. of the attributes is defined, otherwise it's value is undefined.
  2293. Document text between the `ifeval` and `endif` macros is included if
  2294. the Python expression inside the square brackets is true. Example:
  2295. ifeval::[{rs458}==2]
  2296. :
  2297. endif::[]
  2298. - Document attribute references are expanded before the expression is
  2299. evaluated.
  2300. - If an attribute reference is undefined then the expression is
  2301. considered false.
  2302. Take a look at the `*.conf` configuration files in the AsciiDoc
  2303. distribution for examples of conditional inclusion macro usage.
  2304. Executable system macros
  2305. ^^^^^^^^^^^^^^^^^^^^^^^^
  2306. The 'eval', 'sys' and 'sys2' block macros exhibit the same behavior as
  2307. their same named <<X24, system attribute references>>. The difference
  2308. is that system macros occur in a block macro context whereas system
  2309. attributes are confined to inline contexts where attribute
  2310. substitution is enabled.
  2311. The following example displays a long directory listing inside a
  2312. literal block:
  2313. ------------------
  2314. sys::[ls -l *.txt]
  2315. ------------------
  2316. NOTE: There are no block macro versions of the 'eval3' and 'sys3'
  2317. system attributes.
  2318. Template System Macro
  2319. ^^^^^^^^^^^^^^^^^^^^^
  2320. The `template` block macro allows the inclusion of one configuration
  2321. file template section within another. The following example includes
  2322. the `[admonitionblock]` section in the `[admonitionparagraph]`
  2323. section:
  2324. [admonitionparagraph]
  2325. template::[admonitionblock]
  2326. .Template macro behavior
  2327. - The `template::[]` macro is useful for factoring configuration file
  2328. markup.
  2329. - `template::[]` macros cannot be nested.
  2330. - `template::[]` macro expansion is applied after all configuration
  2331. files have been read.
  2332. [[X77]]
  2333. Passthrough macros
  2334. ~~~~~~~~~~~~~~~~~~
  2335. Passthrough macros are analogous to <<X76,passthrough blocks>> and are
  2336. used to pass text directly to the output. The substitution performed
  2337. on the text is determined by the macro definition but can be overridden
  2338. by the `<subslist>`. The usual syntax is
  2339. `<name>:<subslist>[<passtext>]` (for inline macros) and
  2340. `<name>::<subslist>[<passtext>]` (for block macros). Passthroughs, by
  2341. definition, take precedence over all other text substitutions.
  2342. pass::
  2343. Inline and block. Passes text unmodified (apart from explicitly
  2344. specified substitutions). Examples:
  2345. pass:[<q>To be or not to be</q>]
  2346. pass:attributes,quotes[<u>the '{author}'</u>]
  2347. asciimath, latexmath::
  2348. Inline and block. Passes text unmodified. Used for
  2349. <<X78,mathematical formulas>>.
  2350. \+++::
  2351. Inline and block. The triple-plus passthrough is functionally
  2352. identical to the 'pass' macro but you don't have to escape `]`
  2353. characters and you can prefix with quoted attributes in the inline
  2354. version. Example:
  2355. Red [red]+++`sum_(i=1)\^n i=(n(n+1))/2`$+++ AsciiMathML formula
  2356. $$::
  2357. Inline and block. The double-dollar passthrough is functionally
  2358. identical to the triple-plus passthrough with one exception: special
  2359. characters are escaped. Example:
  2360. $$`[[a,b],[c,d]]((n),(k))`$$
  2361. [[X80]]`::
  2362. Text quoted with single backtick characters constitutes an 'inline
  2363. literal' passthrough. The enclosed text is rendered in a monospaced
  2364. font and is only subject to special character substitution. This
  2365. makes sense since monospace text is usually intended to be rendered
  2366. literally and often contains characters that would otherwise have to
  2367. be escaped. If you need monospaced text containing inline
  2368. substitutions use a <<X81,plus character instead of a backtick>>.
  2369. Macro Definitions
  2370. ~~~~~~~~~~~~~~~~~
  2371. Each entry in the configuration `[macros]` section is a macro
  2372. definition which can take one of the following forms:
  2373. `<pattern>=<name>[<subslist]`:: Inline macro definition.
  2374. `<pattern>=#<name>[<subslist]`:: Block macro definition.
  2375. `<pattern>=+<name>[<subslist]`:: System macro definition.
  2376. `<pattern>`:: Delete the existing macro with this `<pattern>`.
  2377. `<pattern>` is a Python regular expression and `<name>` is the name of
  2378. a markup template. If `<name>` is omitted then it is the value of the
  2379. regular expression match group named 'name'. The optional
  2380. `[<subslist]` is a comma-separated list of substitution names enclosed
  2381. in `[]` brackets, it sets the default substitutions for passthrough
  2382. text, if omitted then no passthrough substitutions are performed.
  2383. .Pattern named groups
  2384. The following named groups can be used in macro `<pattern>` regular
  2385. expressions and are available as markup template attributes:
  2386. name::
  2387. The macro name.
  2388. target::
  2389. The macro target.
  2390. attrlist::
  2391. The macro attribute list.
  2392. passtext::
  2393. Contents of this group are passed unmodified to the output subject
  2394. only to 'subslist' substitutions.
  2395. subslist::
  2396. Processed as a comma-separated list of substitution names for
  2397. 'passtext' substitution, overrides the the macro definition
  2398. 'subslist'.
  2399. .Here's what happens during macro substitution
  2400. - Each contextually relevant macro 'pattern' from the `[macros]`
  2401. section is matched against the input source line.
  2402. - If a match is found the text to be substituted is loaded from a
  2403. configuration markup template section named like
  2404. `<name>-inlinemacro` or `<name>-blockmacro` (depending on the macro
  2405. type).
  2406. - Global and macro attribute list attributes are substituted in the
  2407. macro's markup template.
  2408. - The substituted template replaces the macro reference in the output
  2409. document.
  2410. [[X98]]
  2411. HTML 5 audio and video block macros
  2412. -----------------------------------
  2413. The 'html5' backend 'audio' and 'video' block macros generate the HTML
  2414. 5 'audio' and 'video' elements respectively. They follow the usual
  2415. AsciiDoc block macro syntax `<name>::<target>[<attrlist>]` where:
  2416. [horizontal]
  2417. `<name>`:: 'audio' or 'video'.
  2418. `<target>`:: The URL or file name of the video or audio file.
  2419. `<attrlist>`:: A list of named attributes (see below).
  2420. .Audio macro attributes
  2421. [options="header",cols="1,5",frame="topbot"]
  2422. |====================================================================
  2423. |Name | Value
  2424. |options
  2425. |A comma separated list of one or more of the following items:
  2426. 'autoplay', 'loop' which correspond to the same-named HTML 5 'audio'
  2427. element boolean attributes. By default the player 'controls' are
  2428. enabled, include the 'nocontrols' option value to hide them.
  2429. |====================================================================
  2430. .Video macro attributes
  2431. [options="header",cols="1,5",frame="topbot"]
  2432. |====================================================================
  2433. |Name | Value
  2434. |height | The height of the player in pixels.
  2435. |width | The width of the player in pixels.
  2436. |poster | The URL or file name of an image representing the video.
  2437. |options
  2438. |A comma separated list of one or more of the following items:
  2439. 'autoplay', 'loop' and 'nocontrols'. The 'autoplay' and 'loop' options
  2440. correspond to the same-named HTML 5 'video' element boolean
  2441. attributes. By default the player 'controls' are enabled, include the
  2442. 'nocontrols' option value to hide them.
  2443. |====================================================================
  2444. Examples:
  2445. ---------------------------------------------------------------------
  2446. audio::images/example.ogg[]
  2447. video::gizmo.ogv[width=200,options="nocontrols,autoplay"]
  2448. .Example video
  2449. video::gizmo.ogv[]
  2450. video::http://www.808.dk/pics/video/gizmo.ogv[]
  2451. ---------------------------------------------------------------------
  2452. If your needs are more complex put raw HTML 5 in a markup block, for
  2453. example (from http://www.808.dk/?code-html-5-video):
  2454. ---------------------------------------------------------------------
  2455. ++++
  2456. <video poster="pics/video/gizmo.jpg" id="video" style="cursor: pointer;" >
  2457. <source src="pics/video/gizmo.mp4" />
  2458. <source src="pics/video/gizmo.webm" type="video/webm" />
  2459. <source src="pics/video/gizmo.ogv" type="video/ogg" />
  2460. Video not playing? <a href="pics/video/gizmo.mp4">Download file</a> instead.
  2461. </video>
  2462. <script type="text/javascript">
  2463. var video = document.getElementById('video');
  2464. video.addEventListener('click',function(){
  2465. video.play();
  2466. },false);
  2467. </script>
  2468. ++++
  2469. ---------------------------------------------------------------------
  2470. Tables
  2471. ------
  2472. The AsciiDoc table syntax looks and behaves like other delimited block
  2473. types and supports standard <<X73,block configuration entries>>.
  2474. Formatting is easy to read and, just as importantly, easy to enter.
  2475. - Cells and columns can be formatted using built-in customizable styles.
  2476. - Horizontal and vertical cell alignment can be set on columns and
  2477. cell.
  2478. - Horizontal and vertical cell spanning is supported.
  2479. .Use tables sparingly
  2480. *********************************************************************
  2481. When technical users first start creating documents, tables (complete
  2482. with column spanning and table nesting) are often considered very
  2483. important. The reality is that tables are seldom used, even in
  2484. technical documentation.
  2485. Try this exercise: thumb through your library of technical books,
  2486. you'll be surprised just how seldom tables are actually used, even
  2487. less seldom are tables containing block elements (such as paragraphs
  2488. or lists) or spanned cells. This is no accident, like figures, tables
  2489. are outside the normal document flow -- tables are for consulting not
  2490. for reading.
  2491. Tables are designed for, and should normally only be used for,
  2492. displaying column oriented tabular data.
  2493. *********************************************************************
  2494. Example tables
  2495. ~~~~~~~~~~~~~~
  2496. .Simple table
  2497. [width="15%"]
  2498. |=======
  2499. |1 |2 |A
  2500. |3 |4 |B
  2501. |5 |6 |C
  2502. |=======
  2503. .AsciiDoc source
  2504. ---------------------------------------------------------------------
  2505. [width="15%"]
  2506. |=======
  2507. |1 |2 |A
  2508. |3 |4 |B
  2509. |5 |6 |C
  2510. |=======
  2511. ---------------------------------------------------------------------
  2512. .Columns formatted with strong, monospaced and emphasis styles
  2513. [width="50%",cols=">s,^m,e",frame="topbot",options="header,footer"]
  2514. |==========================
  2515. | 2+|Columns 2 and 3
  2516. |1 |Item 1 |Item 1
  2517. |2 |Item 2 |Item 2
  2518. |3 |Item 3 |Item 3
  2519. |4 |Item 4 |Item 4
  2520. |footer 1|footer 2|footer 3
  2521. |==========================
  2522. .AsciiDoc source
  2523. ---------------------------------------------------------------------
  2524. .An example table
  2525. [width="50%",cols=">s,^m,e",frame="topbot",options="header,footer"]
  2526. |==========================
  2527. | 2+|Columns 2 and 3
  2528. |1 |Item 1 |Item 1
  2529. |2 |Item 2 |Item 2
  2530. |3 |Item 3 |Item 3
  2531. |4 |Item 4 |Item 4
  2532. |footer 1|footer 2|footer 3
  2533. |==========================
  2534. ---------------------------------------------------------------------
  2535. .Horizontal and vertical source data
  2536. [width="80%",cols="3,^2,^2,10",options="header"]
  2537. |=========================================================
  2538. |Date |Duration |Avg HR |Notes
  2539. |22-Aug-08 |10:24 | 157 |
  2540. Worked out MSHR (max sustainable heart rate) by going hard
  2541. for this interval.
  2542. |22-Aug-08 |23:03 | 152 |
  2543. Back-to-back with previous interval.
  2544. |24-Aug-08 |40:00 | 145 |
  2545. Moderately hard interspersed with 3x 3min intervals (2min
  2546. hard + 1min really hard taking the HR up to 160).
  2547. |=========================================================
  2548. Short cells can be entered horizontally, longer cells vertically. The
  2549. default behavior is to strip leading and trailing blank lines within a
  2550. cell. These characteristics aid readability and data entry.
  2551. .AsciiDoc source
  2552. ---------------------------------------------------------------------
  2553. .Windtrainer workouts
  2554. [width="80%",cols="3,^2,^2,10",options="header"]
  2555. |=========================================================
  2556. |Date |Duration |Avg HR |Notes
  2557. |22-Aug-08 |10:24 | 157 |
  2558. Worked out MSHR (max sustainable heart rate) by going hard
  2559. for this interval.
  2560. |22-Aug-08 |23:03 | 152 |
  2561. Back-to-back with previous interval.
  2562. |24-Aug-08 |40:00 | 145 |
  2563. Moderately hard interspersed with 3x 3min intervals (2min
  2564. hard + 1min really hard taking the HR up to 160).
  2565. |=========================================================
  2566. ---------------------------------------------------------------------
  2567. .A table with externally sourced CSV data
  2568. [format="csv",cols="^1,4*2",options="header"]
  2569. |===================================================
  2570. ID,Customer Name,Contact Name,Customer Address,Phone
  2571. include::customers.csv[]
  2572. |===================================================
  2573. .AsciiDoc source
  2574. ---------------------------------------------------------------------
  2575. [format="csv",cols="^1,4*2",options="header"]
  2576. |===================================================
  2577. ID,Customer Name,Contact Name,Customer Address,Phone
  2578. \include::customers.csv[]
  2579. |===================================================
  2580. ---------------------------------------------------------------------
  2581. .Cell spans, alignments and styles
  2582. [cols="e,m,^,>s",width="25%"]
  2583. |============================
  2584. |1 >s|2 |3 |4
  2585. ^|5 2.2+^.^|6 .3+<.>m|7
  2586. ^|8
  2587. |9 2+>|10
  2588. |============================
  2589. .AsciiDoc source
  2590. ---------------------------------------------------------------------
  2591. [cols="e,m,^,>s",width="25%"]
  2592. |============================
  2593. |1 >s|2 |3 |4
  2594. ^|5 2.2+^.^|6 .3+<.>m|7
  2595. ^|8
  2596. |9 2+>|10
  2597. |============================
  2598. ---------------------------------------------------------------------
  2599. [[X68]]
  2600. Table input data formats
  2601. ~~~~~~~~~~~~~~~~~~~~~~~~
  2602. AsciiDoc table data can be 'psv', 'dsv' or 'csv' formatted. The
  2603. default table format is 'psv'.
  2604. AsciiDoc 'psv' ('Prefix Separated Values') and 'dsv' ('Delimiter
  2605. Separated Values') formats are cell oriented -- the table is treated
  2606. as a sequence of cells -- there are no explicit row separators.
  2607. - 'psv' prefixes each cell with a separator whereas 'dsv' delimits
  2608. cells with a separator.
  2609. - 'psv' and 'dsv' separators are Python regular expressions.
  2610. - The default 'psv' separator contains <<X84, cell specifier>> related
  2611. named regular expression groups.
  2612. - The default 'dsv' separator is `:|\n` (a colon or a new line
  2613. character).
  2614. - 'psv' and 'dsv' cell separators can be escaped by preceding them
  2615. with a backslash character.
  2616. Here are four 'psv' cells (the second item spans two columns; the
  2617. last contains an escaped separator):
  2618. |One 2+|Two and three |A \| separator character
  2619. 'csv' is the quasi-standard row oriented 'Comma Separated Values
  2620. (CSV)' format commonly used to import and export spreadsheet and
  2621. database data.
  2622. [[X69]]
  2623. Table attributes
  2624. ~~~~~~~~~~~~~~~~
  2625. Tables can be customized by the following attributes:
  2626. format::
  2627. 'psv' (default), 'dsv' or 'csv' (See <<X68, Table Data Formats>>).
  2628. separator::
  2629. The cell separator. A Python regular expression ('psv' and 'dsv'
  2630. formats) or a single character ('csv' format).
  2631. frame::
  2632. Defines the table border and can take the following values: 'topbot'
  2633. (top and bottom), 'all' (all sides), 'none' and 'sides' (left and
  2634. right sides). The default value is 'all'.
  2635. grid::
  2636. Defines which ruler lines are drawn between table rows and columns.
  2637. The 'grid' attribute value can be any of the following values: 'none',
  2638. 'cols', 'rows' and 'all'. The default value is 'all'.
  2639. align::
  2640. Use the 'align' attribute to horizontally align the table on the
  2641. page (works with HTML outputs only, has no effect on DocBook outputs).
  2642. The following values are valid: 'left', 'right', and 'center'.
  2643. float::
  2644. Use the 'float' attribute to float the table 'left' or 'right' on the
  2645. page (works with HTML outputs only, has no effect on DocBook outputs).
  2646. Floating only makes sense in conjunction with a table 'width'
  2647. attribute value of less than 100% (otherwise the table will take up
  2648. all the available space). 'float' and 'align' attributes are mutually
  2649. exclusive. Use the `unfloat::[]` block macro to stop floating.
  2650. halign::
  2651. Use the 'halign' attribute to horizontally align all cells in a table.
  2652. The following values are valid: 'left', 'right', and 'center'
  2653. (defaults to 'left'). Overridden by <<X70,Column specifiers>> and
  2654. <<X84,Cell specifiers>>.
  2655. valign::
  2656. Use the 'valign' attribute to vertically align all cells in a table.
  2657. The following values are valid: 'top', 'bottom', and 'middle'
  2658. (defaults to 'top'). Overridden by <<X70,Column specifiers>> and
  2659. <<X84,Cell specifiers>>.
  2660. options::
  2661. The 'options' attribute can contain comma separated values, for
  2662. example: 'header', 'footer'. By default header and footer rows are
  2663. omitted. See <<X74,attribute options>> for a complete list of
  2664. available table options.
  2665. cols::
  2666. The 'cols' attribute is a comma separated list of <<X70,column
  2667. specifiers>>. For example `cols="2<p,2*,4p,>"`.
  2668. - If 'cols' is present it must specify all columns.
  2669. - If the 'cols' attribute is not specified the number of columns is
  2670. calculated as the number of data items in the *first line* of the
  2671. table.
  2672. - The degenerate form for the 'cols' attribute is an integer
  2673. specifying the number of columns e.g. `cols=4`.
  2674. width::
  2675. The 'width' attribute is expressed as a percentage value
  2676. ('"1%"'...'"99%"'). The width specifies the table width relative to
  2677. the available width. HTML backends use this value to set the table
  2678. width attribute. It's a bit more complicated with DocBook, see the
  2679. <<X89,DocBook table widths>> sidebar.
  2680. filter::
  2681. The 'filter' attribute defines an external shell command that is
  2682. invoked for each cell. The built-in 'asciidoc' table style is
  2683. implemented using a filter.
  2684. [[X89]]
  2685. .DocBook table widths
  2686. **********************************************************************
  2687. The AsciiDoc docbook backend generates CALS tables. CALS tables do not
  2688. support a table width attribute -- table width can only be controlled
  2689. by specifying absolute column widths.
  2690. Specifying absolute column widths is not media independent because
  2691. different presentation media have different physical dimensions. To
  2692. get round this limitation both
  2693. http://www.sagehill.net/docbookxsl/Tables.html#TableWidth[DocBook XSL
  2694. Stylesheets] and
  2695. http://dblatex.sourceforge.net/doc/manual/ch03s05.html#sec-table-width[dblatex]
  2696. have implemented table width processing instructions for setting the
  2697. table width as a percentage of the available width. AsciiDoc emits
  2698. these processing instructions if the 'width' attribute is set along
  2699. with proportional column widths (the AsciiDoc docbook backend
  2700. 'pageunits' attribute defaults to '*').
  2701. To generate DocBook tables with absolute column widths set the
  2702. 'pageunits' attribute to a CALS absolute unit such as 'pt' and set the
  2703. 'pagewidth' attribute to match the width of the presentation media.
  2704. **********************************************************************
  2705. [[X70]]
  2706. Column Specifiers
  2707. ~~~~~~~~~~~~~~~~~
  2708. Column specifiers define how columns are rendered and appear in the
  2709. table <<X69,cols attribute>>. A column specifier consists of an
  2710. optional column multiplier followed by optional alignment, width and
  2711. style values and is formatted like:
  2712. [<multiplier>*][<align>][<width>][<style>]
  2713. - All components are optional. The multiplier must be first and the
  2714. style last. The order of `<align>` or `<width>` is not important.
  2715. - Column `<width>` can be either an integer proportional value (1...)
  2716. or a percentage (1%...100%). The default value is 1. To ensure
  2717. portability across different backends, there is no provision for
  2718. absolute column widths (not to be confused with output column width
  2719. <<X72,markup attributes>> which are available in both percentage and
  2720. absolute units).
  2721. - The '<align>' column alignment specifier is formatted like:
  2722. [<horizontal>][.<vertical>]
  2723. +
  2724. Where `<horizontal>` and `<vertical>` are one of the following
  2725. characters: `<`, `^` or `>` which represent 'left', 'center' and
  2726. 'right' horizontal alignment or 'top', 'middle' and 'bottom' vertical
  2727. alignment respectively.
  2728. - A `<multiplier>` can be used to specify repeated columns e.g.
  2729. `cols="4*<"` specifies four left-justified columns. The default
  2730. multiplier value is 1.
  2731. - The `<style>` name specifies a <<X71,table style>> to used to markup
  2732. column cells (you can use the full style names if you wish but the
  2733. first letter is normally sufficient).
  2734. - Column specific styles are not applied to header rows.
  2735. [[X84]]
  2736. Cell Specifiers
  2737. ~~~~~~~~~~~~~~~
  2738. Cell specifiers allow individual cells in 'psv' formatted tables to be
  2739. spanned, multiplied, aligned and styled. Cell specifiers prefix 'psv'
  2740. `|` delimiters and are formatted like:
  2741. [<span>*|+][<align>][<style>]
  2742. - '<span>' specifies horizontal and vertical cell spans ('+' operator) or
  2743. the number of times the cell is replicated ('*' operator). '<span>'
  2744. is formatted like:
  2745. [<colspan>][.<rowspan>]
  2746. +
  2747. Where `<colspan>` and `<rowspan>` are integers specifying the number of
  2748. columns and rows to span.
  2749. - `<align>` specifies horizontal and vertical cell alignment an is the
  2750. same as in <<X70,column specifiers>>.
  2751. - A `<style>` value is the first letter of <<X71,table style>> name.
  2752. For example, the following 'psv' formatted cell will span two columns
  2753. and the text will be centered and emphasized:
  2754. `2+^e| Cell text`
  2755. [[X71]]
  2756. Table styles
  2757. ~~~~~~~~~~~~
  2758. Table styles can be applied to the entire table (by setting the
  2759. 'style' attribute in the table's attribute list) or on a per column
  2760. basis (by specifying the style in the table's <<X69,cols attribute>>).
  2761. Table data can be formatted using the following predefined styles:
  2762. default::
  2763. The default style: AsciiDoc inline text formatting; blank lines are
  2764. treated as paragraph breaks.
  2765. emphasis::
  2766. Like default but all text is emphasised.
  2767. monospaced::
  2768. Like default but all text is in a monospaced font.
  2769. strong::
  2770. Like default but all text is bold.
  2771. header::
  2772. Apply the same style as the table header. Normally used to create a
  2773. vertical header in the first column.
  2774. asciidoc::
  2775. With this style table cells can contain any of the AsciiDoc elements
  2776. that are allowed inside document sections. This style runs asciidoc(1)
  2777. as a filter to process cell contents. See also <<X83,Docbook table
  2778. limitations>>.
  2779. literal::
  2780. No text formatting; monospaced font; all line breaks are retained
  2781. (the same as the AsciiDoc <<X65,LiteralBlock>> element).
  2782. verse::
  2783. All line breaks are retained (just like the AsciiDoc <<X94,verse
  2784. paragraph style>>).
  2785. [[X72]]
  2786. Markup attributes
  2787. ~~~~~~~~~~~~~~~~~
  2788. AsciiDoc makes a number of attributes available to table markup
  2789. templates and tags. Column specific attributes are available when
  2790. substituting the 'colspec' cell data tags.
  2791. pageunits::
  2792. DocBook backend only. Specifies table column absolute width units.
  2793. Defaults to '*'.
  2794. pagewidth::
  2795. DocBook backend only. The nominal output page width in 'pageunit'
  2796. units. Used to calculate CALS tables absolute column and table
  2797. widths. Defaults to '425'.
  2798. tableabswidth::
  2799. Integer value calculated from 'width' and 'pagewidth' attributes.
  2800. In 'pageunit' units.
  2801. tablepcwidth::
  2802. Table width expressed as a percentage of the available width. Integer
  2803. value (0..100).
  2804. colabswidth::
  2805. Integer value calculated from 'cols' column width, 'width' and
  2806. 'pagewidth' attributes. In 'pageunit' units.
  2807. colpcwidth::
  2808. Column width expressed as a percentage of the table width. Integer
  2809. value (0..100).
  2810. colcount::
  2811. Total number of table columns.
  2812. rowcount::
  2813. Total number of table rows.
  2814. halign::
  2815. Horizontal cell content alignment: 'left', 'right' or 'center'.
  2816. valign::
  2817. Vertical cell content alignment: 'top', 'bottom' or 'middle'.
  2818. colnumber, colstart::
  2819. The number of the leftmost column occupied by the cell (1...).
  2820. colend::
  2821. The number of the rightmost column occupied by the cell (1...).
  2822. colspan::
  2823. Number of columns the cell should span.
  2824. rowspan::
  2825. Number of rows the cell should span (1...).
  2826. morerows::
  2827. Number of additional rows the cell should span (0...).
  2828. Nested tables
  2829. ~~~~~~~~~~~~~
  2830. An alternative 'psv' separator character '!' can be used (instead of
  2831. '|') in nested tables. This allows a single level of table nesting.
  2832. Columns containing nested tables must use the 'asciidoc' style. An
  2833. example can be found in `./examples/website/newtables.txt`.
  2834. [[X83]]
  2835. DocBook table limitations
  2836. ~~~~~~~~~~~~~~~~~~~~~~~~~
  2837. Fully implementing tables is not trivial, some DocBook toolchains do
  2838. better than others. AsciiDoc HTML table outputs are rendered
  2839. correctly in all the popular browsers -- if your DocBook generated
  2840. tables don't look right compare them with the output generated by the
  2841. AsciiDoc 'xhtml11' backend or try a different DocBook toolchain. Here
  2842. is a list of things to be aware of:
  2843. - Although nested tables are not legal in DocBook 4 the FOP and
  2844. dblatex toolchains will process them correctly. If you use `a2x(1)`
  2845. you will need to include the `--no-xmllint` option to suppress
  2846. DocBook validation errors.
  2847. +
  2848. NOTE: In theory you can nest DocBook 4 tables one level using the
  2849. 'entrytbl' element, but not all toolchains process 'entrytbl'.
  2850. - DocBook only allows a subset of block elements inside table cells so
  2851. not all AsciiDoc elements produce valid DocBook inside table cells.
  2852. If you get validation errors running `a2x(1)` try the `--no-xmllint`
  2853. option, toolchains will often process nested block elements such as
  2854. sidebar blocks and floating titles correctly even though, strictly
  2855. speaking, they are not legal.
  2856. - Text formatting in cells using the 'monospaced' table style will
  2857. raise validation errors because the DocBook 'literal' element was
  2858. not designed to support formatted text (using the 'literal' element
  2859. is a kludge on the part of AsciiDoc as there is no easy way to set
  2860. the font style in DocBook.
  2861. - Cell alignments are ignored for 'verse', 'literal' or 'asciidoc'
  2862. table styles.
  2863. [[X1]]
  2864. Manpage Documents
  2865. -----------------
  2866. Sooner or later, if you program in a UNIX environment, you're going
  2867. to have to write a man page.
  2868. By observing a couple of additional conventions (detailed below) you
  2869. can write AsciiDoc files that will generate HTML and PDF man pages
  2870. plus the native manpage roff format. The easiest way to generate roff
  2871. manpages from AsciiDoc source is to use the a2x(1) command. The
  2872. following example generates a roff formatted manpage file called
  2873. `asciidoc.1` (a2x(1) uses asciidoc(1) to convert `asciidoc.1.txt` to
  2874. DocBook which it then converts to roff using DocBook XSL Stylesheets):
  2875. a2x --doctype manpage --format manpage asciidoc.1.txt
  2876. .Viewing and printing manpage files
  2877. **********************************************************************
  2878. Use the `man(1)` command to view the manpage file:
  2879. $ man -l asciidoc.1
  2880. To print a high quality man page to a postscript printer:
  2881. $ man -l -Tps asciidoc.1 | lpr
  2882. You could also create a PDF version of the man page by converting
  2883. PostScript to PDF using `ps2pdf(1)`:
  2884. $ man -l -Tps asciidoc.1 | ps2pdf - asciidoc.1.pdf
  2885. The `ps2pdf(1)` command is included in the Ghostscript distribution.
  2886. **********************************************************************
  2887. To find out more about man pages view the `man(7)` manpage
  2888. (`man 7 man` and `man man-pages` commands).
  2889. Document Header
  2890. ~~~~~~~~~~~~~~~
  2891. A manpage document Header is mandatory. The title line contains the
  2892. man page name followed immediately by the manual section number in
  2893. brackets, for example 'ASCIIDOC(1)'. The title name should not contain
  2894. white space and the manual section number is a single digit optionally
  2895. followed by a single character.
  2896. The NAME Section
  2897. ~~~~~~~~~~~~~~~~
  2898. The first manpage section is mandatory, must be titled 'NAME' and must
  2899. contain a single paragraph (usually a single line) consisting of a
  2900. list of one or more comma separated command name(s) separated from the
  2901. command purpose by a dash character. The dash must have at least one
  2902. white space character on either side. For example:
  2903. printf, fprintf, sprintf - print formatted output
  2904. The SYNOPSIS Section
  2905. ~~~~~~~~~~~~~~~~~~~~
  2906. The second manpage section is mandatory and must be titled 'SYNOPSIS'.
  2907. refmiscinfo attributes
  2908. ~~~~~~~~~~~~~~~~~~~~~~
  2909. In addition to the automatically created man page <<X60,intrinsic
  2910. attributes>> you can assign DocBook
  2911. http://www.docbook.org/tdg5/en/html/refmiscinfo.html[refmiscinfo]
  2912. element 'source', 'version' and 'manual' values using AsciiDoc
  2913. `{mansource}`, `{manversion}` and `{manmanual}` attributes
  2914. respectively. This example is from the AsciiDoc header of a man page
  2915. source file:
  2916. :man source: AsciiDoc
  2917. :man version: {revnumber}
  2918. :man manual: AsciiDoc Manual
  2919. [[X78]]
  2920. Mathematical Formulas
  2921. ---------------------
  2922. The 'asciimath' and 'latexmath' <<X77,passthrough macros>> along with
  2923. 'asciimath' and 'latexmath' <<X76,passthrough blocks>> provide a
  2924. (backend dependent) mechanism for rendering mathematical formulas. You
  2925. can use the following math markups:
  2926. NOTE: The 'latexmath' macro used to include 'LaTeX Math' in DocBook
  2927. outputs is not the same as the 'latexmath' macro used to include
  2928. 'LaTeX MathML' in XHTML outputs. 'LaTeX Math' applies to DocBook
  2929. outputs that are processed by <<X31,dblatex>> and is normally used to
  2930. generate PDF files. 'LaTeXMathML' is very much a subset of 'LaTeX
  2931. Math' and applies to XHTML documents.
  2932. LaTeX Math
  2933. ~~~~~~~~~~
  2934. ftp://ftp.ams.org/pub/tex/doc/amsmath/short-math-guide.pdf[LaTeX
  2935. math] can be included in documents that are processed by
  2936. <<X31,dblatex(1)>>. Example inline formula:
  2937. latexmath:[$C = \alpha + \beta Y^{\gamma} + \epsilon$]
  2938. For more examples see the {website}[AsciiDoc website] or the
  2939. distributed `doc/latexmath.txt` file.
  2940. ASCIIMathML
  2941. ~~~~~~~~~~~
  2942. /////////////////////////////////////////////////////////////////////
  2943. The older ASCIIMathML 1.47 version is used instead of version 2
  2944. because:
  2945. 1. Version 2 doesn't work when embedded.
  2946. 2. Version 2 is much larger.
  2947. /////////////////////////////////////////////////////////////////////
  2948. http://www1.chapman.edu/~jipsen/mathml/asciimath.html[ASCIIMathML]
  2949. formulas can be included in XHTML documents generated using the
  2950. 'xhtml11' and 'html5' backends. To enable ASCIIMathML support you must
  2951. define the 'asciimath' attribute, for example using the `-a asciimath`
  2952. command-line option. Example inline formula:
  2953. asciimath:[`x/x={(1,if x!=0),(text{undefined},if x=0):}`]
  2954. For more examples see the {website}[AsciiDoc website] or the
  2955. distributed `doc/asciimathml.txt` file.
  2956. LaTeXMathML
  2957. ~~~~~~~~~~~
  2958. /////////////////////////////////////////////////////////////////////
  2959. There is an http://math.etsu.edu/LaTeXMathML/[extended LaTeXMathML
  2960. version] by Jeff Knisley, in addition to a JavaScript file it requires
  2961. the inclusion of a CSS file.
  2962. /////////////////////////////////////////////////////////////////////
  2963. 'LaTeXMathML' allows LaTeX Math style formulas to be included in XHTML
  2964. documents generated using the AsciiDoc 'xhtml11' and 'html5' backends.
  2965. AsciiDoc uses the
  2966. http://www.maths.nottingham.ac.uk/personal/drw/lm.html[original
  2967. LaTeXMathML] by Douglas Woodall. 'LaTeXMathML' is derived from
  2968. ASCIIMathML and is for users who are more familiar with or prefer
  2969. using LaTeX math formulas (it recognizes a subset of LaTeX Math, the
  2970. differences are documented on the 'LaTeXMathML' web page). To enable
  2971. LaTeXMathML support you must define the 'latexmath' attribute, for
  2972. example using the `-a latexmath` command-line option. Example inline
  2973. formula:
  2974. latexmath:[$\sum_{n=1}^\infty \frac{1}{2^n}$]
  2975. For more examples see the {website}[AsciiDoc website] or the
  2976. distributed `doc/latexmathml.txt` file.
  2977. MathML
  2978. ~~~~~~
  2979. http://www.w3.org/Math/[MathML] is a low level XML markup for
  2980. mathematics. AsciiDoc has no macros for MathML but users familiar with
  2981. this markup could use passthrough macros and passthrough blocks to
  2982. include MathML in output documents.
  2983. [[X7]]
  2984. Configuration Files
  2985. -------------------
  2986. AsciiDoc source file syntax and output file markup is largely
  2987. controlled by a set of cascading, text based, configuration files. At
  2988. runtime The AsciiDoc default configuration files are combined with
  2989. optional user and document specific configuration files.
  2990. Configuration File Format
  2991. ~~~~~~~~~~~~~~~~~~~~~~~~~
  2992. Configuration files contain named sections. Each section begins with a
  2993. section name in square brackets []. The section body consists of the
  2994. lines of text between adjacent section headings.
  2995. - Section names consist of one or more alphanumeric, underscore or
  2996. dash characters and cannot begin or end with a dash.
  2997. - Lines starting with a '#' character are treated as comments and
  2998. ignored.
  2999. - If the section name is prefixed with a '+' character then the
  3000. section contents is appended to the contents of an already existing
  3001. same-named section.
  3002. - Otherwise same-named sections and section entries override
  3003. previously loaded sections and section entries (this is sometimes
  3004. referred to as 'cascading'). Consequently, downstream configuration
  3005. files need only contain those sections and section entries that need
  3006. to be overridden.
  3007. TIP: When creating custom configuration files you only need to include
  3008. the sections and entries that differ from the default configuration.
  3009. TIP: The best way to learn about configuration files is to read the
  3010. default configuration files in the AsciiDoc distribution in
  3011. conjunction with asciidoc(1) output files. You can view configuration
  3012. file load sequence by turning on the asciidoc(1) `-v` (`--verbose`)
  3013. command-line option.
  3014. AsciiDoc reserves the following section names for specific purposes:
  3015. miscellaneous::
  3016. Configuration options that don't belong anywhere else.
  3017. attributes::
  3018. Attribute name/value entries.
  3019. specialcharacters::
  3020. Special characters reserved by the backend markup.
  3021. tags::
  3022. Backend markup tags.
  3023. quotes::
  3024. Definitions for quoted inline character formatting.
  3025. specialwords::
  3026. Lists of words and phrases singled out for special markup.
  3027. replacements, replacements2, replacements3::
  3028. Find and replace substitution definitions.
  3029. specialsections::
  3030. Used to single out special section names for specific markup.
  3031. macros::
  3032. Macro syntax definitions.
  3033. titles::
  3034. Heading, section and block title definitions.
  3035. paradef-*::
  3036. Paragraph element definitions.
  3037. blockdef-*::
  3038. DelimitedBlock element definitions.
  3039. listdef-*::
  3040. List element definitions.
  3041. listtags-*::
  3042. List element tag definitions.
  3043. tabledef-*::
  3044. Table element definitions.
  3045. tabletags-*::
  3046. Table element tag definitions.
  3047. Each line of text in these sections is a 'section entry'. Section
  3048. entries share the following syntax:
  3049. name=value::
  3050. The entry value is set to value.
  3051. name=::
  3052. The entry value is set to a zero length string.
  3053. name!::
  3054. The entry is undefined (deleted from the configuration). This
  3055. syntax only applies to 'attributes' and 'miscellaneous'
  3056. sections.
  3057. .Section entry behavior
  3058. - All equals characters inside the `name` must be escaped with a
  3059. backslash character.
  3060. - `name` and `value` are stripped of leading and trailing white space.
  3061. - Attribute names, tag entry names and markup template section names
  3062. consist of one or more alphanumeric, underscore or dash characters.
  3063. Names should not begin or end with a dash.
  3064. - A blank configuration file section (one without any entries) deletes
  3065. any preceding section with the same name (applies to non-markup
  3066. template sections).
  3067. Miscellaneous section
  3068. ~~~~~~~~~~~~~~~~~~~~~
  3069. The optional `[miscellaneous]` section specifies the following
  3070. `name=value` options:
  3071. newline::
  3072. Output file line termination characters. Can include any
  3073. valid Python string escape sequences. The default value is
  3074. `\r\n` (carriage return, line feed). Should not be quoted or
  3075. contain explicit spaces (use `\x20` instead). For example:
  3076. $ asciidoc -a 'newline=\n' -b docbook mydoc.txt
  3077. outfilesuffix::
  3078. The default extension for the output file, for example
  3079. `outfilesuffix=.html`. Defaults to backend name.
  3080. tabsize::
  3081. The number of spaces to expand tab characters, for example
  3082. `tabsize=4`. Defaults to 8. A 'tabsize' of zero suppresses tab
  3083. expansion (useful when piping included files through block
  3084. filters). Included files can override this option using the
  3085. 'tabsize' attribute.
  3086. pagewidth, pageunits::
  3087. These global table related options are documented in the
  3088. <<X4,Table Configuration File Definitions>> sub-section.
  3089. NOTE: `[miscellaneous]` configuration file entries can be set using
  3090. the asciidoc(1) `-a` (`--attribute`) command-line option.
  3091. Titles section
  3092. ~~~~~~~~~~~~~~
  3093. sectiontitle::
  3094. Two line section title pattern. The entry value is a Python
  3095. regular expression containing the named group 'title'.
  3096. underlines::
  3097. A comma separated list of document and section title underline
  3098. character pairs starting with the section level 0 and ending
  3099. with section level 4 underline. The default setting is:
  3100. underlines="==","--","~~","^^","++"
  3101. sect0...sect4::
  3102. One line section title patterns. The entry value is a Python
  3103. regular expression containing the named group 'title'.
  3104. blocktitle::
  3105. <<X42,BlockTitle element>> pattern. The entry value is a
  3106. Python regular expression containing the named group 'title'.
  3107. subs::
  3108. A comma separated list of substitutions that are performed on
  3109. the document header and section titles. Defaults to 'normal'
  3110. substitution.
  3111. Tags section
  3112. ~~~~~~~~~~~~
  3113. The `[tags]` section contains backend tag definitions (one per
  3114. line). Tags are used to translate AsciiDoc elements to backend
  3115. markup.
  3116. An AsciiDoc tag definition is formatted like
  3117. `<tagname>=<starttag>|<endtag>`. For example:
  3118. emphasis=<em>|</em>
  3119. In this example asciidoc(1) replaces the | character with the
  3120. emphasized text from the AsciiDoc input file and writes the result to
  3121. the output file.
  3122. Use the `{brvbar}` attribute reference if you need to include a | pipe
  3123. character inside tag text.
  3124. Attributes section
  3125. ~~~~~~~~~~~~~~~~~~
  3126. The optional `[attributes]` section contains predefined attributes.
  3127. If the attribute value requires leading or trailing spaces then the
  3128. text text should be enclosed in quotation mark (") characters.
  3129. To delete a attribute insert a `name!` entry in a downstream
  3130. configuration file or use the asciidoc(1) `--attribute name!`
  3131. command-line option (an attribute name suffixed with a `!` character
  3132. deletes the attribute)
  3133. Special Characters section
  3134. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  3135. The `[specialcharacters]` section specifies how to escape characters
  3136. reserved by the backend markup. Each translation is specified on a
  3137. single line formatted like:
  3138. <special_character>=<translated_characters>
  3139. Special characters are normally confined to those that resolve
  3140. markup ambiguity (in the case of HTML and XML markups the ampersand,
  3141. less than and greater than characters). The following example causes
  3142. all occurrences of the `<` character to be replaced by `&lt;`.
  3143. <=&lt;
  3144. Quoted Text section
  3145. ~~~~~~~~~~~~~~~~~~~
  3146. Quoting is used primarily for text formatting. The `[quotes]` section
  3147. defines AsciiDoc quoting characters and their corresponding backend
  3148. markup tags. Each section entry value is the name of a of a `[tags]`
  3149. section entry. The entry name is the character (or characters) that
  3150. quote the text. The following examples are taken from AsciiDoc
  3151. configuration files:
  3152. [quotes]
  3153. _=emphasis
  3154. [tags]
  3155. emphasis=<em>|</em>
  3156. You can specify the left and right quote strings separately by
  3157. separating them with a | character, for example:
  3158. ``|''=quoted
  3159. Omitting the tag will disable quoting, for example, if you don't want
  3160. superscripts or subscripts put the following in a custom configuration
  3161. file or edit the global `asciidoc.conf` configuration file:
  3162. [quotes]
  3163. ^=
  3164. ~=
  3165. <<X52,Unconstrained quotes>> are differentiated from constrained
  3166. quotes by prefixing the tag name with a hash character, for example:
  3167. __=#emphasis
  3168. .Quoted text behavior
  3169. - Quote characters must be non-alphanumeric.
  3170. - To minimize quoting ambiguity try not to use the same quote
  3171. characters in different quote types.
  3172. Special Words section
  3173. ~~~~~~~~~~~~~~~~~~~~~
  3174. The `[specialwords]` section is used to single out words and phrases
  3175. that you want to consistently format in some way throughout your
  3176. document without having to repeatedly specify the markup. The name of
  3177. each entry corresponds to a markup template section and the entry
  3178. value consists of a list of words and phrases to be marked up. For
  3179. example:
  3180. [specialwords]
  3181. strongwords=NOTE IMPORTANT
  3182. [strongwords]
  3183. <strong>{words}</strong>
  3184. The examples specifies that any occurrence of `NOTE` or `IMPORTANT`
  3185. should appear in a bold font.
  3186. Words and word phrases are treated as Python regular expressions: for
  3187. example, the word `^NOTE` would only match `NOTE` if appeared at
  3188. the start of a line.
  3189. AsciiDoc comes with three built-in Special Word types:
  3190. 'emphasizedwords', 'monospacedwords' and 'strongwords', each has a
  3191. corresponding (backend specific) markup template section. Edit the
  3192. configuration files to customize existing Special Words and to add new
  3193. ones.
  3194. .Special word behavior
  3195. - Word list entries must be separated by space characters.
  3196. - Word list entries with embedded spaces should be enclosed in quotation (")
  3197. characters.
  3198. - A `[specialwords]` section entry of the form
  3199. +name=word1{nbsp}[word2...]+ adds words to existing `name` entries.
  3200. - A `[specialwords]` section entry of the form `name` undefines
  3201. (deletes) all existing `name` words.
  3202. - Since word list entries are processed as Python regular expressions
  3203. you need to be careful to escape regular expression special
  3204. characters.
  3205. - By default Special Words are substituted before Inline Macros, this
  3206. may lead to undesirable consequences. For example the special word
  3207. `foobar` would be expanded inside the macro call
  3208. `http://www.foobar.com[]`. A possible solution is to emphasize
  3209. whole words only by defining the word using regular expression
  3210. characters, for example `\bfoobar\b`.
  3211. - If the first matched character of a special word is a backslash then
  3212. the remaining characters are output without markup i.e. the
  3213. backslash can be used to escape special word markup. For example
  3214. the special word `\\?\b[Tt]en\b` will mark up the words `Ten` and
  3215. `ten` only if they are not preceded by a backslash.
  3216. [[X10]]
  3217. Replacements section
  3218. ~~~~~~~~~~~~~~~~~~~~
  3219. `[replacements]`, `[replacements2]` and `[replacements3]`
  3220. configuration file entries specify find and replace text and are
  3221. formatted like:
  3222. <find_pattern>=<replacement_text>
  3223. The find text can be a Python regular expression; the replace text can
  3224. contain Python regular expression group references.
  3225. Use Replacement shortcuts for often used macro references, for
  3226. example (the second replacement allows us to backslash escape the
  3227. macro name):
  3228. NEW!=image:./images/smallnew.png[New!]
  3229. \\NEW!=NEW!
  3230. The only difference between the three replacement types is how they
  3231. are applied. By default 'replacements' and 'replacement2' are applied
  3232. in <<X102,normal>> substitution contexts whereas 'replacements3' needs
  3233. to be configured explicitly and should only be used in backend
  3234. configuration files.
  3235. .Replacement behavior
  3236. - The built-in replacements can be escaped with a backslash.
  3237. - If the find or replace text has leading or trailing spaces then the
  3238. text should be enclosed in quotation (") characters.
  3239. - Since the find text is processed as a regular expression you need to
  3240. be careful to escape regular expression special characters.
  3241. - Replacements are performed in the same order they appear in the
  3242. configuration file replacements section.
  3243. Markup Template Sections
  3244. ~~~~~~~~~~~~~~~~~~~~~~~~
  3245. Markup template sections supply backend markup for translating
  3246. AsciiDoc elements. Since the text is normally backend dependent
  3247. you'll find these sections in the backend specific configuration
  3248. files. Template sections differ from other sections in that they
  3249. contain a single block of text instead of per line 'name=value'
  3250. entries. A markup template section body can contain:
  3251. - Attribute references
  3252. - System macro calls.
  3253. - A document content placeholder
  3254. The document content placeholder is a single | character and is
  3255. replaced by text from the source element. Use the `{brvbar}`
  3256. attribute reference if you need a literal | character in the template.
  3257. [[X27]]
  3258. Configuration file names, precedence and locations
  3259. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3260. Configuration files have a `.conf` file name extension; they are
  3261. loaded from the following locations:
  3262. 1. The directory containing the asciidoc executable.
  3263. 2. If there is no `asciidoc.conf` file in the directory containing the
  3264. asciidoc executable then load from the global configuration
  3265. directory (normally `/etc/asciidoc` or `/usr/local/etc/asciidoc`)
  3266. i.e. the global configuration files directory is skipped if
  3267. AsciiDoc configuration files are installed in the same directory as
  3268. the asciidoc executable. This allows both a system wide copy and
  3269. multiple local copies of AsciiDoc to coexist on the same host PC.
  3270. 3. The user's `$HOME/.asciidoc` directory (if it exists).
  3271. 4. The directory containing the AsciiDoc source file.
  3272. 5. Explicit configuration files specified using:
  3273. - The `conf-files` attribute (one or more file names separated by a
  3274. `|` character). These files are loaded in the order they are
  3275. specified and prior to files specified using the `--conf-file`
  3276. command-line option.
  3277. - The asciidoc(1) `--conf-file`) command-line option. The
  3278. `--conf-file` option can be specified multiple times, in which
  3279. case configuration files will be processed in the same order they
  3280. appear on the command-line.
  3281. 6. <<X100,Backend plugin>> configuration files are loaded from
  3282. subdirectories named like `backends/<backend>` in locations 1, 2
  3283. and 3.
  3284. 7. <<X59,Filter>> configuration files are loaded from subdirectories
  3285. named like `filters/<filter>` in locations 1, 2 and 3.
  3286. Configuration files from the above locations are loaded in the
  3287. following order:
  3288. - The `[attributes]` section only from:
  3289. * `asciidoc.conf` in location 3
  3290. * Files from location 5.
  3291. +
  3292. This first pass makes locally set attributes available in the global
  3293. `asciidoc.conf` file.
  3294. - `asciidoc.conf` from locations 1, 2, 3.
  3295. - 'attributes', 'titles' and 'specialcharacters' sections from the
  3296. `asciidoc.conf` in location 4.
  3297. - The document header is parsed at this point and we can assume the
  3298. 'backend' and 'doctype' have now been defined.
  3299. - Backend plugin `<backend>.conf` and `<backend>-<doctype>.conf` files
  3300. from locations 6. If a backend plugin is not found then try
  3301. locations 1, 2 and 3 for `<backend>.conf` and
  3302. `<backend>-<doctype>.conf` backend configuration files.
  3303. - Filter conf files from locations 7.
  3304. - `lang-<lang>.conf` from locations 1, 2, 3.
  3305. - `asciidoc.conf` from location 4.
  3306. - `<backend>.conf` and `<backend>-<doctype>.conf` from location 4.
  3307. - Filter conf files from location 4.
  3308. - `<docfile>.conf` and `<docfile>-<backend>.conf` from location 4.
  3309. - Configuration files from location 5.
  3310. Where:
  3311. - `<backend>` and `<doctype>` are values specified by the asciidoc(1)
  3312. `-b` (`--backend`) and `-d` (`--doctype`) command-line options.
  3313. - `<infile>` is the path name of the AsciiDoc input file without the
  3314. file name extension.
  3315. - `<lang>` is a two letter country code set by the the AsciiDoc 'lang'
  3316. attribute.
  3317. [NOTE]
  3318. =====================================================================
  3319. The backend and language global configuration files are loaded *after*
  3320. the header has been parsed. This means that you can set most
  3321. attributes in the document header. Here's an example header:
  3322. Life's Mysteries
  3323. ================
  3324. :author: Hu Nose
  3325. :doctype: book
  3326. :toc:
  3327. :icons:
  3328. :data-uri:
  3329. :lang: en
  3330. :encoding: iso-8859-1
  3331. Attributes set in the document header take precedence over
  3332. configuration file attributes.
  3333. =====================================================================
  3334. TIP: Use the asciidoc(1) `-v` (`--verbose`) command-line option to see
  3335. which configuration files are loaded and the order in which they are
  3336. loaded.
  3337. Document Attributes
  3338. -------------------
  3339. A document attribute is comprised of a 'name' and a textual 'value'
  3340. and is used for textual substitution in AsciiDoc documents and
  3341. configuration files. An attribute reference (an attribute name
  3342. enclosed in braces) is replaced by the corresponding attribute
  3343. value. Attribute names are case insensitive and can only contain
  3344. alphanumeric, dash and underscore characters.
  3345. There are four sources of document attributes (from highest to lowest
  3346. precedence):
  3347. - Command-line attributes.
  3348. - AttributeEntry, AttributeList, Macro and BlockId elements.
  3349. - Configuration file `[attributes]` sections.
  3350. - Intrinsic attributes.
  3351. Within each of these divisions the last processed entry takes
  3352. precedence.
  3353. NOTE: If an attribute is not defined then the line containing the
  3354. attribute reference is dropped. This property is used extensively in
  3355. AsciiDoc configuration files to facilitate conditional markup
  3356. generation.
  3357. [[X18]]
  3358. Attribute Entries
  3359. -----------------
  3360. The `AttributeEntry` block element allows document attributes to be
  3361. assigned within an AsciiDoc document. Attribute entries are added to
  3362. the global document attributes dictionary. The attribute name/value
  3363. syntax is a single line like:
  3364. :<name>: <value>
  3365. For example:
  3366. :Author Initials: JB
  3367. This will set an attribute reference `{authorinitials}` to the value
  3368. 'JB' in the current document.
  3369. To delete (undefine) an attribute use the following syntax:
  3370. :<name>!:
  3371. .AttributeEntry behavior
  3372. - The attribute entry line begins with colon -- no white space allowed
  3373. in left margin.
  3374. - AsciiDoc converts the `<name>` to a legal attribute name (lower
  3375. case, alphanumeric, dash and underscore characters only -- all other
  3376. characters deleted). This allows more human friendly text to be
  3377. used.
  3378. - Leading and trailing white space is stripped from the `<value>`.
  3379. - Lines ending in a space followed by a plus character are continued
  3380. to the next line, for example:
  3381. :description: AsciiDoc is a text document format for writing notes, +
  3382. documentation, articles, books, slideshows, web pages +
  3383. and man pages.
  3384. - If the `<value>` is blank then the corresponding attribute value is
  3385. set to an empty string.
  3386. - Attribute references contained in the entry `<value>` will be
  3387. expanded.
  3388. - By default AttributeEntry values are substituted for
  3389. `specialcharacters` and `attributes` (see above), if you want to
  3390. change or disable AttributeEntry substitution use the <<X77,pass:[]
  3391. inline macro>> syntax.
  3392. - Attribute entries in the document Header are available for header
  3393. markup template substitution.
  3394. - Attribute elements override configuration file and intrinsic
  3395. attributes but do not override command-line attributes.
  3396. Here are some more attribute entry examples:
  3397. ---------------------------------------------------------------------
  3398. AsciiDoc User Manual
  3399. ====================
  3400. :author: Stuart Rackham
  3401. :email: srackham@gmail.com
  3402. :revdate: April 23, 2004
  3403. :revnumber: 5.1.1
  3404. ---------------------------------------------------------------------
  3405. Which creates these attributes:
  3406. {author}, {firstname}, {lastname}, {authorinitials}, {email},
  3407. {revdate}, {revnumber}
  3408. The previous example is equivalent to this <<X95,document header>>:
  3409. ---------------------------------------------------------------------
  3410. AsciiDoc User Manual
  3411. ====================
  3412. Stuart Rackham <srackham@gmail.com>
  3413. 5.1.1, April 23, 2004
  3414. ---------------------------------------------------------------------
  3415. Setting configuration entries
  3416. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3417. A variant of the Attribute Entry syntax allows configuration file
  3418. section entries and markup template sections to be set from within an
  3419. AsciiDoc document:
  3420. :<section_name>.[<entry_name>]: <entry_value>
  3421. Where `<section_name>` is the configuration section name,
  3422. `<entry_name>` is the name of the entry and `<entry_value>` is the
  3423. optional entry value. This example sets the default labeled list
  3424. style to 'horizontal':
  3425. :listdef-labeled.style: horizontal
  3426. It is exactly equivalent to a configuration file containing:
  3427. [listdef-labeled]
  3428. style=horizontal
  3429. - If the `<entry_name>` is omitted then the entire section is
  3430. substituted with the `<entry_value>`. This feature should only be
  3431. used to set markup template sections. The following example sets the
  3432. 'xref2' inline macro markup template:
  3433. :xref2-inlinemacro.: <a href="#{1}">{2?{2}}</a>
  3434. - No substitution is performed on configuration file attribute entries
  3435. and they cannot be undefined.
  3436. - This feature can only be used in attribute entries -- configuration
  3437. attributes cannot be set using the asciidoc(1) command `--attribute`
  3438. option.
  3439. [[X62]]
  3440. .Attribute entries promote clarity and eliminate repetition
  3441. *********************************************************************
  3442. URLs and file names in AsciiDoc macros are often quite long -- they
  3443. break paragraph flow and readability suffers. The problem is
  3444. compounded by redundancy if the same name is used repeatedly.
  3445. Attribute entries can be used to make your documents easier to read
  3446. and write, here are some examples:
  3447. :1: http://freshmeat.net/projects/asciidoc/
  3448. :homepage: http://methods.co.nz/asciidoc/[AsciiDoc home page]
  3449. :new: image:./images/smallnew.png[]
  3450. :footnote1: footnote:[A meaningless latin term]
  3451. Using previously defined attributes: See the {1}[Freshmeat summary]
  3452. or the {homepage} for something new {new}. Lorem ispum {footnote1}.
  3453. .Note
  3454. - The attribute entry definition must precede it's usage.
  3455. - You are not limited to URLs or file names, entire macro calls or
  3456. arbitrary lines of text can be abbreviated.
  3457. - Shared attributes entries could be grouped into a separate file and
  3458. <<X63,included>> in multiple documents.
  3459. *********************************************************************
  3460. [[X21]]
  3461. Attribute Lists
  3462. ---------------
  3463. - An attribute list is a comma separated list of attribute values.
  3464. - The entire list is enclosed in square brackets.
  3465. - Attribute lists are used to pass parameters to macros, blocks (using
  3466. the <<X79,AttributeList element>>) and inline quotes.
  3467. The list consists of zero or more positional attribute values followed
  3468. by zero or more named attribute values. Here are three examples: a
  3469. single unquoted positional attribute; three unquoted positional
  3470. attribute values; one positional attribute followed by two named
  3471. attributes; the unquoted attribute value in the final example contains
  3472. comma (`&#44;`) and double-quote (`&#34;`) character entities:
  3473. [Hello]
  3474. [quote, Bertrand Russell, The World of Mathematics (1956)]
  3475. ["22 times", backcolor="#0e0e0e", options="noborders,wide"]
  3476. [A footnote&#44; &#34;with an image&#34; image:smallnew.png[]]
  3477. .Attribute list behavior
  3478. - If one or more attribute values contains a comma the all string
  3479. values must be quoted (enclosed in double quotation mark
  3480. characters).
  3481. - If the list contains any named or quoted attributes then all string
  3482. attribute values must be quoted.
  3483. - To include a double quotation mark (") character in a quoted
  3484. attribute value the the quotation mark must be escaped with a
  3485. backslash.
  3486. - List attributes take precedence over existing attributes.
  3487. - List attributes can only be referenced in configuration file markup
  3488. templates and tags, they are not available elsewhere in the
  3489. document.
  3490. - Setting a named attribute to `None` undefines the attribute.
  3491. - Positional attributes are referred to as `{1}`,`{2}`,`{3}`,...
  3492. - Attribute `{0}` refers to the entire list (excluding the enclosing
  3493. square brackets).
  3494. - Named attribute names cannot contain dash characters.
  3495. [[X75]]
  3496. Options attribute
  3497. ~~~~~~~~~~~~~~~~~
  3498. If the attribute list contains an attribute named `options` it is
  3499. processed as a comma separated list of option names:
  3500. - Each name generates an attribute named like `<option>-option` (where
  3501. `<option>` is the option name) with an empty string value. For
  3502. example `[options="opt1,opt2,opt3"]` is equivalent to setting the
  3503. following three attributes
  3504. `[opt1-option="",opt2-option="",opt2-option=""]`.
  3505. - If you define a an option attribute globally (for example with an
  3506. <<X18,attribute entry>>) then it will apply to all elements in the
  3507. document.
  3508. - AsciiDoc implements a number of predefined options which are listed
  3509. in the <<X74,Attribute Options appendix>>.
  3510. Macro Attribute lists
  3511. ~~~~~~~~~~~~~~~~~~~~~
  3512. Macros calls are suffixed with an attribute list. The list may be
  3513. empty but it cannot be omitted. List entries are used to pass
  3514. attribute values to macro markup templates.
  3515. Attribute References
  3516. --------------------
  3517. An attribute reference is an attribute name (possibly followed by an
  3518. additional parameters) enclosed in curly braces. When an attribute
  3519. reference is encountered it is evaluated and replaced by its
  3520. corresponding text value. If the attribute is undefined the line
  3521. containing the attribute is dropped.
  3522. There are three types of attribute reference: 'Simple', 'Conditional'
  3523. and 'System'.
  3524. .Attribute reference evaluation
  3525. - You can suppress attribute reference expansion by placing a
  3526. backslash character immediately in front of the opening brace
  3527. character.
  3528. - By default attribute references are not expanded in
  3529. 'LiteralParagraphs', 'ListingBlocks' or 'LiteralBlocks'.
  3530. - Attribute substitution proceeds line by line in reverse line order.
  3531. - Attribute reference evaluation is performed in the following order:
  3532. 'Simple' then 'Conditional' and finally 'System'.
  3533. Simple Attributes References
  3534. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3535. Simple attribute references take the form `{<name>}`. If the
  3536. attribute name is defined its text value is substituted otherwise the
  3537. line containing the reference is dropped from the output.
  3538. Conditional Attribute References
  3539. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3540. Additional parameters are used in conjunction with attribute names to
  3541. calculate a substitution value. Conditional attribute references take
  3542. the following forms:
  3543. `{<names>=<value>}`::
  3544. `<value>` is substituted if the attribute `<names>` is
  3545. undefined otherwise its value is substituted. `<value>` can
  3546. contain simple attribute references.
  3547. `{<names>?<value>}`::
  3548. `<value>` is substituted if the attribute `<names>` is defined
  3549. otherwise an empty string is substituted. `<value>` can
  3550. contain simple attribute references.
  3551. `{<names>!<value>}`::
  3552. `<value>` is substituted if the attribute `<names>` is
  3553. undefined otherwise an empty string is substituted. `<value>`
  3554. can contain simple attribute references.
  3555. `{<names>#<value>}`::
  3556. `<value>` is substituted if the attribute `<names>` is defined
  3557. otherwise the undefined attribute entry causes the containing
  3558. line to be dropped. `<value>` can contain simple attribute
  3559. references.
  3560. `{<names>%<value>}`::
  3561. `<value>` is substituted if the attribute `<names>` is not
  3562. defined otherwise the containing line is dropped. `<value>`
  3563. can contain simple attribute references.
  3564. `{<names>@<regexp>:<value1>[:<value2>]}`::
  3565. `<value1>` is substituted if the value of attribute `<names>`
  3566. matches the regular expression `<regexp>` otherwise `<value2>`
  3567. is substituted. If attribute `<names>` is not defined the
  3568. containing line is dropped. If `<value2>` is omitted an empty
  3569. string is assumed. The values and the regular expression can
  3570. contain simple attribute references. To embed colons in the
  3571. values or the regular expression escape them with backslashes.
  3572. `{<names>$<regexp>:<value1>[:<value2>]}`::
  3573. Same behavior as the previous ternary attribute except for
  3574. the following cases:
  3575. `{<names>$<regexp>:<value>}`;;
  3576. Substitutes `<value>` if `<names>` matches `<regexp>`
  3577. otherwise the result is undefined and the containing
  3578. line is dropped.
  3579. `{<names>$<regexp>::<value>}`;;
  3580. Substitutes `<value>` if `<names>` does not match
  3581. `<regexp>` otherwise the result is undefined and the
  3582. containing line is dropped.
  3583. The attribute `<names>` parameter normally consists of a single
  3584. attribute name but it can be any one of the following:
  3585. - A single attribute name which evaluates to the attributes value.
  3586. - Multiple ',' separated attribute names which evaluates to an empty
  3587. string if one or more of the attributes is defined, otherwise it's
  3588. value is undefined.
  3589. - Multiple '+' separated attribute names which evaluates to an empty
  3590. string if all of the attributes are defined, otherwise it's value is
  3591. undefined.
  3592. Conditional attributes with single attribute names are evaluated first
  3593. so they can be used inside the multi-attribute conditional `<value>`.
  3594. Conditional attribute examples
  3595. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3596. Conditional attributes are mainly used in AsciiDoc configuration
  3597. files -- see the distribution `.conf` files for examples.
  3598. Attribute equality test::
  3599. If `{backend}` is 'docbook45' or 'xhtml11' the example evaluates to
  3600. ``DocBook 4.5 or XHTML 1.1 backend'' otherwise it evaluates to
  3601. ``some other backend'':
  3602. {backend@docbook45|xhtml11:DocBook 4.5 or XHTML 1.1 backend:some other backend}
  3603. Attribute value map::
  3604. This example maps the `frame` attribute values [`topbot`, `all`,
  3605. `none`, `sides`] to [`hsides`, `border`, `void`, `vsides`]:
  3606. {frame@topbot:hsides}{frame@all:border}{frame@none:void}{frame@sides:vsides}
  3607. [[X24]]
  3608. System Attribute References
  3609. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3610. System attribute references generate the attribute text value by
  3611. executing a predefined action that is parametrized by one or more
  3612. arguments. The syntax is `{<action>:<arguments>}`.
  3613. `{counter:<attrname>[:<seed>]}`::
  3614. Increments the document attribute (if the attribute is
  3615. undefined it is set to `1`). Returns the new attribute value.
  3616. - Counters generate global (document wide) attributes.
  3617. - The optional `<seed>` specifies the counter's initial value;
  3618. it can be a number or a single letter; defaults to '1'.
  3619. - `<seed>` can contain simple and conditional attribute
  3620. references.
  3621. - The 'counter' system attribute will not be executed if the
  3622. containing line is dropped by the prior evaluation of an
  3623. undefined attribute.
  3624. `{counter2:<attrname>[:<seed>]}`::
  3625. Same as `counter` except the it always returns a blank string.
  3626. `{eval:<expression>}`::
  3627. Substitutes the result of the Python `<expression>`.
  3628. - If `<expression>` evaluates to `None` or `False` the
  3629. reference is deemed undefined and the line containing the
  3630. reference is dropped from the output.
  3631. - If the expression evaluates to `True` the attribute
  3632. evaluates to an empty string.
  3633. - `<expression>` can contain simple and conditional attribute
  3634. references.
  3635. - The 'eval' system attribute can be nested inside other
  3636. system attributes.
  3637. `{eval3:<command>}`::
  3638. Passthrough version of `{eval:<expression>}` -- the generated
  3639. output is written directly to the output without any further
  3640. substitutions.
  3641. `{include:<filename>}`::
  3642. Substitutes contents of the file named `<filename>`.
  3643. - The included file is read at the time of attribute
  3644. substitution.
  3645. - If the file does not exist a warning is emitted and the line
  3646. containing the reference is dropped from the output file.
  3647. - Tabs are expanded based on the current 'tabsize' attribute
  3648. value.
  3649. `{set:<attrname>[!][:<value>]}`::
  3650. Sets or unsets document attribute. Normally only used in
  3651. configuration file markup templates (use
  3652. <<X18,AttributeEntries>> in AsciiDoc documents).
  3653. - If the attribute name is followed by an exclamation mark
  3654. the attribute becomes undefined.
  3655. - If `<value>` is omitted the attribute is set to a blank
  3656. string.
  3657. - `<value>` can contain simple and conditional attribute
  3658. references.
  3659. - Returns a blank string unless the attribute is undefined in
  3660. which case the return value is undefined and the enclosing
  3661. line will be dropped.
  3662. `{set2:<attrname>[!][:<value>]}`::
  3663. Same as `set` except that the attribute scope is local to the
  3664. template.
  3665. `{sys:<command>}`::
  3666. Substitutes the stdout generated by the execution of the shell
  3667. `<command>`.
  3668. `{sys2:<command>}`::
  3669. Substitutes the stdout and stderr generated by the execution
  3670. of the shell `<command>`.
  3671. `{sys3:<command>}`::
  3672. Passthrough version of `{sys:<command>}` -- the generated
  3673. output is written directly to the output without any further
  3674. substitutions.
  3675. `{template:<template>}`::
  3676. Substitutes the contents of the configuration file section
  3677. named `<template>`. Attribute references contained in the
  3678. template are substituted.
  3679. .System reference behavior
  3680. - System attribute arguments can contain non-system attribute
  3681. references.
  3682. - Closing brace characters inside system attribute arguments must be
  3683. escaped with a backslash.
  3684. [[X60]]
  3685. Intrinsic Attributes
  3686. --------------------
  3687. Intrinsic attributes are simple attributes that are created
  3688. automatically from: AsciiDoc document header parameters; asciidoc(1)
  3689. command-line arguments; attributes defined in the default
  3690. configuration files; the execution context. Here's the list of
  3691. predefined intrinsic attributes:
  3692. {amp} ampersand (&) character entity
  3693. {asciidoc-args} used to pass inherited arguments to asciidoc filters
  3694. {asciidoc-confdir} the asciidoc(1) global configuration directory
  3695. {asciidoc-dir} the asciidoc(1) application directory
  3696. {asciidoc-file} the full path name of the asciidoc(1) script
  3697. {asciidoc-version} the version of asciidoc(1)
  3698. {author} author's full name
  3699. {authored} empty string '' if {author} or {email} defined,
  3700. {authorinitials} author initials (from document header)
  3701. {backend-<backend>} empty string ''
  3702. {<backend>-<doctype>} empty string ''
  3703. {backend} document backend specified by `-b` option
  3704. {backend-confdir} the directory containing the <backend>.conf file
  3705. {backslash} backslash character
  3706. {basebackend-<base>} empty string ''
  3707. {basebackend} html or docbook
  3708. {blockname} current block name (note 8).
  3709. {brvbar} broken vertical bar (|) character
  3710. {docdate} document last modified date
  3711. {docdir} document input directory name (note 5)
  3712. {docfile} document file name (note 5)
  3713. {docname} document file name without extension (note 6)
  3714. {doctime} document last modified time
  3715. {doctitle} document title (from document header)
  3716. {doctype-<doctype>} empty string ''
  3717. {doctype} document type specified by `-d` option
  3718. {email} author's email address (from document header)
  3719. {empty} empty string ''
  3720. {encoding} specifies input and output encoding
  3721. {filetype-<fileext>} empty string ''
  3722. {filetype} output file name file extension
  3723. {firstname} author first name (from document header)
  3724. {gt} greater than (>) character entity
  3725. {id} running block id generated by BlockId elements
  3726. {indir} input file directory name (note 2,5)
  3727. {infile} input file name (note 2,5)
  3728. {lastname} author last name (from document header)
  3729. {ldquo} Left double quote character (note 7)
  3730. {level} title level 1..4 (in section titles)
  3731. {listindex} the list index (1..) of the most recent list item
  3732. {localdate} the current date
  3733. {localtime} the current time
  3734. {lsquo} Left single quote character (note 7)
  3735. {lt} less than (<) character entity
  3736. {manname} manpage name (defined in NAME section)
  3737. {manpurpose} manpage (defined in NAME section)
  3738. {mantitle} document title minus the manpage volume number
  3739. {manvolnum} manpage volume number (1..8) (from document header)
  3740. {middlename} author middle name (from document header)
  3741. {nbsp} non-breaking space character entity
  3742. {notitle} do not display the document title
  3743. {outdir} document output directory name (note 2)
  3744. {outfile} output file name (note 2)
  3745. {python} the full path name of the Python interpreter executable
  3746. {rdquo} Right double quote character (note 7)
  3747. {reftext} running block xreflabel generated by BlockId elements
  3748. {revdate} document revision date (from document header)
  3749. {revnumber} document revision number (from document header)
  3750. {rsquo} Right single quote character (note 7)
  3751. {sectnum} formatted section number (in section titles)
  3752. {sp} space character
  3753. {showcomments} send comment lines to the output
  3754. {title} section title (in titled elements)
  3755. {two-colons} Two colon characters
  3756. {two-semicolons} Two semicolon characters
  3757. {user-dir} the ~/.asciidoc directory (if it exists)
  3758. {verbose} defined as '' if --verbose command option specified
  3759. {wj} Word-joiner
  3760. {zwsp} Zero-width space character entity
  3761. [NOTE]
  3762. ======
  3763. 1. Intrinsic attributes are global so avoid defining custom attributes
  3764. with the same names.
  3765. 2. `{outfile}`, `{outdir}`, `{infile}`, `{indir}` attributes are
  3766. effectively read-only (you can set them but it won't affect the
  3767. input or output file paths).
  3768. 3. See also the <<X88,Backend Attributes>> section for attributes
  3769. that relate to AsciiDoc XHTML file generation.
  3770. 4. The entries that translate to blank strings are designed to be used
  3771. for conditional text inclusion. You can also use the `ifdef`,
  3772. `ifndef` and `endif` System macros for conditional inclusion.
  3773. footnote:[Conditional inclusion using `ifdef` and `ifndef` macros
  3774. differs from attribute conditional inclusion in that the former
  3775. occurs when the file is read while the latter occurs when the
  3776. contents are written.]
  3777. 5. `{docfile}` and `{docdir}` refer to root document specified on the
  3778. asciidoc(1) command-line; `{infile}` and `{indir}` refer to the
  3779. current input file which may be the root document or an included
  3780. file. When the input is being read from the standard input
  3781. (`stdin`) these attributes are undefined.
  3782. 6. If the input file is the standard input and the output file is not
  3783. the standard output then `{docname}` is the output file name sans
  3784. file extension.
  3785. 7. See
  3786. http://en.wikipedia.org/wiki/Non-English_usage_of_quotation_marks[non-English
  3787. usage of quotation marks].
  3788. 8. The `{blockname}` attribute identifies the style of the current
  3789. block. It applies to delimited blocks, lists and tables. Here is a
  3790. list of `{blockname}` values (does not include filters or custom
  3791. block and style names):
  3792. delimited blocks:: comment, sidebar, open, pass, literal, verse,
  3793. listing, quote, example, note, tip, important, caution, warning,
  3794. abstract, partintro
  3795. lists:: arabic, loweralpha, upperalpha, lowerroman, upperroman,
  3796. labeled, labeled3, labeled4, qanda, horizontal, bibliography,
  3797. glossary
  3798. tables:: table
  3799. ======
  3800. [[X73]]
  3801. Block Element Definitions
  3802. -------------------------
  3803. The syntax and behavior of Paragraph, DelimitedBlock, List and Table
  3804. block elements is determined by block definitions contained in
  3805. <<X7,AsciiDoc configuration file>> sections.
  3806. Each definition consists of a section title followed by one or more
  3807. section entries. Each entry defines a block parameter controlling some
  3808. aspect of the block's behavior. Here's an example:
  3809. ---------------------------------------------------------------------
  3810. [blockdef-listing]
  3811. delimiter=^-{4,}$
  3812. template=listingblock
  3813. presubs=specialcharacters,callouts
  3814. ---------------------------------------------------------------------
  3815. Configuration file block definition sections are processed
  3816. incrementally after each configuration file is loaded. Block
  3817. definition section entries are merged into the block definition, this
  3818. allows block parameters to be overridden and extended by later
  3819. <<X27,loading configuration files>>.
  3820. AsciiDoc Paragraph, DelimitedBlock, List and Table block elements
  3821. share a common subset of configuration file parameters:
  3822. delimiter::
  3823. A Python regular expression that matches the first line of a block
  3824. element -- in the case of DelimitedBlocks and Tables it also matches
  3825. the last line.
  3826. template::
  3827. The name of the configuration file markup template section that will
  3828. envelope the block contents. The pipe ('|') character is substituted
  3829. for the block contents. List elements use a set of (list specific)
  3830. tag parameters instead of a single template. The template name can
  3831. contain attribute references allowing dynamic template selection a
  3832. the time of template substitution.
  3833. options::
  3834. A comma delimited list of element specific option names. In addition
  3835. to being used internally, options are available during markup tag
  3836. and template substitution as attributes with an empty string value
  3837. named like `<option>-option` (where `<option>` is the option name).
  3838. See <<X74,attribute options>> for a complete list of available
  3839. options.
  3840. subs, presubs, postsubs::
  3841. * 'presubs' and 'postsubs' are lists of comma separated substitutions that are
  3842. performed on the block contents. 'presubs' is applied first,
  3843. 'postsubs' (if specified) second.
  3844. * 'subs' is an alias for 'presubs'.
  3845. * If a 'filter' is allowed (Paragraphs, DelimitedBlocks and Tables)
  3846. and has been specified then 'presubs' and 'postsubs' substitutions
  3847. are performed before and after the filter is run respectively.
  3848. * Allowed values: 'specialcharacters', 'quotes', 'specialwords',
  3849. 'replacements', 'macros', 'attributes', 'callouts'.
  3850. * [[X102]]The following composite values are also allowed:
  3851. 'none';;
  3852. No substitutions.
  3853. 'normal';;
  3854. The following substitutions in the following order:
  3855. 'specialcharacters', 'quotes', 'attributes', 'specialwords',
  3856. 'replacements', 'macros', 'replacements2'.
  3857. 'verbatim';;
  3858. The following substitutions in the following order:
  3859. 'specialcharacters' and 'callouts'.
  3860. * 'normal' and 'verbatim' substitutions can be redefined by with
  3861. `subsnormal` and `subsverbatim` entries in a configuration file
  3862. `[miscellaneous]` section.
  3863. * The substitutions are processed in the order in which they are
  3864. listed and can appear more than once.
  3865. filter::
  3866. This optional entry specifies an executable shell command for
  3867. processing block content (Paragraphs, DelimitedBlocks and Tables).
  3868. The filter command can contain attribute references.
  3869. posattrs::
  3870. Optional comma separated list of positional attribute names. This
  3871. list maps positional attributes (in the block's <<X21,attribute
  3872. list>>) to named block attributes. The following example, from the
  3873. QuoteBlock definition, maps the first and section positional
  3874. attributes:
  3875. posattrs=attribution,citetitle
  3876. style::
  3877. This optional parameter specifies the default style name.
  3878. <stylename>-style::
  3879. Optional style definition (see <<X23,Styles>> below).
  3880. The following block parameters behave like document attributes and can
  3881. be set in block attribute lists and style definitions: 'template',
  3882. 'options', 'subs', 'presubs', 'postsubs', 'filter'.
  3883. [[X23]]
  3884. Styles
  3885. ~~~~~~
  3886. A style is a set of block parameter bundled as a single named
  3887. parameter. The following example defines a style named 'verbatim':
  3888. verbatim-style=template="literalblock",subs="verbatim"
  3889. If a block's <<X21,attribute list>> contains a 'style' attribute then
  3890. the corresponding style parameters are be merged into the default
  3891. block definition parameters.
  3892. - All style parameter names must be suffixed with `-style` and the
  3893. style parameter value is in the form of a list of <<X21,named
  3894. attributes>>.
  3895. - The 'template' style parameter is mandatory, other parameters can be
  3896. omitted in which case they inherit their values from the default
  3897. block definition parameters.
  3898. - Multi-item style parameters ('subs','presubs','postsubs','posattrs')
  3899. must be specified using Python tuple syntax (rather than a simple
  3900. list of values as they in separate entries) e.g.
  3901. `postsubs=("callouts",)` not `postsubs="callouts"`.
  3902. Paragraphs
  3903. ~~~~~~~~~~
  3904. Paragraph translation is controlled by `[paradef-*]` configuration
  3905. file section entries. Users can define new types of paragraphs and
  3906. modify the behavior of existing types by editing AsciiDoc
  3907. configuration files.
  3908. Here is the shipped Default paragraph definition:
  3909. --------------------------------------------------------------------
  3910. [paradef-default]
  3911. delimiter=(?P<text>\S.*)
  3912. template=paragraph
  3913. --------------------------------------------------------------------
  3914. The normal paragraph definition has a couple of special properties:
  3915. 1. It must exist and be defined in a configuration file section named
  3916. `[paradef-default]`.
  3917. 2. Irrespective of its position in the configuration files default
  3918. paragraph document matches are attempted only after trying all
  3919. other paragraph types.
  3920. Paragraph specific block parameter notes:
  3921. delimiter::
  3922. This regular expression must contain the named group 'text' which
  3923. matches the text on the first line. Paragraphs are terminated by a
  3924. blank line, the end of file, or the start of a DelimitedBlock.
  3925. options::
  3926. The 'listelement' option specifies that paragraphs of this type will
  3927. automatically be considered part of immediately preceding list
  3928. items. The 'skip' option causes the paragraph to be treated as a
  3929. comment (see <<X26,CommentBlocks>>).
  3930. .Paragraph processing proceeds as follows:
  3931. 1. The paragraph text is aligned to the left margin.
  3932. 2. Optional 'presubs' inline substitutions are performed on the
  3933. paragraph text.
  3934. 3. If a filter command is specified it is executed and the paragraph
  3935. text piped to its standard input; the filter output replaces the
  3936. paragraph text.
  3937. 4. Optional 'postsubs' inline substitutions are performed on the
  3938. paragraph text.
  3939. 5. The paragraph text is enveloped by the paragraph's markup template
  3940. and written to the output file.
  3941. Delimited Blocks
  3942. ~~~~~~~~~~~~~~~~
  3943. DelimitedBlock 'options' values are:
  3944. sectionbody::
  3945. The block contents are processed as a SectionBody.
  3946. skip::
  3947. The block is treated as a comment (see <<X26,CommentBlocks>>).
  3948. Preceding <<X21,attribute lists>> and <<X42,block titles>> are not
  3949. consumed.
  3950. 'presubs', 'postsubs' and 'filter' entries are ignored when
  3951. 'sectionbody' or 'skip' options are set.
  3952. DelimitedBlock processing proceeds as follows:
  3953. 1. Optional 'presubs' substitutions are performed on the block
  3954. contents.
  3955. 2. If a filter is specified it is executed and the block's contents
  3956. piped to its standard input. The filter output replaces the block
  3957. contents.
  3958. 3. Optional 'postsubs' substitutions are performed on the block
  3959. contents.
  3960. 4. The block contents is enveloped by the block's markup template and
  3961. written to the output file.
  3962. TIP: Attribute expansion is performed on the block filter command
  3963. before it is executed, this is useful for passing arguments to the
  3964. filter.
  3965. Lists
  3966. ~~~~~
  3967. List behavior and syntax is determined by `[listdef-*]` configuration
  3968. file sections. The user can change existing list behavior and add new
  3969. list types by editing configuration files.
  3970. List specific block definition notes:
  3971. type::
  3972. This is either 'bulleted','numbered','labeled' or 'callout'.
  3973. delimiter::
  3974. A Python regular expression that matches the first line of a
  3975. list element entry. This expression can contain the named groups
  3976. 'text' (bulleted groups), 'index' and 'text' (numbered lists),
  3977. 'label' and 'text' (labeled lists).
  3978. tags::
  3979. The `<name>` of the `[listtags-<name>]` configuration file section
  3980. containing list markup tag definitions. The tag entries ('list',
  3981. 'entry', 'label', 'term', 'text') map the AsciiDoc list structure to
  3982. backend markup; see the 'listtags' sections in the AsciiDoc
  3983. distributed backend `.conf` configuration files for examples.
  3984. Tables
  3985. ~~~~~~
  3986. Table behavior and syntax is determined by `[tabledef-*]` and
  3987. `[tabletags-*]` configuration file sections. The user can change
  3988. existing table behavior and add new table types by editing
  3989. configuration files. The following `[tabledef-*]` section entries
  3990. generate table output markup elements:
  3991. colspec::
  3992. The table 'colspec' tag definition.
  3993. headrow, footrow, bodyrow::
  3994. Table header, footer and body row tag definitions. 'headrow' and
  3995. 'footrow' table definition entries default to 'bodyrow' if
  3996. they are undefined.
  3997. headdata, footdata, bodydata::
  3998. Table header, footer and body data tag definitions. 'headdata' and
  3999. 'footdata' table definition entries default to 'bodydata' if they
  4000. are undefined.
  4001. paragraph::
  4002. If the 'paragraph' tag is specified then blank lines in the cell
  4003. data are treated as paragraph delimiters and marked up using this
  4004. tag.
  4005. [[X4]]
  4006. Table behavior is also influenced by the following `[miscellaneous]`
  4007. configuration file entries:
  4008. pagewidth::
  4009. This integer value is the printable width of the output media. See
  4010. <<X69,table attributes>>.
  4011. pageunits::
  4012. The units of width in output markup width attribute values.
  4013. .Table definition behavior
  4014. - The output markup generation is specifically designed to work with
  4015. the HTML and CALS (DocBook) table models, but should be adaptable to
  4016. most XML table schema.
  4017. - Table definitions can be ``mixed in'' from multiple cascading
  4018. configuration files.
  4019. - New table definitions inherit the default table and table tags
  4020. definitions (`[tabledef-default]` and `[tabletags-default]`) so you
  4021. only need to override those conf file entries that require
  4022. modification.
  4023. [[X59]]
  4024. Filters
  4025. -------
  4026. AsciiDoc filters allow external commands to process AsciiDoc
  4027. 'Paragraphs', 'DelimitedBlocks' and 'Table' content. Filters are
  4028. primarily an extension mechanism for generating specialized outputs.
  4029. Filters are implemented using external commands which are specified in
  4030. configuration file definitions.
  4031. There's nothing special about the filters, they're just standard UNIX
  4032. filters: they read text from the standard input, process it, and write
  4033. to the standard output.
  4034. The asciidoc(1) command `--filter` option can be used to install and
  4035. remove filters. The same option is used to unconditionally load a
  4036. filter.
  4037. Attribute substitution is performed on the filter command prior to
  4038. execution -- attributes can be used to pass parameters from the
  4039. AsciiDoc source document to the filter.
  4040. WARNING: Filters sometimes included executable code. Before installing
  4041. a filter you should verify that it is from a trusted source.
  4042. Filter Search Paths
  4043. ~~~~~~~~~~~~~~~~~~~
  4044. If the filter command does not specify a directory path then
  4045. asciidoc(1) recursively searches for the executable filter command:
  4046. - First it looks in the user's `$HOME/.asciidoc/filters` directory.
  4047. - Next the global filters directory (usually `/etc/asciidoc/filters`
  4048. or `/usr/local/etc/asciidoc`) directory is searched.
  4049. - Then it looks in the asciidoc(1) `./filters` directory.
  4050. - Finally it relies on the executing shell to search the environment
  4051. search path (`$PATH`).
  4052. Standard practice is to install each filter in it's own sub-directory
  4053. with the same name as the filter's style definition. For example the
  4054. music filter's style name is 'music' so it's configuration and filter
  4055. files are stored in the `filters/music` directory.
  4056. Filter Configuration Files
  4057. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  4058. Filters are normally accompanied by a configuration file containing a
  4059. Paragraph or DelimitedBlock definition along with corresponding markup
  4060. templates.
  4061. While it is possible to create new 'Paragraph' or 'DelimitedBlock'
  4062. definitions the preferred way to implement a filter is to add a
  4063. <<X23,style>> to the existing Paragraph and ListingBlock definitions
  4064. (all filters shipped with AsciiDoc use this technique). The filter is
  4065. applied to the paragraph or delimited block by preceding it with an
  4066. attribute list: the first positional attribute is the style name,
  4067. remaining attributes are normally filter specific parameters.
  4068. asciidoc(1) auto-loads all `.conf` files found in the filter search
  4069. paths unless the container directory also contains a file named
  4070. `__noautoload__` (see previous section). The `__noautoload__` feature
  4071. is used for filters that will be loaded manually using the `--filter`
  4072. option.
  4073. [[X56]]
  4074. Example Filter
  4075. ~~~~~~~~~~~~~~
  4076. AsciiDoc comes with a toy filter for highlighting source code keywords
  4077. and comments. See also the `./filters/code/code-filter-readme.txt`
  4078. file.
  4079. NOTE: The purpose of this toy filter is to demonstrate how to write a
  4080. filter -- it's much to simplistic to be passed off as a code syntax
  4081. highlighter. If you want a full featured multi-language highlighter
  4082. use the {website}source-highlight-filter.html[source code highlighter
  4083. filter].
  4084. Built-in filters
  4085. ~~~~~~~~~~~~~~~~
  4086. The AsciiDoc distribution includes 'source', 'music', 'latex' and
  4087. 'graphviz' filters, details are on the
  4088. {website}index.html#_filters[AsciiDoc website].
  4089. [cols="1e,5",frame="topbot",options="header"]
  4090. .Built-in filters list
  4091. |====================================================================
  4092. |Filter name |Description
  4093. |music
  4094. |A {website}music-filter.html[music filter] is included in the
  4095. distribution `./filters/` directory. It translates music in
  4096. http://lilypond.org/[LilyPond] or http://abcnotation.org.uk/[ABC]
  4097. notation to standard classical notation.
  4098. |source
  4099. |A {website}source-highlight-filter.html[source code highlight filter]
  4100. is included in the distribution `./filters/` directory.
  4101. |latex
  4102. |The {website}latex-filter.html[AsciiDoc LaTeX filter] translates
  4103. LaTeX source to a PNG image that is automatically inserted into the
  4104. AsciiDoc output documents.
  4105. |graphviz
  4106. |Gouichi Iisaka has written a http://www.graphviz.org/[Graphviz]
  4107. filter for AsciiDoc. Graphviz generates diagrams from a textual
  4108. specification. Gouichi Iisaka's Graphviz filter is included in the
  4109. AsciiDoc distribution. Here are some
  4110. {website}asciidoc-graphviz-sample.html[AsciiDoc Graphviz examples].
  4111. |====================================================================
  4112. [[X58]]
  4113. Filter plugins
  4114. ~~~~~~~~~~~~~~
  4115. Filter <<X101,plugins>> are a mechanism for distributing AsciiDoc
  4116. filters. A filter plugin is a Zip file containing the files that
  4117. constitute a filter. The asciidoc(1) `--filter` option is used to
  4118. load and manage filer <<X101,plugins>>.
  4119. - Filter plugins <<X27,take precedence>> over built-in filters with
  4120. the same name.
  4121. - By default filter plugins are installed in
  4122. `$HOME/.asciidoc/filters/<filter>` where `<filter>` is the filter
  4123. name.
  4124. [[X101]]
  4125. Plugins
  4126. -------
  4127. The AsciiDoc plugin architecture is an extension mechanism that allows
  4128. additional <<X100,backends>>, <<X58,filters>> and <<X99,themes>> to be
  4129. added to AsciiDoc.
  4130. - A plugin is a Zip file containing an AsciiDoc backend, filter or
  4131. theme (configuration files, stylesheets, scripts, images).
  4132. - The asciidoc(1) `--backend`, `--filter` and `--theme` command-line
  4133. options are used to load and manage plugins. Each of these options
  4134. responds to the plugin management 'install', 'list', 'remove' and
  4135. 'build' commands.
  4136. - The plugin management command names are reserved and cannot be used
  4137. for filter, backend or theme names.
  4138. - The plugin Zip file name always begins with the backend, filter or
  4139. theme name.
  4140. Plugin commands and conventions are documented in the asciidoc(1) man
  4141. page. You can find lists of plugins on the
  4142. {website}plugins.html[AsciiDoc website].
  4143. [[X36]]
  4144. Help Commands
  4145. -------------
  4146. The asciidoc(1) command has a `--help` option which prints help topics
  4147. to stdout. The default topic summarizes asciidoc(1) usage:
  4148. $ asciidoc --help
  4149. To print a help topic specify the topic name as a command argument.
  4150. Help topic names can be shortened so long as they are not ambiguous.
  4151. Examples:
  4152. $ asciidoc --help manpage
  4153. $ asciidoc -h m # Short version of previous example.
  4154. $ asciidoc --help syntax
  4155. $ asciidoc -h s # Short version of previous example.
  4156. Customizing Help
  4157. ~~~~~~~~~~~~~~~~
  4158. To change, delete or add your own help topics edit a help
  4159. configuration file. The help file name `help-<lang>.conf` is based on
  4160. the setting of the `lang` attribute, it defaults to `help.conf`
  4161. (English). The <<X27,help file location>> will depend on whether you
  4162. want the topics to apply to all users or just the current user.
  4163. The help topic files have the same named section format as other
  4164. <<X7,configuration files>>. The `help.conf` files are stored in the
  4165. same locations and loaded in the same order as other configuration
  4166. files.
  4167. When the `--help` command-line option is specified AsciiDoc loads the
  4168. appropriate help files and then prints the contents of the section
  4169. whose name matches the help topic name. If a topic name is not
  4170. specified `default` is used. You don't need to specify the whole help
  4171. topic name on the command-line, just enough letters to ensure it's not
  4172. ambiguous. If a matching help file section is not found a list of
  4173. available topics is printed.
  4174. Tips and Tricks
  4175. ---------------
  4176. Know Your Editor
  4177. ~~~~~~~~~~~~~~~~
  4178. Writing AsciiDoc documents will be a whole lot more pleasant if you
  4179. know your favorite text editor. Learn how to indent and reformat text
  4180. blocks, paragraphs, lists and sentences. <<X20,Tips for 'vim' users>>
  4181. follow.
  4182. [[X20]]
  4183. Vim Commands for Formatting AsciiDoc
  4184. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4185. Text Wrap Paragraphs
  4186. ^^^^^^^^^^^^^^^^^^^^
  4187. Use the vim `:gq` command to reformat paragraphs. Setting the
  4188. 'textwidth' sets the right text wrap margin; for example:
  4189. :set textwidth=70
  4190. To reformat a paragraph:
  4191. 1. Position the cursor at the start of the paragraph.
  4192. 2. Type `gq}`.
  4193. Execute `:help gq` command to read about the vim gq command.
  4194. [TIP]
  4195. =====================================================================
  4196. - Assign the `gq}` command to the Q key with the `nnoremap Q gq}`
  4197. command or put it in your `~/.vimrc` file to so it's always
  4198. available (see the <<X61, Example `~/.vimrc` file>>).
  4199. - Put `set` commands in your `~/.vimrc` file so you don't have to
  4200. enter them manually.
  4201. - The Vim website (http://www.vim.org) has a wealth of resources,
  4202. including scripts for automated spell checking and ASCII Art
  4203. drawing.
  4204. =====================================================================
  4205. Format Lists
  4206. ^^^^^^^^^^^^
  4207. The `gq` command can also be used to format bulleted, numbered and
  4208. callout lists. First you need to set the `comments`, `formatoptions`
  4209. and `formatlistpat` (see the <<X61, Example `~/.vimrc` file>>).
  4210. Now you can format simple lists that use dash, asterisk, period and
  4211. plus bullets along with numbered ordered lists:
  4212. 1. Position the cursor at the start of the list.
  4213. 2. Type `gq}`.
  4214. Indent Paragraphs
  4215. ^^^^^^^^^^^^^^^^^
  4216. Indent whole paragraphs by indenting the fist line with the desired
  4217. indent and then executing the `gq}` command.
  4218. [[X61]]
  4219. Example `~/.vimrc` File
  4220. ^^^^^^^^^^^^^^^^^^^^^^^
  4221. ---------------------------------------------------------------------
  4222. " Use bold bright fonts.
  4223. set background=dark
  4224. " Show tabs and trailing characters.
  4225. set listchars=tab:»·,trail:·
  4226. set list
  4227. " Don't highlight searched text.
  4228. highlight clear Search
  4229. " Don't move to matched text while search pattern is being entered.
  4230. set noincsearch
  4231. " Reformat paragraphs and list.
  4232. nnoremap R gq}
  4233. " Delete trailing white space and Dos-returns and to expand tabs to spaces.
  4234. nnoremap S :set et<CR>:retab!<CR>:%s/[\r \t]\+$//<CR>
  4235. autocmd BufRead,BufNewFile *.txt,README,TODO,CHANGELOG,NOTES
  4236. \ setlocal autoindent expandtab tabstop=8 softtabstop=2 shiftwidth=2 filetype=asciidoc
  4237. \ textwidth=70 wrap formatoptions=tcqn
  4238. \ formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\\|^\\s*<\\d\\+>\\s\\+\\\\|^\\s*[a-zA-Z.]\\.\\s\\+\\\\|^\\s*[ivxIVX]\\+\\.\\s\\+
  4239. \ comments=s1:/*,ex:*/,://,b:#,:%,:XCOMM,fb:-,fb:*,fb:+,fb:.,fb:>
  4240. ---------------------------------------------------------------------
  4241. Troubleshooting
  4242. ~~~~~~~~~~~~~~~
  4243. AsciiDoc diagnostic features are detailed in the <<X82,Diagnostics
  4244. appendix>>.
  4245. Gotchas
  4246. ~~~~~~~
  4247. Incorrect character encoding::
  4248. If you get an error message like `'UTF-8' codec can't decode ...`
  4249. then you source file contains invalid UTF-8 characters -- set the
  4250. AsciiDoc <<X54,encoding attribute>> for the correct character set
  4251. (typically ISO-8859-1 (Latin-1) for European languages).
  4252. Invalid output::
  4253. AsciiDoc attempts to validate the input AsciiDoc source but makes
  4254. no attempt to validate the output markup, it leaves that to
  4255. external tools such as `xmllint(1)` (integrated into `a2x(1)`).
  4256. Backend validation cannot be hardcoded into AsciiDoc because
  4257. backends are dynamically configured. The following example
  4258. generates valid HTML but invalid DocBook (the DocBook `literal`
  4259. element cannot contain an `emphasis` element):
  4260. +monospaced text with an _emphasized_ word+
  4261. Misinterpreted text formatting::
  4262. You can suppress markup expansion by placing a backslash character
  4263. immediately in front of the element. The following example
  4264. suppresses inline monospaced formatting:
  4265. \+1 for C++.
  4266. Overlapping text formatting::
  4267. Overlapping text formatting will generate illegal overlapping
  4268. markup tags which will result in downstream XML parsing errors.
  4269. Here's an example:
  4270. Some *strong markup _that overlaps* emphasized markup_.
  4271. Ambiguous underlines::
  4272. A DelimitedBlock can immediately follow a paragraph without an
  4273. intervening blank line, but be careful, a single line paragraph
  4274. underline may be misinterpreted as a section title underline
  4275. resulting in a ``closing block delimiter expected'' error.
  4276. Ambiguous ordered list items::
  4277. Lines beginning with numbers at the end of sentences will be
  4278. interpreted as ordered list items. The following example
  4279. (incorrectly) begins a new list with item number 1999:
  4280. He was last sighted in
  4281. 1999. Since then things have moved on.
  4282. +
  4283. The 'list item out of sequence' warning makes it unlikely that this
  4284. problem will go unnoticed.
  4285. Special characters in attribute values::
  4286. Special character substitution precedes attribute substitution so
  4287. if attribute values contain special characters you may, depending
  4288. on the substitution context, need to escape the special characters
  4289. yourself. For example:
  4290. $ asciidoc -a 'orgname=Bill &amp; Ben Inc.' mydoc.txt
  4291. Attribute lists::
  4292. If any named attribute entries are present then all string
  4293. attribute values must be quoted. For example:
  4294. ["Desktop screenshot",width=32]
  4295. [[X90]]
  4296. Combining separate documents
  4297. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4298. You have a number of stand-alone AsciiDoc documents that you want to
  4299. process as a single document. Simply processing them with a series of
  4300. `include` macros won't work because the documents contain (level 0)
  4301. document titles. The solution is to create a top level wrapper
  4302. document and use the `leveloffset` attribute to push them all down one
  4303. level. For example:
  4304. [listing]
  4305. .....................................................................
  4306. Combined Document Title
  4307. =======================
  4308. // Push titles down one level.
  4309. :leveloffset: 1
  4310. \include::document1.txt[]
  4311. // Return to normal title levels.
  4312. :leveloffset: 0
  4313. A Top Level Section
  4314. -------------------
  4315. Lorum ipsum.
  4316. // Push titles down one level.
  4317. :leveloffset: 1
  4318. \include::document2.txt[]
  4319. \include::document3.txt[]
  4320. .....................................................................
  4321. The document titles in the included documents will now be processed as
  4322. level 1 section titles, level 1 sections as level 2 sections and so
  4323. on.
  4324. - Put a blank line between the `include` macro lines to ensure the
  4325. title of the included document is not seen as part of the last
  4326. paragraph of the previous document.
  4327. - You won't want non-title document header lines (for example, Author
  4328. and Revision lines) in the included files -- conditionally exclude
  4329. them if they are necessary for stand-alone processing.
  4330. Processing document sections separately
  4331. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4332. You have divided your AsciiDoc document into separate files (one per
  4333. top level section) which are combined and processed with the following
  4334. top level document:
  4335. ---------------------------------------------------------------------
  4336. Combined Document Title
  4337. =======================
  4338. Joe Bloggs
  4339. v1.0, 12-Aug-03
  4340. \include::section1.txt[]
  4341. \include::section2.txt[]
  4342. \include::section3.txt[]
  4343. ---------------------------------------------------------------------
  4344. You also want to process the section files as separate documents.
  4345. This is easy because asciidoc(1) will quite happily process
  4346. `section1.txt`, `section2.txt` and `section3.txt` separately -- the
  4347. resulting output documents contain the section but have no document
  4348. title.
  4349. Processing document snippets
  4350. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4351. Use the `-s` (`--no-header-footer`) command-line option to suppress
  4352. header and footer output, this is useful if the processed output is to
  4353. be included in another file. For example:
  4354. $ asciidoc -sb docbook section1.txt
  4355. asciidoc(1) can be used as a filter, so you can pipe chunks of text
  4356. through it. For example:
  4357. $ echo 'Hello *World!*' | asciidoc -s -
  4358. <div class="paragraph"><p>Hello <strong>World!</strong></p></div>
  4359. Badges in HTML page footers
  4360. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4361. See the `[footer]` section in the AsciiDoc distribution `xhtml11.conf`
  4362. configuration file.
  4363. Pretty printing AsciiDoc output
  4364. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4365. If the indentation and layout of the asciidoc(1) output is not to your
  4366. liking you can:
  4367. 1. Change the indentation and layout of configuration file markup
  4368. template sections. The `{empty}` attribute is useful for outputting
  4369. trailing blank lines in markup templates.
  4370. 2. Use Dave Raggett's http://tidy.sourceforge.net/[HTML Tidy] program
  4371. to tidy asciidoc(1) output. Example:
  4372. $ asciidoc -b docbook -o - mydoc.txt | tidy -indent -xml >mydoc.xml
  4373. 3. Use the `xmllint(1)` format option. Example:
  4374. $ xmllint --format mydoc.xml
  4375. Supporting minor DocBook DTD variations
  4376. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4377. The conditional inclusion of DocBook SGML markup at the end of the
  4378. distribution `docbook45.conf` file illustrates how to support minor
  4379. DTD variations. The included sections override corresponding entries
  4380. from preceding sections.
  4381. Creating stand-alone HTML documents
  4382. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4383. If you've ever tried to send someone an HTML document that includes
  4384. stylesheets and images you'll know that it's not as straight-forward
  4385. as exchanging a single file. AsciiDoc has options to create
  4386. stand-alone documents containing embedded images, stylesheets and
  4387. scripts. The following AsciiDoc command creates a single file
  4388. containing <<X66,embedded images>>, CSS stylesheets, and JavaScript
  4389. (for table of contents and footnotes):
  4390. $ asciidoc -a data-uri -a icons -a toc -a max-width=55em article.txt
  4391. You can view the HTML file here: {website}article-standalone.html[]
  4392. Shipping stand-alone AsciiDoc source
  4393. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4394. Reproducing presentation documents from someone else's source has one
  4395. major problem: unless your configuration files are the same as the
  4396. creator's you won't get the same output.
  4397. The solution is to create a single backend specific configuration file
  4398. using the asciidoc(1) `-c` (`--dump-conf`) command-line option. You
  4399. then ship this file along with the AsciiDoc source document plus the
  4400. `asciidoc.py` script. The only end user requirement is that they have
  4401. Python installed (and that they consider you a trusted source). This
  4402. example creates a composite HTML configuration file for `mydoc.txt`:
  4403. $ asciidoc -cb xhtml11 mydoc.txt > mydoc-xhtml11.conf
  4404. Ship `mydoc.txt`, `mydoc-html.conf`, and `asciidoc.py`. With
  4405. these three files (and a Python interpreter) the recipient can
  4406. regenerate the HMTL output:
  4407. $ ./asciidoc.py -eb xhtml11 mydoc.txt
  4408. The `-e` (`--no-conf`) option excludes the use of implicit
  4409. configuration files, ensuring that only entries from the
  4410. `mydoc-html.conf` configuration are used.
  4411. Inserting blank space
  4412. ~~~~~~~~~~~~~~~~~~~~~
  4413. Adjust your style sheets to add the correct separation between block
  4414. elements. Inserting blank paragraphs containing a single non-breaking
  4415. space character `{nbsp}` works but is an ad hoc solution compared
  4416. to using style sheets.
  4417. Closing open sections
  4418. ~~~~~~~~~~~~~~~~~~~~~
  4419. You can close off section tags up to level `N` by calling the
  4420. `eval::[Section.setlevel(N)]` system macro. This is useful if you
  4421. want to include a section composed of raw markup. The following
  4422. example includes a DocBook glossary division at the top section level
  4423. (level 0):
  4424. ---------------------------------------------------------------------
  4425. \ifdef::basebackend-docbook[]
  4426. \eval::[Section.setlevel(0)]
  4427. +++++++++++++++++++++++++++++++
  4428. <glossary>
  4429. <title>Glossary</title>
  4430. <glossdiv>
  4431. ...
  4432. </glossdiv>
  4433. </glossary>
  4434. +++++++++++++++++++++++++++++++
  4435. \endif::basebackend-docbook[]
  4436. ---------------------------------------------------------------------
  4437. Validating output files
  4438. ~~~~~~~~~~~~~~~~~~~~~~~
  4439. Use `xmllint(1)` to check the AsciiDoc generated markup is both well
  4440. formed and valid. Here are some examples:
  4441. $ xmllint --nonet --noout --valid docbook-file.xml
  4442. $ xmllint --nonet --noout --valid xhtml11-file.html
  4443. $ xmllint --nonet --noout --valid --html html4-file.html
  4444. The `--valid` option checks the file is valid against the document
  4445. type's DTD, if the DTD is not installed in your system's catalog then
  4446. it will be fetched from its Internet location. If you omit the
  4447. `--valid` option the document will only be checked that it is well
  4448. formed.
  4449. The online http://validator.w3.org/#validate_by_uri+with_options[W3C
  4450. Markup Validation Service] is the defacto standard when it comes to
  4451. validating HTML (it validates all HTML standards including HTML5).
  4452. :numbered!:
  4453. [glossary]
  4454. Glossary
  4455. --------
  4456. [glossary]
  4457. [[X8]] Block element::
  4458. An AsciiDoc block element is a document entity composed of one or
  4459. more whole lines of text.
  4460. [[X34]] Inline element::
  4461. AsciiDoc inline elements occur within block element textual
  4462. content, they perform formatting and substitution tasks.
  4463. Formal element::
  4464. An AsciiDoc block element that has a BlockTitle. Formal elements
  4465. are normally listed in front or back matter, for example lists of
  4466. tables, examples and figures.
  4467. Verbatim element::
  4468. The word verbatim indicates that white space and line breaks in
  4469. the source document are to be preserved in the output document.
  4470. [appendix]
  4471. Migration Notes
  4472. ---------------
  4473. [[X53]]
  4474. Version 7 to version 8
  4475. ~~~~~~~~~~~~~~~~~~~~~~
  4476. - A new set of quotes has been introduced which may match inline text
  4477. in existing documents -- if they do you'll need to escape the
  4478. matched text with backslashes.
  4479. - The index entry inline macro syntax has changed -- if your documents
  4480. include indexes you may need to edit them.
  4481. - Replaced a2x(1) `--no-icons` and `--no-copy` options with their
  4482. negated equivalents: `--icons` and `--copy` respectively. The
  4483. default behavior has also changed -- the use of icons and copying of
  4484. icon and CSS files must be specified explicitly with the `--icons`
  4485. and `--copy` options.
  4486. The rationale for the changes can be found in the AsciiDoc
  4487. `CHANGELOG`.
  4488. NOTE: If you want to disable unconstrained quotes, the new alternative
  4489. constrained quotes syntax and the new index entry syntax then you can
  4490. define the attribute `asciidoc7compatible` (for example by using the
  4491. `-a asciidoc7compatible` command-line option).
  4492. [[X38]]
  4493. [appendix]
  4494. Packager Notes
  4495. --------------
  4496. Read the `README` and `INSTALL` files (in the distribution root
  4497. directory) for install prerequisites and procedures. The distribution
  4498. `Makefile.in` (used by `configure` to generate the `Makefile`) is the
  4499. canonical installation procedure.
  4500. [[X39]]
  4501. [appendix]
  4502. AsciiDoc Safe Mode
  4503. -------------------
  4504. AsciiDoc 'safe mode' skips potentially dangerous scripted sections in
  4505. AsciiDoc source files by inhibiting the execution of arbitrary code or
  4506. the inclusion of arbitrary files.
  4507. The safe mode is disabled by default, it can be enabled with the
  4508. asciidoc(1) `--safe` command-line option.
  4509. .Safe mode constraints
  4510. - `eval`, `sys` and `sys2` executable attributes and block macros are
  4511. not executed.
  4512. - `include::<filename>[]` and `include1::<filename>[]` block macro
  4513. files must reside inside the parent file's directory.
  4514. - `{include:<filename>}` executable attribute files must reside
  4515. inside the source document directory.
  4516. - Passthrough Blocks are dropped.
  4517. [WARNING]
  4518. =====================================================================
  4519. The safe mode is not designed to protect against unsafe AsciiDoc
  4520. configuration files. Be especially careful when:
  4521. 1. Implementing filters.
  4522. 2. Implementing elements that don't escape special characters.
  4523. 3. Accepting configuration files from untrusted sources.
  4524. =====================================================================
  4525. [appendix]
  4526. Using AsciiDoc with non-English Languages
  4527. -----------------------------------------
  4528. AsciiDoc can process UTF-8 character sets but there are some things
  4529. you need to be aware of:
  4530. - If you are generating output documents using a DocBook toolchain
  4531. then you should set the AsciiDoc `lang` attribute to the appropriate
  4532. language (it defaults to `en` (English)). This will ensure things
  4533. like table of contents, figure and table captions and admonition
  4534. captions are output in the specified language. For example:
  4535. $ a2x -a lang=es doc/article.txt
  4536. - If you are outputting HTML directly from asciidoc(1) you'll
  4537. need to set the various `*_caption` attributes to match your target
  4538. language (see the list of captions and titles in the `[attributes]`
  4539. section of the distribution `lang-*.conf` files). The easiest way is
  4540. to create a language `.conf` file (see the AsciiDoc's `lang-en.conf`
  4541. file).
  4542. +
  4543. NOTE: You still use the 'NOTE', 'CAUTION', 'TIP', 'WARNING',
  4544. 'IMPORTANT' captions in the AsciiDoc source, they get translated in
  4545. the HTML output file.
  4546. - asciidoc(1) automatically loads configuration files named like
  4547. `lang-<lang>.conf` where `<lang>` is a two letter language code that
  4548. matches the current AsciiDoc `lang` attribute. See also
  4549. <<X27,Configuration File Names and Locations>>.
  4550. [appendix]
  4551. Vim Syntax Highlighter
  4552. ----------------------
  4553. Syntax highlighting is incredibly useful, in addition to making
  4554. reading AsciiDoc documents much easier syntax highlighting also helps
  4555. you catch AsciiDoc syntax errors as you write your documents.
  4556. The AsciiDoc `./vim/` distribution directory contains Vim syntax
  4557. highlighter and filetype detection scripts for AsciiDoc. Syntax
  4558. highlighting makes it much easier to spot AsciiDoc syntax errors.
  4559. If Vim is installed on your system the AsciiDoc installer
  4560. (`install.sh`) will automatically install the vim scripts in the Vim
  4561. global configuration directory (`/etc/vim`).
  4562. You can also turn on syntax highlighting by adding the following line
  4563. to the end of you AsciiDoc source files:
  4564. // vim: set syntax=asciidoc:
  4565. TIP: Bold fonts are often easier to read, use the Vim `:set
  4566. background=dark` command to set bold bright fonts.
  4567. NOTE: There are a number of alternative syntax highlighters for
  4568. various editors listed on the {website}[AsciiDoc website].
  4569. Limitations
  4570. ~~~~~~~~~~~
  4571. The current implementation does a reasonable job but on occasions gets
  4572. things wrong:
  4573. - Nested quoted text formatting is highlighted according to the outer
  4574. format.
  4575. - If a closing Example Block delimiter is sometimes mistaken for a
  4576. title underline. A workaround is to insert a blank line before the
  4577. closing delimiter.
  4578. - Lines within a paragraph starting with equals characters may be
  4579. highlighted as single-line titles.
  4580. - Lines within a paragraph beginning with a period may be highlighted
  4581. as block titles.
  4582. [[X74]]
  4583. [appendix]
  4584. Attribute Options
  4585. -----------------
  4586. Here is the list of predefined <<X75,attribute list options>>:
  4587. [cols="2e,2,2,5",frame="topbot",options="header"]
  4588. |====================================================================
  4589. |Option|Backends|AsciiDoc Elements|Description
  4590. |autowidth |xhtml11, html5, html4 |table|
  4591. The column widths are determined by the browser, not the AsciiDoc
  4592. 'cols' attribute. If there is no 'width' attribute the table width is
  4593. also left up to the browser.
  4594. |unbreakable |xhtml11, html5 |block elements|
  4595. 'unbreakable' attempts to keep the block element together on a single
  4596. printed page c.f. the 'breakable' and 'unbreakable' docbook (XSL/FO)
  4597. options below.
  4598. |breakable, unbreakable |docbook (XSL/FO) |table, example, block image|
  4599. The 'breakable' options allows block elements to break across page
  4600. boundaries; 'unbreakable' attempts to keep the block element together
  4601. on a single page. If neither option is specified the default XSL
  4602. stylesheet behavior prevails.
  4603. |compact |docbook, xhtml11, html5 |bulleted list, numbered list|
  4604. Minimizes vertical space in the list
  4605. |footer |docbook, xhtml11, html5, html4 |table|
  4606. The last row of the table is rendered as a footer.
  4607. |header |docbook, xhtml11, html5, html4 |table|
  4608. The first row of the table is rendered as a header.
  4609. |pgwide |docbook (XSL/FO) |table, block image, horizontal labeled list|
  4610. Specifies that the element should be rendered across the full text
  4611. width of the page irrespective of the current indentation.
  4612. |strong |xhtml11, html5, html4 |labeled lists|
  4613. Emboldens label text.
  4614. |====================================================================
  4615. [[X82]]
  4616. [appendix]
  4617. Diagnostics
  4618. -----------
  4619. The `asciidoc(1)` `--verbose` command-line option prints additional
  4620. information to stderr: files processed, filters processed, warnings,
  4621. system attribute evaluation.
  4622. A special attribute named 'trace' enables the output of
  4623. element-by-element diagnostic messages detailing output markup
  4624. generation to stderr. The 'trace' attribute can be set on the
  4625. command-line or from within the document using <<X18,Attribute
  4626. Entries>> (the latter allows tracing to be confined to specific
  4627. portions of the document).
  4628. - Trace messages print the source file name and line number and the
  4629. trace name followed by related markup.
  4630. - 'trace names' are normally the names of AsciiDoc elements (see the
  4631. list below).
  4632. - The trace message is only printed if the 'trace' attribute value
  4633. matches the start of a 'trace name'. The 'trace' attribute value can
  4634. be any Python regular expression. If a trace value is not specified
  4635. all trace messages will be printed (this can result in large amounts
  4636. of output if applied to the whole document).
  4637. - In the case of inline substitutions:
  4638. * The text before and after the substitution is printed; the before
  4639. text is preceded by a line containing `<<<` and the after text by
  4640. a line containing `>>>`.
  4641. * The 'subs' trace value is an alias for all inline substitutions.
  4642. .Trace names
  4643. .....................................................................
  4644. <blockname> block close
  4645. <blockname> block open
  4646. <subs>
  4647. dropped line (a line containing an undefined attribute reference).
  4648. floating title
  4649. footer
  4650. header
  4651. list close
  4652. list entry close
  4653. list entry open
  4654. list item close
  4655. list item open
  4656. list label close
  4657. list label open
  4658. list open
  4659. macro block (a block macro)
  4660. name (man page NAME section)
  4661. paragraph
  4662. preamble close
  4663. preamble open
  4664. push blockname
  4665. pop blockname
  4666. section close
  4667. section open: level <level>
  4668. subs (all inline substitutions)
  4669. table
  4670. .....................................................................
  4671. Where:
  4672. - `<level>` is section level number '0...4'.
  4673. - `<blockname>` is a delimited block name: 'comment', 'sidebar',
  4674. 'open', 'pass', 'listing', 'literal', 'quote', 'example'.
  4675. - `<subs>` is an inline substitution type:
  4676. 'specialcharacters','quotes','specialwords', 'replacements',
  4677. 'attributes','macros','callouts', 'replacements2', 'replacements3'.
  4678. Command-line examples:
  4679. . Trace the entire document.
  4680. $ asciidoc -a trace mydoc.txt
  4681. . Trace messages whose names start with `quotes` or `macros`:
  4682. $ asciidoc -a 'trace=quotes|macros' mydoc.txt
  4683. . Print the first line of each trace message:
  4684. $ asciidoc -a trace mydoc.txt 2>&1 | grep ^TRACE:
  4685. Attribute Entry examples:
  4686. . Begin printing all trace messages:
  4687. :trace:
  4688. . Print only matched trace messages:
  4689. :trace: quotes|macros
  4690. . Turn trace messages off:
  4691. :trace!:
  4692. [[X88]]
  4693. [appendix]
  4694. Backend Attributes
  4695. ------------------
  4696. This table contains a list of optional attributes that influence the
  4697. generated outputs.
  4698. [cols="1e,1,5a",frame="topbot",options="header"]
  4699. |====================================================================
  4700. |Name |Backends |Description
  4701. |badges |xhtml11, html5 |
  4702. Link badges ('XHTML 1.1' and 'CSS') in document footers. By default
  4703. badges are omitted ('badges' is undefined).
  4704. NOTE: The path names of images, icons and scripts are relative path
  4705. names to the output document not the source document.
  4706. |data-uri |xhtml11, html5 |
  4707. Embed images using the <<X66,data: uri scheme>>.
  4708. |css-signature |html5, xhtml11 |
  4709. Set a 'CSS signature' for the document (sets the 'id' attribute of the
  4710. HTML 'body' element). CSS signatures provide a mechanism that allows
  4711. users to personalize the document appearance. The term 'CSS signature'
  4712. was http://archivist.incutio.com/viewlist/css-discuss/13291[coined by
  4713. Eric Meyer].
  4714. |disable-javascript |xhtml11, html5 |
  4715. If the `disable-javascript` attribute is defined the `asciidoc.js`
  4716. JavaScript is not embedded or linked to the output document. By
  4717. default AsciiDoc automatically embeds or links the `asciidoc.js`
  4718. JavaScript to the output document. The script dynamically generates
  4719. <<X91,table of contents>> and <<X92,footnotes>>.
  4720. |[[X97]] docinfo, docinfo1, docinfo2 |All backends |
  4721. These three attributes control which <<X87,document information
  4722. files>> will be included in the the header of the output file:
  4723. docinfo:: Include `<filename>-docinfo.<ext>`
  4724. docinfo1:: Include `docinfo.<ext>`
  4725. docinfo2:: Include `docinfo.<ext>` and `<filename>-docinfo.<ext>`
  4726. Where `<filename>` is the file name (sans extension) of the AsciiDoc
  4727. input file and `<ext>` is `.html` for HTML outputs or `.xml` for
  4728. DocBook outputs. If the input file is the standard input then the
  4729. output file name is used. The following example will include the
  4730. `mydoc-docinfo.xml` docinfo file in the DocBook `mydoc.xml` output
  4731. file:
  4732. $ asciidoc -a docinfo -b docbook mydoc.txt
  4733. This next example will include `docinfo.html` and `mydoc-docinfo.html`
  4734. docinfo files in the HTML output file:
  4735. $ asciidoc -a docinfo2 -b html4 mydoc.txt
  4736. |[[X54]]encoding |html4, html5, xhtml11, docbook |
  4737. Set the input and output document character set encoding. For example
  4738. the `--attribute encoding=ISO-8859-1` command-line option will set the
  4739. character set encoding to `ISO-8859-1`.
  4740. - The default encoding is UTF-8.
  4741. - This attribute specifies the character set in the output document.
  4742. - The encoding name must correspond to a Python codec name or alias.
  4743. - The 'encoding' attribute can be set using an AttributeEntry inside
  4744. the document header. For example:
  4745. :encoding: ISO-8859-1
  4746. |[[X45]]icons |xhtml11, html5 |
  4747. Link admonition paragraph and admonition block icon images and badge
  4748. images. By default 'icons' is undefined and text is used in place of
  4749. icon images.
  4750. |[[X44]]iconsdir |html4, html5, xhtml11, docbook |
  4751. The name of the directory containing linked admonition icons,
  4752. navigation icons and the `callouts` sub-directory (the `callouts`
  4753. sub-directory contains <<X105,callout>> number images). 'iconsdir'
  4754. defaults to `./images/icons`.
  4755. |imagesdir |html4, html5, xhtml11, docbook |
  4756. If this attribute is defined it is prepended to the target image file
  4757. name paths in inline and block image macros.
  4758. |keywords, description, title |html4, html5, xhtml11 |
  4759. The 'keywords' and 'description' attributes set the correspondingly
  4760. named HTML meta tag contents; the 'title' attribute sets the HTML
  4761. title tag contents. Their principle use is for SEO (Search Engine
  4762. Optimisation). All three are optional, but if they are used they must
  4763. appear in the document header (or on the command-line). If 'title' is
  4764. not specified the AsciiDoc document title is used.
  4765. |linkcss |html5, xhtml11 |
  4766. Link CSS stylesheets and JavaScripts. By default 'linkcss' is
  4767. undefined in which case stylesheets and scripts are automatically
  4768. embedded in the output document.
  4769. |[[X103]]max-width |html5, xhtml11 |
  4770. Set the document maximum display width (sets the 'body' element CSS
  4771. 'max-width' property).
  4772. |numbered |html4, html5, xhtml11, docbook (XSL Stylesheets) |
  4773. Adds section numbers to section titles. The 'docbook' backend ignores
  4774. 'numbered' attribute entries after the document header.
  4775. |plaintext | All backends |
  4776. If this global attribute is defined all inline substitutions are
  4777. suppressed and block indents are retained. This option is useful when
  4778. dealing with large amounts of imported plain text.
  4779. |quirks |xhtml11 |
  4780. Include the `xhtml11-quirks.conf` configuration file and
  4781. `xhtml11-quirks.css` <<X35,stylesheet>> to work around IE6 browser
  4782. incompatibilities. This feature is deprecated and its use is
  4783. discouraged -- documents are still viewable in IE6 without it.
  4784. |revremark |docbook |
  4785. A short summary of changes in this document revision. Must be defined
  4786. prior to the first document section. The document also needs to be
  4787. dated to output this attribute.
  4788. |scriptsdir |html5, xhtml11 |
  4789. The name of the directory containing linked JavaScripts.
  4790. See <<X35,HTML stylesheets and JavaScript locations>>.
  4791. |sgml |docbook45 |
  4792. The `--backend=docbook45` command-line option produces DocBook 4.5
  4793. XML. You can produce the older DocBook SGML format using the
  4794. `--attribute sgml` command-line option.
  4795. |stylesdir |html5, xhtml11 |
  4796. The name of the directory containing linked or embedded
  4797. <<X35,stylesheets>>.
  4798. See <<X35,HTML stylesheets and JavaScript locations>>.
  4799. |stylesheet |html5, xhtml11 |
  4800. The file name of an optional additional CSS <<X35,stylesheet>>.
  4801. |theme |html5, xhtml11 |
  4802. Use alternative stylesheet (see <<X35,Stylesheets>>).
  4803. |[[X91]]toc |html5, xhtml11, docbook (XSL Stylesheets) |
  4804. Adds a table of contents to the start of an article or book document.
  4805. The `toc` attribute can be specified using the `--attribute toc`
  4806. command-line option or a `:toc:` attribute entry in the document
  4807. header. The 'toc' attribute is defined by default when the 'docbook'
  4808. backend is used. To disable table of contents generation undefine the
  4809. 'toc' attribute by putting a `:toc!:` attribute entry in the document
  4810. header or from the command-line with an `--attribute toc!` option.
  4811. *xhtml11 and html5 backends*
  4812. - JavaScript needs to be enabled in your browser.
  4813. - The following example generates a numbered table of contents using a
  4814. JavaScript embedded in the `mydoc.html` output document:
  4815. $ asciidoc -a toc -a numbered mydoc.txt
  4816. |toc2 |html5, xhtml11 |
  4817. Adds a scrollable table of contents in the left hand margin of an
  4818. article or book document. Use the 'max-width' attribute to change the
  4819. content width. In all other respects behaves the same as the 'toc'
  4820. attribute.
  4821. |toc-placement |html5, xhtml11 |
  4822. When set to 'auto' (the default value) asciidoc(1) will place the
  4823. table of contents in the document header. When 'toc-placement' is set
  4824. to 'manual' the TOC can be positioned anywhere in the document by
  4825. placing the `toc::[]` block macro at the point you want the TOC to
  4826. appear.
  4827. NOTE: If you use 'toc-placement' then you also have to define the
  4828. <<X91,toc>> attribute.
  4829. |toc-title |html5, xhtml11 |
  4830. Sets the table of contents title (defaults to 'Table of Contents').
  4831. |toclevels |html5, xhtml11 |
  4832. Sets the number of title levels (1..4) reported in the table of
  4833. contents (see the 'toc' attribute above). Defaults to 2 and must be
  4834. used with the 'toc' attribute. Example usage:
  4835. $ asciidoc -a toc -a toclevels=3 doc/asciidoc.txt
  4836. |====================================================================
  4837. [appendix]
  4838. License
  4839. -------
  4840. AsciiDoc is free software; you can redistribute it and/or modify it
  4841. under the terms of the 'GNU General Public License version 2' (GPLv2)
  4842. as published by the Free Software Foundation.
  4843. AsciiDoc is distributed in the hope that it will be useful, but
  4844. WITHOUT ANY WARRANTY; without even the implied warranty of
  4845. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  4846. General Public License version 2 for more details.
  4847. AsciiDoc Highlighter sponsored by O'Reilly Media
  4848. Copyright (C) 2002-2011 Stuart Rackham.