3 * Copyright (C) 2008-2009 Didier Villevalois
4 * Copyright (C) 2008-2014 Florian Brosch
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 * Didier 'Ptitjes Villevalois <ptitjes@free.fr>
25 public class Valadoc
.Content
.Link
: InlineContent
, Inline
{
32 * Used by importers to transform internal URLs
34 public Importer
.InternalIdRegistrar id_registrar
{
44 public override void configure (Settings settings
, ResourceLocator locator
) {
47 public override void check (Api
.Tree api_root
, Api
.Node container
, string file_path
,
48 ErrorReporter reporter
, Settings settings
)
51 // Internal gktdoc-id? (gir-importer)
52 if (id_registrar
!= null) {
53 Api
.Node? node
= id_registrar
.map_symbol_id (url
);
55 InlineContent _parent
= parent as InlineContent
;
56 assert (_parent
!= null);
58 SymbolLink replacement
= new
SymbolLink (node
);
59 replacement
.content
.add_all (content
);
61 replacement
.check (api_root
, container
, file_path
, reporter
, settings
);
62 _parent
.replace_node (this
, replacement
);
67 string _url
= id_registrar
.map_url_id (url
);
69 string node_segment
= (container is Api
.Package
)?
"" : container
.get_full_name () + ": ";
70 reporter
.simple_warning ("%s: %s[[".printf (file_path
, node_segment
),
71 "unknown imported internal id '%s'", url
);
73 InlineContent _parent
= parent as InlineContent
;
74 assert (_parent
!= null);
76 Run replacement
= new
Run (Run
.Style
.ITALIC
);
77 replacement
.content
.add_all (content
);
78 replacement
.check (api_root
, container
, file_path
, reporter
, settings
);
80 _parent
.replace_node (this
, replacement
);
89 base.check (api_root
, container
, file_path
, reporter
, settings
);
92 public override void accept (ContentVisitor visitor
) {
93 visitor
.visit_link (this
);
96 public override bool is_empty () {
100 public override ContentElement
copy (ContentElement? new_parent
= null) {
101 Link link
= new
Link ();
102 link
.id_registrar
= id_registrar
;
103 link
.parent
= new_parent
;
106 foreach (Inline element
in content
) {
107 Inline copy
= element
.copy (link
) as Inline
;
108 link
.content
.add (copy
);