equal
deleted
inserted
replaced
80 def theory_by_file(session: String, file: String): Option[Document_Info.Theory] = |
80 def theory_by_file(session: String, file: String): Option[Document_Info.Theory] = |
81 document_info.theory_by_file(session, file) |
81 document_info.theory_by_file(session, file) |
82 |
82 |
83 def session_dir(session: String): Path = |
83 def session_dir(session: String): Path = |
84 root_dir + Path.explode(sessions_structure(session).chapter_session) |
84 root_dir + Path.explode(sessions_structure(session).chapter_session) |
|
85 |
|
86 def theory_dir(theory: Document_Info.Theory): Path = |
|
87 session_dir(theory.dynamic_session) |
85 |
88 |
86 def theory_html(theory: Document_Info.Theory): Path = |
89 def theory_html(theory: Document_Info.Theory): Path = |
87 { |
90 { |
88 def check(name: String): Option[Path] = { |
91 def check(name: String): Option[Path] = { |
89 val path = Path.explode(name).html |
92 val path = Path.explode(name).html |
190 theory_name: String, |
193 theory_name: String, |
191 file_name: String, |
194 file_name: String, |
192 node_dir: Path, |
195 node_dir: Path, |
193 ): Node_Context = |
196 ): Node_Context = |
194 new Node_Context { |
197 new Node_Context { |
195 private val session_dir = context.session_dir(session_name) |
|
196 |
|
197 private val seen_ranges: mutable.Set[Symbol.Range] = mutable.Set.empty |
198 private val seen_ranges: mutable.Set[Symbol.Range] = mutable.Set.empty |
198 |
199 |
199 override def make_def(range: Symbol.Range, body: XML.Body): Option[XML.Elem] = |
200 override def make_def(range: Symbol.Range, body: XML.Body): Option[XML.Elem] = |
200 body match { |
201 body match { |
201 case List(XML.Elem(Markup("span", List("id" -> _)), _)) => None |
202 case List(XML.Elem(Markup("span", List("id" -> _)), _)) => None |
220 override def make_ref(props: Properties.T, body: XML.Body): Option[XML.Elem] = { |
221 override def make_ref(props: Properties.T, body: XML.Body): Option[XML.Elem] = { |
221 props match { |
222 props match { |
222 case Theory_Ref(thy_name) => |
223 case Theory_Ref(thy_name) => |
223 for (theory <- context.theory_by_name(session_name, thy_name)) |
224 for (theory <- context.theory_by_name(session_name, thy_name)) |
224 yield { |
225 yield { |
225 val html_path = session_dir + context.theory_html(theory) |
226 val html_path = context.theory_dir(theory) + context.theory_html(theory) |
226 val html_link = HTML.relative_href(html_path, base = Some(node_dir)) |
227 val html_link = HTML.relative_href(html_path, base = Some(node_dir)) |
227 HTML.link(html_link, body) |
228 HTML.link(html_link, body) |
228 } |
229 } |
229 case Entity_Ref(def_file, kind, name) => |
230 case Entity_Ref(def_file, kind, name) => |
230 def logical_ref(theory: Document_Info.Theory): Option[String] = |
231 def logical_ref(theory: Document_Info.Theory): Option[String] = |
241 for { |
242 for { |
242 theory <- context.theory_by_file(session_name, def_file) |
243 theory <- context.theory_by_file(session_name, def_file) |
243 html_ref <- logical_ref(theory) orElse physical_ref(theory) |
244 html_ref <- logical_ref(theory) orElse physical_ref(theory) |
244 } |
245 } |
245 yield { |
246 yield { |
246 val html_path = session_dir + context.smart_html(theory, def_file) |
247 val html_path = context.theory_dir(theory) + context.smart_html(theory, def_file) |
247 val html_link = HTML.relative_href(html_path, base = Some(node_dir)) |
248 val html_link = HTML.relative_href(html_path, base = Some(node_dir)) |
248 HTML.entity_ref(HTML.link(html_link + "#" + html_ref, body)) |
249 HTML.entity_ref(HTML.link(html_link + "#" + html_ref, body)) |
249 } |
250 } |
250 case _ => None |
251 case _ => None |
251 } |
252 } |