open topic in merged chm file in master chm file window - chm

I would like to open topic in merged chm file in master chm file windows.
I have main chm file of application help. So this main chm file includes sub chm file. And I would like to open the topic in sub (merged) chm file in the window of main chm file by calling htmlhelp function.
The following is header file in main chm project.And operation\ACORD_geometry.chm is merged chm file. Now I'm using Adobe robohelp.
[ALIAS]
IDH_operation_geometry=operation\ACORD_geometry.chm:\HID_geometrytab_functions.htm
[MAP]
#define IDH_operation_geometry 9001
And I call htmlhelp function by following way. But The topic don't open. .\help\3DFEMGeo.chm is main chm file.
HtmlHelp(Application.Handle, '.\help\3DFEMGeo.chm', HH_HELP_CONTEXT, 9001);
Please teach me the way to open topic in the sub chm.

Creating modular help systems has some benefits by merging indexes and TOCs of multiple help projects, but overcoming the wall is difficult some times. Some parts of the following instructions have been posted many years ago by Sean Stagmer. For context-sensitive help see also content and links at the bottom:
http://www.help-info.de/en/Help_Info_HTMLHelp/hh_context-id.htm
Long story short (HTH - please try for your needs and environment):
// *** BEGIN CODE SNIPPET
...
HID_TOPIC_ID1="ms-its:Master.chm::/SubHelpSubject1.chm::/Topic_1.htm#Topic1"
HID_TOPIC_ID2="ms-its:Master.chm::/SubHelpSubject2.chm::/Topic_2.htm#Topic2"
...
// *** END CODE SNIPPET
And the stories long version:
RoboHelp e.g. and many other Help Authoring Tools (HAT's) are a IDE front end for utilizing the Microsoft HTML Help compiler (hhw.exe). The designers of RoboHelp's older versions did a pretty good job of separating the technical aspects of building an HTML compiled help file, but left out several features available if you used the underlying tool directly.
Specifically, modular help. I assume that most people who investigated this topic learned about adding the following to their help project file (the .hhp) to begin designing a modular HTML help system:
// *** BEGIN CODE SNIPPET
[MERGE FILES]
SubHelpSubject1.chm
SubHelpSubject2.chm
...
// *** END CODE SNIPPET
Now, tackling the subject of context-sensitive help AND merged files in a modular design adds a new twist: How can the topic ID be mapped to the appropriate merged HTML file? Being modular, the topic ID is not in the master/host help file, but is instead integrated into it through the merged sub-help project's .chm file. This is accomplished by placing the following code in the master/host master's TOC file:
// *** BEGIN CODE SNIPPET
...
<LI>
<OBJECT type="text/sitemap">
<param name="Name" value="SubHelpSubject1">
</OBJECT>
<OBJECT type="text/sitemap">
<param name="Merge" value="SubHelpSubject1.chm::\SubHelpSubject1.hhc">
</OBJECT>
<LI>
<OBJECT type="text/sitemap">
<param name="Name" value="SubHelpSubject2">
</OBJECT>
<OBJECT type="text/sitemap">
<param name="Merge" value="SubHelpSubject2.chm::\SubHelpSubject2.hhc">
</OBJECT>
...
// *** END CODE SNIPPET
With these two additions (the MERGE FILES statement and the addition to the TOC file) the correct resolving of topic id's to their help topic information is complete, EXCEPT that you notice that the HTML help window shows ONLY the TOC for the sub-help project it mapped to! The master/host TOC doesn't show up at all. What gives?
The answer lies in the alias file for the master/host project. Being a good little HTML help content developer, you knew to map the topic id of interest to the appropriate sub-help file by modifying the simple alias syntax like this:
// *** BEGIN CODE SNIPPET
...
HID_TOPIC_ID1=Topic_1.htm
HID_TOPIC_ID2=Topic_2.htm
...
// *** END CODE SNIPPET
...to this:
// *** BEGIN CODE SNIPPET
...
HID_TOPIC_ID1="ms-its:SubHelpSubject1.chm::/Topic_1.htm#Topic1"
HID_TOPIC_ID2="ms-its:SubHelpSubject2.chm::/Topic_2.htm#Topic2"
...
// *** END CODE SNIPPET
That little 'ms-its:' thing is very much like the 'http:' or 'ftp:' text you type into a web browser: it's known as an Asynchronous Pluggable Protocol from Microsoft. The '::/' portion of it is a reference; a kind of 'level of indirection' or 'reference alias' in C++ parlance. So, to solve the problem of having the context-sensitive help topic BOTH map to the correct help topic html text AND keep the TOC synchronized with the master, you must add an additional level of indirection to make it work, as shown below:
// *** BEGIN CODE SNIPPET
...
HID_TOPIC_ID1="ms-its:Master.chm::/SubHelpSubject1.chm::/Topic_1.htm#Topic1"
HID_TOPIC_ID2="ms-its:Master.chm::/SubHelpSubject2.chm::/Topic_2.htm#Topic2"
...
// *** END CODE SNIPPET
This can be read as meaning this: "When displaying the help topic HID_TOPIC_ID1 information, open Master.chm, then navigate to SubHelpSubject1.chm's HTML file Topic_1.htm, then move down the page to the bookmark Topic1."
Hooray! Your topic pops up, and the master/host TOC is visible as well!
Like thinking in C++ terms the alias file looks very much like how we would reference functionality in a C++ class:
Result = BaseClass::SubClass1::Subclass2::DoFunctionCall();
As a side note, this syntax is being replaced by XML - HTML help will reference a 'Collection' as specified in a collection file (.col), which has XML entries in it. Much easier to read and follow than the obtuse PERL-like syntax in the alias file.

Related

Include HTML files in R Markdown file?

Quick Summary
How do I place HTML files in place within an R Markdown file?
Details
I have created some nice animated choropleth maps via choroplethr.
As the link demonstrates, the animated choropleths function via creating a set of PNG images, which are then rolled into an HTML file that cycles through the images, to show the animation. Works great, looks great.
But now I want to embed / incorporate these pages within the .Rmd file, so that I have a holistic report including these animated choropleths, along with other work.
It seems to me there should be an easy way to do an equivalent to
Links:
[please click here](http://this.is.where.you.will.go.html)
or
Images:
![cute cat image](http://because.that.is.what.we.need...another.cat.image.html)
The images path is precisely what I want: a reference that is "blown up" to put the information in place, instead of just as a link. How can I do this with a full HTML file instead of just an image? Is there any way?
Explanation via Example
Let's say my choropleth HTML file lives in my local path at './animations/demographics.html', and I have an R Markdown file like:
---
title: 'Looking at the demographics issue'
author: "Mike"
date: "April 9th, 2016"
output:
html_document:
number_sections: no
toc: yes
toc_depth: 2
fontsize: 12pt
---
# Introduction
Here is some interesting stuff that I want to talk about. But first, let's review those earlier demographic maps we'd seen.
!![demographics map]('./animations/demographics.html')
where I have assumed / pretended that !! is the antecedent that will do precisely what I want: allow me to embed that HTML file in-line with the rest of the report.
Updates
Two updates. Most recently, I still could not get things to work, so I pushed it all up to a GitHub repository, in case anyone is willing to help me sort out the problem. Further details can be found at that repo's Readme file.
It seems that being able to embed HTML into an R Markdown file would be incredibly useful, so I keep trying to sort it out.
(Older comments)
As per some of the helpful suggestions, I tried and failed the following in the R Markdown file:
Shiny method:
```{r showChoro1}
shiny::includeHTML("./animations/demographics.html")
```
(I also added runtime:Shiny up in the YAML portion.)
htmltools method:
```{r showChoro1}
htmltools::includeHTML("./animations/demographics.html")
```
(In this case, I made no changes to the YAML.)
In the former case (Shiny), it did not work at all. In fact, including the HTML seemed to muck up the functionality of the document altogether, such that the runtime seemed perpetually not-fully-functional. (In short, while it appeared to load everything, the "loading" spindel never went away.)
In the latter case, nothing else got messed up, but it was a broken image. Strangely, there was a "choropleth player" ribbon at the top of the document which would work, it's just that none of the images would pop up.
For my own sanity, I also provided simple links, which worked fine.
[This link](./animations/demographics.html) worked without a problem, except that it is not embedded, as I would prefer.
So it is clearly a challenge with the embedding.
Here is a hack (probably inelegant)...idea is to directly insert HTML programmatically in Rmd and then render Rmd.
temp.Rmd file:
---
title: "Introduction"
author: "chinsoon12"
date: "April 10, 2016"
output: html_document
---
<<insertHTML:[test.html]
etc, etc, etc
```{r, echo=FALSE}
htmltools::includeHTML("test.html")
```
etc, etc, etc
test.html file:
<html>
<head>
<title>Title</title>
</head>
<body>
<p>This is an R HTML document. When you click the <b>Knit HTML</b> button a web page will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:</p>
<p>test test</p>
</body>
</html>
verbose code to replace Rmd code with HTML code and then render (can probably be shortened by a lot)
library(stringi)
subHtmlRender <- function(mdfile, htmlfile) {
#replace <<insertHTML:htmlfile with actual html code
#but without beginning white space
lines <- readLines(mdfile)
toSubcode <- paste0("<<insertHTML:[",htmlfile,"]")
location <- which(stri_detect_fixed(lines, toSubcode) )
htmllines <- stri_trim(readLines(htmlfile))
#render html doc
newRmdfile <- tempfile("temp", getwd(), ".Rmd")
newlines <- c(lines[1:(location-1)],
htmllines,
lines[min(location+1, length(lines)):length(lines)]) #be careful when insertHTML being last line in .Rmd file
write(newlines, newRmdfile)
rmarkdown::render(newRmdfile, "html_document")
shell(gsub(".Rmd",".html",basename(newRmdfile),fixed=T))
} #end subHtmlRender
subHtmlRender("temp.Rmd", "test.html")
EDIT: htmltools::includeHTML also works with the sample files that I provided. Is it because your particular html does not like UTF8-encoding?
EDIT: taking #MikeWilliamson comments into feedback
I tried the following
copied and pasted animated_choropleth.html into a blank .Rmd
remove references to cloudfare.com as I had access issues while
rendering (see below)
knit HTML
put back those cloudfare weblinks
put the graphs in the same folder as the rendered html
open the HTML
I appear to get back the html but am not sure if the result is what you expect
Are you also facing the same issue in pt 2? You might want to post the error message and ask for fixes :). This was my error message
pandoc.exe: Failed to retrieve http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/css/bootstrap.min.css
FailedConnectionException2 "cdnjs.cloudflare.com" 80 False getAddrInfo: does not exist (error 11001)
Error: pandoc document conversion failed with error 61
Did you try the includes: option in your YAML header?
https://rmarkdown.rstudio.com/html_document_format.html#includes
But maybe you'll have the same problem I have: I'd like to include the HTML file in a specific section in my RMarkdown document, not in the header or before/after body.
can try put this line in the Rmarkdown and then knit.
(YAML header "output: html_document"; if "runtime: shiny" somehow it does not work)

How can I add a new category to a morea site?

I'm trying to add a new 'project' category to a morea based site, where there will be a page similar to experiences page where I'll collect all course project related experiences and assignments, and maybe even modules.
Is it ok to look for pages with 'project' in their id or maybe better to tag with a new morea tag?
Do I need to also create a new entity type called 'project' or just reuse existing entities
In MoreaGeneraor.rb I couldn't find where module level page collections are prepared, like for example module_page.data['morea_experiences'].
I thought of preparing a similar collection of 'morea_project' pages and then traversing it in the new project page.
Is that done outside of this .rb file? by Jekyll? so how do I inject my collection.
Any simpler idea?...
Thank
p.s. I've also added the following (from line 3) to 'processMoreaFile()', but it does not seem to be visible at later stages:
elsif new_page.data['morea_type'] == "assessment"
site.config['morea_assessment_pages'] << new_page
if new_page.data['morea_id'].include?('project')
site.config['morea_project_pages'] << new_page
puts "--- project page #{new_page.data['morea_id']}\n "
end
but still do not know where to let each module page find out about it's 'project' pages
This is a cool idea. The simplest approach is to avoid making changes to MoreaGenerator.rb, and instead do it using normal Jekyll mechanisms. Here's a sketch:
Add a morea_label called "Project" to each associated module, reading, experience, and assessment.
In master/src, create a new directory called project, containing a file called index.md. This adds a new top-level page to your site (i.e. http://example.com/ics101/project/index.html)
Implement the index.md file with liquid tags to create the desired page layout for your project page. For inspiration, see the index.md files in the other top-level pages (readings, experiences, etc.). You can access YAML content in Liquid.
Once you've got your rocking project page done, you'll want a link to it in the navbar. See add a menu item for instructions.
Good luck! If you get it working to your satisfaction, please post its link as a followup to this question so we can see how it turned out!

What is the correct way to express a path in order to get Pelican generated html to link to an image?

I'm just starting to create a blog with Pelican and wanted to link to an image. I did this by including the following line in my Markdown file:
<img src="./myImg1a.png" alt="./myImg.png" style="width: 750px; height: 800px;"/>
This line was successfully reproduced in the html file, which Pelican placed in the output directory (i.e. /myBlog/output). I placed the png files in the output directory (i.e. the same directory as the html files and got the following error:
WARNING:root:Unable to find file /category/myImg1a.png/index.html or variations.
where /category refers to myBlog/output/category. When I, instead, used the following html code:
<img src="/myImg1a.png" alt="/myImg.png" style="width: 750px; height: 800px;"/>
everything worked fine. I don't understand why this should be:
If the image file is in the same directory as the html file, shouldn't "./myImg1.png" be correct and "/myImg.png" be incorrect?
Why was the folder /category/myImg1a.png/index.html being sought at all?
First of all, by design, you should not change the contents of the output directly/manually.
You should put all your static contents in separate directory which is usually named as images or paths. And, then configure the path(s) in pelicanconf.py as:
# ...
PATH = 'content'
STATIC_PATHS = ['images', 'files'] # add any no. of locations
# ...
In that case, when Pelican is building actual page, it will look for any referenced static file in ./content/images and ./content/files locations. If cannot find there, it will emit the error message.
Now, answering to your trouble ...
By,
... src="./myImg1a.png" ...
Pelican look for this myImg1a.png file in your myBlog/content/ folder as you are mentioning ./ which is the root folder for Pelican is working on.
But, when you are referring it as
... src="/myImg1a.png" ...
Pelican eventually finds it in the html file's directory. By getting / as location, Pelican is looking for it in the same directory of your myblog/my-blog-post/index.html which is myblog/my-blog-post/.
Hence, working. But not in the ideal way.
For a deeper understanding, please take a look into Pelican's documentation on this matter.
Why was the folder /category/myImg1a.png/index.html being sought at all?
Pelican, here, just trying to be smart.

F# FSharp.Literate formatted code snippet does not display correctly (.css & .js?)

I'm trying to use FSharp.Literate to produce html pages. I'm working in Xamarin using Mono 4.5. I want to turn basic *.fsx scripts into html. I am using the simple script example from the documentation for tests. The script I wish to turn into html looks like this.
(**
# First-level heading
Some more documentation using `Markdown`.
*)
(*** include: final-sample ***)
(**
## Second-level heading
With some more documentation
*)
(*** define: final-sample ***)
let helloWorld() = printfn "Hello world!"
I used the built in NuGet manager to download FSharp.Formatting. It also installed Microsoft.AspNet.Razor 2 and RazorEngine
Based on the example in the documentation, I wrote the following script to turn the above example into html. I'm using the html template from the original FSharp.Formatting on github.
#I "bin/Debug/"
#r "FSharp.Literate.dll"
#r "FSharp.Markdown.dll"
#r "FSharp.CodeFormat.dll"
open System.IO
open FSharp.Literate
let source = __SOURCE_DIRECTORY__
let baseDir = Path.Combine(source, "html/")
let file = Path.Combine(baseDir, "demo.fsx")
let output = Path.Combine(baseDir, "demo-script.html")
let template = Path.Combine(baseDir, "template.html")
Literate.ProcessScriptFile(file, template, output)
The process runs and it does produce an html file. However, the F# code does not tokenize. Instead of nicely formatted code, I get the example below. Am I missing something obvious?
Edit:
Based on Tomas' comment below, I found the problem with the .css and .js files.
The template I used had href="{root}/content/style.css" /> <script src="{root}/content/tips.js"
The {root} tag was the reason it could not find the css and js files.
Changing that to href="content/style.css" /> <script src="content/tips.js" solved the problem
I think the library actually produced the correct HTML. As you can see at the end of the file, the content that should appear in the tool tips (information about the type of helloWorld and printfn) is there.
The problem is likely that the generated HTML file does not correctly reference tips.js and style.css that defines the formatting for the HTML and script to pop-up the tool tips.
These two files should be included in the NuGet package (together with the default templates), or you can find them on the project GitHub.

Showing HTML reports in CruiseControl dashboard

I have been looking into CruiseControl configuration recently (I'm a complete CC noob) and so far I understand that various XML reports generated by your build process (eg mbunit.xml, ncover.xml, fxcop.xml) can be shown in the dashboard by adding a reference to the xml to the following part of the ccnet.config:
<publishers>
<merge>
<files>
<file>logs\some-report.xml</file>
</files>
</merge>
</publish>
adding an xsl file to transform the xml into presentable html and adding a report build plugin to dashboard.config which references the xsl:
<xslReportBuildPlugin description="Some report"
actionName="SomeReportAction" xslFileName="xsl\some-report.xsl" />
My question is: if I have some reports (code documentation generated by JGregory's Docu and test specs generated by jpboodhoo's Bdddoc) which are pure HTML, is there any way I can show these in the dashboard in a similar way? I can't figure this out. I did think of adding an ExternalLink directly to the HTML page, but this is in a protected area which users normally cant access. Anyone any ideas?
Currently this is not possible in CruiseControl.NET up to version 1.4.4. However this functionality is being added as part of version 1.5.0.
We can't give you a timeframe on the release yet, but you can download and try out the latest version from http://ccnetlive.thoughtworks.com/CCNet-builds/1.5.0/.
Craig
As craig already mentioned this functionality was added in CCNet 1.5, you'll find the documentation about the HtmlPlugin here: http://cruisecontrolnet.org/projects/ccnet/wiki/HtmlReportPlugin