nested styles xml

Me again, but as everyone seems to be motivated, will try my supplementary question

You have any advice or managed resources nested Styles to Xml?

For example:

italic/bold text italic text bold text

If I am first marking italic tag just "BOLD", the result will be:

< i > italic text < /i > < b > text in italic/bold text in "BOLD" < /b > (and it is of course not what I need!)

So, you are looking for ideas for:

  1. Find a style (it's ok with findText)
  2. test if an xml tag is already applicable on all or part of the findText result
  3. Otherwise, apply the xml tag
  4. If so, find where the 2 styles are both present and apply to all the two and where only the new is apply and him only to find
  5. start over from 1 to all the additional styles
  6. not with 2000 lines of code

The goal is to get:

< i > text in italics/i <>< i > < b > bold/italic text < /b > < / i > < b > bold < /b >

I know I will get crazy, but it's for a good cause

Crazy life

By combining and adapting the different ideas of Uwe (. + grep search) and Ariel (function backToNoStyle), I found a pretty easy fix. Need to test more but first try to make sure that it is stable work.

Here is the code for those who are interested. I just give the "Italic" part but copy/paste (or better put in a loop) the lines in bold to manage other properties (smallcaps, exhibitor...).

The basic idea is to remove the formatting all the markers of tags you add. In doing so, the findGrep results are cut into large pieces that cannot have multiple nested styles.

function caraToXml() {
    app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
    app.findChangeTextOptions.caseSensitive = false;
    app.findChangeTextOptions.includeFootnotes = app.findChangeGrepOptions.includeFootnotes = false;
    app.findChangeTextOptions.includeHiddenLayers = false;
    app.findChangeTextOptions.includeLockedLayersForFind = false;
    app.findChangeTextOptions.includeLockedStoriesForFind = false;
    app.findChangeTextOptions.includeMasterPages = false;
    app.findChangeTextOptions.wholeWord = false;
    // italic conversion
    // need to be developed for other styles
    // pay attention to nested xml tags problems
    app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
    app.findGrepPreferences.findWhat = ".+";
    app.findGrepPreferences.fontStyle = "Italic";
    var myFindTexts = myDoc.findGrep();
    var myShift = 0;
    if (myFindTexts.length > 0) {
        for (var j = 0; j < myFindTexts.length; j++) {
            var myText = myFindTexts[j];
            var myStartIndex = myText.characters[0].index;
            var myEndIndex = myText.characters[-1].index;
            myXmlElement = myXmlElement.xmlElements.add({markupTag:"i", xmlContent:myText});
            myXmlElement = myXmlElement.parent;
            backToNoStyle(myText.parent.characters[myStartIndex]);
            backToNoStyle(myText.parent.characters[myEndIndex+ 2 + myShift]);
            myShift+=2;
        }
    }
}

//
function backToNoStyle(xmlMarker) {
    xmlMarker.fontStyle = "Regular";
    xmlMarker.capitalization = Capitalization.NORMAL;
    xmlMarker.position = Position.NORMAL;
    xmlMarker.underline = false;
    xmlMarker.strikeThru = false;
}

Tags: InDesign

Similar Questions

  • Do tabs in a paragraph based on a style where a nested style ends

    Hello world

    I work at a list containing "BOLD" leaders using a nested style. I want to do is have my line of plaintext upward with the line above. However, I can't just create a regular in the style tab because my "BOLD" leaders are of different lengths.

    Is it possible to configure the paragraph style so that the text on the line under the first line indentera to where the light text has started on the first line?

    Screen Shot 2016-08-23 at 12.13.52 PM.png

    In the above example, I want my text on the second line indented for where is the red line. Note that the "BOLD" leadership in each paragraph are of different lengths. I know that this can be done manually, but I want to try to do this with a paragraph style.

    Please notify.

    Thank you all!

    Not with a style of paragraph, but you could use find and replace to add an indicator of withdrawal here after the colon and space.

    Which would allow all of your paragraphs to keep the same style, but move your withdrawal based on the implementation of this marker in each element.

    No need to tab stops.

  • How can I configure nested style None?

    Hello.

    I have a paragraph style, which contains two nested styles (char).

    var psBody = myDocument.paragraphStyles.add({  
        name: "ps Body",
        appliedFont: "Cambria",  
        fontStyle: "Bold",  
        pointSize: 24,  
        justification: Justification.centerAlign,
        keepWithNext:1});
        psBody.nestedStyles.add({
            appliedCharacterStyle: ,//<=============
            delimiter: NestedStyleDelimiters.anyWord,
            inclusive: true,
            repetition: 1});
        psBody.nestedStyles.add({
            appliedCharacterStyle: csBlue,
            delimiter: NestedStyleDelimiters.anyWord,
            inclusive: true,
            repetition: 1});
    

    How can I 'say' I want my first style nested to be none?

    Any help would be appreciated

    Hello

    It's a simple way to set to [None] without dependence on the locale.

        psBody.nestedStyles.add({
            appliedCharacterStyle: "$ID/[No Character Style]",
            delimiter: NestedStyleDelimiters.anyWord,
            inclusive: true,
            repetition: 1});
    

    Thank you

    mg.

  • Drop caps and nested Styles does not

    For reasons that escape me, it seems, the drop caps and Nested styles does not work for me. I am confident, I have followed the correct steps of there exactly: Nested styles to heavy users. Adobe InDesign tutorials CC

    Yet somehow the style preview and paragraph simply do nothing for me.

    I wonder what I'm missing.

    NestedStyles_NotWorking.JPG

    You have manually applied 1 character Style to the whole paragraph. THT is a priority.

  • Nested style help

    I want a header style that is a character style for however many words is typed, then a space, then a rule that fills the rest of the column. I tried several ways, but I can't make it work. The rule ends up being visible through it all.

    Instead of nested styles, this can be done with nets of paragraph. Rule here is paper, rule above is the color of the text (or whatever color you want). Adjust the size of the rule and the offsets to work with your text size.  (this example has been 40 pt)

     

  • Nested style Nested Grep for the last 2 words

    Hi all

    I'm under InDesign CS6 on Mac.

    I am trying to create a style for a header so that two last words of position have a designated character style (i.e. position is written in light character and last two words of it are in bold). So that I can return the nested style, and by adding the command end nested Style here to each topic, I prefer something more automatic. The only similar to that post was dated 2008 and it was for CS3. Not to mention it was a script. Not a lot of help.

    Thank you for your time.

    Can't wait to hear a solution on your part.

    Sincerely yours.

    Sebastian

    The last two words in a paragraph matches the grep expression:

    (\S+)\s(\S+)$

    \s whitespace

    \S a space that is not

    $ end of paragraph

    in other words, a series of spaces that are not followed by a space followed by a string of nowheres at end of paragraph.

    Peter

  • Create Styles... and then the nesting styles

    Seems simple enough:

    say application "Adobe InDesign CS5.5.

    say active document

    put myCharacterStyle to do style of characters with properties {name: 'Year', size: 26.0, fill color: 'Paper', race color: 'Black', race weight: 0.75, fonts: "Helvetica" font style: "Black"}

    put myCharacterStyle to do style of characters with properties {name: "Years", size: 18.0, fill color: 'Black', line color:nothing, weight:race nothing, horizontal scale: 80.0, vertical scale: 80.0, fonts: "Helvetica", font style: "Black"}

    put myParagraphStyle to do paragraph style with property {name: 'Year'}

    put nested styles of myParagraphStyle to {{applied the character style: 'Year', rehearsal: 1, false inclusive: delimiter:any word}, {applied the character style: "Years", rehearsal: 2, inclusive true: delimiter:any word}}

    end tell

    end tell

    The police and the point size do not come through when the style is created. Nested styles are not as through.

    I tried the applied policies: "Helvetica" to get "font family is not available. Also: font 'Helvetica '...

    What I get just now I is no defined font or size. The rest works.

    So what I'm doing wrong here?


    Hi lithodora.

    as Mary Posner wrote a character style has the property 'do', but 'applied police' and 'make-style ".

    «... specified as font family name or an object are.»

    just look it up in the dictionary...

    Always try to work with references.

    Tell application "Adobe InDesign CS5.5"

    -You need to myHelvetica your needs!

    Set myHelveticas to (font family of each font whose name contains "Helvetica") - returns the helvetica font family names

    myHelvetica defined in article 1 of the myHelveticas - just choose randomly one for my example, in the hope there is a 'black' style ;-)...

    tell the active document

    myCharacterStyle01 to style character with the properties the value {name: 'test', size: 26.0, fill color: 'Paper', race color: 'Black', accident stroke weight: 0.75, applied the police: myHelvetica, font style: "Black"}

    myCharacterStyle02 to style character with the property value {name: 'tests', size: 18.0, fill color: 'Black', race color: nothing, stroke cerebral weight: nothing, horizontal scale: 80.0 vertical scale: 80.0, applied the police: myHelvetica, font style: "Black"}

    myParagraphStyle to style of paragraph with the properties the value {name: 'nextTest'}

    say myParagraphStyle

    do new style nested with properties {applied the character style: myCharacterStyle01, repetition: 1, included: false, delimiter: any word}

    do new style nested with properties {applied the character style: myCharacterStyle02, repeat: 2, inclusively: true, delimiter: any word}

    tell the end

    tell the end

    tell the end


  • Can I use "no pause" as a nested style?

    I have a long paragraph which is nothing other than the names of people, separated by commas. I don't want the names to break, so I created a character called "No Break" Style and I can choose a name and apply it to this name. But I prefer not to go through the whole paragraph and select all the names, and then apply the style. So, I try to understand how to use a nested Style. I chose my style No. Break character through a ',' (comma) and then I'm trying to use a nested Style to repeat, but when I do that, the whole paragraph gets in excess.

    What Miss me? Is there a better way to do this?

    It's an interesting thing. I use not Nested styles to do the same thing, I use a GREP style, but the principle is the same I guess.

    What I do is set the * entire * paragraph No. break, in the context of the paragraph style. Then I create a character called "No No. Break" style (for obvious reasons; it has * no * "No Break" selected) and apply it to comma-space using a GREP style. I think you can use a Style nested in the same way, but if not, you can use the GREP style.

  • GREP to select lowercase until an em-space. Complex nested styles

    I try a complex search grep in combination with a nested style. I would like to apply a style nested up to an em space (it's easy, and I managed.) but then I need to do a GREP only small letters preceding the em-space, and which is difficult, if not impossible. Can you enlighten us?

    I build styles of paragraph and character for a book. Our 4 - heads appear in two styles: 1) on a line by itself and 2) as a response to a paragraph of text. the line by itself is no problem, and the para-style and tank styles nested apply small capitals without intervention. Small capitals are defined as a tank-style 85% green/horiz sizing so that we maintain control of sizing; to use applications preferences could introduce several sizes of Cap with several people doing layout work.

    example-grep-problem.jpg

    When I get the Run-in version (shown above with no small capitals applied) I can use nested styles to apply the bold italic, but then I must be able to apply selectively small capitals. I was intending to do this using a GREP style to select only the lowercase letters of beginning of paragraph to em-space, but I am struggling to achieve.

    • Using a positive postanalyse, I can choose the \l+ in the single word that immediately precedes the em space, but not on all THE words before the em-space.
    • Using a nested style expandable, I can't ignore the first letters of each word, but then it continues beyond the em-space.

    Is there a GREP that can do the following?

    Beginning with the new paragraph ^.

    Select only the characters in tiny \l+

    and apply a character style

    ending the first em-space

    Or am I stuck do a find/replace (which is only semi automated)?

    Try this:

    \l+(?=.*~m)

    I think that your 'start of the paragraph' is not serious--unless, that is, there may be more than one em space in a single paragraph.

  • Problem with nested styles

    Relatively new user of InDesign tries to follow the instructions contained in the help files on creating nested styles, and something weird is happening that I can't understand.

    The goal: create a paragraph for paragraph style, after a break from the scene in a novel with no hyphen and the first [number] of words in capital letters.

    I have the paragraph style and the character in the format style. Each style individually works as expected. But when I select the Style Options > drop caps and Styles nested > new Style nested > choose the character style > via > 4 words > OK, the paragraph begins with the first three words in the normal case and caps are applied to the four words of the first line. Nothing I've tried puts the caps at the beginning of the paragraph and begins to count the number of words from there.

    I'd appreciate any help to ease my frustration. Thank you.

    Tosh

    OK, Peter responded before me in a few seconds, I guess.

    Thank you, Peter

  • Nested style were not applied

    In InDesign CS4 (6.0.6) I have a problem with nested styles, returning to the main paragraph style. The nested style is set to apply for a period, but it's randomly switch back on the font used in the paragraph style. Some paragraphs have the nested style applied and others do not (see table).  Unknown yet, the paragraph Styles Panel does not show the substitutions to the style (or is erase replacements an option in the dialog box) but if I option click on the style, the number will return to its true nested state.

    I thought it might be a conflict of fonts, but I already checked the editors of machines (we have an InCopy workflow) as well as mine and nobody has no substitute fonts in use.

    Is this a known bug? Anyone had this problem before? We had this question pop up at random before but never this close a date press option so usually just click on even though we do not know how it goes. We're a little freaked out. Any help would be appreciated.

    Screen shot 2012-02-09 at 1.10.54 PM.png

    Screen shot 2012-02-09 at 1.15.54 PM.png

    Screen shot 2012-02-09 at 1.16.07 PM.png

    Out of curiosity, I decided to do a search/replace for the STAGE of paragraph Style RECIPE and replaced by the STAGE of RECIPE of paragraph Style. Interestingly, I've corrected in fact the nested style when I would click on change. It makes me wonder if something in InDesign was not recognizing as paragraphs with this style applied?

    For the purposes of closure, I'll mark the thread as answered, even if we discover the technical problem at the origin of the problem. In my opinion, is just a bug (not a feature).

  • Problems with nested Styles

    I am creating a style nested in copy CS5. What I want to do is to create the first few words with a certain style of character, then get back on the paragraph style setting. I have the nested style set to end with the end nested style here special character, but it seems to stay in the format of the nested little style matter what I do.

    Any suggestions?

    Just create the nested style to use the character for the first three words style. That's all.

    Bob

  • Paragraph return vs forced in a nested style line break

    I need some clarification, if I want a style to run through a paragraph return, the forced line break accomplishes the same thing?

    In other words, he broke no option to return a line break in the nested only Style dialog box.

    Am I missing something?

    It seems to me that you don't need the second nested style. Your paragraph style must be consistent in any case, and the reason that it seems to operate through forced, even line break if there isn't one, is that the second nested style is applied until the end of the paragraph. Think of it this way: you set your style of paragraph like what you want to look like the whole paragraph, and you use a nested style if you need a discrepancy with the paragraph at the beginning of the paragraph style, two styles nested If you need two differences at the beginning and so on. -You don't need nested character styles to describe the entire paragraph, that what should look like different from the paragraph style.

    If you kill the second nested style, what happens to your layout?

  • Style headings-use of Grep or possible nested styles at TOC

    Hello

    I have the following titles on each page 2 spread from a reference book of vegetable oil

    When I tried to generate a table of contents, I came across some problems

    Here are some samples

    Title I - safflower oil

    Title II - plant species: Carthamus Tinctorius (in the same line)

    I would like to take the words of plant species and remove them the style called II while maintaining

    the same character search and simply retain title II for the real plant name so that it is included in the table of contents

    Using GREP or nested styles would be useful here?

    See screenshotbook screen shot.jpg

    Any easy suggestions?

    Thanks in advance

    Yes, only add to the style used for the ads themselves.

    Right hanging tabs don't you leaders, the way than do other types of tab. To work around this problem you use underscore of some sort, and the best way to do that is of a character style that does nothing, but add the underline (I like the Japanese for leaders points line style because it's subtle, but you can use what you want, as long as it is an underscore [see the custom underline options]) you apply this character style in a nested style in the paragraph style definition, because no up to 1 ^ y (the withdrawal right tab metacharacter), then the new style of underlining through 1 character.

  • Question about nested Styles and returns

    I have a paragraph Style that has a slight font specified as its police force. In this paragraph Style is a nested style that calls for a character style (bold text) through the first occurrence of a period.  When I do a paragraph return, the nested style repeats itself and makes bold text via the appearance next period.

    Is a paragraph always returns result in the repetition of a nested style?

    Everything sounds just except the part where the style does not change when you press ENTER.

    Styles do not retroactively apply to an existing text or place the text (other than the style on site map). If you start a new image and type text in BodyStory, and then press ENTER, the style switches that you start to type the second paragraph?

