Syntax highlighting of moin

= contributing to moin - a shy developer story =

== getting set up ==

=== weechat and screen ===

[[https://www.linode.com/docs/guides/using-weechat-for-irc/|linode weechat doc]]

[[https://libera.chat/|libera IRC chat server home page]]

=== github ===

setup: fork, set up github auth & clone

development process: branch, code, test, commit, push, create pull request

== diving into the code ==

=== understanding moin.utils.tree ===

[[WikiPedia:QName]]

[[https://developer.mozilla.org/en-US/docs/Web/SVG/Namespaces_Crash_Course|svg namespace crash course]]

{{{#!highlight python
from moin.converters._tests import serialize
from emeraldtree import ElementTree as ET
from moin.utils.tree import moin_page, html, dc, mathml, svg, xinclude, xlink, docbook, xml

def dump(el):
  namespaces = {
    moin_page : 'moin_page',
    html: 'xhtml',
    dc : 'dc',
    mathml: 'mathml',
    svg: 'svg',
    xinclude: 'xinclude',
    xlink: 'xlink',
    docbook: 'docbook',
    xml: 'xml',
  }
  print(f'{serialize(el, namespaces=namespaces)}')

html.p == ET.QName('p', 'http://www.w3.org/1999/xhtml')

n = html.p
n.name
n.uri

el1 = ET.Element(html.p)
el2 = html.p()
el1 == el2
el1.tag == el2.tag

elp = html.p()
elp.append('hello world ')
elp.text
dump(elp)

ela = html.a()
ela.set(html.href, 'page.html')
dump(ela)

elp.append(ela)
elp.append(' more text')
dump(elp)

}}}

=== image src atttribute ===

starting with this moinwiki on /my_page:



moinwiki_in.Converter.__call__ -> 

   {{{ 
   <moin_page:page>
     <moin_page:body>
       <moin_page:p>
         <xinclude:include xhtml:alt="photo" xhtml:width="80%" xinclude:href="wiki.local:/photo.jpg?" />
       </moin_page:p>
     </moin_page:body>
   </moin_page:page>
   }}}

content.Content.internal_representation adds page_href to the top level element:

   {{{
   <moin_page:page moin_page:page-href="wiki:///my_page">
     <moin_page:body>
       <moin_page:p>
         <xinclude:include xhtml:alt="photo" xhtml:width="80%" xinclude:href="wiki.local:/photo.jpg?" />
       </moin_page:p>
     </moin_page:body>
   </moin_page:page>
   }}}

content._expand_document -> include.Converter.__call__ converts xinclude:include to moin_page.object with moin_page.type and xlink:href, retaining the xinclude:href
  \_ mark_item_as_transclusion adds data_href and xhtml:class to the moin_page

   {{{
   <moin_page:p>
     <moin_page:page moin_page:page-href="wiki:///my_page/photo.jpg" xhtml:class="moin-transclusion" xhtml:data-href="/my_page/photo.jpg">
       <moin_page:body>
         <moin_page:object moin_page:type="image/jpeg" xhtml:alt="photo" xhtml:width="80%" xlink:href="wiki:///my_page/photo.jpg?do=get&amp;rev=521f309c038c4ce7b8670371ac60335b" xinclude:href="wiki.local:/photo.jpg?">my_page/photo.jpg</moin_page:object>
     </moin_page:body>
   </moin_page:page>
   }}}