| | 102 | end |
| | 103 | |
| | 104 | |
| | 105 | function docparrstmarkupparser::_processLink, text, reference=reference |
| | 106 | compile_opt strictarr |
| | 107 | |
| | 108 | tokens = stregex(text, '(.*) <(.*)>', /extract, /subexpr) |
| | 109 | |
| | 110 | if (tokens[0] eq '') then begin |
| | 111 | reference = '' |
| | 112 | return, text |
| | 113 | endif |
| | 114 | |
| | 115 | link_text = tokens[1] |
| | 116 | reference = tokens[2] |
| | 117 | |
| | 118 | return, link_text |
| | 119 | end |
| | 120 | |
| | 121 | |
| | 122 | ;+ |
| | 123 | ; Handle inline markup like emphasis, bold, and links. |
| | 124 | ; |
| | 125 | ; :Params: |
| | 126 | ; para : in, required, type=MGtmTag object |
| | 127 | ; current paragraph |
| | 128 | ; line : in, required, type=string |
| | 129 | ; current line |
| | 130 | ;- |
| | 131 | pro docparrstmarkupparser::_processInlines, para, line |
| | 132 | compile_opt strictarr |
| | 133 | |
| | 134 | tokens = strsplit(line, '`', /extract, /preserve_null, count=ntokens) |
| | 135 | |
| | 136 | ; always should have the first element |
| | 137 | para->addChild, obj_new('MGtmText', text=self->_processText(tokens[0])) |
| | 138 | |
| | 139 | for i = 0L, ntokens / 2L - 1L do begin |
| | 140 | link_text = self->_processLink(tokens[2 * i + 1], reference=reference) |
| | 141 | |
| | 142 | tag = obj_new('MGtmTag', type='link') |
| | 143 | tag->addAttribute, 'reference', reference |
| | 144 | para->addChild, tag |
| | 145 | |
| | 146 | tag->addChild, obj_new('MGtmText', text=link_text) |
| | 147 | |
| | 148 | if (2 * i + 2 lt ntokens) then begin |
| | 149 | para->addChild, obj_new('MGtmText', $ |
| | 150 | text=self->_processText(tokens[2 * i + 2])) |
| | 151 | endif |
| | 152 | endfor |
| | 153 | |
| | 154 | para->addChild, obj_new('MGtmTag', type='newline') |
| 266 | | if (cleanline ne '') then begin |
| 267 | | para->addChild, obj_new('MGtmText', $ |
| 268 | | text=self->_processText(cleanline, code=code)) |
| 269 | | para->addChild, obj_new('MGtmTag', type='newline') |
| | 321 | if (cleanline ne '') then begin |
| | 322 | self->_processInlines, para, cleanline |