Maybe you are looking for

  • Can satellite A300 - 1 5 - I change HARD drive?

    Hi everyone; I have this laptop: [Toshiba Satallite A300 - 1 G 5 | http://eu.computers.toshiba-europe.com/innovation/jsp/SUPPORTSECTION/discontinuedProductPage.do?service=EU&com.broadvis ion.session.new = Yes & PRODUCT_ID = 1055589]. It has the stand

  • Windows xp pro sp3 getting does not updated__

    Windows xp sp3 do not update automatically.  also showing the missing or damaged windows core files.

  • Downloads accomplished successfully.

    Recently, I have updated Windows XP to Windows 7 Professional.  I used it for a few months and I noticed that when I try to download anything on the Microsoft site, it takes me to a page that looks like this: Oops! This link seems broken. Suggestions

  • Disk management doubt

    I was wondering why my windows sees 4 times each LUN I like volume, I had 2 fibre channel host bus adapters, so I had 2 LUNS and SO (rs 64-bit of Windows 2003) is scaning 4 times evey lun as a drive, some are online and some is not readable, what do

  • PSI triple with Cisco IOS XR

    Hey the Cisco Experts Greeting I've lost my way with config RPL, calling all of you to help me how config RPL looks for the scenario below, 2 X ASR 9006 political 0utbound=============== 1. LIKE 52 X accepts the local routes of 3 providors, as well a